|
|
@@ -2,6 +2,7 @@ package com.style24.admin.biz.service;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Collection;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@@ -22,6 +23,8 @@ import com.style24.persistence.domain.AdKeyword;
|
|
|
import com.style24.persistence.domain.AdKeywordGoods;
|
|
|
import com.style24.persistence.domain.Brand;
|
|
|
import com.style24.persistence.domain.Color;
|
|
|
+import com.style24.persistence.domain.CommonCode;
|
|
|
+import com.style24.persistence.domain.DelvFeePolicy;
|
|
|
import com.style24.persistence.domain.FreeGoods;
|
|
|
import com.style24.persistence.domain.Goods;
|
|
|
import com.style24.persistence.domain.GoodsCategory;
|
|
|
@@ -30,6 +33,7 @@ import com.style24.persistence.domain.GoodsDesc;
|
|
|
import com.style24.persistence.domain.GoodsEpSkip;
|
|
|
import com.style24.persistence.domain.GoodsHst;
|
|
|
import com.style24.persistence.domain.GoodsImg;
|
|
|
+import com.style24.persistence.domain.GoodsMass;
|
|
|
import com.style24.persistence.domain.GoodsNaverLowestPrice;
|
|
|
import com.style24.persistence.domain.GoodsNotiInfo;
|
|
|
import com.style24.persistence.domain.GoodsPriceRes;
|
|
|
@@ -46,6 +50,7 @@ import com.style24.persistence.domain.NoticeGoods;
|
|
|
import com.style24.persistence.domain.Option;
|
|
|
import com.style24.persistence.domain.ReinboundInform;
|
|
|
import com.style24.persistence.domain.SearchData;
|
|
|
+import com.style24.persistence.domain.SupplyCompany;
|
|
|
import com.style24.persistence.domain.Video;
|
|
|
import com.style24.persistence.domain.WmsColorMapping;
|
|
|
import com.style24.persistence.domain.WmsGoods;
|
|
|
@@ -94,6 +99,9 @@ public class TsaGoodsService {
|
|
|
@Autowired
|
|
|
private TsaDisplayService displayService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TsaRendererService rendererService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private SafetyKoreaApi safetyKoreaApi;
|
|
|
|
|
|
@@ -105,6 +113,8 @@ public class TsaGoodsService {
|
|
|
|
|
|
private static final String NUMBER_PATTERN = "^[0-9]+$";
|
|
|
|
|
|
+ private static final String UPDATE_NO_PATTERN = "X";
|
|
|
+
|
|
|
private static final String SELF_GOOODS_AFTER = "STY";
|
|
|
|
|
|
/**
|
|
|
@@ -873,7 +883,7 @@ public class TsaGoodsService {
|
|
|
}
|
|
|
goodsDao.updateGoodsSnm(goods);
|
|
|
|
|
|
- //상품 등록후에는 고시정보는 품목과 상관없이 변경처리 가능하게
|
|
|
+ //상품 등록후에는 고시정보는 품목과 상관없이 변경처리 가능하게
|
|
|
// Collection<GoodsNotiInfo> goodsNotiInfoList = goodsDao.getNewNotiInfo(goods);
|
|
|
// goodsDao.deleteGoodsNotiInfo(goods);
|
|
|
//
|
|
|
@@ -1353,6 +1363,11 @@ public class TsaGoodsService {
|
|
|
regGoods.setSupplyCompCd(extendGoods.getSupplyCompCd());
|
|
|
regGoods.setFormalGb(extendGoods.getFormalGb());
|
|
|
}
|
|
|
+
|
|
|
+ if ("Y".equals(goodsCompose.getRepYn())) {
|
|
|
+ regGoods.setListPrice(extendGoods.getCurrPrice());
|
|
|
+ regGoods.setCurrPrice(extendGoods.getCurrPrice());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
this.createGoodsExtend(regGoods, goodsComposeList); // 딜상품 관련 정보 저장
|
|
|
@@ -1459,8 +1474,6 @@ public class TsaGoodsService {
|
|
|
|
|
|
float pntPrate = 0f;
|
|
|
float pntMrate = 0f;
|
|
|
- float sellFeeRate = 0f;
|
|
|
- //String delvFeeCd = "";
|
|
|
for (Brand tmpBrand : brandList) {
|
|
|
|
|
|
if ("10".equals(regGoods.getFormalGb())) {
|
|
|
@@ -1470,15 +1483,31 @@ public class TsaGoodsService {
|
|
|
pntPrate = tmpBrand.getPntPrate20();
|
|
|
pntMrate = tmpBrand.getPntMrate20();
|
|
|
}
|
|
|
- sellFeeRate = tmpBrand.getSellFeeRate();
|
|
|
- //delvFeeCd = tmpBrand.getDelvFeeCd();
|
|
|
}
|
|
|
- //regGoods.setDelvFeeCd(delvFeeCd);// 배송비전책코드
|
|
|
+
|
|
|
regGoods.setPntPrate(pntPrate); // 포인트적립율(PC)
|
|
|
regGoods.setPntMrate(pntMrate); // 포인트적립율(MOBILE)
|
|
|
- regGoods.setSellFeeRate(sellFeeRate); // 판매수수료율
|
|
|
+
|
|
|
regGoods.setSelfGoodsYn("Y");
|
|
|
|
|
|
+ SupplyCompany supplyCompany = new SupplyCompany();
|
|
|
+ supplyCompany.setSupplyCompCd(regGoods.getSupplyCompCd());
|
|
|
+ Collection<SupplyCompany> supplyCompanyList = businessService.getSupplyCompanyList(supplyCompany);
|
|
|
+ if (supplyCompanyList == null || supplyCompanyList.isEmpty()) {
|
|
|
+ throw new IllegalStateException(message.getMessage("구성상품 중 기준 상품의 업체(판매수수율를 확인해 주세요."));
|
|
|
+ }
|
|
|
+ regGoods.setSellFeeRate(supplyCompanyList.iterator().next().getSellFeeRate()); // 판매수수료율
|
|
|
+
|
|
|
+
|
|
|
+ DelvFeePolicy delvFeePolicy = new DelvFeePolicy();
|
|
|
+ delvFeePolicy.setSupplyCompCd(regGoods.getSupplyCompCd());
|
|
|
+ Collection<DelvFeePolicy> deliveryFeePolicyList = businessService.getDeliveryFeePolicyList(delvFeePolicy);
|
|
|
+ if (deliveryFeePolicyList == null || deliveryFeePolicyList.isEmpty()) {
|
|
|
+ throw new IllegalStateException(message.getMessage("구성상품 중 기준 상품의 업체(배송비정책)를 확인해 주세요."));
|
|
|
+ }
|
|
|
+ regGoods.setDelvFeeCd(deliveryFeePolicyList.iterator().next().getDelvFeeCd());// 배송비정책코드
|
|
|
+
|
|
|
+
|
|
|
// 스타일 연도
|
|
|
regGoods.setStyleYear(regGoods.getStyleYear());
|
|
|
|
|
|
@@ -2696,4 +2725,794 @@ public class TsaGoodsService {
|
|
|
return goodsDao.getNotiClsfColumnInfo(niClsfCd);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 상품대량수정 엑셀 저장
|
|
|
+ *
|
|
|
+ * @param ecxelGoodsList, procJob(updateGoods)
|
|
|
+ * @return
|
|
|
+ * @author eskim
|
|
|
+ * @since 2021. 01. 25
|
|
|
+ */
|
|
|
+ @Transactional("shopTxnManager")
|
|
|
+ public String updateMassExceluploadGoods(GagaMap gagaMap, String procJob) {
|
|
|
+
|
|
|
+ GoodsMass goodsMass = mapper.convertValue(gagaMap, GoodsMass.class);
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(goodsMass.getGoodsCd())) {
|
|
|
+ throw new IllegalStateException("상품코드가 없습니다.");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 상품기본정보
|
|
|
+ Goods goodsData = new Goods();
|
|
|
+ goodsData.setGoodsCd(goodsMass.getGoodsCd().trim().toUpperCase());
|
|
|
+ Goods goodsOrigin = goodsDao.getGoods(goodsData);
|
|
|
+ if (goodsOrigin == null) {
|
|
|
+ goodsData.setGoodsRegMsg("미등록 상품코드");
|
|
|
+ goodsData.setGoodsStat("10");
|
|
|
+ this.setGoodsRegResult(goodsData, goodsMass, procJob);
|
|
|
+ return goodsData.getGoodsStat();
|
|
|
+ }
|
|
|
+ Goods goods = this.updateMassGoodsInfo(goodsMass, procJob, goodsOrigin);
|
|
|
+
|
|
|
+ if ("10".equals(goods.getGoodsStat())) { // 정보 오류
|
|
|
+ this.setGoodsRegResult(goods, goodsMass, procJob);
|
|
|
+ return goods.getGoodsStat();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 상품 고시
|
|
|
+ Collection<GoodsNotiInfo> newGoodsNotiList = new ArrayList<>(); //적용할 고시 정보
|
|
|
+ goods = this.getUpdateMassGoodsNotiCheck(goods, gagaMap, goodsOrigin, newGoodsNotiList);
|
|
|
+ if ("10".equals(goods.getGoodsStat())) { // 정보 오류
|
|
|
+ this.setGoodsRegResult(goods, goodsMass, procJob);
|
|
|
+ return goods.getGoodsStat();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 상품상세 (html, as-is/입점)
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goodsMass.getGoodsContent().trim())) {
|
|
|
+ if (goodsMass.getGoodsContent().toLowerCase().indexOf("script") >= 0) {
|
|
|
+ goods.setGoodsRegMsg("상품상세 html script 선언 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ this.setGoodsRegResult(goods, goodsMass, procJob);
|
|
|
+ return goods.getGoodsStat();
|
|
|
+ }
|
|
|
+ goods.setChkDescKeep("Y");
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("N".equals(goods.getChDataYn()) && "N".equals(goods.getChkDescKeep()) && "N".equals(goods.getChNotiYn())) {
|
|
|
+ goods.setGoodsRegMsg("변경정보 없음");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ this.setGoodsRegResult(goods, goodsMass, procJob);
|
|
|
+ return goods.getGoodsStat();
|
|
|
+ }
|
|
|
+
|
|
|
+ //상품 기본정보 변경여부 와 촬영업체가 아닌경우
|
|
|
+ if ("Y".equals(goods.getChDataYn()) && !"G001_E000".equals(TsaSession.getInfo().getRoleCd())) {
|
|
|
+
|
|
|
+ goodsDao.createGoodsHst(goods); // 이력생성
|
|
|
+ goodsDao.updateGoodsMass(goods); // 상품기본 저장
|
|
|
+
|
|
|
+ if (!StringUtils.isBlank(goods.getGoodsSnm1()) && !UPDATE_NO_PATTERN.equals(goods.getGoodsSnm1())) {
|
|
|
+ // 사용자 검색어를 검색어에 적용
|
|
|
+ String goodsSnm = goodsDao.getGoodsSnm(goods.getGoodsCd());
|
|
|
+
|
|
|
+ String[] arrGoodsSnm = goods.getGoodsSnm1().split(";");
|
|
|
+ StringBuilder tempGoodsSnm = new StringBuilder();
|
|
|
+ for (String loopGoodsSnm : arrGoodsSnm) {
|
|
|
+ if (goodsSnm.toUpperCase().indexOf(loopGoodsSnm.toUpperCase()) <= -1) {
|
|
|
+ tempGoodsSnm.append(loopGoodsSnm).append(";");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ goods.setGoodsSnm(tempGoodsSnm.toString() + goodsSnm);
|
|
|
+ goodsDao.updateGoodsSnm(goods);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //상품 상세 변경여부 와 촬영업체가 아닌경우
|
|
|
+ if ("Y".equals(goods.getChkDescKeep()) && !"G001_E000".equals(TsaSession.getInfo().getRoleCd())) {
|
|
|
+ GoodsDesc goodsDesc = new GoodsDesc();
|
|
|
+ goodsDesc.setGoodsCd(goods.getGoodsCd());
|
|
|
+ goodsDesc.setRegNo(goods.getRegNo());
|
|
|
+ goodsDesc.setUpdNo(goods.getUpdNo());
|
|
|
+
|
|
|
+ goodsDesc.setDescGb("80");
|
|
|
+ goodsDesc.setGoodsDesc(goodsMass.getGoodsContent().trim());
|
|
|
+ this.saveGoodsDesc(goodsDesc);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 상품고시정보 적용
|
|
|
+ if ("Y".equals(goods.getChNotiYn()) && newGoodsNotiList != null && !newGoodsNotiList.isEmpty()) {
|
|
|
+
|
|
|
+ int index = 0;
|
|
|
+ for (GoodsNotiInfo goodsNotiInfo : newGoodsNotiList) {
|
|
|
+
|
|
|
+ if (index == 0) {
|
|
|
+ goodsDao.deleteGoodsNotiInfo(goods);
|
|
|
+ }
|
|
|
+ goodsDao.saveGoodsNotiInfo(goodsNotiInfo);
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 품목변경시 카테고리 자동 전시
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goods.getItemkindCd().trim())) {
|
|
|
+ GoodsCategory goodsCategory = new GoodsCategory();
|
|
|
+ goodsCategory.setRegNo(TsaSession.getInfo().getUserNo());
|
|
|
+ goodsCategory.setUpdNo(TsaSession.getInfo().getUserNo());
|
|
|
+ goodsCategory.setGoodsCd(goods.getGoodsCd());
|
|
|
+ goodsCategory.setCateType("G031_10"); //상품분류카테고리
|
|
|
+ displayService.deleteGoodsCategory(goodsCategory);
|
|
|
+ goodsDao.createCategoryGoods(goods);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ this.setGoodsRegResult(goods, goodsMass, procJob);
|
|
|
+
|
|
|
+ return goods.getGoodsStat();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품 대량 등록 결과 정보
|
|
|
+ *
|
|
|
+ * @param goods
|
|
|
+ * @author eskim
|
|
|
+ * @since 2021. 01. 25
|
|
|
+ */
|
|
|
+ private void setGoodsRegResult(Goods goods, GoodsMass goodsMass, String procJob) {
|
|
|
+ // 결과 저장
|
|
|
+ goodsMass.setBrandCd(goods.getBrandCd());
|
|
|
+ goodsMass.setGoodsStat(goods.getGoodsStat());
|
|
|
+ goodsMass.setRegSuccYn("Y");
|
|
|
+ goodsMass.setRegFailRsn(goods.getGoodsRegMsg());
|
|
|
+ goodsMass.setRegNo(TsaSession.getInfo().getUserNo());
|
|
|
+ //model은 string 테이블은 number 형이라 ,,,
|
|
|
+// if (StringUtils.isBlank(goodsMass.getListPrice())) {
|
|
|
+// goodsMass.setListPrice("0");
|
|
|
+// }
|
|
|
+// if (UPDATE_NO_PATTERN.equals(goodsMass.getCurrPrice()) || StringUtils.isBlank(goodsMass.getCurrPrice())) {
|
|
|
+// goodsMass.setCurrPrice("0");
|
|
|
+// }
|
|
|
+// if (StringUtils.isBlank(goodsMass.getCostPrice())) {
|
|
|
+// goodsMass.setCostPrice("0");
|
|
|
+// }
|
|
|
+// if ("10".equals(goods.getGoodsStat())) {
|
|
|
+// goodsMass.setRegSuccYn("N");
|
|
|
+// }
|
|
|
+ goodsMass.setProcGb("C");
|
|
|
+ if ("updateGoods".equals(procJob)) {
|
|
|
+ goodsMass.setProcGb("U");
|
|
|
+ }
|
|
|
+ goodsDao.createGoodsRegLog(goodsMass);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품대량수정 - 상품기본정보
|
|
|
+ *
|
|
|
+ * @param goodsMass
|
|
|
+ * @param excelFilename
|
|
|
+ * @author eskim
|
|
|
+ * @since 2021. 1. 20
|
|
|
+ */
|
|
|
+ private Goods updateMassGoodsInfo(GoodsMass goodsMass, String procJob, Goods goodsOrigin) {
|
|
|
+
|
|
|
+ Goods goods = new Goods();
|
|
|
+ goods.setChDataYn("N"); // 데이터 변경여부
|
|
|
+ goods.setGoodsRegMsg("상품정보 변경");
|
|
|
+ goods.setRegNo(TsaSession.getInfo().getUserNo());
|
|
|
+ goods.setUpdNo(TsaSession.getInfo().getUserNo());
|
|
|
+
|
|
|
+ goods.setGoodsCd(goodsMass.getGoodsCd().toUpperCase().trim().toUpperCase()); // 상품코드
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(goodsMass.getGoodsNm())) {
|
|
|
+ goods.setGoodsRegMsg("상품명 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setGoodsNm(goodsMass.getGoodsNm().trim()); // 상품명
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goods.getGoodsNm())) {
|
|
|
+ goods.setGoodsNm(goods.getGoodsNm().replaceAll("(\\r\\n|\\r|\\n|\\n\\r)", "")); // 상품명
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+ goods.setGoodsTnm(goodsMass.getGoodsTnm().trim()); // 상품 타이틀
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goods.getGoodsTnm())) {
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ if (!StringUtils.isBlank(goods.getGoodsTnm())) {
|
|
|
+ goods.setGoodsTnm(goods.getGoodsTnm().replaceAll("(\\r\\n|\\r|\\n|\\n\\r)", "")); // 상품 타이틀
|
|
|
+ }
|
|
|
+ }
|
|
|
+ goods.setGoodsSnm1(goodsMass.getGoodsSnm1().trim()); // 상품 사용자 검색어
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goods.getGoodsSnm1())) {
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ if (!StringUtils.isBlank(goods.getGoodsSnm1())) {
|
|
|
+ goods.setGoodsSnm1(goods.getGoodsSnm1().replaceAll("(\\r\\n|\\r|\\n|\\n\\r|\\s)", "")); // 상품 사용자 검색어
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 품목확인
|
|
|
+ if (StringUtils.isBlank(goodsMass.getItemkindCd())) {
|
|
|
+ goods.setGoodsRegMsg("품목코드 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setItemkindCd(goodsMass.getItemkindCd().trim().toUpperCase()); // 품목
|
|
|
+
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goods.getItemkindCd())) {
|
|
|
+ Itemkind itemkind = new Itemkind();
|
|
|
+ itemkind.setItemkindCd(goods.getItemkindCd());
|
|
|
+ itemkind.setUseYn("Y");
|
|
|
+ Collection<Itemkind> itemkindList = goodsDao.getItemkindList(itemkind);
|
|
|
+ if (itemkindList == null || itemkindList.isEmpty()) {
|
|
|
+ goods.setGoodsRegMsg("품목 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+
|
|
|
+ CommonCode commonCode = new CommonCode();
|
|
|
+ commonCode.setUseYn("Y");
|
|
|
+ // 시즌코드
|
|
|
+ if (StringUtils.isBlank(goodsMass.getSeasonCd())) {
|
|
|
+ goods.setGoodsRegMsg("시즌코드 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setSeasonCd(goodsMass.getSeasonCd().trim().toUpperCase());
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goods.getSeasonCd())) {
|
|
|
+ commonCode.setCdGb("G006"); // 시즌
|
|
|
+ commonCode.setCd(goods.getSeasonCd());
|
|
|
+ Collection<CommonCode> seassonList = rendererService.getCommonCodeList(commonCode);
|
|
|
+ if (seassonList == null || seassonList.isEmpty()) {
|
|
|
+ goods.setGoodsRegMsg("시즌 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+ // 성별
|
|
|
+ if (StringUtils.isBlank(goodsMass.getSexGb())) {
|
|
|
+ goods.setGoodsRegMsg("성별코드 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setSexGb(goodsMass.getSexGb().trim().toUpperCase());
|
|
|
+ // 성별
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goods.getSexGb())) {
|
|
|
+ commonCode.setCdGb("G007"); // 성별
|
|
|
+ commonCode.setCd(goods.getSexGb());
|
|
|
+ Collection<CommonCode> genderList = rendererService.getCommonCodeList(commonCode);
|
|
|
+ if (genderList == null || genderList.isEmpty()) {
|
|
|
+ goods.setGoodsRegMsg("성별 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+ //판매가
|
|
|
+ if (StringUtils.isBlank(goodsMass.getCurrPrice())) {
|
|
|
+ goods.setGoodsRegMsg("판매가 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ if (UPDATE_NO_PATTERN.equals(goodsMass.getCurrPrice().trim())) {
|
|
|
+ goods.setCurrPrice(0);
|
|
|
+ } else {
|
|
|
+
|
|
|
+ if (!GagaStringUtil.replace(goodsMass.getCurrPrice().trim(), ",", "").matches(NUMBER_PATTERN)) {
|
|
|
+ goods.setGoodsRegMsg("판매가 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ if (Integer.parseInt(goodsMass.getCurrPrice().trim()) == 0) {
|
|
|
+ goods.setGoodsRegMsg("판매가 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //판매수수료율
|
|
|
+ if (StringUtils.isBlank(goodsMass.getSellFeeRate())) {
|
|
|
+ goods.setGoodsRegMsg("판매수수료율 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ float sellFeeRate = 0f;
|
|
|
+ if (UPDATE_NO_PATTERN.equals(goodsMass.getSellFeeRate().trim())) {
|
|
|
+ goods.setSellFeeRate(0);
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ sellFeeRate = Float.valueOf(goodsMass.getSellFeeRate().trim());
|
|
|
+ //goods.setSellFeeRate(sellFeeRate);
|
|
|
+ } catch (Exception e) {
|
|
|
+ goods.setGoodsRegMsg("판매수수료율 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+
|
|
|
+ //비교값 크면 1, 같으면 0, 작은면 -1 리턴
|
|
|
+ if (Float.compare(sellFeeRate, 0) == 0) {
|
|
|
+ goods.setGoodsRegMsg("판매수수료율 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Float.compare(sellFeeRate, 100) >= 0) {
|
|
|
+ goods.setGoodsRegMsg("판매수수료율 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //판매가나 판매수수료율이 변경되었을 때
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goodsMass.getCurrPrice().trim()) || !UPDATE_NO_PATTERN.equals(goodsMass.getSellFeeRate().trim())) {
|
|
|
+ //자사
|
|
|
+ if ("Y".equals(goodsOrigin.getSelfGoodsYn())) {
|
|
|
+ //판매가 변경시
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goodsMass.getCurrPrice().trim())) {
|
|
|
+ goods.setCurrPrice(Integer.parseInt(GagaStringUtil.replace(goodsMass.getCurrPrice().trim(), ",", ""))); // 판매가
|
|
|
+ goods.setCurrBprice(goodsOrigin.getCurrPrice());
|
|
|
+ goods.setDcRate((int)(this.getDcRate(goodsOrigin.getListPrice(), goods.getCurrPrice())));
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+ //판매수수료율 변경시
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goodsMass.getSellFeeRate().trim())) {
|
|
|
+ goods.setSellFeeRate(sellFeeRate); // 판매수수료율
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //입점
|
|
|
+ GoodsPriceRes goodsPriceRes = new GoodsPriceRes();
|
|
|
+ goodsPriceRes.setGoodsCd(goods.getGoodsCd());
|
|
|
+ if (goods.getCurrPrice() != goodsOrigin.getCurrPrice()) {
|
|
|
+ goodsPriceRes.setResGoodsPrice(goods.getCurrPrice());
|
|
|
+ goodsPriceRes.setEndGoodsPrice(goods.getCurrPrice());
|
|
|
+ }
|
|
|
+ if (goods.getSellFeeRate() != goodsOrigin.getSellFeeRate()) {
|
|
|
+ goodsPriceRes.setSellFeeRate(sellFeeRate);
|
|
|
+ }
|
|
|
+ goodsPriceRes.setApplyStdt(GagaDateUtil.getTodayDateTime()); //yyyymmddhhmiss
|
|
|
+ int toYear = Integer.parseInt(GagaDateUtil.getToday("yyyy")) + 4;
|
|
|
+ goodsPriceRes.setApplyEddt(Integer.toString(toYear) + "1231235959"); //yyyymmddhhmiss
|
|
|
+ goodsPriceRes.setCfrmYn("N");
|
|
|
+ goodsPriceRes.setApplyYn("N");
|
|
|
+ goodsPriceRes.setRegNo(goods.getRegNo());
|
|
|
+ goodsPriceRes.setUpdNo(goods.getUpdNo());
|
|
|
+ goodsDao.createGoodPriceRes(goodsPriceRes);
|
|
|
+
|
|
|
+ // 상품테이블에 바로 변경하지 않고 입점상품가격관리에서 승인해야함
|
|
|
+ goods.setCurrPrice(goodsOrigin.getCurrPrice());
|
|
|
+ goods.setSellFeeRate(goodsOrigin.getSellFeeRate());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 상품구분
|
|
|
+ if (StringUtils.isBlank(goodsMass.getGoodsGb())) {
|
|
|
+ goods.setGoodsRegMsg("상품구분 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setSexGb(goodsMass.getGoodsGb().trim().toUpperCase());
|
|
|
+ // 상품구분
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goods.getGoodsGb())) {
|
|
|
+ commonCode.setCdGb("G073"); // 상품구분
|
|
|
+ commonCode.setCd(goods.getGoodsGb());
|
|
|
+ Collection<CommonCode> goodsGbList = rendererService.getCommonCodeList(commonCode);
|
|
|
+ if (goodsGbList == null || goodsGbList.isEmpty()) {
|
|
|
+ goods.setGoodsRegMsg("상품구분 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+
|
|
|
+ //정상이월구분
|
|
|
+ if (StringUtils.isBlank(goodsMass.getFormalGb())) {
|
|
|
+ goods.setGoodsRegMsg("정상이월구분 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setFormalGb(goodsMass.getFormalGb().trim().toUpperCase()); // 정상이월
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goods.getFormalGb())
|
|
|
+ && !"G009_10".equals(goods.getFormalGb())
|
|
|
+ && !"G009_20".equals(goods.getFormalGb())) {
|
|
|
+ goods.setGoodsRegMsg("정상이월구분 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goods.getFormalGb())) {
|
|
|
+ goods.setPntPrate(goodsOrigin.getPntPrate()); // 포인트적립율(PC)
|
|
|
+ goods.setPntMrate(goodsOrigin.getPntMrate()); // 포인트적립율(MOBILE)
|
|
|
+ Brand brand = new Brand();
|
|
|
+ brand.setBrandCd(goodsOrigin.getBrandCd());
|
|
|
+ Collection<Brand> brandList = businessService.getBrandList(brand);
|
|
|
+ if (brandList != null && !brandList.isEmpty()) {
|
|
|
+ // 브랜드 확인
|
|
|
+ float pntPrate = 0f;
|
|
|
+ float pntMrate = 0f;
|
|
|
+ for (Brand tmpBrand : brandList) {
|
|
|
+ if ("G009_10".equals(goods.getFormalGb())) {
|
|
|
+ pntPrate = tmpBrand.getPntPrate10();
|
|
|
+ pntMrate = tmpBrand.getPntMrate10();
|
|
|
+ } else {
|
|
|
+ pntPrate = tmpBrand.getPntPrate20();
|
|
|
+ pntMrate = tmpBrand.getPntMrate20();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ goods.setPntPrate(pntPrate); // 포인트적립율(PC)
|
|
|
+ goods.setPntMrate(pntMrate); // 포인트적립율(MOBILE)
|
|
|
+ }
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+
|
|
|
+ //최소주문수량
|
|
|
+ if (UPDATE_NO_PATTERN.equals(goodsMass.getMinOrdQty().trim())) {
|
|
|
+ goods.setMinOrdQty(0);
|
|
|
+ } else {
|
|
|
+ if (!goodsMass.getMinOrdQty().trim().matches(NUMBER_PATTERN) || Integer.parseInt(goodsMass.getMinOrdQty().trim()) == 0) {
|
|
|
+ goods.setGoodsRegMsg("최소주문수량 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setMinOrdQty(Integer.parseInt(goodsMass.getMinOrdQty().trim()));
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+ //최대주문수량
|
|
|
+ if (UPDATE_NO_PATTERN.equals(goodsMass.getMaxOrdQty().trim())) {
|
|
|
+ goods.setMaxOrdQty(0);
|
|
|
+ } else {
|
|
|
+ if (!goodsMass.getMaxOrdQty().trim().matches(NUMBER_PATTERN) || Integer.parseInt(goodsMass.getMaxOrdQty().trim()) == 0) {
|
|
|
+ goods.setGoodsRegMsg("최대주문수량 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setMaxOrdQty(Integer.parseInt(goodsMass.getMaxOrdQty().trim()));
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+ //ID당1일최대주문수량
|
|
|
+ if (UPDATE_NO_PATTERN.equals(goodsMass.getDayMaxOrdQty().trim())) {
|
|
|
+ goods.setMaxOrdQty(0);
|
|
|
+ } else {
|
|
|
+ if (!goodsMass.getDayMaxOrdQty().trim().matches(NUMBER_PATTERN) || Integer.parseInt(goodsMass.getDayMaxOrdQty().trim()) == 0) {
|
|
|
+ goods.setGoodsRegMsg("ID당1일최대주문수량 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setDayMaxOrdQty(Integer.parseInt(goodsMass.getDayMaxOrdQty().trim()));
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (goods.getMinOrdQty() > goods.getMaxOrdQty()) {
|
|
|
+ goods.setGoodsRegMsg("최소주문수량 오류(최대주문수량보다 클 수 없음)");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (goods.getMaxOrdQty() > goods.getDayMaxOrdQty()) {
|
|
|
+ goods.setGoodsRegMsg("최대주문수량 오류(ID당1일최대구매수량보다 클 수 없음)");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+
|
|
|
+ //선물주문가능여부
|
|
|
+ if (StringUtils.isBlank(goodsMass.getGiftPackYn())) {
|
|
|
+ goods.setGoodsRegMsg("선물주문가능여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ if ("Y".equals(goodsOrigin.getSelfGoodsYn())) {
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goodsMass.getGiftPackYn().trim().toUpperCase())) {
|
|
|
+ goods.setGiftPackYn(goodsMass.getGiftPackYn().trim().toUpperCase());
|
|
|
+ if (!"Y".equals(goods.getGiftPackYn()) && !"N".equals(goods.getGiftPackYn())) {
|
|
|
+ goods.setGoodsRegMsg("선물주문가능여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ goods.setGiftPackYn(goodsOrigin.getGiftPackYn().trim().toUpperCase());
|
|
|
+ }
|
|
|
+
|
|
|
+ //신규가입구매가능여부
|
|
|
+ if (StringUtils.isBlank(goodsMass.getNewCustOrdYn())) {
|
|
|
+ goods.setGoodsRegMsg("신규가입구매가능여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ if ("Y".equals(goodsOrigin.getSelfGoodsYn())) {
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goodsMass.getNewCustOrdYn().trim().toUpperCase())) {
|
|
|
+ goods.setNewCustOrdYn(goodsMass.getNewCustOrdYn().trim().toUpperCase());
|
|
|
+ if (!"Y".equals(goods.getNewCustOrdYn()) && !"N".equals(goods.getNewCustOrdYn())) {
|
|
|
+ goods.setGoodsRegMsg("신규가입구매가능여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ goods.setNewCustOrdYn(goodsOrigin.getNewCustOrdYn().toUpperCase());
|
|
|
+ }
|
|
|
+
|
|
|
+ //반품여부
|
|
|
+ if (StringUtils.isBlank(goodsMass.getReturnableYn())) {
|
|
|
+ goods.setGoodsRegMsg("반품여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setReturnableYn(goodsMass.getReturnableYn().trim().toUpperCase());
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goodsMass.getReturnableYn().trim())) {
|
|
|
+ if (!"Y".equals(goods.getReturnableYn()) && !"N".equals(goods.getReturnableYn())) {
|
|
|
+ goods.setGoodsRegMsg("반품여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+
|
|
|
+ //교환여부
|
|
|
+ if (StringUtils.isBlank(goodsMass.getChangeableYn())) {
|
|
|
+ goods.setGoodsRegMsg("교환여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setChangeableYn(goodsMass.getChangeableYn().trim().toUpperCase());
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goodsMass.getChangeableYn().trim())) {
|
|
|
+ if (!"Y".equals(goods.getChangeableYn()) && !"N".equals(goods.getChangeableYn())) {
|
|
|
+ goods.setGoodsRegMsg("교환여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+
|
|
|
+ //과세구분
|
|
|
+ if (StringUtils.isBlank(goodsMass.getTaxGb())) {
|
|
|
+ goods.setGoodsRegMsg("과세구분 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setTaxGb(goodsMass.getTaxGb().trim().toUpperCase());
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goodsMass.getTaxGb().trim())) {
|
|
|
+ if (!"Y".equals(goods.getTaxGb()) && !"N".equals(goods.getTaxGb())) {
|
|
|
+ goods.setGoodsRegMsg("과세구분 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+
|
|
|
+ //상품연령
|
|
|
+ if (StringUtils.isBlank(goodsMass.getAgeGrpCd())) {
|
|
|
+ goods.setGoodsRegMsg("상품연령 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setAgeGrpCd(goodsMass.getAgeGrpCd().trim().toUpperCase());
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goods.getAgeGrpCd())) {
|
|
|
+ commonCode.setCdGb("G023");
|
|
|
+ commonCode.setCd(goods.getAgeGrpCd());
|
|
|
+ Collection<CommonCode> ageGrpCdList = rendererService.getCommonCodeList(commonCode);
|
|
|
+ if (ageGrpCdList == null || ageGrpCdList.isEmpty()) {
|
|
|
+ goods.setGoodsRegMsg("상품연령 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+
|
|
|
+ //성인용품여부
|
|
|
+ if (StringUtils.isBlank(goodsMass.getAdultYn())) {
|
|
|
+ goods.setGoodsRegMsg("성인용품여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setAdultYn(goodsMass.getAdultYn().trim().toUpperCase());
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goods.getAdultYn())) {
|
|
|
+ if (!"Y".equals(goods.getAdultYn()) && !"N".equals(goods.getAdultYn())) {
|
|
|
+ goods.setGoodsRegMsg("성인용품여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+
|
|
|
+ //PC포인트적립율
|
|
|
+ if (StringUtils.isBlank(goodsMass.getPntPrate())) {
|
|
|
+ goods.setGoodsRegMsg("PC포인트적립율 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goodsMass.getPntPrate().trim())) {
|
|
|
+ try {
|
|
|
+ float pntPrate = Float.valueOf(goodsMass.getPntPrate().trim());
|
|
|
+ goods.setPntPrate(pntPrate);
|
|
|
+ } catch (Exception e) {
|
|
|
+ goods.setGoodsRegMsg("PC포인트적립율 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(goodsMass.getPrePpntUsableYn())) {
|
|
|
+ goods.setGoodsRegMsg("PC선포인트 사용여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goodsMass.getPrePpntUsableYn().trim())) {
|
|
|
+ if ("Y".equals(goodsMass.getPrePpntUsableYn().trim()) || "N".equals(goodsMass.getPrePpntUsableYn().trim())) {
|
|
|
+ goods.setPrePpntUsableYn(goodsMass.getPrePpntUsableYn().trim());
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ } else {
|
|
|
+ goods.setGoodsRegMsg("PC선포인트 사용여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(goodsMass.getPntMrate())) {
|
|
|
+ goods.setGoodsRegMsg("모바일포인트적립율 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goodsMass.getPntMrate().trim())) {
|
|
|
+ try {
|
|
|
+ int pntMrate = Integer.parseInt(goodsMass.getPntMrate().trim());
|
|
|
+ goods.setPntMrate(pntMrate);
|
|
|
+ } catch (Exception e) {
|
|
|
+ goods.setGoodsRegMsg("모바일포인트적립율 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(goodsMass.getPreMpntUsableYn())) {
|
|
|
+ goods.setGoodsRegMsg("모바일선포인트 사용여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goodsMass.getPreMpntUsableYn().trim())) {
|
|
|
+ if ("Y".equals(goodsMass.getPreMpntUsableYn().trim()) || "N".equals(goodsMass.getPreMpntUsableYn().trim())) {
|
|
|
+ goods.setPreMpntUsableYn(goodsMass.getPreMpntUsableYn().trim());
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ } else {
|
|
|
+ goods.setGoodsRegMsg("모바일선포인트 사용여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 배송비 정책 확인
|
|
|
+ if (StringUtils.isBlank(goodsMass.getDelvFeeCd())) {
|
|
|
+ goods.setGoodsRegMsg("배송비정책코드 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setDelvFeeCd(goodsMass.getDelvFeeCd().trim().toUpperCase());
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goods.getDelvFeeCd())) {
|
|
|
+
|
|
|
+ DelvFeePolicy delvFeePolicy = new DelvFeePolicy();
|
|
|
+ delvFeePolicy.setSupplyCompCd(goods.getSupplyCompCd());
|
|
|
+ delvFeePolicy.setDelvFeeCd(goods.getDelvFeeCd());
|
|
|
+ delvFeePolicy.setUseYn("Y");
|
|
|
+ Collection<DelvFeePolicy> deliveryFeePolicyList = businessService.getDeliveryFeePolicyList(delvFeePolicy);
|
|
|
+ if (deliveryFeePolicyList != null && !deliveryFeePolicyList.isEmpty()) {
|
|
|
+ goods.setGoodsRegMsg("배송비정책코드 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품대량수정 - 상품고시정보 check
|
|
|
+ *
|
|
|
+ * @param goods
|
|
|
+ * @param excelMap
|
|
|
+ * @param goodsOrigin
|
|
|
+ * @param newGoodsNotiList
|
|
|
+ * @return Goods
|
|
|
+ * @author eskim
|
|
|
+ * @since 2021. 01. 25
|
|
|
+ */
|
|
|
+ private Goods getUpdateMassGoodsNotiCheck(Goods goods, GagaMap excelMap, Goods goodsOrigin, Collection<GoodsNotiInfo> newGoodsNotiList) {
|
|
|
+
|
|
|
+ goods.setChNotiYn("N");
|
|
|
+ String oldNiClsfCd = "";
|
|
|
+ String newNiClsfCd = "";
|
|
|
+
|
|
|
+ newNiClsfCd = excelMap.getString("niClsfCd").trim();
|
|
|
+ for (int i = 0; i < 28; i++) {
|
|
|
+ if (StringUtils.isBlank(excelMap.getString("niContent" + (i + 1)))) {
|
|
|
+ goods.setGoodsRegMsg("고시항목정보 없음 (" + (i + 1) + "번째 항목)");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(excelMap.getString("niContent" + (i + 1)).trim())) {
|
|
|
+ goods.setChNotiYn("Y");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 변경사항이 있는지 확인
|
|
|
+ if (UPDATE_NO_PATTERN.equals(newNiClsfCd) && "N".equals(goods.getChNotiYn())) {
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+
|
|
|
+ Collection<GoodsNotiInfo> goodsNotiList = new ArrayList<>();
|
|
|
+ //고시분류 코드의 고시항목 조회
|
|
|
+ NotiInfo notiInfo = new NotiInfo();
|
|
|
+ notiInfo.setSupplyVendorCd(goodsOrigin.getSupplyVendorCd());
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(newNiClsfCd)) {
|
|
|
+ notiInfo.setNiClsfCd(newNiClsfCd);
|
|
|
+ } else {
|
|
|
+ GoodsNotiInfo goodsNotiInfo = new GoodsNotiInfo();
|
|
|
+ goodsNotiInfo.setGoodsCd(goods.getGoodsCd());
|
|
|
+ goodsNotiList = goodsDao.getGoodsNotiInfoList(goodsNotiInfo);
|
|
|
+ if (goodsNotiList != null && !goodsNotiList.isEmpty()) {
|
|
|
+ oldNiClsfCd = goodsNotiList.iterator().next().getNiClsfCd();
|
|
|
+ }
|
|
|
+ notiInfo.setNiClsfCd(oldNiClsfCd);
|
|
|
+ newNiClsfCd = oldNiClsfCd;
|
|
|
+ }
|
|
|
+ Collection<NotiInfo> notiInfolist = goodsDao.getNotiInfoItemList(notiInfo); // 항목별 기본값 조회
|
|
|
+ // 상품의 고시 분류코드 조회
|
|
|
+ if (notiInfolist == null || notiInfolist.isEmpty()) {
|
|
|
+ goods.setGoodsRegMsg("고시분류정보 없음");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+
|
|
|
+ int index = 0;
|
|
|
+ // 같은 고시분류 일경우 기존 고시항목 정보 적용
|
|
|
+ if (oldNiClsfCd.equals(newNiClsfCd)) {
|
|
|
+ for (NotiInfo notiInfoData : notiInfolist) {
|
|
|
+ for (GoodsNotiInfo goodsNotiInfoTemp : goodsNotiList) {
|
|
|
+ if (notiInfoData.getNiItemCd().equals(goodsNotiInfoTemp.getNiItemCd())) {
|
|
|
+ notiInfoData.setNiContent(goodsNotiInfoTemp.getNiContent());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ index = 0;
|
|
|
+ for (NotiInfo notiInfoTmp : notiInfolist) {
|
|
|
+ GoodsNotiInfo goodsNotiInfoTmp = new GoodsNotiInfo();
|
|
|
+ goodsNotiInfoTmp.setGoodsCd(goods.getGoodsCd());
|
|
|
+ goodsNotiInfoTmp.setNiClsfCd(notiInfoTmp.getNiClsfCd());
|
|
|
+ goodsNotiInfoTmp.setNiItemCd(notiInfoTmp.getNiItemCd());
|
|
|
+ goodsNotiInfoTmp.setDispOrd(index + 1);
|
|
|
+ goodsNotiInfoTmp.setRegNo(TsaSession.getInfo().getUserNo());
|
|
|
+ goodsNotiInfoTmp.setUpdNo(TsaSession.getInfo().getUserNo());
|
|
|
+ if (UPDATE_NO_PATTERN.equals(excelMap.getString("niContent" + (index + 1)))) {
|
|
|
+ goodsNotiInfoTmp.setNiContent(notiInfoTmp.getNiContent());
|
|
|
+ } else {
|
|
|
+ goodsNotiInfoTmp.setNiContent(excelMap.getString("niContent" + (index + 1)));
|
|
|
+ }
|
|
|
+
|
|
|
+ newGoodsNotiList.add(goodsNotiInfoTmp);
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품등록로그 목록
|
|
|
+ *
|
|
|
+ * @param goodsSearch
|
|
|
+ * @return
|
|
|
+ * @author eskim
|
|
|
+ * @since 2020. 01. 25
|
|
|
+ */
|
|
|
+ public Collection<GoodsMass> getGoodsRegLogList(GoodsSearch goodsSearch) {
|
|
|
+
|
|
|
+ // 입점업체담당자는 업체코드 설정
|
|
|
+ if ("G001_B000".equals(TsaSession.getInfo().getRoleCd()) || "G001_E000".equals(TsaSession.getInfo().getRoleCd())) {
|
|
|
+ goodsSearch.setSupplyCompCd(TsaSession.getInfo().getSupplyCompCd());
|
|
|
+ goodsSearch.setRegNo(TsaSession.getInfo().getUserNo());
|
|
|
+ }
|
|
|
+ return goodsDao.getGoodsRegLogList(goodsSearch);
|
|
|
+ }
|
|
|
}
|