|
|
@@ -414,40 +414,46 @@ public class TsaPlanService {
|
|
|
if (ind < 10) {
|
|
|
imgInd = "0" + imgInd;
|
|
|
}
|
|
|
- String planUploadPath = env.getProperty("upload.default.target.path");
|
|
|
- String yearMonth = GagaDateUtil.getToday().substring(0, 6);
|
|
|
- planUploadPath = GagaFileUtil.getConcatenationPath(planUploadPath, "/planning");
|
|
|
- File newFile = new File(GagaFileUtil.getConcatenationPath(planUploadPath, param.getMainPimg()));
|
|
|
- planUploadPath = GagaFileUtil.getConcatenationPath(planUploadPath, yearMonth);
|
|
|
- String newFilename = "PLANNING_" + GagaDateUtil.getTodayDateTime() + "_" + imgInd + "." + StringUtils.getFilenameExtension(param.getMainPimg());
|
|
|
- File uniqueFile = GagaFileUtil.getUniqueFile(new File(GagaFileUtil.getConcatenationPath(planUploadPath, newFilename)));
|
|
|
- // Rename a file
|
|
|
- File path = new File(planUploadPath);
|
|
|
- if (!path.exists()) {
|
|
|
- path.mkdir();
|
|
|
+ if (!param.getMainPimg().contains("planning")) {
|
|
|
+ String planUploadPath = env.getProperty("upload.default.target.path");
|
|
|
+ String yearMonth = GagaDateUtil.getToday().substring(0, 6);
|
|
|
+ planUploadPath = GagaFileUtil.getConcatenationPath(planUploadPath, "/planning");
|
|
|
+ File newFile = new File(GagaFileUtil.getConcatenationPath(planUploadPath, param.getMainPimg()));
|
|
|
+ planUploadPath = GagaFileUtil.getConcatenationPath(planUploadPath, yearMonth);
|
|
|
+ String newFilename = "PLANNING_" + GagaDateUtil.getTodayDateTime() + "_" + imgInd + "." + StringUtils.getFilenameExtension(param.getMainPimg());
|
|
|
+ File uniqueFile = GagaFileUtil.getUniqueFile(new File(GagaFileUtil.getConcatenationPath(planUploadPath, newFilename)));
|
|
|
+ // Rename a file
|
|
|
+ File path = new File(planUploadPath);
|
|
|
+ if (!path.exists()) {
|
|
|
+ path.mkdir();
|
|
|
+ }
|
|
|
+ newFile.renameTo(uniqueFile);
|
|
|
+ param.setMainPimg("/planning/" + yearMonth + "/" + newFilename);
|
|
|
}
|
|
|
- newFile.renameTo(uniqueFile);
|
|
|
- param.setMainPimg("/planning/" + yearMonth + "/" + newFilename);
|
|
|
+
|
|
|
}
|
|
|
if(param.getMainMimg() != null && !"".equals(param.getMainMimg())){
|
|
|
String imgInd = String.valueOf(ind);
|
|
|
if (ind < 10) {
|
|
|
imgInd = "0" + imgInd;
|
|
|
}
|
|
|
- String planUploadPath = env.getProperty("upload.default.target.path");
|
|
|
- String yearMonth = GagaDateUtil.getToday().substring(0, 6);
|
|
|
- planUploadPath = GagaFileUtil.getConcatenationPath(planUploadPath, "/planning");
|
|
|
- File newFile = new File(GagaFileUtil.getConcatenationPath(planUploadPath, param.getMainMimg()));
|
|
|
- planUploadPath = GagaFileUtil.getConcatenationPath(planUploadPath, yearMonth);
|
|
|
- String newFilename = "PLANNING_" + GagaDateUtil.getTodayDateTime() + "_" + imgInd + "." + StringUtils.getFilenameExtension(param.getMainMimg());
|
|
|
- File uniqueFile = GagaFileUtil.getUniqueFile(new File(GagaFileUtil.getConcatenationPath(planUploadPath, newFilename)));
|
|
|
- // Rename a file
|
|
|
- File path = new File(planUploadPath);
|
|
|
- if (!path.exists()) {
|
|
|
- path.mkdir();
|
|
|
+ if(!param.getMainMimg().contains("planning")) {
|
|
|
+ String planUploadPath = env.getProperty("upload.default.target.path");
|
|
|
+ String yearMonth = GagaDateUtil.getToday().substring(0, 6);
|
|
|
+ planUploadPath = GagaFileUtil.getConcatenationPath(planUploadPath, "/planning");
|
|
|
+ File newFile = new File(GagaFileUtil.getConcatenationPath(planUploadPath, param.getMainMimg()));
|
|
|
+ planUploadPath = GagaFileUtil.getConcatenationPath(planUploadPath, yearMonth);
|
|
|
+ String newFilename = "PLANNING_" + GagaDateUtil.getTodayDateTime() + "_" + imgInd + "." + StringUtils.getFilenameExtension(param.getMainMimg());
|
|
|
+ File uniqueFile = GagaFileUtil.getUniqueFile(new File(GagaFileUtil.getConcatenationPath(planUploadPath, newFilename)));
|
|
|
+ // Rename a file
|
|
|
+ File path = new File(planUploadPath);
|
|
|
+ if (!path.exists()) {
|
|
|
+ path.mkdir();
|
|
|
+ }
|
|
|
+ newFile.renameTo(uniqueFile);
|
|
|
+ param.setMainMimg("/planning/" + yearMonth + "/" + newFilename);
|
|
|
}
|
|
|
- newFile.renameTo(uniqueFile);
|
|
|
- param.setMainMimg("/planning/" + yearMonth + "/" + newFilename);
|
|
|
+
|
|
|
}
|
|
|
// 최종업데이트
|
|
|
planDao.updatePlanInfo(param);
|