New file |
| | |
| | | package com.dy.pipIrrWebFile.util; |
| | | |
| | | import com.dy.common.util.DateTime; |
| | | import com.dy.pipIrrGlobal.dyFile.FileConstant; |
| | | |
| | | import java.io.File; |
| | | |
| | | |
| | | /** |
| | | * 文档类 |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | public class FileDocumentUtil extends FileUtil { |
| | | |
| | | /** |
| | | * 生成文件相对路径名称 |
| | | * |
| | | * @param absolutePath |
| | | * @param relativePath |
| | | * @param regionNum |
| | | * @return |
| | | */ |
| | | public String newFileRelativityPath(String absolutePath, String relativePath, String regionNum) { |
| | | String relativityPath = relativePath ; |
| | | if(regionNum != null && !regionNum.trim().equals("") && !regionNum.trim().equals(FileConstant.NotRegionNum)){ |
| | | relativityPath += regionNum ; |
| | | }else{ |
| | | if(com.dy.pipIrrWebFile.util.FileConstant.documentFileBasePath.startsWith("/")){ |
| | | if(relativityPath.endsWith("/")){ |
| | | relativityPath = relativityPath.substring(0, relativityPath.length() - 1) ; |
| | | } |
| | | } |
| | | } |
| | | relativityPath += com.dy.pipIrrWebFile.util.FileConstant.documentFileBasePath + DateTime.yyyyMMdd() + "/"; |
| | | |
| | | String basePath = absolutePath + relativityPath; |
| | | File dir = new File(basePath); |
| | | if (!dir.exists()) { |
| | | dir.mkdirs(); |
| | | } |
| | | return relativityPath; |
| | | } |
| | | |
| | | |
| | | } |