|
@@ -1,6 +1,8 @@
|
|
|
package com.style24.scm.biz.service;
|
|
package com.style24.scm.biz.service;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Collection;
|
|
import java.util.Collection;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -13,18 +15,22 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.style24.core.support.message.TscMessageByLocale;
|
|
import com.style24.core.support.message.TscMessageByLocale;
|
|
|
import com.style24.persistence.domain.Brand;
|
|
import com.style24.persistence.domain.Brand;
|
|
|
|
|
+import com.style24.persistence.domain.CommonCode;
|
|
|
import com.style24.persistence.domain.Goods;
|
|
import com.style24.persistence.domain.Goods;
|
|
|
import com.style24.persistence.domain.GoodsDesc;
|
|
import com.style24.persistence.domain.GoodsDesc;
|
|
|
import com.style24.persistence.domain.GoodsHst;
|
|
import com.style24.persistence.domain.GoodsHst;
|
|
|
import com.style24.persistence.domain.GoodsImg;
|
|
import com.style24.persistence.domain.GoodsImg;
|
|
|
|
|
+import com.style24.persistence.domain.GoodsMass;
|
|
|
import com.style24.persistence.domain.GoodsNotiInfo;
|
|
import com.style24.persistence.domain.GoodsNotiInfo;
|
|
|
import com.style24.persistence.domain.GoodsPriceRes;
|
|
import com.style24.persistence.domain.GoodsPriceRes;
|
|
|
import com.style24.persistence.domain.GoodsSearch;
|
|
import com.style24.persistence.domain.GoodsSearch;
|
|
|
|
|
+import com.style24.persistence.domain.Itemkind;
|
|
|
import com.style24.persistence.domain.NotiInfo;
|
|
import com.style24.persistence.domain.NotiInfo;
|
|
|
import com.style24.persistence.domain.Notice;
|
|
import com.style24.persistence.domain.Notice;
|
|
|
import com.style24.persistence.domain.NoticeGoods;
|
|
import com.style24.persistence.domain.NoticeGoods;
|
|
|
import com.style24.persistence.domain.Option;
|
|
import com.style24.persistence.domain.Option;
|
|
|
import com.style24.persistence.domain.SearchData;
|
|
import com.style24.persistence.domain.SearchData;
|
|
|
|
|
+import com.style24.persistence.domain.WmsGoods;
|
|
|
import com.style24.scm.biz.dao.TssGoodsDao;
|
|
import com.style24.scm.biz.dao.TssGoodsDao;
|
|
|
import com.style24.scm.support.env.TssConstants;
|
|
import com.style24.scm.support.env.TssConstants;
|
|
|
import com.style24.scm.support.security.session.TssSession;
|
|
import com.style24.scm.support.security.session.TssSession;
|
|
@@ -66,9 +72,18 @@ public class TssGoodsService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private TssNoticeService noticeService;
|
|
private TssNoticeService noticeService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private TssRendererService rendererService;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ObjectMapper mapper;
|
|
private ObjectMapper mapper;
|
|
|
|
|
|
|
|
|
|
+ private static final String NUMBER_PATTERN = "^[0-9]+$";
|
|
|
|
|
+
|
|
|
|
|
+ private static final String UPDATE_NO_PATTERN = "X";
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 상품 목록 건수
|
|
* 상품 목록 건수
|
|
|
*
|
|
*
|
|
@@ -1058,4 +1073,531 @@ public class TssGoodsService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 상품대량등록 엑셀 저장 - 자사상품
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param ecxelGoodsList, excelFilename, procJob(자사:createSelfGoods, 입점:createGoods)
|
|
|
|
|
+ * @return
|
|
|
|
|
+ * @author eskim
|
|
|
|
|
+ * @since 2021. 01. 12
|
|
|
|
|
+ */
|
|
|
|
|
+ @Transactional("shopTxnManager")
|
|
|
|
|
+ public void createExceluploadSelfGoods(Collection<GagaMap> ecxelGoodsList, String excelFilename, String procJob) {
|
|
|
|
|
+ String targetPath = GagaFileUtil.getConcatenationPath(env.getProperty("upload.excel.target.path"), "excel");
|
|
|
|
|
+ if ((ecxelGoodsList == null || ecxelGoodsList.isEmpty())) {
|
|
|
|
|
+ this.deleteExceluploadFile(targetPath, excelFilename);
|
|
|
|
|
+ throw new IllegalStateException(message.getMessage("FAIL_1001"));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ for (GagaMap gagaMap : ecxelGoodsList) {
|
|
|
|
|
+ GoodsMass goodsMass = mapper.convertValue(gagaMap, GoodsMass.class);
|
|
|
|
|
+
|
|
|
|
|
+ // 상품기본정보
|
|
|
|
|
+ Goods goods = this.createSelfGoodsInfo(goodsMass, procJob);
|
|
|
|
|
+
|
|
|
|
|
+ if ("10".equals(goods.getGoodsStat())) { // 정보 오류
|
|
|
|
|
+ this.setGoodsRegResult(goods, goodsMass, procJob);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 상품고시정보
|
|
|
|
|
+ Collection<GoodsNotiInfo> goodsNotiList = goodsDao.getItemkindNotiInfoList(goods);
|
|
|
|
|
+ if (goodsNotiList == null || goodsNotiList.isEmpty()) {
|
|
|
|
|
+ goods.setGoodsRegMsg("품목의 고시정보 없음");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ this.setGoodsRegResult(goods, goodsMass, procJob);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 자사 상품 등록시 고시정보 처리
|
|
|
|
|
+ for (GoodsNotiInfo goodsNotiInfo : goodsNotiList) {
|
|
|
|
|
+// if ("003".equals(goodsNotiInfo.getNiItemCd())) { // 색상
|
|
|
|
|
+// if (!StringUtils.isEmpty(goods.getColorNm())) {
|
|
|
|
|
+// goodsNotiInfo.setNiContent(goods.getColorNm());
|
|
|
|
|
+// }
|
|
|
|
|
+// } else if ("004".equals(goodsNotiInfo.getNiItemCd())) { //치수
|
|
|
|
|
+// if (!StringUtils.isEmpty(goods.getSizeName())) {
|
|
|
|
|
+// goodsNotiInfo.setNiContent(goods.getSizeName());
|
|
|
|
|
+// }
|
|
|
|
|
+ if ("006".equals(goodsNotiInfo.getNiItemCd())) { //제조국
|
|
|
|
|
+ if (!StringUtils.isEmpty(goods.getOriginNm())) {
|
|
|
|
|
+ goodsNotiInfo.setNiContent(goods.getOriginNm());
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if ("009".equals(goodsNotiInfo.getNiItemCd())) { //제조년월
|
|
|
|
|
+ if (!StringUtils.isEmpty(goods.getMakeYmd())) {
|
|
|
|
|
+ goodsNotiInfo.setNiContent(goods.getMakeYmd());
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if ("097".equals(goodsNotiInfo.getNiItemCd())) { //수입여부
|
|
|
|
|
+ if (!StringUtils.isEmpty(goods.getOriginNm()) &&
|
|
|
|
|
+ (goods.getOriginNm().indexOf("대한민국") >= 0 || goods.getOriginNm().indexOf("한국") >= 0 || goods.getOriginNm().toUpperCase().indexOf("KOREA") >= 0)) {
|
|
|
|
|
+ goodsNotiInfo.setNiContent("N");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ goodsNotiInfo.setNiContent("Y");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //고시항목 필수값 확인
|
|
|
|
|
+ goods = this.getGoodsNotiCheck(goods, goodsNotiList, gagaMap, procJob);
|
|
|
|
|
+
|
|
|
|
|
+ Collection<Option> goodsWmsSizeList = new ArrayList<>();
|
|
|
|
|
+
|
|
|
|
|
+ // 상품사이즈 정보 -- 재고 정보연동 해야함
|
|
|
|
|
+ goodsWmsSizeList = goodsDao.getGoodsWmsSizeList(goods);
|
|
|
|
|
+ if (goodsWmsSizeList == null || goodsWmsSizeList.isEmpty()) {
|
|
|
|
|
+ goods.setGoodsRegMsg("WMS 상품 사이즈 정보 없음");
|
|
|
|
|
+ goods.setGoodsStat("20");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 할인율
|
|
|
|
|
+ goods.setDcRate((int)(this.getDcRate(goods.getListPrice(), goods.getCurrPrice())));
|
|
|
|
|
+
|
|
|
|
|
+ goodsDao.createGoods(goods); // 상품기본 저장
|
|
|
|
|
+ goodsDao.createGoodsSmmary(goods); // 상품통계 생성
|
|
|
|
|
+
|
|
|
|
|
+ WmsGoods wmsGoods = new WmsGoods();
|
|
|
|
|
+ wmsGoods.setUpdNo(TssSession.getInfo().getUserNo());
|
|
|
|
|
+ wmsGoods.setGoodsRegGb("G"); // G: 상품, F: 사은품
|
|
|
|
|
+ wmsGoods.setProductNo(goods.getProductNo());
|
|
|
|
|
+ goodsDao.saveGoodsWmsIncomelot(wmsGoods); // wms 상품 상품등록일 변경
|
|
|
|
|
+
|
|
|
|
|
+ this.createGoodsNoti(gagaMap, goodsNotiList); // 상품고시정보 저장
|
|
|
|
|
+ this.createSelfGoodsSize(goods, goodsWmsSizeList); // 자사 상품사이즈 정보 자장
|
|
|
|
|
+
|
|
|
|
|
+ // 사용자 검색어를 검색어에 적용
|
|
|
|
|
+ String goodsSnm = goodsDao.getGoodsSnm(goods.getGoodsCd());
|
|
|
|
|
+ if (!StringUtils.isEmpty(goods.getGoodsSnm1())) {
|
|
|
|
|
+ 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);
|
|
|
|
|
+
|
|
|
|
|
+ } else if (!goodsSnm.equals(goods.getGoodsSnm())) {
|
|
|
|
|
+ goods.setGoodsSnm(goodsSnm);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ goodsDao.updateGoodsSnm(goods);
|
|
|
|
|
+
|
|
|
|
|
+ goodsDao.createCategoryGoods(goods);
|
|
|
|
|
+
|
|
|
|
|
+ this.setGoodsRegResult(goods, goodsMass, procJob);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 상품등록 - 상품기본정보 - 자사상품
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param goodsMass
|
|
|
|
|
+ * @param excelFilename
|
|
|
|
|
+ * @author eskim
|
|
|
|
|
+ * @since 2021. 01. 12
|
|
|
|
|
+ */
|
|
|
|
|
+ private Goods createSelfGoodsInfo(GoodsMass goodsMass, String procJob) {
|
|
|
|
|
+
|
|
|
|
|
+ Goods goods = new Goods();
|
|
|
|
|
+ goods.setGoodsStat("40"); // 상품상태
|
|
|
|
|
+ goods.setGoodsRegMsg("승인대기");
|
|
|
|
|
+
|
|
|
|
|
+ // 품번정보 확인 (FRJ 는 11개, 그외는 10개)
|
|
|
|
|
+ if (StringUtils.isEmpty(goodsMass.getGoodsNum()) || (goodsMass.getGoodsNum().length() >= 10 && goodsMass.getGoodsNum().length() <= 11)) {
|
|
|
|
|
+ goods.setGoodsRegMsg("품번코드 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ goods.setGoodsCd(goodsMass.getGoodsNum().toUpperCase()); // 상품코드
|
|
|
|
|
+
|
|
|
|
|
+ // 상품코드 중복여부 확인
|
|
|
|
|
+ Goods goodsDup = goodsDao.getGoods(goods);
|
|
|
|
|
+ if (goodsDup != null) {
|
|
|
|
|
+ goods.setGoodsRegMsg("상품코드(품번) 중복등록요청");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ("createSelfGoods".equals(procJob)) {
|
|
|
|
|
+ if (!StringUtils.isEmpty(goodsMass.getSupplyCompCd())) {
|
|
|
|
|
+ throw new IllegalStateException("입점상품은 입점상품등록으로 작업해 주세요.");
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if ("S0001".equals(goodsMass.getSupplyCompCd()) || "S0002".equals(goodsMass.getSupplyCompCd())) {
|
|
|
|
|
+ throw new IllegalStateException("자사상품은 자사상등록으로 작업해 주세요.");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // wms 상품 정보 확인
|
|
|
|
|
+ WmsGoods wmsGoodsInfo = goodsDao.getWmsGoodsInfo(goodsMass);
|
|
|
|
|
+ if (wmsGoodsInfo == null) {
|
|
|
|
|
+ goods.setGoodsRegMsg("WMS 미존재 상품코드");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+ goods.setProductNo(wmsGoodsInfo.getProductNo());
|
|
|
|
|
+ goods.setProductCode(wmsGoodsInfo.getProductCode());
|
|
|
|
|
+
|
|
|
|
|
+ // 품번코드
|
|
|
|
|
+ goods.setGoodsNum(goodsMass.getGoodsNum().toUpperCase());
|
|
|
|
|
+ // 입점상품코드
|
|
|
|
|
+ goods.setSupplyGoodsCd(goodsMass.getGoodsNum().toUpperCase());
|
|
|
|
|
+
|
|
|
|
|
+ // 브랜드
|
|
|
|
|
+ if (StringUtils.isEmpty(goodsMass.getBrandCd())) {
|
|
|
|
|
+ goods.setGoodsRegMsg("브랜드코드 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+ goods.setBrandCd(goodsMass.getBrandCd()); // 브랜드 코드
|
|
|
|
|
+ // 브랜드 확인
|
|
|
|
|
+ Brand brand = new Brand();
|
|
|
|
|
+ brand.setBrandCd(goods.getBrandCd());
|
|
|
|
|
+ Collection<Brand> brandList = businessService.getBrandList(brand);
|
|
|
|
|
+ if (brandList == null || brandList.isEmpty()) {
|
|
|
|
|
+ goods.setGoodsRegMsg("브랜드 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ float pntPrate = 0.0f;
|
|
|
|
|
+ float pntMrate = 0.0f;
|
|
|
|
|
+ float sellFeeRate = 0.0f;
|
|
|
|
|
+ String delvFeeCd = "";
|
|
|
|
|
+ String supplyCompCd = "";
|
|
|
|
|
+ for (Brand tmpBrand : brandList) {
|
|
|
|
|
+ if ("G009_10".equals(goods.getFormalGb())) {
|
|
|
|
|
+ pntPrate = tmpBrand.getPntPrate10();
|
|
|
|
|
+ pntMrate = tmpBrand.getPntMrate10();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ pntPrate = tmpBrand.getPntPrate20();
|
|
|
|
|
+ pntMrate = tmpBrand.getPntMrate20();
|
|
|
|
|
+ }
|
|
|
|
|
+ delvFeeCd = tmpBrand.getDelvFeeCd(); //배송비정책 코드
|
|
|
|
|
+ supplyCompCd = tmpBrand.getSupplyCompCd(); //업체코드
|
|
|
|
|
+ sellFeeRate = tmpBrand.getSellFeeRate(); //판매수수료율
|
|
|
|
|
+ }
|
|
|
|
|
+ goods.setPntPrate(pntPrate); // 포인트적립율(PC)
|
|
|
|
|
+ goods.setPntMrate(pntMrate); // 포인트적립율(MOBILE)
|
|
|
|
|
+ goods.setSupplyCompCd(supplyCompCd); // 업체코드
|
|
|
|
|
+ goods.setDelvFeeCd(delvFeeCd); // 배송비정책 코드
|
|
|
|
|
+ goods.setSellFeeRate(sellFeeRate); // 판매수수료율
|
|
|
|
|
+
|
|
|
|
|
+ goodsMass.setSupplyCompCd(supplyCompCd); // 업체 코드
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // 상품명
|
|
|
|
|
+ if (StringUtils.isEmpty(goodsMass.getGoodsNm())) {
|
|
|
|
|
+ goods.setGoodsRegMsg("상품명 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+ goods.setGoodsNm(goodsMass.getGoodsNm().replaceAll("(\\r\\n|\\r|\\n|\\n\\r)", ""));
|
|
|
|
|
+
|
|
|
|
|
+ // 품목코드
|
|
|
|
|
+ if (StringUtils.isEmpty(goodsMass.getItemkindCd())) {
|
|
|
|
|
+ goods.setGoodsRegMsg("품목코드 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+ goods.setItemkindCd(goodsMass.getItemkindCd());
|
|
|
|
|
+
|
|
|
|
|
+ Itemkind itemkind = new Itemkind();
|
|
|
|
|
+ itemkind.setItemkindCd(goodsMass.getItemkindCd());
|
|
|
|
|
+ itemkind.setUseYn("Y");
|
|
|
|
|
+ Collection<Itemkind> getItemkindList = goodsDao.getItemkindList(itemkind);
|
|
|
|
|
+ if (getItemkindList == null || getItemkindList.size() == 0) {
|
|
|
|
|
+ goods.setGoodsRegMsg("품목코드 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 스타일 년도
|
|
|
|
|
+ if (StringUtils.isEmpty(goodsMass.getStyleYear()) || goodsMass.getStyleYear().length() != 4 || !goodsMass.getStyleYear().trim().matches(NUMBER_PATTERN)) {
|
|
|
|
|
+ goods.setGoodsRegMsg("스타일 년도 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+ goods.setStyleYear(goodsMass.getStyleYear());
|
|
|
|
|
+
|
|
|
|
|
+ // 시즌
|
|
|
|
|
+ if (StringUtils.isEmpty(goodsMass.getSeasonCd())) {
|
|
|
|
|
+ goods.setGoodsRegMsg("시즌 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+ goods.setSeasonCd(goodsMass.getSeasonCd()); // 시즌
|
|
|
|
|
+
|
|
|
|
|
+ CommonCode commonCode = new CommonCode();
|
|
|
|
|
+ commonCode.setUseYn("Y");
|
|
|
|
|
+ commonCode.setCdGb("G0006"); // 시즌
|
|
|
|
|
+ commonCode.setCd(goods.getSeasonCd());
|
|
|
|
|
+ Collection<CommonCode> styleYearList = rendererService.getCommonCodeList(commonCode);
|
|
|
|
|
+ if (styleYearList == null || styleYearList.isEmpty()) {
|
|
|
|
|
+ goods.setGoodsRegMsg("시즌 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 성별
|
|
|
|
|
+ if (StringUtils.isEmpty(goodsMass.getSexGb())) {
|
|
|
|
|
+ goods.setGoodsRegMsg("성별 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+ goods.setSexGb(goodsMass.getSexGb()); // 성별
|
|
|
|
|
+ commonCode.setCdGb("G0007"); // 성별
|
|
|
|
|
+ commonCode.setCd(goods.getSexGb());
|
|
|
|
|
+ Collection<CommonCode> sexGbList = rendererService.getCommonCodeList(commonCode);
|
|
|
|
|
+ if (sexGbList == null || sexGbList.isEmpty()) {
|
|
|
|
|
+ goods.setGoodsRegMsg("성별 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 정상가
|
|
|
|
|
+ if (StringUtils.isEmpty(goodsMass.getListPrice())) {
|
|
|
|
|
+ goods.setGoodsRegMsg("정상가 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!GagaStringUtil.replace(goodsMass.getListPrice(), ",", "").trim().matches(NUMBER_PATTERN)) {
|
|
|
|
|
+ goods.setGoodsRegMsg("정상가 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 판매가
|
|
|
|
|
+ if (StringUtils.isEmpty(goodsMass.getCurrPrice())) {
|
|
|
|
|
+ goods.setGoodsRegMsg("판매가 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!GagaStringUtil.replace(goodsMass.getCurrPrice(), ",", "").trim().matches(NUMBER_PATTERN)) {
|
|
|
|
|
+ goods.setGoodsRegMsg("판매가 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ int listPrice = Integer.parseInt(GagaStringUtil.replace(goodsMass.getListPrice(), ",", "").trim());
|
|
|
|
|
+ int currPrice = Integer.parseInt(GagaStringUtil.replace(goodsMass.getCurrPrice(), ",", "").trim());
|
|
|
|
|
+
|
|
|
|
|
+ if (currPrice > listPrice) {
|
|
|
|
|
+ goods.setGoodsRegMsg("판매가 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 정상가
|
|
|
|
|
+ goods.setListPrice(listPrice);
|
|
|
|
|
+ // 판매가
|
|
|
|
|
+ goods.setCurrPrice(currPrice);
|
|
|
|
|
+
|
|
|
|
|
+ // 원가
|
|
|
|
|
+ // FRJ 필수 확인
|
|
|
|
|
+ if ("S006".equals(goods.getBrandCd())) {
|
|
|
|
|
+ if (StringUtils.isEmpty(goodsMass.getCostPrice())) {
|
|
|
|
|
+ goods.setGoodsRegMsg("원가 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!GagaStringUtil.replace(goodsMass.getCostPrice(), ",", "").trim().matches(NUMBER_PATTERN)) {
|
|
|
|
|
+ goods.setGoodsRegMsg("원가 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+ int costPrice = Integer.parseInt(GagaStringUtil.replace(goodsMass.getCostPrice(), ",", "").trim());
|
|
|
|
|
+ // 원가
|
|
|
|
|
+ goods.setCostPrice(costPrice);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ goods.setCostPrice(0);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 정상이월
|
|
|
|
|
+ if (StringUtils.isEmpty(goodsMass.getSexGb())) {
|
|
|
|
|
+ goods.setGoodsRegMsg("성별 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+ goods.setFormalGb(goodsMass.getFormalGb());
|
|
|
|
|
+ commonCode.setCdGb("G009"); // 정상이월구분
|
|
|
|
|
+ commonCode.setCd(goods.getFormalGb());
|
|
|
|
|
+ Collection<CommonCode> formalGbList = rendererService.getCommonCodeList(commonCode);
|
|
|
|
|
+ if (formalGbList == null || formalGbList.isEmpty()) {
|
|
|
|
|
+ goods.setGoodsRegMsg("정상이월구분 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 원산지 / 제조국
|
|
|
|
|
+ if (StringUtils.isEmpty(goodsMass.getOriginCd())) {
|
|
|
|
|
+ goods.setGoodsRegMsg("원산지 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+ goods.setOriginCd(goodsMass.getOriginCd());
|
|
|
|
|
+ commonCode.setCdGb("G076"); // 원산지
|
|
|
|
|
+ commonCode.setCd(goods.getFormalGb());
|
|
|
|
|
+ Collection<CommonCode> originCdList = rendererService.getCommonCodeList(commonCode);
|
|
|
|
|
+ if (originCdList == null || originCdList.isEmpty()) {
|
|
|
|
|
+ goods.setGoodsRegMsg("원산지 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+ goods.setOriginNm(originCdList.iterator().next().getCdNm()); //고시정보 적용용
|
|
|
|
|
+
|
|
|
|
|
+ // 제조년월
|
|
|
|
|
+ if (StringUtils.isEmpty(goodsMass.getMakeYmd())) {
|
|
|
|
|
+ goods.setGoodsRegMsg("제조년월일 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+ goods.setMakeYmd(goodsMass.getMakeYmd());
|
|
|
|
|
+
|
|
|
|
|
+ SimpleDateFormat dateFormatParser = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
|
+ dateFormatParser.setLenient(false);
|
|
|
|
|
+ try {
|
|
|
|
|
+ dateFormatParser.parse(goodsMass.getMakeYmd());
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ goods.setGoodsRegMsg("제조년월일 오류");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ goods.setGoodsType("G056_N"); //상품타입
|
|
|
|
|
+ goods.setFormalGb("G009_10"); // 정상이월 구분
|
|
|
|
|
+ goods.setGoodsGb("G073_11"); //상품구분
|
|
|
|
|
+ goods.setDistributionGb("G065_12"); //유통구분
|
|
|
|
|
+ if ("S006".equals(goods.getBrandCd())) { //frj 사입처리
|
|
|
|
|
+ goods.setDistributionGb("G065_11"); //자사 - 사입
|
|
|
|
|
+ }
|
|
|
|
|
+ goods.setSelfGoodsYn("Y"); // 자사상품여부
|
|
|
|
|
+ goods.setSelfMallYn("Y"); //자사몰 노출여부
|
|
|
|
|
+ goods.setErpStockLinkYn("Y"); // ERP재고연동여부
|
|
|
|
|
+
|
|
|
|
|
+ goods.setRegNo(TssSession.getInfo().getUserNo());
|
|
|
|
|
+ goods.setUpdNo(TssSession.getInfo().getUserNo());
|
|
|
|
|
+
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 상품 대량 등록 결과 정보
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param goods
|
|
|
|
|
+ * @author eskim
|
|
|
|
|
+ * @since 2021. 01. 12
|
|
|
|
|
+ */
|
|
|
|
|
+ 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(TssSession.getInfo().getUserNo());
|
|
|
|
|
+ //model은 string 테이블은 number 형이라 ,,,
|
|
|
|
|
+ if (StringUtils.isEmpty(goodsMass.getListPrice())) {
|
|
|
|
|
+ goodsMass.setListPrice("0");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (UPDATE_NO_PATTERN.equals(goodsMass.getCurrPrice()) || StringUtils.isEmpty(goodsMass.getCurrPrice())) {
|
|
|
|
|
+ goodsMass.setCurrPrice("0");
|
|
|
|
|
+ }
|
|
|
|
|
+ if ("10".equals(goods.getGoodsStat())) {
|
|
|
|
|
+ goodsMass.setRegSuccYn("N");
|
|
|
|
|
+ }
|
|
|
|
|
+ goodsMass.setProcGb("C");
|
|
|
|
|
+ if ("updateGoods".equals(procJob)) {
|
|
|
|
|
+ goodsMass.setProcGb("U");
|
|
|
|
|
+ }
|
|
|
|
|
+ goodsDao.createGoodsRegLog(goodsMass);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 상품등록 - 상품고시정보 check
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param goods
|
|
|
|
|
+ * @param goodsNotiList
|
|
|
|
|
+ * @return Goods
|
|
|
|
|
+ * @author eskim
|
|
|
|
|
+ * @since 2021. 01. 12
|
|
|
|
|
+ */
|
|
|
|
|
+ private Goods getGoodsNotiCheck(Goods goods, Collection<GoodsNotiInfo> goodsNotiList, GagaMap excelMap, String procJob) {
|
|
|
|
|
+
|
|
|
|
|
+ // 고시항목 필수값 입력 확인
|
|
|
|
|
+ int index = 0;
|
|
|
|
|
+
|
|
|
|
|
+ if ("createSelfGoods".equals(procJob)) {
|
|
|
|
|
+ for (GoodsNotiInfo goodsNotiInfo : goodsNotiList) {
|
|
|
|
|
+ if ("Y".equals(goodsNotiInfo.getReqYn()) && StringUtils.isEmpty(goodsNotiInfo.getNiContent())) {
|
|
|
|
|
+ goods.setGoodsRegMsg("고시항목 오류");
|
|
|
|
|
+ goods.setGoodsStat("20");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ for (GoodsNotiInfo goodsNotiInfo : goodsNotiList) {
|
|
|
|
|
+ if ("Y".equals(goodsNotiInfo.getReqYn()) && StringUtils.isEmpty(excelMap.getString("niContent" + (index + 1)))) {
|
|
|
|
|
+ goods.setGoodsRegMsg("고시정보 없음 (" + (index + 1) + "번째 항목) - " + goodsNotiInfo.getNiItemCd() + "(" + goodsNotiInfo.getNiItemNm() + ")");
|
|
|
|
|
+ goods.setGoodsStat("10");
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ index++;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return goods;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 상품등록 - 상품고시정보
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param goods
|
|
|
|
|
+ * @param excelMap
|
|
|
|
|
+ * @return TsaGoods
|
|
|
|
|
+ * @author eskim
|
|
|
|
|
+ * @since 2021. 01. 12
|
|
|
|
|
+ */
|
|
|
|
|
+ private void createGoodsNoti(GagaMap excelMap, Collection<GoodsNotiInfo> goodsNotiList) {
|
|
|
|
|
+
|
|
|
|
|
+ int index = 0;
|
|
|
|
|
+ for (GoodsNotiInfo goodsNotiInfo : goodsNotiList) {
|
|
|
|
|
+
|
|
|
|
|
+ if (StringUtils.isEmpty(excelMap.getString("niContent" + (index + 1)))) {
|
|
|
|
|
+ goodsNotiInfo.setNiContent(goodsNotiInfo.getNiContent());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ goodsNotiInfo.setNiContent(excelMap.getString("niContent" + (index + 1)));
|
|
|
|
|
+ }
|
|
|
|
|
+ goodsNotiInfo.setRegNo(TssSession.getInfo().getUserNo());
|
|
|
|
|
+ goodsNotiInfo.setUpdNo(TssSession.getInfo().getUserNo());
|
|
|
|
|
+ goodsDao.saveGoodsNotiInfo(goodsNotiInfo);
|
|
|
|
|
+ index++;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 상품등록 - 상품재고정보 (자상상품등록시)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param goods
|
|
|
|
|
+ * @param excelMap
|
|
|
|
|
+ * @return TsaGoods
|
|
|
|
|
+ * @author eskim
|
|
|
|
|
+ * @since 2021. 01. 13
|
|
|
|
|
+ */
|
|
|
|
|
+ private void createSelfGoodsSize(Goods goods, Collection<Option> goodsSizeList) {
|
|
|
|
|
+
|
|
|
|
|
+ int index = 0;
|
|
|
|
|
+ for (Option goodsStock : goodsSizeList) {
|
|
|
|
|
+ goodsStock.setSoldoutYn("N");
|
|
|
|
|
+ goodsStock.setDispYn("N");
|
|
|
|
|
+ goodsStock.setBaseStockQty(0);
|
|
|
|
|
+ goodsStock.setAddPrice(0);
|
|
|
|
|
+ goodsStock.setRegNo(TssSession.getInfo().getUserNo());
|
|
|
|
|
+ goodsStock.setUpdNo(TssSession.getInfo().getUserNo());
|
|
|
|
|
+ goodsDao.saveStock(goodsStock);
|
|
|
|
|
+ index++;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|