| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455 |
- package com.style24.scm.biz.service;
- import java.io.File;
- import java.io.IOException;
- import java.util.ArrayList;
- import java.util.Collection;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.core.env.Environment;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import org.springframework.util.StringUtils;
- 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.persistence.domain.Plan;
- import com.style24.scm.biz.dao.TssPlanDao;
- import com.style24.scm.support.security.session.TssSession;
- import lombok.extern.slf4j.Slf4j;
- /**
- * 기획전 Service
- *
- * @author sowon
- * @since 2021. 02. 04
- */
- @Service
- @Slf4j
- public class TssPlanService {
- @Autowired
- private TssPlanDao planDao;
-
- @Autowired
- private Environment env;
-
- @Autowired
- private ObjectMapper mapper;
- /**
- * 기획전 목록
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 2. 5
- */
- public Collection<Plan> getPlanList(Plan param) {
- return planDao.getPlanList(param);
- }
-
- /**
- * 기획전 목록 카운트 조회
- * @param param
- * @return int
- * @author sowon
- * @since 2021. 2. 5
- */
- public int getPlanListCount(Plan param) {
- return planDao.getPlanListCount(param);
- }
-
- /**
- * 기획전 카테고리 목록
- *
- * @param plan
- * @return
- * @author sowon
- * @since 2021. 05. 05
- */
- public Collection<Plan> getPlanningCategoryList(Plan param){
- return planDao.getPlanningCategoryList(param);
- }
-
- /**
- * 기획전 웹 등록
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 5. 5
- */
- @Transactional("shopTxnManager")
- public void createPlanInfo(Plan param) {
- Plan plan = new Plan();
- // 입점업체담당자는 업체코드 설정
- if ("G001_B000".equals(TssSession.getInfo().getRoleCd())) {
- param.setRegNo(TssSession.getInfo().getUserNo());
- param.setUpdNo(TssSession.getInfo().getUserNo());
- }
- 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);
- param.setMainMimg("/planning/" + yearMonth + "/" + newFilename);
- }
- planDao.createPlanInfo(param);
-
- String[] brand = param.getMultiBrand();
- // 기획전 브랜드 insert
- for (int j = 0; j < brand.length; j++) {
- plan.setBrandGroupNo(brand[j]);
- plan.setPlanSq(param.getPlanSq());
- plan.setRegNo(TssSession.getInfo().getUserNo());
- plan.setUpdNo(TssSession.getInfo().getUserNo());
- planDao.createPlanBrand(plan);
- }
-
- String[] cate = param.getMultiCate();
- // 기획전 카테고리insert
- for (int j = 0; j < cate.length; j++) {
- plan.setCateNo(cate[j]);
- plan.setPlanSq(param.getPlanSq());
- plan.setRegNo(TssSession.getInfo().getUserNo());
- plan.setUpdNo(TssSession.getInfo().getUserNo());
- planDao.createPlanCate(plan);
- }
-
- // 기획전 회원구분 insert
- String[] custGb = param.getUsableCustGbArr();
- for (int j = 0; j < custGb.length; j++) {
- plan.setCustGb(custGb[j]);
- plan.setPlanSq(param.getPlanSq());
- plan.setRegNo(TssSession.getInfo().getUserNo());
- planDao.createPlanCustGb(plan);
- }
-
- // 기획전 회원등급 insert
- String[] custGrade = param.getUsableCustGradeArr();
- for (int j = 0; j < custGrade.length; j++) {
- plan.setCustGrade(custGrade[j]);
- plan.setPlanSq(param.getPlanSq());
- plan.setRegNo(TssSession.getInfo().getUserNo());
- planDao.createPlanCustGrade(plan);
- }
- }
-
- /**
- * 기획전 상세 정보
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 5. 5
- */
- public Plan getPlanDetailInfo(Plan param) {
- Collection<Plan> planList = planDao.getPlanList(param);
- Plan planInfo = new Plan();
- if (!planList.isEmpty()) {
- for (Plan plan : planList) {
- planInfo = plan;
- }
- }
- // 날짜 설정
- String[] stDate = planInfo.getDispStdt().split(" ");
- planInfo.setStartSearchDate(stDate[0]);
- planInfo.setStartSearchTime(GagaStringUtil.replace(stDate[1], ":", "").substring(0, 6));
- String[] edDate = planInfo.getDispEddt().split(" ");
- planInfo.setEndSearchDate(edDate[0]);
- planInfo.setEndSearchTime(GagaStringUtil.replace(edDate[1], ":", "").substring(0, 6));
- return planInfo;
- }
-
- /**
- * 기획전 브랜드 목록
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 5. 5
- */
- public Collection<Plan> getPlanBrandList(Plan param){
- return planDao.getPlanBrandList(param);
- }
- /**
- * 기획전 카테고리 목록
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 5. 5
- */
- public Collection<Plan> getPlanCateList(Plan param){
- return planDao.getPlanCateList(param);
- }
-
- /**
- * 기획전 웹 수정
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 2. 8
- */
- @Transactional("shopTxnManager")
- public void updatePlanInfo(Plan param) {
- Plan plan = new Plan();
- log.debug("param {}", param);
- String targetPath = env.getProperty("upload.default.target.path") + "/planning";
- param.setRegNo(TssSession.getInfo().getUserNo());
- param.setUpdNo(TssSession.getInfo().getUserNo());
- // 이미지 삭제 여부에 따른 이미지 삭제 처리
- if (("Y").equals(param.getOrgMainPimgDelYn())) {
- deleteFile(targetPath, param.getOrgMainPimg());
- }
- if (("Y").equals(param.getOrgMainMimgDelYn())) {
- deleteFile(targetPath, param.getOrgMainMimg());
- }
- if (("Y").equals(param.getOrgDtlPimgDelYn())) {
- deleteFile(targetPath, param.getOrgDtlPimg());
- }
- if (("Y").equals(param.getOrgDtlMimgDelYn())) {
- deleteFile(targetPath, param.getOrgDtlMimg());
- }
- if (("Y").equals(param.getOrgReplyImgDelYn())) {
- //param.setReplyImg(null);
- deleteFile(targetPath, param.getOrgReplyImg());
- }
- // 기존 기획전 카테고리 삭제
- planDao.deletePlanCate(param);
-
- String[] cate = param.getMultiCate();
- // 기획전 카테고리insert
- for (int j = 0; j < cate.length; j++) {
- plan.setCateNo(cate[j]);
- plan.setPlanSq(param.getPlanSq());
- plan.setRegNo(TssSession.getInfo().getUserNo());
- plan.setUpdNo(TssSession.getInfo().getUserNo());
- planDao.createPlanCate(plan);
- }
-
- // 기존 기획전 브랜드 삭제
- planDao.deletePlanBrand(param);;
-
-
-
- String[] brand = param.getMultiBrand();
- // 기획전 브랜드 insert
- for (int j = 0; j < brand.length; j++) {
- plan.setBrandGroupNo(brand[j]);
- plan.setPlanSq(param.getPlanSq());
- plan.setRegNo(TssSession.getInfo().getUserNo());
- plan.setUpdNo(TssSession.getInfo().getUserNo());
- planDao.createPlanBrand(plan);
- }
-
- //기존 회원구분 삭제
- planDao.deletePlanCustGb(param);
-
-
- // 기획전 회원구분 insert
- String[] custGb = param.getUsableCustGbArr();
- for (int j = 0; j < custGb.length; j++) {
- plan.setCustGb(custGb[j]);
- plan.setPlanSq(param.getPlanSq());
- plan.setRegNo(TssSession.getInfo().getUserNo());
- planDao.createPlanCustGb(plan);
- }
-
- //기존 회원등급 삭제
- planDao.deletePlanCustGrade(param);
-
-
- // 기획전 회원등급 insert
- String[] custGrade = param.getUsableCustGradeArr();
- for (int j = 0; j < custGrade.length; j++) {
- plan.setCustGrade(custGrade[j]);
- plan.setPlanSq(param.getPlanSq());
- plan.setRegNo(TssSession.getInfo().getUserNo());
- planDao.createPlanCustGrade(plan);
- }
-
- int ind = 1;
- param.setMainMimg(param.getMainPimg());
- if(param.getMainPimg() != null && !"".equals(param.getMainPimg())){
- String imgInd = String.valueOf(ind);
- if (ind < 10) {
- imgInd = "0" + imgInd;
- }
- 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);
- }
-
- }
- if(param.getMainMimg() != null && !"".equals(param.getMainMimg())){
- String imgInd = String.valueOf(ind);
- if (ind < 10) {
- imgInd = "0" + imgInd;
- }
- 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);
- }
-
- }
-
- // 최종업데이트
- planDao.updatePlanInfo(param);
- //기획전 응모이벤트
- // if (StringUtils.isNotBlank(param.getPrivacyPolicy())) {
- // int i = 0;
- // for (String planQtitle : param.getPlanQtitle()) {
- // PlanQuestAnswer planQuestAnswer = new TsaPlanQuestAnswer();
- // planQuestAnswer.setPlanSq(param.getPlanSq());
- // planQuestAnswer.setPlanQtitle(planQtitle);
- // planQuestAnswer.setAttachYn(param.getAttachYn()[i]);
- // planQuestAnswer.setQuestNo(i);
- // planQuestAnswer.setRegNo(param.getRegNo());
- // planQuestAnswer.setUpdNo(param.getUpdNo());
- // planDao.savePlanQuestion(planQuestAnswer);
- // i++;
- // }
- // }
- }
-
- /**
- * 기획전 코너 목록 조회
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 05. 06
- */
- public Collection<Plan> getPlanCornerList(Plan param) {
-
- Collection<Plan> cornerList = planDao.getPlanCornerList(param);
- for (Plan corner : cornerList) {
- // 날짜 설정
- String[] stDate = corner.getDispStdt().split(" ");
- corner.setStartSearchDate(stDate[0]);
- corner.setStartSearchTime(stDate[1].substring(0, 8));
-
- String[] edDate = corner.getDispEddt().split(" ");
- corner.setEndSearchDate(edDate[0]);
- corner.setEndSearchTime(edDate[1].substring(0, 8));
- }
- return cornerList;
- }
-
- /**
- * 기획전 코너 저장
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 05. 06
- */
- @Transactional("shopTxnManager")
- public void savePlanCornerInfo(Collection<Plan> paramList) {
- for (Plan cornerInfo : paramList) {
- cornerInfo.setRegNo(TssSession.getInfo().getUserNo());
- cornerInfo.setUpdNo(TssSession.getInfo().getUserNo());
- planDao.savePlanCornerInfo(cornerInfo);
- }
- }
-
- /**
- * 기획전 코너 상품 조회 건수
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 05. 06
- */
- public int getPlanGoodsListCount(Plan param) {
- return planDao.getPlanGoodsListCount(param);
- }
- /**
- * 기획전 코너 상품 조회
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 05. 06
- */
- public Collection<Plan> getPlanGoodsList(Plan param) {
- return planDao.getPlanGoodsList(param);
- }
-
- /**
- * 파일 삭제
- *
- * @param targetPath
- * @param excelFilename
- * @author sowon
- * @since 2021. 5. 6
- */
- private void deleteFile(String targetPath, String excelFilename) {
- // 파일 삭제
- try {
- GagaFileUtil.deleteFile(GagaFileUtil.getConcatenationPath(targetPath, excelFilename));
- } catch (IOException e) {
- // Nothing Do
- }
- }
-
- /**
- * 기획전 코너 상품 엑셀 저장
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 5. 6
- */
- @Transactional("shopTxnManager")
- public void createExceluploadGoods(Collection<GagaMap> ecxelGoodsList, Plan param) {
- String targetPath = env.getProperty("upload.excel.target.path");
- if ((ecxelGoodsList == null || ecxelGoodsList.isEmpty())) {
- deleteFile(targetPath, param.getExcelFileNm());
- throw new IllegalStateException("저장 할 데이터가 없습니다.");
- }
- Collection<Plan> dtlPlan = new ArrayList<>();
- Collection<Plan> goodsList = new ArrayList<>();
- long tempPlanDtlSq = 0;
- for (GagaMap gagaMap : ecxelGoodsList) {
- Plan planGoods = mapper.convertValue(gagaMap, Plan.class);
- planGoods.setPlanSq(param.getPlanSq());
- String planDtlSq = String.valueOf(planGoods.getPlanDtlSq());
- if (org.apache.commons.lang3.StringUtils.isBlank(planDtlSq)) {
- throw new IllegalStateException("상품코드 : " + planGoods.getGoodsCd() + " 기획전 코너 번호가 없습니다.");
- }
- if (org.apache.commons.lang3.StringUtils.isBlank(planGoods.getGoodsCd())) {
- throw new IllegalStateException("비어 있는 상품코드가 존재합니다.");
- }
- // 중복 확인 위한 데이터 적제
- if (tempPlanDtlSq != planGoods.getPlanDtlSq()) {
- dtlPlan.add(planGoods);
- }
- // 상품 데이터 적제
- goodsList.add(planGoods);
- }
- // 기획전 유효성 체크
- for (Plan plan : dtlPlan) {
- Plan searchCorner = new Plan();
- searchCorner.setPlanSq(plan.getPlanSq());
- searchCorner.setPlanDtlSq(plan.getPlanDtlSq());
- Collection<Plan> cornerList = planDao.getPlanCornerList(searchCorner);
- if (cornerList == null || cornerList.isEmpty()) {
- throw new IllegalStateException("상품코드 : " + plan.getGoodsCd() + "의 " + plan.getPlanDtlSq() + " 기획전 코너가 존재 하지 않습니다.");
- }
- }
- // 기획전 상품 저장
- for (Plan goods : goodsList) {
- savePlanCornerGoods(goods);
- }
- }
-
- /**
- * 기획전 코너 상품 저장
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 05. 06
- */
- @Transactional("shopTxnManager")
- public void savePlanCornerGoods(Plan param) {
- Plan plan = new Plan();
-
- plan.setRegNo(TssSession.getInfo().getUserNo());
- plan.setUpdNo(TssSession.getInfo().getUserNo());
- plan.setGoodsCd(param.getGoodsCd());
- plan.setPlanDtlSq(param.getPlanDtlSq());
- planDao.savePlanCornerGoods(plan);
- }
-
- /**
- * 기획전 코너 상품 추가
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 05. 06
- */
- @Transactional("shopTxnManager")
- public void savePlanGoods(Collection<Plan> paramList) {
- for (Plan param : paramList) {
- savePlanCornerGoods(param);
- }
- }
-
- /**
- * 기획전 코너 삭제 처리
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 05. 06
- */
- @Transactional("shopTxnManager")
- public void deletePlanCornerInfo(Collection<Plan> paramList) {
- for (Plan cornerInfo : paramList) {
- planDao.deletePlanCornerInfo(cornerInfo);
- planDao.deletePlanCornerGoods(cornerInfo);
- }
- }
-
- /**
- * 기획전 코너 상품 삭제 처리
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 05. 06
- */
- @Transactional("shopTxnManager")
- public void deletePlanCornerGoods(Collection<Plan> paramList) {
- for (Plan cornerInfo : paramList) {
- planDao.deletePlanCornerGoods(cornerInfo);
- }
- }
-
- /**
- * 기획전 템플릿 목록 카운트 조회
- * @param param
- * @return int
- * @author sowon
- * @since 2021. 05. 06
- */
- public int getPlanContentsCount(Plan param) {
- return planDao.getPlanContentsCount(param);
- }
-
- /**
- * 기획전 템플릿 상세조회 - 리뷰
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 05. 06
- */
- public Collection<Plan> getPlanContentReviewList(Plan param){
- return planDao.getPlanContentReviewList(param);
- }
- /**
- * 기획전 템플릿 상세조회 - 쿠폰
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 05. 06
- */
- public Collection<Plan> getPlanContentCouponList(Plan param){
- return planDao.getPlanContentCouponList(param);
- }
-
- /**
- * 기획전 템플릿 상세조회 - 쿠폰유의사항
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 5 .26
- */
- public Plan getPlanContentCouponNotice(Plan param){
- return planDao.getPlanContentCouponNotice(param);
- }
-
-
- /**
- * 기획전 템플릿 상세조회 - 파일
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 05. 06
- */
- public Collection<Plan> getPlanContentFileList(Plan param){
- return planDao.getPlanContentFileList(param);
- }
-
- /**
- * 기획전 템플릿 상세조회 - 유의사항
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 5 .28
- */
- public Collection<Plan> getPlanContentNoticeList(Plan param){
- return planDao.getPlanContentNoticeList(param);
- }
-
- /**
- * 기획전 템플릿 상세조회 - html
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 05. 06
- */
- public Collection<Plan> getPlanContentFsrcList(Plan param){
- return planDao.getPlanContentFsrcList(param);
- }
-
- /**
- * 기획전 템플릿 상세조회 - goods
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 05. 06
- */
- public Collection<Plan> getPlanContentGoodsList(Plan param){
- return planDao.getPlanContentGoodsList(param);
- }
-
- /**
- * 기획전 템플릿 상세조회 - goods 목록조회
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 05. 06
- */
- public Collection<Plan> getPlanContentGoodsDetailList(Plan param){
- return planDao.getPlanContentGoodsDetailList(param);
- }
-
- /**
- * 기획전 템플릿 상품목록 삭제
- * @param
- * @return
- * @author sowon
- * @since 2021. 05. 06
- */
- @Transactional("shopTxnManager")
- public void deletePlanContentItemGoods(Integer planContSq) {
- planDao.deletePlanContentItemGoods(planContSq);
- }
-
- /**
- * 기획전 템플릿 컨텐츠 삭제
- * @param
- * @return
- * @author sowon
- * @since 2021. 05. 06
- */
- @Transactional("shopTxnManager")
- public void deletePlanContentItem(Integer planContSq) {
- planDao.deletePlanContentItem(planContSq);
-
- }
-
- /**
- * 기획전 템플릿 등록
- *
- * @param
- * @return
- * @author sowon
- * @since 2021. 2. 25
- */
- public void createPlanContents(Plan param) {
- Integer regNo = TssSession.getInfo().getUserNo();
-
- param.setRegNo(regNo);
-
- // 리뷰 등록
- Plan rePlan = new Plan();
- //리뷰 등록 - tb_plan_contents
- if(param.getReTitle() != "" || !org.apache.commons.lang3.StringUtils.isAllEmpty(param.getMultiPlanReview())) {
- rePlan.setRegNo(regNo);
- rePlan.setUpdNo(regNo);
- rePlan.setTmplType("G082_10");
- rePlan.setPlanSq(param.getPlanSq());
- rePlan.setTitle(param.getReTitle());
- rePlan.setDispYn(param.getReDispYn());
- rePlan.setDispOrd(param.getReDispOrd());
- rePlan.setPlanContSq(param.getRePlanContSq());
- planDao.createPlanContents(rePlan);
- // 기존 리뷰아이템 삭제
- planDao.deletePlanContentItem(param.getRePlanContSq());
- //리뷰 아이템 등록
- if(param.getMultiPlanReview().length>0) {
- String[] reItemVal = param.getMultiPlanReview();
- String[] startDate = param.getMultiPlanReviewStartD();
- String[] startTime = param.getMultiPlanReviewStartT();
- String[] endDate = param.getMultiPlanReviewEndD();
- String[] endTime = param.getMultiPlanReviewEndT();
- // 기획전 브랜드 insert
- for (int j = 0; j < reItemVal.length; j++) {
- rePlan.setItemVal(reItemVal[j]);
- rePlan.setReviewDispStdt(startDate[j] + ' ' +startTime[j]);
- rePlan.setReviewDispEddt(endDate[j] + ' ' +endTime[j]);
- planDao.createPlanContentsItem(rePlan);
- }
- }
- }
-
- // 쿠폰등록
- Plan cuPlan = new Plan();
- //쿠폰 등록 - tb_plan_contents
- if(param.getCuTitle() != "" || param.getMultiPlanCoupon().length>0) {
- cuPlan.setRegNo(regNo);
- cuPlan.setUpdNo(regNo);
- cuPlan.setTmplType("G082_20");
- cuPlan.setPlanSq(param.getPlanSq());
- cuPlan.setTitle(param.getCuTitle());
- cuPlan.setDispYn(param.getCuDispYn());
- cuPlan.setDispOrd(param.getCuDispOrd());
- cuPlan.setPlanContSq(param.getCuPlanContSq());
- String[] cpnNote = param.getMultiPlanCouponNotice();
- for (int i = 0; i < cpnNote.length; i++) {
- if(i==0)
- cuPlan.setCpnNote0(cpnNote[i]);
- else if(i==1)
- cuPlan.setCpnNote1(cpnNote[i]);
- else if(i==2)
- cuPlan.setCpnNote2(cpnNote[i]);
- else if(i==3)
- cuPlan.setCpnNote3(cpnNote[i]);
- else if(i==4)
- cuPlan.setCpnNote4(cpnNote[i]);
- else if(i==5)
- cuPlan.setCpnNote5(cpnNote[i]);
- else if(i==6)
- cuPlan.setCpnNote6(cpnNote[i]);
- else if(i==7)
- cuPlan.setCpnNote7(cpnNote[i]);
- else if(i==8)
- cuPlan.setCpnNote8(cpnNote[i]);
- else if(i==9)
- cuPlan.setCpnNote9(cpnNote[i]);
- }
- planDao.createPlanContents(cuPlan);
-
- // 기존 쿠폰아이템 삭제
- planDao.deletePlanContentItem(param.getCuPlanContSq());
-
- //쿠폰아이템 등록
- if(param.getMultiPlanCoupon().length>0) {
- String[] cuItemVal = param.getMultiPlanCoupon();
-
- // 기획전 브랜드 insert
- for (int j = 0; j < cuItemVal.length; j++) {
- cuPlan.setItemVal(cuItemVal[j]);
- planDao.createPlanContentsItem(cuPlan);
- }
- }
- }
-
- //이미지등록
- Plan filePlan = new Plan();
- if(!org.apache.commons.lang3.StringUtils.isAllEmpty(param.getMultiPlanFile()) || param.getFileDispOrd() >=0) {
- filePlan.setRegNo(regNo);
- filePlan.setUpdNo(regNo);
- filePlan.setTmplType("G082_30");
- filePlan.setPlanSq(param.getPlanSq());
- filePlan.setDispYn(param.getFileDispYn());
- filePlan.setDispOrd(param.getFileDispOrd());
- filePlan.setPlanContSq(param.getFilePlanContSq());
-
- planDao.createPlanContents(filePlan);
-
- // 기존 파일 삭제
- planDao.deletePlanContentItem(param.getFilePlanContSq());
-
- //파일아이템 등록
- String[] fileItemVal = param.getMultiPlanFile();
- String[] fileItemVal2 = param.getMultiPlanFile2();
- String[] fileItemVal3 = param.getMultiPlanFile3();
- int ind = 1;
- for (int j = 0; j < fileItemVal.length; 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);
- if (fileItemVal[j].contains("/planning")) {
- filePlan.setItemVal(fileItemVal[j]);
- }else {
- filePlan.setItemVal("/planning/" + yearMonth + "/" + newFilename);
- }
- filePlan.setItemVal("/planning/" + yearMonth + "/" + newFilename);
- filePlan.setLinkUrl(fileItemVal2[j]);
- filePlan.setLinkOpenGb((fileItemVal3[j]));
- planDao.createPlanContentsItem(filePlan);
- ind++;
- }
- }
-
- // 유의사항등록
- Plan noticePlan = new Plan();
- //유의사항 등록 - tb_plan_contents
- if(!org.apache.commons.lang3.StringUtils.isAllEmpty(param.getMultiPlanNotice()) || param.getNoticeDispOrd() >=0) {
- noticePlan.setRegNo(regNo);
- noticePlan.setUpdNo(regNo);
- noticePlan.setTmplType("G082_60");
- noticePlan.setPlanSq(param.getPlanSq());
- noticePlan.setDispYn(param.getNoticeDispYn());
- noticePlan.setDispOrd(param.getNoticeDispOrd());
- noticePlan.setPlanContSq(param.getNoticePlanContSq());
- planDao.createPlanContents(noticePlan);
-
- // 기존 유의사항삭제
- planDao.deletePlanContentItem(param.getNoticePlanContSq());
-
- //유의사항아이템 등록
- if(param.getMultiPlanNotice().length>0) {
- String[] noticeItemVal = param.getMultiPlanNotice();
-
- // 유의사항 insert
- for (int j = 0; j < noticeItemVal.length; j++) {
- noticePlan.setItemVal(noticeItemVal[j]);
- planDao.createPlanContentsItem(noticePlan);
- }
- }
- }
-
- //HTML[PC] 상단 하단 등록
- if(param.getFsrcMobileTop() != "" || param.getFsrcPcTop() != "") {
-
- // 웹용 상단PC 등록
- if (org.apache.commons.lang3.StringUtils.isNotBlank(param.getFsrcPcTop())) {
-
- createPlanFsrcPcTop(param);
- }
- }
- //HTML[하단] 등록
- if(param.getFsrcMobileBtm() != "" || param.getFsrcPcBtm() != "") {
-
-
- // 웹용 상단PC 등록
- if (org.apache.commons.lang3.StringUtils.isNotBlank(param.getFsrcPcBtm())) {
- createPlanFsrcPcBtm(param);
- }
- }
-
- //상품 등록 -- 1
- for (Plan multiPlanGoodsContent1 : param.getMultiPlanGoodsContent1()) {
-
- if (!StringUtils.isEmpty(multiPlanGoodsContent1.getGoodsType())) {
- String goodsTitle = multiPlanGoodsContent1.getGoodsTitle();
- String goodsUrl = multiPlanGoodsContent1.getGoodsUrl();
- String goodsType = multiPlanGoodsContent1.getGoodsType();
- long goodsDispOrd = multiPlanGoodsContent1.getGoodsDispOrd();
- String goodsDispYn = multiPlanGoodsContent1.getGoodsDispYn();
- Integer goodsPlanContSq = multiPlanGoodsContent1.getGoodsPlanContSq();
- String linkOpenGb = multiPlanGoodsContent1.getGoodsLinkOpenGb();
-
- Plan goods1 = new Plan();
- goods1.setRegNo(regNo);
- goods1.setUpdNo(regNo);
- goods1.setTitle(goodsTitle);
- goods1.setDispOrd(goodsDispOrd);
- goods1.setPlanSq(param.getPlanSq());
- goods1.setDispYn(goodsDispYn);
- goods1.setTmplType(goodsType);
- goods1.setLinkOpenGb(linkOpenGb);
- goods1.setLinkUrl(goodsUrl);
- goods1.setPlanContSq(goodsPlanContSq);
-
- planDao.createPlanContents(goods1);
-
- // 기존 상품1 삭제
- planDao.deletePlanContentItem(goodsPlanContSq);
-
- for (Plan multiPlanGoodsContentVal1 : param.getMultiPlanGoodsContentVal1()) {
- if(param.getMultiPlanGoodsContentVal1().size()>0) {
- goods1.setItemVal(multiPlanGoodsContentVal1.getGoodsItemVal());
- planDao.createPlanContentsItem(goods1);
- }
-
- }
- }
- }
-
- //상품 등록 -- 2
- for (Plan multiPlanGoodsContent2 : param.getMultiPlanGoodsContent2()) {
-
- if (!StringUtils.isEmpty(multiPlanGoodsContent2.getGoodsType())) {
- String goodsTitle = multiPlanGoodsContent2.getGoodsTitle();
- String goodsUrl = multiPlanGoodsContent2.getGoodsUrl();
- String goodsType = multiPlanGoodsContent2.getGoodsType();
- long goodsDispOrd = multiPlanGoodsContent2.getGoodsDispOrd();
- String goodsDispYn = multiPlanGoodsContent2.getGoodsDispYn();
- Integer goodsPlanContSq = multiPlanGoodsContent2.getGoodsPlanContSq();
- String linkOpenGb = multiPlanGoodsContent2.getGoodsLinkOpenGb();
-
- Plan goods2 = new Plan();
- goods2.setRegNo(regNo);
- goods2.setUpdNo(regNo);
- goods2.setTitle(goodsTitle);
- goods2.setDispOrd(goodsDispOrd);
- goods2.setPlanSq(param.getPlanSq());
- goods2.setDispYn(goodsDispYn);
- goods2.setTmplType(goodsType);
- goods2.setLinkUrl(goodsUrl);
- goods2.setLinkOpenGb(linkOpenGb);
- goods2.setPlanContSq(goodsPlanContSq);
-
- planDao.createPlanContents(goods2);
-
- // 기존 상품2 삭제
- planDao.deletePlanContentItem(goodsPlanContSq);
-
- for (Plan multiPlanGoodsContentVal2 : param.getMultiPlanGoodsContentVal2()) {
- if(param.getMultiPlanGoodsContentVal2().size()>0) {
- goods2.setItemVal(multiPlanGoodsContentVal2.getGoodsItemVal());
- planDao.createPlanContentsItem(goods2);
- }
-
- }
- }
- }
-
- //상품 등록 -- 3
- for (Plan multiPlanGoodsContent3 : param.getMultiPlanGoodsContent3()) {
-
- if (!StringUtils.isEmpty(multiPlanGoodsContent3.getGoodsType())) {
- String goodsTitle = multiPlanGoodsContent3.getGoodsTitle();
- String goodsUrl = multiPlanGoodsContent3.getGoodsUrl();
- String goodsType = multiPlanGoodsContent3.getGoodsType();
- long goodsDispOrd = multiPlanGoodsContent3.getGoodsDispOrd();
- String goodsDispYn = multiPlanGoodsContent3.getGoodsDispYn();
- Integer goodsPlanContSq = multiPlanGoodsContent3.getGoodsPlanContSq();
- String linkOpenGb = multiPlanGoodsContent3.getGoodsLinkOpenGb();
-
- Plan goods3 = new Plan();
- goods3.setRegNo(regNo);
- goods3.setUpdNo(regNo);
- goods3.setTitle(goodsTitle);
- goods3.setDispOrd(goodsDispOrd);
- goods3.setPlanSq(param.getPlanSq());
- goods3.setDispYn(goodsDispYn);
- goods3.setTmplType(goodsType);
- goods3.setLinkUrl(goodsUrl);
- goods3.setLinkOpenGb(linkOpenGb);
- goods3.setPlanContSq(goodsPlanContSq);
-
- planDao.createPlanContents(goods3);
-
- // 기존 상품3 삭제
- planDao.deletePlanContentItem(goodsPlanContSq);
-
- for (Plan multiPlanGoodsContentVal3 : param.getMultiPlanGoodsContentVal3()) {
- if(param.getMultiPlanGoodsContentVal3().size()>0) {
- goods3.setItemVal(multiPlanGoodsContentVal3.getGoodsItemVal());
- planDao.createPlanContentsItem(goods3);
- }
-
- }
- }
- }
-
- //상품 등록 -- 4
- for (Plan multiPlanGoodsContent4 : param.getMultiPlanGoodsContent4()) {
-
- if (!StringUtils.isEmpty(multiPlanGoodsContent4.getGoodsType())) {
- String goodsTitle = multiPlanGoodsContent4.getGoodsTitle();
- String goodsUrl = multiPlanGoodsContent4.getGoodsUrl();
- String goodsType = multiPlanGoodsContent4.getGoodsType();
- long goodsDispOrd = multiPlanGoodsContent4.getGoodsDispOrd();
- String goodsDispYn = multiPlanGoodsContent4.getGoodsDispYn();
- Integer goodsPlanContSq = multiPlanGoodsContent4.getGoodsPlanContSq();
- String linkOpenGb = multiPlanGoodsContent4.getGoodsLinkOpenGb();
-
- Plan goods4 = new Plan();
- goods4.setRegNo(regNo);
- goods4.setUpdNo(regNo);
- goods4.setTitle(goodsTitle);
- goods4.setDispOrd(goodsDispOrd);
- goods4.setPlanSq(param.getPlanSq());
- goods4.setDispYn(goodsDispYn);
- goods4.setTmplType(goodsType);
- goods4.setLinkUrl(goodsUrl);
- goods4.setPlanContSq(goodsPlanContSq);
- goods4.setLinkOpenGb(linkOpenGb);
-
- planDao.createPlanContents(goods4);
-
- // 기존 상품4 삭제
- planDao.deletePlanContentItem(goodsPlanContSq);
-
- for (Plan multiPlanGoodsContentVal4 : param.getMultiPlanGoodsContentVal4()) {
- if(param.getMultiPlanGoodsContentVal4().size()>0) {
- goods4.setItemVal(multiPlanGoodsContentVal4.getGoodsItemVal());
- planDao.createPlanContentsItem(goods4);
- }
-
- }
- }
- }
-
- //상품 등록 -- 5
- for (Plan multiPlanGoodsContent5 : param.getMultiPlanGoodsContent5()) {
-
- if (!StringUtils.isEmpty(multiPlanGoodsContent5.getGoodsType())) {
- String goodsTitle = multiPlanGoodsContent5.getGoodsTitle();
- String goodsUrl = multiPlanGoodsContent5.getGoodsUrl();
- String goodsType = multiPlanGoodsContent5.getGoodsType();
- long goodsDispOrd = multiPlanGoodsContent5.getGoodsDispOrd();
- String goodsDispYn = multiPlanGoodsContent5.getGoodsDispYn();
- Integer goodsPlanContSq = multiPlanGoodsContent5.getGoodsPlanContSq();
- String linkOpenGb = multiPlanGoodsContent5.getGoodsLinkOpenGb();
-
- Plan goods5 = new Plan();
- goods5.setRegNo(regNo);
- goods5.setUpdNo(regNo);
- goods5.setTitle(goodsTitle);
- goods5.setDispOrd(goodsDispOrd);
- goods5.setPlanSq(param.getPlanSq());
- goods5.setDispYn(goodsDispYn);
- goods5.setTmplType(goodsType);
- goods5.setLinkUrl(goodsUrl);
- goods5.setPlanContSq(goodsPlanContSq);
- goods5.setLinkOpenGb(linkOpenGb);
-
- planDao.createPlanContents(goods5);
-
- // 기존 상품5 삭제
- planDao.deletePlanContentItem(goodsPlanContSq);
-
- for (Plan multiPlanGoodsContentVal5 : param.getMultiPlanGoodsContentVal5()) {
- if(param.getMultiPlanGoodsContentVal5().size()>0) {
- goods5.setItemVal(multiPlanGoodsContentVal5.getGoodsItemVal());
- planDao.createPlanContentsItem(goods5);
- }
-
- }
- }
- }
-
- //상품 등록 -- 6
- for (Plan multiPlanGoodsContent6 : param.getMultiPlanGoodsContent6()) {
-
- if (!StringUtils.isEmpty(multiPlanGoodsContent6.getGoodsType())) {
- String goodsTitle = multiPlanGoodsContent6.getGoodsTitle();
- String goodsUrl = multiPlanGoodsContent6.getGoodsUrl();
- String goodsType = multiPlanGoodsContent6.getGoodsType();
- long goodsDispOrd = multiPlanGoodsContent6.getGoodsDispOrd();
- String goodsDispYn = multiPlanGoodsContent6.getGoodsDispYn();
- Integer goodsPlanContSq = multiPlanGoodsContent6.getGoodsPlanContSq();
- String linkOpenGb = multiPlanGoodsContent6.getGoodsLinkOpenGb();
-
- Plan goods6 = new Plan();
- goods6.setRegNo(regNo);
- goods6.setUpdNo(regNo);
- goods6.setTitle(goodsTitle);
- goods6.setDispOrd(goodsDispOrd);
- goods6.setPlanSq(param.getPlanSq());
- goods6.setDispYn(goodsDispYn);
- goods6.setTmplType(goodsType);
- goods6.setLinkUrl(goodsUrl);
- goods6.setPlanContSq(goodsPlanContSq);
- goods6.setLinkOpenGb(linkOpenGb);
-
- planDao.createPlanContents(goods6);
-
- // 기존 상품6 삭제
- planDao.deletePlanContentItem(goodsPlanContSq);
-
- for (Plan multiPlanGoodsContentVal6 : param.getMultiPlanGoodsContentVal6()) {
- if(param.getMultiPlanGoodsContentVal6().size()>0) {
- goods6.setItemVal(multiPlanGoodsContentVal6.getGoodsItemVal());
- planDao.createPlanContentsItem(goods6);
- }
-
- }
- }
- }
-
- //상품 등록 -- 7
- for (Plan multiPlanGoodsContent7 : param.getMultiPlanGoodsContent7()) {
-
- if (!StringUtils.isEmpty(multiPlanGoodsContent7.getGoodsType())) {
- String goodsTitle = multiPlanGoodsContent7.getGoodsTitle();
- String goodsUrl = multiPlanGoodsContent7.getGoodsUrl();
- String goodsType = multiPlanGoodsContent7.getGoodsType();
- long goodsDispOrd = multiPlanGoodsContent7.getGoodsDispOrd();
- String goodsDispYn = multiPlanGoodsContent7.getGoodsDispYn();
- Integer goodsPlanContSq = multiPlanGoodsContent7.getGoodsPlanContSq();
- String linkOpenGb = multiPlanGoodsContent7.getGoodsLinkOpenGb();
-
- Plan goods7 = new Plan();
- goods7.setRegNo(regNo);
- goods7.setUpdNo(regNo);
- goods7.setTitle(goodsTitle);
- goods7.setDispOrd(goodsDispOrd);
- goods7.setPlanSq(param.getPlanSq());
- goods7.setDispYn(goodsDispYn);
- goods7.setTmplType(goodsType);
- goods7.setLinkUrl(goodsUrl);
- goods7.setPlanContSq(goodsPlanContSq);
- goods7.setLinkOpenGb(linkOpenGb);
-
- planDao.createPlanContents(goods7);
-
- // 기존 상품7 삭제
- planDao.deletePlanContentItem(goodsPlanContSq);
-
- for (Plan multiPlanGoodsContentVal7 : param.getMultiPlanGoodsContentVal7()) {
- if(param.getMultiPlanGoodsContentVal7().size()>0) {
- goods7.setItemVal(multiPlanGoodsContentVal7.getGoodsItemVal());
- planDao.createPlanContentsItem(goods7);
- }
-
- }
- }
- }
-
- //상품 등록 -- 8
- for (Plan multiPlanGoodsContent8 : param.getMultiPlanGoodsContent8()) {
-
- if (!StringUtils.isEmpty(multiPlanGoodsContent8.getGoodsType())) {
- String goodsTitle = multiPlanGoodsContent8.getGoodsTitle();
- String goodsUrl = multiPlanGoodsContent8.getGoodsUrl();
- String goodsType = multiPlanGoodsContent8.getGoodsType();
- long goodsDispOrd = multiPlanGoodsContent8.getGoodsDispOrd();
- String goodsDispYn = multiPlanGoodsContent8.getGoodsDispYn();
- Integer goodsPlanContSq = multiPlanGoodsContent8.getGoodsPlanContSq();
- String linkOpenGb = multiPlanGoodsContent8.getGoodsLinkOpenGb();
-
- Plan goods8 = new Plan();
- goods8.setRegNo(regNo);
- goods8.setUpdNo(regNo);
- goods8.setTitle(goodsTitle);
- goods8.setDispOrd(goodsDispOrd);
- goods8.setPlanSq(param.getPlanSq());
- goods8.setDispYn(goodsDispYn);
- goods8.setTmplType(goodsType);
- goods8.setLinkUrl(goodsUrl);
- goods8.setPlanContSq(goodsPlanContSq);
- goods8.setLinkOpenGb(linkOpenGb);
-
- planDao.createPlanContents(goods8);
-
- // 기존 상품8 삭제
- planDao.deletePlanContentItem(goodsPlanContSq);
-
- for (Plan multiPlanGoodsContentVal8 : param.getMultiPlanGoodsContentVal8()) {
- if(param.getMultiPlanGoodsContentVal8().size()>0) {
- goods8.setItemVal(multiPlanGoodsContentVal8.getGoodsItemVal());
- planDao.createPlanContentsItem(goods8);
- }
-
- }
- }
- }
-
- //상품 등록 -- 9
- for (Plan multiPlanGoodsContent9 : param.getMultiPlanGoodsContent9()) {
-
- if (!StringUtils.isEmpty(multiPlanGoodsContent9.getGoodsType())) {
- String goodsTitle = multiPlanGoodsContent9.getGoodsTitle();
- String goodsUrl = multiPlanGoodsContent9.getGoodsUrl();
- String goodsType = multiPlanGoodsContent9.getGoodsType();
- long goodsDispOrd = multiPlanGoodsContent9.getGoodsDispOrd();
- String goodsDispYn = multiPlanGoodsContent9.getGoodsDispYn();
- Integer goodsPlanContSq = multiPlanGoodsContent9.getGoodsPlanContSq();
- String linkOpenGb = multiPlanGoodsContent9.getGoodsLinkOpenGb();
-
- Plan goods9 = new Plan();
- goods9.setRegNo(regNo);
- goods9.setUpdNo(regNo);
- goods9.setTitle(goodsTitle);
- goods9.setDispOrd(goodsDispOrd);
- goods9.setPlanSq(param.getPlanSq());
- goods9.setDispYn(goodsDispYn);
- goods9.setTmplType(goodsType);
- goods9.setLinkUrl(goodsUrl);
- goods9.setPlanContSq(goodsPlanContSq);
- goods9.setLinkOpenGb(linkOpenGb);
-
- planDao.createPlanContents(goods9);
-
- // 기존 상품9 삭제
- planDao.deletePlanContentItem(goodsPlanContSq);
-
- for (Plan multiPlanGoodsContentVal9 : param.getMultiPlanGoodsContentVal9()) {
- if(param.getMultiPlanGoodsContentVal9().size()>0) {
- goods9.setItemVal(multiPlanGoodsContentVal9.getGoodsItemVal());
- planDao.createPlanContentsItem(goods9);
- }
-
- }
- }
- }
-
- //상품 등록 -- 10
- for (Plan multiPlanGoodsContent10 : param.getMultiPlanGoodsContent10()) {
-
- if (!StringUtils.isEmpty(multiPlanGoodsContent10.getGoodsType())) {
- String goodsTitle = multiPlanGoodsContent10.getGoodsTitle();
- String goodsUrl = multiPlanGoodsContent10.getGoodsUrl();
- String goodsType = multiPlanGoodsContent10.getGoodsType();
- long goodsDispOrd = multiPlanGoodsContent10.getGoodsDispOrd();
- String goodsDispYn = multiPlanGoodsContent10.getGoodsDispYn();
- Integer goodsPlanContSq = multiPlanGoodsContent10.getGoodsPlanContSq();
- String linkOpenGb = multiPlanGoodsContent10.getGoodsLinkOpenGb();
-
- Plan goods10 = new Plan();
- goods10.setRegNo(regNo);
- goods10.setUpdNo(regNo);
- goods10.setTitle(goodsTitle);
- goods10.setDispOrd(goodsDispOrd);
- goods10.setPlanSq(param.getPlanSq());
- goods10.setDispYn(goodsDispYn);
- goods10.setTmplType(goodsType);
- goods10.setLinkUrl(goodsUrl);
- goods10.setPlanContSq(goodsPlanContSq);
- goods10.setLinkOpenGb(linkOpenGb);
-
- planDao.createPlanContents(goods10);
-
- // 기존 상품10 삭제
- planDao.deletePlanContentItem(goodsPlanContSq);
-
- for (Plan multiPlanGoodsContentVal10 : param.getMultiPlanGoodsContentVal10()) {
- if(param.getMultiPlanGoodsContentVal10().size()>0) {
- goods10.setItemVal(multiPlanGoodsContentVal10.getGoodsItemVal());
- planDao.createPlanContentsItem(goods10);
- }
-
- }
- }
- }
- }
-
- /**
- * 기획전 복사
- *
- * @param 복사대상 기획전 번호
- * @return 복사된 기획전 번호
- * @author sowon
- * @since 2021. 02. 09
- */
- @Transactional("shopTxnManager")
- public Plan copyPlan(Plan param) {
- Plan plan = new Plan();
- int userNo = TssSession.getInfo().getUserNo();
- // 01. 기획전 복사
- param.setRegNo(userNo);
- param.setUpdNo(userNo);
- planDao.createPlanCopy(param);
-
- plan.setRegNo(userNo);
- plan.setUpdNo(userNo);
-
- // 02. 기획전 브랜드 복사
- plan.setPlanSq(param.getCopyPlanSq());
- Collection <Plan> brandList = planDao.getPlanBrandList(plan);
-
- for(Plan brandCd : brandList){
- plan.setPlanSq(param.getPlanSq());
- plan.setBrandGroupNo(brandCd.getBrandGroupNo());
- plan.setCopyPlanSq(param.getCopyPlanSq());
- planDao.createPlanBrandCopy(plan);
- }
-
- // 02. 기획전 카테고리 복사
- plan.setPlanSq(param.getCopyPlanSq());
- Collection <Plan> cateList = planDao.getPlanCateList(plan);
-
- for(Plan cateNo : cateList){
- plan.setPlanSq(param.getPlanSq());
- plan.setCateNo(cateNo.getCateNo());
- plan.setCopyPlanSq(param.getCopyPlanSq());
- planDao.createPlanCateCopy(plan);
- }
-
- // 04.고객 유형복사
- plan.setPlanSq(param.getCopyPlanSq());
- Collection <Plan> custGbList = planDao.getPlanCustGbList(plan);
-
- for(Plan custGb : custGbList){
- plan.setPlanSq(param.getPlanSq());
- plan.setCustGb(custGb.getCustGb());
- plan.setCopyPlanSq(param.getCopyPlanSq());
- planDao.createPlanCustGbCopy(plan);
- }
-
- // 05.고객 등급 복사
- // plan.setPlanSq(param.getCopyPlanSq());
- // Collection <Plan> custGradeList = planDao.getPlanCustGradeList(plan);
- //
- // for(Plan custGrade : custGradeList){
- // plan.setPlanSq(param.getPlanSq());
- // plan.setCustGrade(custGrade.getCustGrade());
- // plan.setCopyPlanSq(param.getCopyPlanSq());
- // planDao.createPlanCustGradeCopy(plan);
- // }
- return plan;
- }
-
- /**
- * 기획전 삭제 처리
- *
- * @param
- * @return
- * @author rladbwnd5
- * @since 2021. 05. 06
- */
- @Transactional("shopTxnManager")
- public void deletePlan(Collection<Plan> paramList) {
- for (Plan plan : paramList) {
- plan.setUpdNo(TssSession.getInfo().getUserNo());
- planDao.deletePlan(plan);
- }
- }
-
- /**
- * 기획전 템플릿 이미지 첨부파일 삭제
- * @param
- * @return
- * @author sowon
- * @since 2021. 05. 06
- */
- @Transactional("shopTxnManager")
- public void deletePlanTemplateFile(Plan plan) {
- planDao.deletePlanTemplateFile(plan);
- }
-
-
- /*
- * 기획전 템플릿 HTML[상단] PC 모바일 소스 등록
- */
- @Transactional("shopTxnManager")
- public Plan createPlanFsrcPcTop(Plan param) {
- Plan fsrcTop = new Plan();
- // int fsrcPcTotalCnt = param.getFsrcPcTop().toCharArray().length;
- // int fsrcMobileTotalCnt = param.getFsrcMobileTop().toCharArray().length;
- // int byteCnt = 1500;
-
-
- fsrcTop.setFrontGb("T");
- fsrcTop.setRegNo(param.getRegNo());
- fsrcTop.setPlanSq(param.getPlanSq());
- fsrcTop.setDispYn(param.getTopFsrcDispYn());
-
- fsrcTop.setFsrcPc(param.getFsrcPcTop());
- fsrcTop.setFsrcMob(param.getFsrcMobileTop());
- planDao.savePlanFsrcInfo(fsrcTop);
- return param;
- }
-
- /*
- * 기획전 템플릿 HTML[하단] PC 모바일 소스 등록
- */
- @Transactional("shopTxnManager")
- public Plan createPlanFsrcPcBtm(Plan param) {
- Plan fsrcBtm = new Plan();
- // int fsrcPcTotalCnt = param.getFsrcPcBtm().toCharArray().length;
- // int fsrcMobileTotalCnt = param.getFsrcMobileBtm().toCharArray().length;
- // int byteCnt = 1500;
- //
-
- fsrcBtm.setFrontGb("B");
- fsrcBtm.setRegNo(param.getRegNo());
- fsrcBtm.setPlanSq(param.getPlanSq());
- fsrcBtm.setDispYn(param.getBtmFsrcDispYn());
- fsrcBtm.setFsrcPc(param.getFsrcPcBtm());
- fsrcBtm.setFsrcMob(param.getFsrcMobileBtm());
- planDao.savePlanFsrcInfo(fsrcBtm);
- return param;
- }
-
- }
|