|
|
@@ -1,11 +1,12 @@
|
|
|
package com.style24.admin.biz.service;
|
|
|
|
|
|
+import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collection;
|
|
|
import java.util.Iterator;
|
|
|
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.core.env.Environment;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -13,6 +14,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.gagaframework.web.parameter.GagaMap;
|
|
|
+import com.gagaframework.web.util.GagaDateUtil;
|
|
|
import com.gagaframework.web.util.GagaFileUtil;
|
|
|
import com.gagaframework.web.util.GagaStringUtil;
|
|
|
import com.style24.admin.biz.dao.TsaPlanDao;
|
|
|
@@ -64,8 +66,49 @@ public class TsaPlanService {
|
|
|
@Transactional("shopTxnManager")
|
|
|
public void createPlanInfo(Plan param) {
|
|
|
Plan plan = new Plan();
|
|
|
+ int ind = 1;
|
|
|
param.setRegNo(TsaSession.getInfo().getUserNo());
|
|
|
param.setUpdNo(TsaSession.getInfo().getUserNo());
|
|
|
+ if(param.getMainPimg() != null && !"".equals(param.getMainPimg())){
|
|
|
+ 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.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);
|
|
|
+ }
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ newFile.renameTo(uniqueFile);
|
|
|
+ param.setMainMimg("/planning/" + yearMonth + "/" + newFilename);
|
|
|
+ }
|
|
|
planDao.createPlanInfo(param);
|
|
|
|
|
|
String[] brand = param.getMultiBrand();
|
|
|
@@ -365,7 +408,47 @@ public class TsaPlanService {
|
|
|
plan.setRegNo(TsaSession.getInfo().getUserNo());
|
|
|
planDao.createPlanCustGrade(plan);
|
|
|
}
|
|
|
-
|
|
|
+ int ind = 1;
|
|
|
+ if(param.getMainPimg() != null && !"".equals(param.getMainPimg())){
|
|
|
+ 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.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);
|
|
|
+ }
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ newFile.renameTo(uniqueFile);
|
|
|
+ param.setMainMimg("/planning/" + yearMonth + "/" + newFilename);
|
|
|
+ }
|
|
|
// 최종업데이트
|
|
|
planDao.updatePlanInfo(param);
|
|
|
|
|
|
@@ -730,11 +813,11 @@ public class TsaPlanService {
|
|
|
planGoods.setPlanSq(param.getPlanSq());
|
|
|
|
|
|
String planDtlSq = String.valueOf(planGoods.getPlanDtlSq());
|
|
|
- if (StringUtils.isBlank(planDtlSq)) {
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isBlank(planDtlSq)) {
|
|
|
throw new IllegalStateException("상품코드 : " + planGoods.getGoodsCd() + " 기획전 코너 번호가 없습니다.");
|
|
|
}
|
|
|
|
|
|
- if (StringUtils.isBlank(planGoods.getGoodsCd())) {
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isBlank(planGoods.getGoodsCd())) {
|
|
|
throw new IllegalStateException("비어 있는 상품코드가 존재합니다.");
|
|
|
}
|
|
|
|
|
|
@@ -806,7 +889,7 @@ public class TsaPlanService {
|
|
|
// 리뷰 등록
|
|
|
Plan rePlan = new Plan();
|
|
|
//리뷰 등록 - tb_plan_contents
|
|
|
- if(param.getReTitle() != "" || !StringUtils.isAllEmpty(param.getMultiPlanReview())) {
|
|
|
+ if(param.getReTitle() != "" || !org.apache.commons.lang3.StringUtils.isAllEmpty(param.getMultiPlanReview())) {
|
|
|
rePlan.setRegNo(regNo);
|
|
|
rePlan.setUpdNo(regNo);
|
|
|
rePlan.setTmplType("G082_10");
|
|
|
@@ -867,7 +950,7 @@ public class TsaPlanService {
|
|
|
|
|
|
//이미지등록
|
|
|
Plan filePlan = new Plan();
|
|
|
- if(!StringUtils.isAllEmpty(param.getMultiPlanFile()) || param.getFileDispOrd() >=0) {
|
|
|
+ if(!org.apache.commons.lang3.StringUtils.isAllEmpty(param.getMultiPlanFile()) || param.getFileDispOrd() >=0) {
|
|
|
filePlan.setRegNo(regNo);
|
|
|
filePlan.setUpdNo(regNo);
|
|
|
filePlan.setTmplType("G082_30");
|
|
|
@@ -883,10 +966,26 @@ public class TsaPlanService {
|
|
|
|
|
|
//파일아이템 등록
|
|
|
String[] fileItemVal = param.getMultiPlanFile();
|
|
|
-
|
|
|
- // 기획전 브랜드 insert
|
|
|
+ int ind = 1;
|
|
|
for (int j = 0; j < fileItemVal.length; j++) {
|
|
|
- filePlan.setItemVal(fileItemVal[j]);
|
|
|
+ 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, fileItemVal[j]));
|
|
|
+ planUploadPath = GagaFileUtil.getConcatenationPath(planUploadPath, yearMonth);
|
|
|
+ String newFilename = "PLANNING_" + GagaDateUtil.getTodayDateTime() + "_" + imgInd + "." + StringUtils.getFilenameExtension(fileItemVal[j]);
|
|
|
+ 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);
|
|
|
+ filePlan.setItemVal("/planning/" + yearMonth + "/" + newFilename);
|
|
|
planDao.createPlanContentsItem(filePlan);
|
|
|
}
|
|
|
}
|
|
|
@@ -896,7 +995,7 @@ public class TsaPlanService {
|
|
|
|
|
|
|
|
|
// 웹용 상단PC 등록
|
|
|
- if (StringUtils.isNotBlank(param.getFsrcPcTop())) {
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotBlank(param.getFsrcPcTop())) {
|
|
|
|
|
|
createPlanFsrcPcTop(param);
|
|
|
}
|
|
|
@@ -906,7 +1005,7 @@ public class TsaPlanService {
|
|
|
|
|
|
|
|
|
// 웹용 상단PC 등록
|
|
|
- if (StringUtils.isNotBlank(param.getFsrcPcBtm())) {
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotBlank(param.getFsrcPcBtm())) {
|
|
|
createPlanFsrcPcBtm(param);
|
|
|
}
|
|
|
|