Showing
3 changed files
with
13 additions
and
18 deletions
| ... | @@ -112,6 +112,7 @@ public class ConFileEmailUtil { | ... | @@ -112,6 +112,7 @@ public class ConFileEmailUtil { |
| 112 | 112 | ||
| 113 | portFileDto.setDestIataCode(portCode); | 113 | portFileDto.setDestIataCode(portCode); |
| 114 | portFileDto.setZipPath(finalPath + fileName); | 114 | portFileDto.setZipPath(finalPath + fileName); |
| 115 | + log.error("zipPath:"+finalPath + fileName); | ||
| 115 | portFileDto.setFileName(fileName); | 116 | portFileDto.setFileName(fileName); |
| 116 | 117 | ||
| 117 | } catch (Exception e) { | 118 | } catch (Exception e) { |
| ... | @@ -301,30 +302,24 @@ public class ConFileEmailUtil { | ... | @@ -301,30 +302,24 @@ public class ConFileEmailUtil { |
| 301 | String targetDirPath = null; | 302 | String targetDirPath = null; |
| 302 | 303 | ||
| 303 | try { | 304 | try { |
| 304 | - // 获取文件的扩展名 | ||
| 305 | - String extension = filePath.substring(filePath.lastIndexOf(".")); | ||
| 306 | - String fileNameOld = file.getName(); // 使用 getName() 获取文件名 | ||
| 307 | - // 生成新的文件名 | ||
| 308 | - String timeStamp = DateUtil.yyyyMMddHHmmss(new Date()); | ||
| 309 | - String fileName = String.format("%s%s%s", fileNameOld, timeStamp, extension); | ||
| 310 | - | ||
| 311 | // 构建目标文件路径 | 305 | // 构建目标文件路径 |
| 312 | targetDirPath = String.join(File.separator, | 306 | targetDirPath = String.join(File.separator, |
| 313 | propertiesConfig.getZipPath(), | 307 | propertiesConfig.getZipPath(), |
| 314 | DateUtil.format(new Date()), // 使用提前生成的时间戳,避免重复计算 | 308 | DateUtil.format(new Date()), // 使用提前生成的时间戳,避免重复计算 |
| 315 | conPushEmail.getBizCode(), | 309 | conPushEmail.getBizCode(), |
| 316 | - fileName | 310 | + file.getName() |
| 317 | ); | 311 | ); |
| 318 | 312 | ||
| 319 | // 获取目标目录,并创建目录(如果不存在) | 313 | // 获取目标目录,并创建目录(如果不存在) |
| 320 | File targetDir = new File(targetDirPath).getParentFile(); | 314 | File targetDir = new File(targetDirPath).getParentFile(); |
| 321 | - if (!targetDir.exists() && targetDir.mkdirs()) { | 315 | + if (!targetDir.exists()){ |
| 322 | - // 复制文件 | 316 | + targetDir.mkdirs(); |
| 323 | - nioFileUtils.copyFile(file, targetDirPath); | ||
| 324 | - | ||
| 325 | - // 删除临时文件 | ||
| 326 | - nioFileUtils.deleteTempFile(Paths.get(filePath)); | ||
| 327 | } | 317 | } |
| 318 | + // 复制文件 | ||
| 319 | + nioFileUtils.copyFile(file, targetDirPath); | ||
| 320 | + | ||
| 321 | + // 删除临时文件 | ||
| 322 | + nioFileUtils.deleteTempFile(Paths.get(filePath)); | ||
| 328 | 323 | ||
| 329 | } catch (Exception e) { | 324 | } catch (Exception e) { |
| 330 | // 记录错误信息 | 325 | // 记录错误信息 | ... | ... |
| ... | @@ -57,5 +57,5 @@ imp001: | ... | @@ -57,5 +57,5 @@ imp001: |
| 57 | upload: | 57 | upload: |
| 58 | path: | 58 | path: |
| 59 | zip: /app/Oracle/Middleware/user_projects/domains/base_domain/iclearConnect/upload/zip | 59 | zip: /app/Oracle/Middleware/user_projects/domains/base_domain/iclearConnect/upload/zip |
| 60 | - zipTemp: /app/Oracle/Middleware/user_projects/domains/base_domain/iclearConnect/upload/zipTemp | ||
| 61 | - zipFinal: /app/Oracle/Middleware/user_projects/domains/base_domain/iclearConnect/upload/zipFinal | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 60 | + zipTemp: /app/Oracle/Middleware/user_projects/domains/base_domain/iclearConnect/upload/zipTemp/ | ||
| 61 | + zipFinal: /app/Oracle/Middleware/user_projects/domains/base_domain/iclearConnect/upload/zipFinal/ | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -53,5 +53,5 @@ imp001: | ... | @@ -53,5 +53,5 @@ imp001: |
| 53 | upload: | 53 | upload: |
| 54 | path: | 54 | path: |
| 55 | zip: /app/Oracle/Middleware/user_projects/domains/base_domain/iclearConnect/upload/zip | 55 | zip: /app/Oracle/Middleware/user_projects/domains/base_domain/iclearConnect/upload/zip |
| 56 | - zipTemp: /app/Oracle/Middleware/user_projects/domains/base_domain/iclearConnect/upload/zipTemp | ||
| 57 | - zipFinal: /app/Oracle/Middleware/user_projects/domains/base_domain/iclearConnect/upload/zipFinal | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 56 | + zipTemp: /app/Oracle/Middleware/user_projects/domains/base_domain/iclearConnect/upload/zipTemp/ | ||
| 57 | + zipFinal: /app/Oracle/Middleware/user_projects/domains/base_domain/iclearConnect/upload/zipFinal/ | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment