| | |
| | | } |
| | | |
| | | /** |
| | | * 获取临时路径 |
| | | * @param companyId |
| | | * @return |
| | | */ |
| | | public String getTempFilePath(String companyId) { |
| | | |
| | | String basePath = FrameworkConfig.getProfile() + "TEMP/"; |
| | | if (org.apache.commons.lang3.StringUtils.isNotEmpty(companyId)) { |
| | | basePath += companyId + "/"; |
| | | } |
| | | File file = new File(basePath); |
| | | if (!file.exists()) { |
| | | file.mkdirs(); |
| | | } |
| | | return basePath; |
| | | } |
| | | |
| | | /** |
| | | * 获取模板路径 |
| | | * @return |
| | | */ |
| | | public String getConfPath() { |
| | | |
| | | String basePath = FrameworkConfig.getProfile() + "CONF/"; |
| | | File file = new File(basePath); |
| | | if (!file.exists()) { |
| | | file.mkdirs(); |
| | | } |
| | | return basePath; |
| | | } |
| | | |
| | | /** |
| | | * 压缩图片 |
| | | * |
| | | * @param filePath 压缩前路径 |
| | |
| | | ImageIO.write(compressedImage, "jpg", new File(outputPath)); |
| | | } |
| | | |
| | | /** |
| | | * 判断路径下文件是否存在,不存在则给默认 |
| | | * @param imgPath |
| | | * @return |
| | | */ |
| | | public String isImgExit(String imgPath, String tag) { |
| | | String path = "/img/img-fail.jpg"; |
| | | if(StringUtils.isNotBlank(tag) && "dept".equals(tag)){ |
| | | path = "/img/deptImg.jpg"; |
| | | } |
| | | if(StringUtils.isNotBlank(imgPath)){ |
| | | File file = new File(imgPath.replace("/profile", FrameworkConfig.getProfile())); |
| | | if(file.exists()){ |
| | | path = imgPath; |
| | | } |
| | | } |
| | | return path; |
| | | } |
| | | |
| | | } |