|
|
@@ -5,11 +5,11 @@ import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collection;
|
|
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
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.core.type.TypeReference;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
@@ -17,6 +17,7 @@ import com.style24.core.support.message.TscMessageByLocale;
|
|
|
import com.style24.persistence.domain.Brand;
|
|
|
import com.style24.persistence.domain.CommonCode;
|
|
|
import com.style24.persistence.domain.Goods;
|
|
|
+import com.style24.persistence.domain.GoodsCategory;
|
|
|
import com.style24.persistence.domain.GoodsDesc;
|
|
|
import com.style24.persistence.domain.GoodsHst;
|
|
|
import com.style24.persistence.domain.GoodsImg;
|
|
|
@@ -75,8 +76,6 @@ public class TssGoodsService {
|
|
|
@Autowired
|
|
|
private TssRendererService rendererService;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
@Autowired
|
|
|
private ObjectMapper mapper;
|
|
|
|
|
|
@@ -84,6 +83,8 @@ public class TssGoodsService {
|
|
|
|
|
|
private static final String UPDATE_NO_PATTERN = "X";
|
|
|
|
|
|
+ private static final String SELF_GOOODS_AFTER = "STY";
|
|
|
+
|
|
|
/**
|
|
|
* 상품 목록 건수
|
|
|
*
|
|
|
@@ -144,8 +145,8 @@ public class TssGoodsService {
|
|
|
Collection<GagaMap> dataList = goodsDao.getGoodsInfoExcelList(goodsSearch); // map형식으로 조회
|
|
|
if (dataList != null && !dataList.isEmpty()) {
|
|
|
for (GagaMap gagaMap : dataList) {
|
|
|
- if (!StringUtils.isEmpty(gagaMap.get("SYS_IMG_NM").toString()) ) {
|
|
|
- gagaMap.set("SYS_IMG_NM", targetPath + '/' + gagaMap.get("SYS_IMG_NM").toString());
|
|
|
+ if (!StringUtils.isBlank(gagaMap.get("SYS_IMG_NM").toString())) {
|
|
|
+ gagaMap.set("SYS_IMG_NM", targetPath + '/' + gagaMap.get("SYS_IMG_NM").toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -219,8 +220,8 @@ public class TssGoodsService {
|
|
|
brand.setBrandCd(originGoods.getBrandCd());
|
|
|
Collection<Brand> brandList = businessService.getBrandList(brand);
|
|
|
if (brandList != null && !brandList.isEmpty()) {
|
|
|
- float pntPrate = 0;
|
|
|
- float pntMrate = 0;
|
|
|
+ float pntPrate = 0f;
|
|
|
+ float pntMrate = 0f;
|
|
|
for (Brand tmpBrand : brandList) {
|
|
|
if ("G009_10".equals(goods.getFormalGb())) {
|
|
|
pntPrate = tmpBrand.getPntPrate10();
|
|
|
@@ -260,8 +261,8 @@ public class TssGoodsService {
|
|
|
brand.setBrandCd(originGoods.getBrandCd());
|
|
|
Collection<Brand> brandList = businessService.getBrandList(brand);
|
|
|
if (brandList != null && !brandList.isEmpty()) {
|
|
|
- float pntPrate = 0;
|
|
|
- float pntMrate = 0;
|
|
|
+ float pntPrate = 0f;
|
|
|
+ float pntMrate = 0f;
|
|
|
for (Brand tmpBrand : brandList) {
|
|
|
if ("G009_10".equals(goods.getFormalGb())) {
|
|
|
pntPrate = tmpBrand.getPntPrate10();
|
|
|
@@ -357,6 +358,11 @@ public class TssGoodsService {
|
|
|
String goodsMobileDownDesc = this.getGoodsDescList(goods);
|
|
|
resultGoods.setGoodsMobileDownDesc(goodsMobileDownDesc);
|
|
|
|
|
|
+ // 상품 상세 (as-is)
|
|
|
+ goods.setDescGb("80");
|
|
|
+ String goodsDesc = this.getGoodsDescList(goods);
|
|
|
+ resultGoods.setGoodsDesc(goodsDesc);
|
|
|
+
|
|
|
return resultGoods;
|
|
|
}
|
|
|
|
|
|
@@ -375,7 +381,7 @@ public class TssGoodsService {
|
|
|
for (GoodsDesc tmpGoodsDesc : goodsDescList) {
|
|
|
goodsDescSb.append(tmpGoodsDesc.getGoodsDesc());
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
goodsDescSb.append("");
|
|
|
}
|
|
|
return goodsDescSb.toString();
|
|
|
@@ -476,11 +482,11 @@ public class TssGoodsService {
|
|
|
String goodsNumFlag = "";
|
|
|
for (Goods goods : goodsList) {
|
|
|
|
|
|
- if (!StringUtils.isEmpty(goodsCdFlag) && !StringUtils.isEmpty(goodsNumFlag)) {
|
|
|
+ if (!StringUtils.isBlank(goodsCdFlag) && !StringUtils.isBlank(goodsNumFlag)) {
|
|
|
throw new IllegalStateException("상품코드와 원코드 중 한 개의 셀에만 값을 입력해서 조회하세요.");
|
|
|
}
|
|
|
|
|
|
- if (!StringUtils.isEmpty(goods.getSupplyCompCd())) {
|
|
|
+ if (!StringUtils.isBlank(goods.getSupplyCompCd())) {
|
|
|
goods.setGoodsCd(goods.getSupplyCompCd());
|
|
|
}
|
|
|
|
|
|
@@ -528,6 +534,7 @@ public class TssGoodsService {
|
|
|
goods.setRegNo(TssSession.getInfo().getUserNo());
|
|
|
goods.setUpdNo(TssSession.getInfo().getUserNo());
|
|
|
|
|
|
+ goods.setGoodsDesc(GagaStringUtil.replace(GagaStringUtil.replace(goods.getGoodsDesc(), "<", "<"), ">", ">"));
|
|
|
goods.setGoodsPcTopDesc(GagaStringUtil.replace(GagaStringUtil.replace(goods.getGoodsPcTopDesc(), "<", "<"), ">", ">"));
|
|
|
goods.setGoodsMobileTopDesc(GagaStringUtil.replace(GagaStringUtil.replace(goods.getGoodsMobileTopDesc(), "<", "<"), ">", ">"));
|
|
|
goods.setGoodsPcDownDesc(GagaStringUtil.replace(GagaStringUtil.replace(goods.getGoodsPcDownDesc(), "<", "<"), ">", ">"));
|
|
|
@@ -561,7 +568,7 @@ public class TssGoodsService {
|
|
|
}
|
|
|
goodsPriceRes.setApplyStdt(GagaDateUtil.getTodayDateTime()); //yyyymmddhhmiss
|
|
|
int toYear = Integer.parseInt(GagaDateUtil.getToday("yyyy")) + 4;
|
|
|
- goodsPriceRes.setApplyEddt(toYear +"1231235959"); //yyyymmddhhmiss
|
|
|
+ goodsPriceRes.setApplyEddt(toYear + "1231235959"); //yyyymmddhhmiss
|
|
|
goodsPriceRes.setCfrmYn("N");
|
|
|
goodsPriceRes.setApplyYn("N");
|
|
|
goodsPriceRes.setRegNo(goods.getRegNo());
|
|
|
@@ -576,7 +583,7 @@ public class TssGoodsService {
|
|
|
goods.setGiftPackYn("N");
|
|
|
// 사용자 검색어를 검색어에 적용
|
|
|
String goodsSnm = goodsDao.getGoodsSnm(goods.getGoodsCd());
|
|
|
- if (!StringUtils.isEmpty(goods.getGoodsSnm1())) {
|
|
|
+ if (!StringUtils.isBlank(goods.getGoodsSnm1())) {
|
|
|
goods.setGoodsSnm1(GagaStringUtil.replace(goods.getGoodsSnm1(), " ", "")); // 빈값 삭제
|
|
|
String[] arrGoodsSnm = goods.getGoodsSnm1().split(";");
|
|
|
StringBuilder tempGoodsSnm = new StringBuilder();
|
|
|
@@ -599,8 +606,8 @@ public class TssGoodsService {
|
|
|
brand.setBrandCd(goods.getBrandCd());
|
|
|
Collection<Brand> brandList = businessService.getBrandList(brand);
|
|
|
if (brandList != null && !brandList.isEmpty()) {
|
|
|
- float pntPrate = 0.0f;
|
|
|
- float pntMrate = 0.0f;
|
|
|
+ float pntPrate = 0f;
|
|
|
+ float pntMrate = 0f;
|
|
|
for (Brand tmpBrand : brandList) {
|
|
|
if ("G009_10".equals(goods.getFormalGb())) {
|
|
|
pntPrate = tmpBrand.getPntPrate10();
|
|
|
@@ -656,11 +663,11 @@ public class TssGoodsService {
|
|
|
goodsOrderGrade.setGoodsCd(goods.getGoodsCd());
|
|
|
goodsOrderGrade.setRegNo(TssSession.getInfo().getUserNo());
|
|
|
goodsDao.deleteGoodsCustGrade(goodsOrderGrade);
|
|
|
- for(String custGrade : goods.getGoodsOrderGrade()) {
|
|
|
+ for (String custGrade : goods.getGoodsOrderGrade()) {
|
|
|
goodsOrderGrade.setCustGrade(custGrade);
|
|
|
goodsDao.createGoodsCustGrade(goodsOrderGrade);
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
Goods goodsOrderGrade = new Goods();
|
|
|
goodsOrderGrade.setGoodsCd(goods.getGoodsCd());
|
|
|
goodsOrderGrade.setRegNo(TssSession.getInfo().getUserNo());
|
|
|
@@ -677,7 +684,7 @@ public class TssGoodsService {
|
|
|
* @since 2020. 10. 27.
|
|
|
*/
|
|
|
private void saveGoodsDetailDesc(Goods goods) {
|
|
|
- // 상품상세 구분(10:상품타이틀,20:상품타이틀내용,30:상품특징,40:상위컨텐츠,50:하위컨텐츠,60:하위컨텐츠-모바일,70:상위컨텐츠-모바일)
|
|
|
+ // 상품상세 구분(10:상품타이틀,20:상품타이틀내용,30:상품특징,40:상위컨텐츠,50:하위컨텐츠,60:하위컨텐츠-모바일,70:상위컨텐츠-모바일,80:상품상세(as-is))
|
|
|
GoodsDesc goodsDesc = new GoodsDesc();
|
|
|
goodsDesc.setGoodsCd(goods.getGoodsCd());
|
|
|
goodsDesc.setRegNo(goods.getRegNo());
|
|
|
@@ -720,6 +727,11 @@ public class TssGoodsService {
|
|
|
goodsDesc.setDescGb("70");
|
|
|
goodsDesc.setGoodsDesc(goods.getGoodsMobileDownDesc());
|
|
|
this.saveGoodsDesc(goodsDesc);
|
|
|
+
|
|
|
+ // 상품상세(as-is,입점
|
|
|
+ goodsDesc.setDescGb("80");
|
|
|
+ goodsDesc.setGoodsDesc(goods.getGoodsDesc());
|
|
|
+ this.saveGoodsDesc(goodsDesc);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -838,7 +850,7 @@ public class TssGoodsService {
|
|
|
goodsStock.setOptCd2(goods.getOptCd2()[index]);
|
|
|
goodsStock.setBaseStockQty(Integer.parseInt(goods.getBaseStockQty()[index]));
|
|
|
goodsStock.setSoldoutYn(goods.getSoldoutYn()[index]);
|
|
|
- goodsStock.setDispOrd(goods.getDispOrd()[index]);
|
|
|
+ goodsStock.setDispOrd(Integer.parseInt(goods.getDispOrd()[index]));
|
|
|
goodsStock.setDispYn(goods.getDispYn()[index]);
|
|
|
goodsStock.setRegNo(goods.getRegNo());
|
|
|
goodsStock.setUpdNo(goods.getUpdNo());
|
|
|
@@ -991,7 +1003,7 @@ public class TssGoodsService {
|
|
|
noticeService.updateNotice(notice);
|
|
|
}
|
|
|
|
|
|
- if (!StringUtils.isEmpty(notice.getGoodsList())) {
|
|
|
+ if (!StringUtils.isBlank(notice.getGoodsList())) {
|
|
|
Collection<NoticeGoods> noticeGoodsList = null;
|
|
|
try {
|
|
|
noticeGoodsList = mapper.readValue(notice.getGoodsList(), new TypeReference<Collection<NoticeGoods>>() {
|
|
|
@@ -1057,7 +1069,7 @@ public class TssGoodsService {
|
|
|
* @since 2020. 12. 23
|
|
|
*/
|
|
|
@Transactional("shopTxnManager")
|
|
|
- public void saveGoodsImageList(Collection<GoodsImg> goodsImgList){
|
|
|
+ public void saveGoodsImageList(Collection<GoodsImg> goodsImgList) {
|
|
|
int index = 0;
|
|
|
for (GoodsImg goodsImg : goodsImgList) {
|
|
|
// 상품이미지 전체 삭제
|
|
|
@@ -1100,7 +1112,7 @@ public class TssGoodsService {
|
|
|
* @since 2021. 01. 12
|
|
|
*/
|
|
|
@Transactional("shopTxnManager")
|
|
|
- public String createExceluploadSelfGoods(GagaMap gagaMap, String procJob) {
|
|
|
+ public String createExceluploadSelfGoods(GagaMap gagaMap, String procJob) {
|
|
|
|
|
|
GoodsMass goodsMass = mapper.convertValue(gagaMap, GoodsMass.class);
|
|
|
|
|
|
@@ -1112,7 +1124,7 @@ public class TssGoodsService {
|
|
|
return goods.getGoodsStat(); //continue
|
|
|
}
|
|
|
|
|
|
- // 상품고시정보
|
|
|
+ // 상품고시정보 - 항목및 기본값
|
|
|
Collection<GoodsNotiInfo> goodsNotiList = goodsDao.getItemkindNotiInfoList(goods);
|
|
|
if (goodsNotiList == null || goodsNotiList.isEmpty()) {
|
|
|
goods.setGoodsRegMsg("품목의 고시정보 없음");
|
|
|
@@ -1121,42 +1133,6 @@ public class TssGoodsService {
|
|
|
return goods.getGoodsStat();
|
|
|
}
|
|
|
|
|
|
- // 자사 상품 등록시 고시정보 처리
|
|
|
- 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);
|
|
|
-
|
|
|
- if ("10".equals(goods.getGoodsStat())) { // 정보 오류
|
|
|
- this.setGoodsRegResult(goods, goodsMass, procJob);
|
|
|
- return goods.getGoodsStat();
|
|
|
- }
|
|
|
-
|
|
|
// 할인율
|
|
|
goods.setDcRate((int)(this.getDcRate(goods.getListPrice(), goods.getCurrPrice())));
|
|
|
|
|
|
@@ -1171,21 +1147,73 @@ public class TssGoodsService {
|
|
|
|
|
|
goodsMass.setGoodsCd(goods.getGoodsCd());
|
|
|
|
|
|
- this.createGoodsNoti(gagaMap, goodsNotiList); // 상품고시정보 저장
|
|
|
-
|
|
|
- Collection<Option> goodsWmsSizeList = new ArrayList<>();
|
|
|
- // 상품사이즈 정보 -- 재고 정보연동 해야함
|
|
|
- goodsWmsSizeList = goodsDao.getGoodsWmsSizeList(goods);
|
|
|
+ // 상품사이즈 정보
|
|
|
+ Collection<Option> goodsWmsSizeList = goodsDao.getGoodsWmsSizeList(goods);
|
|
|
if (goodsWmsSizeList == null || goodsWmsSizeList.isEmpty()) {
|
|
|
goods.setGoodsRegMsg("WMS 상품 사이즈 정보 없음");
|
|
|
goods.setGoodsStat("G008_20");
|
|
|
+ } else {
|
|
|
+ this.createSelfGoodsSize(goods, goodsWmsSizeList); // 자사 상품사이즈 정보 저장
|
|
|
+ }
|
|
|
+
|
|
|
+ // 상품 색상 , 사이즈 옵션 정보 조회
|
|
|
+ GoodsMass goodsColorSize = goodsDao.getGoodsColorSize(goods);
|
|
|
+ if (goodsColorSize != null && !StringUtils.isBlank(goodsColorSize.getMainColorCd())) {
|
|
|
+ goodsColorSize.setUpdNo(TssSession.getInfo().getUserNo());
|
|
|
+ goodsDao.updateGoodsMainColorCd(goodsColorSize); // 대표색상 설정
|
|
|
+ }
|
|
|
+
|
|
|
+ int index = 0;
|
|
|
+ // 자사 상품 등록시 고시정보 처리
|
|
|
+ for (GoodsNotiInfo goodsNotiInfo : goodsNotiList) {
|
|
|
+ if (!StringUtils.isBlank(gagaMap.getString("niContent" + (index + 1)).trim())) {
|
|
|
+ goodsNotiInfo.setNiContent(gagaMap.getString("niContent" + (index + 1)).trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("G005_003".equals(goodsNotiInfo.getNiItemCd())) { // 색상
|
|
|
+ if (!StringUtils.isBlank(goodsColorSize.getOpt1Str())) {
|
|
|
+ goodsNotiInfo.setNiContent(goodsColorSize.getOpt1Str());
|
|
|
+ }
|
|
|
+ } else if ("G005_004".equals(goodsNotiInfo.getNiItemCd())) { //치수
|
|
|
+ if (!StringUtils.isBlank(goodsColorSize.getOpt2Str())) {
|
|
|
+ goodsNotiInfo.setNiContent(goodsColorSize.getOpt2Str());
|
|
|
+ }
|
|
|
+ } else if ("G005_006".equals(goodsNotiInfo.getNiItemCd())) { //제조국
|
|
|
+ if (!StringUtils.isBlank(goods.getOriginNm())) {
|
|
|
+ goodsNotiInfo.setNiContent(goods.getOriginNm());
|
|
|
+ }
|
|
|
+ } else if ("G005_009".equals(goodsNotiInfo.getNiItemCd())) { //제조년월
|
|
|
+ if (!StringUtils.isBlank(goods.getMakeYmd())) {
|
|
|
+ goodsNotiInfo.setNiContent(goods.getMakeYmd());
|
|
|
+ }
|
|
|
+ } else if ("G005_097".equals(goodsNotiInfo.getNiItemCd())) { //수입여부
|
|
|
+ if (!StringUtils.isBlank(goods.getOriginNm()) &&
|
|
|
+ (goods.getOriginNm().indexOf("대한민국") >= 0 || goods.getOriginNm().indexOf("한국") >= 0 || goods.getOriginNm().toUpperCase().indexOf("KOREA") >= 0)) {
|
|
|
+ goodsNotiInfo.setNiContent("N");
|
|
|
+ } else {
|
|
|
+ goodsNotiInfo.setNiContent("Y");
|
|
|
+ }
|
|
|
+ } else if ("G005_099".equals(goodsNotiInfo.getNiItemCd())) { //종류
|
|
|
+ if (!StringUtils.isBlank(goods.getItemkindNm())) {
|
|
|
+ goodsNotiInfo.setNiContent(goods.getItemkindNm());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ index++;
|
|
|
}
|
|
|
|
|
|
- this.createSelfGoodsSize(goods, goodsWmsSizeList); // 자사 상품사이즈 정보 자장
|
|
|
+ //고시항목 필수값 확인
|
|
|
+ goods = this.getGoodsNotiCheck(goods, goodsNotiList, gagaMap, procJob);
|
|
|
+
|
|
|
+ //고시 필수 항목 미입력으로 상품 상태 변경
|
|
|
+ if ("G008_20".equals(goods.getGoodsStat())) {
|
|
|
+ goodsDao.updateGoodsStatOnly(goods);
|
|
|
+ }
|
|
|
+
|
|
|
+ this.createGoodsNoti(gagaMap, goodsNotiList); // 상품고시정보 저장
|
|
|
|
|
|
// 사용자 검색어를 검색어에 적용
|
|
|
String goodsSnm = goodsDao.getGoodsSnm(goods.getGoodsCd());
|
|
|
- if (!StringUtils.isEmpty(goods.getGoodsSnm1())) {
|
|
|
+ if (!StringUtils.isBlank(goods.getGoodsSnm1())) {
|
|
|
String[] arrGoodsSnm = goods.getGoodsSnm1().split(";");
|
|
|
StringBuilder tempGoodsSnm = new StringBuilder();
|
|
|
for (String loopGoodsSnm : arrGoodsSnm) {
|
|
|
@@ -1220,17 +1248,19 @@ public class TssGoodsService {
|
|
|
private Goods createSelfGoodsInfo(GoodsMass goodsMass, String procJob) {
|
|
|
|
|
|
Goods goods = new Goods();
|
|
|
- goods.setGoodsStat("G008_40"); // 상품상태
|
|
|
- goods.setGoodsRegMsg("승인대기");
|
|
|
+ goods.setGoodsStat("G008_20"); // 상품상태
|
|
|
+ goods.setGoodsRegMsg("이미지 등록 필요");
|
|
|
+ goods.setRegNo(TssSession.getInfo().getUserNo());
|
|
|
+ goods.setUpdNo(TssSession.getInfo().getUserNo());
|
|
|
|
|
|
- // 품번정보 확인 (FRJ 는 11, 그외는 10)
|
|
|
- if (StringUtils.isEmpty(goodsMass.getGoodsNum()) || goodsMass.getGoodsNum().length() < 10 || goodsMass.getGoodsNum().length() > 11) {
|
|
|
+ // 품번정보 확인 (길이 10, FRJ '-' 삭제)
|
|
|
+ if (StringUtils.isBlank(goodsMass.getGoodsNum().trim()) || goodsMass.getGoodsNum().trim().replace("-", "") .length() != 10) {
|
|
|
goods.setGoodsRegMsg("품번코드 오류");
|
|
|
goods.setGoodsStat("10");
|
|
|
return goods;
|
|
|
}
|
|
|
|
|
|
- goods.setGoodsCd(goodsMass.getGoodsNum().toUpperCase()); // 상품코드
|
|
|
+ goods.setGoodsCd(goodsMass.getGoodsNum().trim().toUpperCase()); // 상품코드
|
|
|
|
|
|
// 상품코드 중복여부 확인
|
|
|
Goods goodsDup = goodsDao.getGoods(goods);
|
|
|
@@ -1240,20 +1270,10 @@ public class TssGoodsService {
|
|
|
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(goods);
|
|
|
if (wmsGoodsInfo == null) {
|
|
|
- goods.setGoodsRegMsg("WMS 미존재 상품코드");
|
|
|
+ goods.setGoodsRegMsg("WMS 미존재 품번코드");
|
|
|
goods.setGoodsStat("10");
|
|
|
return goods;
|
|
|
}
|
|
|
@@ -1261,71 +1281,36 @@ public class TssGoodsService {
|
|
|
goods.setProductCode(wmsGoodsInfo.getProductCode());
|
|
|
|
|
|
// 품번코드
|
|
|
- goods.setGoodsNum(goodsMass.getGoodsNum().toUpperCase());
|
|
|
+ goods.setGoodsNum(goodsMass.getGoodsNum().trim().toUpperCase());
|
|
|
// 입점상품코드
|
|
|
- goods.setSupplyGoodsCd(goodsMass.getGoodsNum().toUpperCase());
|
|
|
+ goods.setSupplyGoodsCd(goodsMass.getGoodsNum().trim().toUpperCase());
|
|
|
|
|
|
// 브랜드
|
|
|
- if (StringUtils.isEmpty(goodsMass.getBrandCd())) {
|
|
|
+ if (StringUtils.isBlank(goodsMass.getBrandCd().trim())) {
|
|
|
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); // 업체 코드
|
|
|
-
|
|
|
+ goods.setBrandCd(goodsMass.getBrandCd().trim()); // 브랜드 코드
|
|
|
|
|
|
// 상품명
|
|
|
- if (StringUtils.isEmpty(goodsMass.getGoodsNm())) {
|
|
|
+ if (StringUtils.isBlank(goodsMass.getGoodsNm().trim())) {
|
|
|
goods.setGoodsRegMsg("상품명 오류");
|
|
|
goods.setGoodsStat("10");
|
|
|
return goods;
|
|
|
}
|
|
|
- goods.setGoodsNm(goodsMass.getGoodsNm().replaceAll("(\\r\\n|\\r|\\n|\\n\\r)", ""));
|
|
|
+ goods.setGoodsNm(goodsMass.getGoodsNm().trim().replaceAll("(\\r\\n|\\r|\\n|\\n\\r)", ""));
|
|
|
|
|
|
// 품목코드
|
|
|
- if (StringUtils.isEmpty(goodsMass.getItemkindCd())) {
|
|
|
+ if (StringUtils.isBlank(goodsMass.getItemkindCd().trim())) {
|
|
|
goods.setGoodsRegMsg("품목코드 오류");
|
|
|
goods.setGoodsStat("10");
|
|
|
return goods;
|
|
|
}
|
|
|
- goods.setItemkindCd(goodsMass.getItemkindCd());
|
|
|
+ goods.setItemkindCd(goodsMass.getItemkindCd().trim());
|
|
|
|
|
|
Itemkind itemkind = new Itemkind();
|
|
|
- itemkind.setItemkindCd(goodsMass.getItemkindCd());
|
|
|
+ itemkind.setItemkindCd(goods.getItemkindCd());
|
|
|
itemkind.setUseYn("Y");
|
|
|
Collection<Itemkind> getItemkindList = goodsDao.getItemkindList(itemkind);
|
|
|
if (getItemkindList == null || getItemkindList.size() == 0) {
|
|
|
@@ -1333,22 +1318,23 @@ public class TssGoodsService {
|
|
|
goods.setGoodsStat("10");
|
|
|
return goods;
|
|
|
}
|
|
|
+ goods.setItemkindNm(getItemkindList.iterator().next().getItemkindLeafNm()); //LEAF품목명
|
|
|
|
|
|
// 스타일 년도
|
|
|
- if (StringUtils.isEmpty(goodsMass.getStyleYear()) || goodsMass.getStyleYear().length() != 4 || !goodsMass.getStyleYear().trim().matches(NUMBER_PATTERN)) {
|
|
|
+ if (StringUtils.isBlank(goodsMass.getStyleYear().trim()) || goodsMass.getStyleYear().trim().length() != 4 || !goodsMass.getStyleYear().trim().matches(NUMBER_PATTERN)) {
|
|
|
goods.setGoodsRegMsg("스타일 년도 오류");
|
|
|
goods.setGoodsStat("10");
|
|
|
return goods;
|
|
|
}
|
|
|
- goods.setStyleYear(goodsMass.getStyleYear());
|
|
|
+ goods.setStyleYear(goodsMass.getStyleYear().trim());
|
|
|
|
|
|
// 시즌
|
|
|
- if (StringUtils.isEmpty(goodsMass.getSeasonCd())) {
|
|
|
+ if (StringUtils.isBlank(goodsMass.getSeasonCd().trim())) {
|
|
|
goods.setGoodsRegMsg("시즌 오류");
|
|
|
goods.setGoodsStat("10");
|
|
|
return goods;
|
|
|
}
|
|
|
- goods.setSeasonCd(goodsMass.getSeasonCd()); // 시즌
|
|
|
+ goods.setSeasonCd(goodsMass.getSeasonCd().trim()); // 시즌
|
|
|
|
|
|
CommonCode commonCode = new CommonCode();
|
|
|
commonCode.setUseYn("Y");
|
|
|
@@ -1362,12 +1348,12 @@ public class TssGoodsService {
|
|
|
}
|
|
|
|
|
|
// 성별
|
|
|
- if (StringUtils.isEmpty(goodsMass.getSexGb())) {
|
|
|
+ if (StringUtils.isBlank(goodsMass.getSexGb().trim())) {
|
|
|
goods.setGoodsRegMsg("성별 오류");
|
|
|
goods.setGoodsStat("10");
|
|
|
return goods;
|
|
|
}
|
|
|
- goods.setSexGb(goodsMass.getSexGb()); // 성별
|
|
|
+ goods.setSexGb(goodsMass.getSexGb().trim()); // 성별
|
|
|
commonCode.setCdGb("G007"); // 성별
|
|
|
commonCode.setCd(goods.getSexGb());
|
|
|
Collection<CommonCode> sexGbList = rendererService.getCommonCodeList(commonCode);
|
|
|
@@ -1378,31 +1364,31 @@ public class TssGoodsService {
|
|
|
}
|
|
|
|
|
|
// 정상가
|
|
|
- if (StringUtils.isEmpty(goodsMass.getListPrice())) {
|
|
|
+ if (StringUtils.isBlank(goodsMass.getListPrice().trim())) {
|
|
|
goods.setGoodsRegMsg("정상가 오류");
|
|
|
goods.setGoodsStat("10");
|
|
|
return goods;
|
|
|
}
|
|
|
- if (!GagaStringUtil.replace(goodsMass.getListPrice(), ",", "").trim().matches(NUMBER_PATTERN)) {
|
|
|
+ if (!GagaStringUtil.replace(goodsMass.getListPrice().trim(), ",", "").trim().matches(NUMBER_PATTERN)) {
|
|
|
goods.setGoodsRegMsg("정상가 오류");
|
|
|
goods.setGoodsStat("10");
|
|
|
return goods;
|
|
|
}
|
|
|
|
|
|
// 판매가
|
|
|
- if (StringUtils.isEmpty(goodsMass.getCurrPrice())) {
|
|
|
+ if (StringUtils.isBlank(goodsMass.getCurrPrice().trim())) {
|
|
|
goods.setGoodsRegMsg("판매가 오류");
|
|
|
goods.setGoodsStat("10");
|
|
|
return goods;
|
|
|
}
|
|
|
- if (!GagaStringUtil.replace(goodsMass.getCurrPrice(), ",", "").trim().matches(NUMBER_PATTERN)) {
|
|
|
+ if (!GagaStringUtil.replace(goodsMass.getCurrPrice().trim(), ",", "").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());
|
|
|
+ int listPrice = Integer.parseInt(GagaStringUtil.replace(goodsMass.getListPrice().trim(), ",", ""));
|
|
|
+ int currPrice = Integer.parseInt(GagaStringUtil.replace(goodsMass.getCurrPrice().trim(), ",", ""));
|
|
|
|
|
|
if (currPrice > listPrice) {
|
|
|
goods.setGoodsRegMsg("판매가 오류");
|
|
|
@@ -1418,31 +1404,31 @@ public class TssGoodsService {
|
|
|
// 원가
|
|
|
// FRJ 필수 확인
|
|
|
if ("S006".equals(goods.getBrandCd())) {
|
|
|
- if (StringUtils.isEmpty(goodsMass.getCostPrice())) {
|
|
|
+ if (StringUtils.isBlank(goodsMass.getCostPrice().trim())) {
|
|
|
goods.setGoodsRegMsg("원가 오류");
|
|
|
goods.setGoodsStat("10");
|
|
|
return goods;
|
|
|
}
|
|
|
- if (!GagaStringUtil.replace(goodsMass.getCostPrice(), ",", "").trim().matches(NUMBER_PATTERN)) {
|
|
|
+ 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());
|
|
|
+ int costPrice = Integer.parseInt(GagaStringUtil.replace(goodsMass.getCostPrice().trim(), ",", ""));
|
|
|
// 원가
|
|
|
goods.setCostPrice(costPrice);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
goods.setCostPrice(0);
|
|
|
}
|
|
|
|
|
|
// 정상이월
|
|
|
- if (StringUtils.isEmpty(goodsMass.getSexGb())) {
|
|
|
- goods.setGoodsRegMsg("성별 오류");
|
|
|
+ if (StringUtils.isBlank(goodsMass.getFormalGb().trim())) {
|
|
|
+ goods.setGoodsRegMsg("정상이월 오류");
|
|
|
goods.setGoodsStat("10");
|
|
|
return goods;
|
|
|
}
|
|
|
- goods.setFormalGb(goodsMass.getFormalGb());
|
|
|
- commonCode.setCdGb("G009"); // 정상이월구분
|
|
|
+ goods.setFormalGb(goodsMass.getFormalGb().trim());
|
|
|
+ commonCode.setCdGb("G009"); //정상이월
|
|
|
commonCode.setCd(goods.getFormalGb());
|
|
|
Collection<CommonCode> formalGbList = rendererService.getCommonCodeList(commonCode);
|
|
|
if (formalGbList == null || formalGbList.isEmpty()) {
|
|
|
@@ -1451,15 +1437,50 @@ public class TssGoodsService {
|
|
|
return goods;
|
|
|
}
|
|
|
|
|
|
+ // 브랜드 확인
|
|
|
+ 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 = 0f;
|
|
|
+ float pntMrate = 0f;
|
|
|
+ float sellFeeRate = 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.getOriginCd())) {
|
|
|
+ if (StringUtils.isBlank(goodsMass.getOriginCd().trim())) {
|
|
|
goods.setGoodsRegMsg("원산지 오류");
|
|
|
goods.setGoodsStat("10");
|
|
|
return goods;
|
|
|
}
|
|
|
- goods.setOriginCd(goodsMass.getOriginCd());
|
|
|
+ goods.setOriginCd(goodsMass.getOriginCd().trim());
|
|
|
commonCode.setCdGb("G076"); // 원산지
|
|
|
- commonCode.setCd(goods.getFormalGb());
|
|
|
+ commonCode.setCd(goods.getOriginCd());
|
|
|
Collection<CommonCode> originCdList = rendererService.getCommonCodeList(commonCode);
|
|
|
if (originCdList == null || originCdList.isEmpty()) {
|
|
|
goods.setGoodsRegMsg("원산지 오류");
|
|
|
@@ -1469,17 +1490,17 @@ public class TssGoodsService {
|
|
|
goods.setOriginNm(originCdList.iterator().next().getCdNm()); //고시정보 적용용
|
|
|
|
|
|
// 제조년월
|
|
|
- if (StringUtils.isEmpty(goodsMass.getMakeYmd())) {
|
|
|
+ if (StringUtils.isBlank(goodsMass.getMakeYmd().trim())) {
|
|
|
goods.setGoodsRegMsg("제조년월일 오류");
|
|
|
goods.setGoodsStat("10");
|
|
|
return goods;
|
|
|
}
|
|
|
- goods.setMakeYmd(goodsMass.getMakeYmd());
|
|
|
+ goods.setMakeYmd(goodsMass.getMakeYmd().trim());
|
|
|
|
|
|
SimpleDateFormat dateFormatParser = new SimpleDateFormat("yyyyMMdd");
|
|
|
dateFormatParser.setLenient(false);
|
|
|
try {
|
|
|
- dateFormatParser.parse(goodsMass.getMakeYmd());
|
|
|
+ dateFormatParser.parse(goods.getMakeYmd());
|
|
|
} catch (Exception e) {
|
|
|
goods.setGoodsRegMsg("제조년월일 오류");
|
|
|
goods.setGoodsStat("10");
|
|
|
@@ -1493,13 +1514,11 @@ public class TssGoodsService {
|
|
|
if ("S006".equals(goods.getBrandCd())) { //frj 사입처리
|
|
|
goods.setDistributionGb("G065_11"); //자사 - 사입
|
|
|
}
|
|
|
+ goods.setTaxGb("10"); // 과세구분 10: 과세, 20:비과세
|
|
|
goods.setSelfGoodsYn("Y"); // 자사상품여부
|
|
|
goods.setSelfMallYn("Y"); //자사몰 노출여부
|
|
|
goods.setErpStockLinkYn("Y"); // ERP재고연동여부
|
|
|
|
|
|
- goods.setRegNo(TssSession.getInfo().getUserNo());
|
|
|
- goods.setUpdNo(TssSession.getInfo().getUserNo());
|
|
|
-
|
|
|
return goods;
|
|
|
}
|
|
|
|
|
|
@@ -1517,19 +1536,19 @@ public class TssGoodsService {
|
|
|
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 (StringUtils.isEmpty(goodsMass.getCostPrice())) {
|
|
|
- goodsMass.setCostPrice("0");
|
|
|
- }
|
|
|
- if ("10".equals(goods.getGoodsStat())) {
|
|
|
- goodsMass.setRegSuccYn("N");
|
|
|
- }
|
|
|
+ //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");
|
|
|
@@ -1547,21 +1566,20 @@ public class TssGoodsService {
|
|
|
* @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("고시항목 오류");
|
|
|
+ if ("Y".equals(goodsNotiInfo.getReqYn()) && StringUtils.isBlank(goodsNotiInfo.getNiContent())) {
|
|
|
+ goods.setGoodsRegMsg("고시항목 필수 항목 오류");
|
|
|
goods.setGoodsStat("G008_20");
|
|
|
return goods;
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
for (GoodsNotiInfo goodsNotiInfo : goodsNotiList) {
|
|
|
- if ("Y".equals(goodsNotiInfo.getReqYn()) && StringUtils.isEmpty(excelMap.getString("niContent" + (index + 1)))) {
|
|
|
+ if ("Y".equals(goodsNotiInfo.getReqYn()) && StringUtils.isBlank(excelMap.getString("niContent" + (index + 1)).trim())) {
|
|
|
goods.setGoodsRegMsg("고시정보 없음 (" + (index + 1) + "번째 항목) - " + goodsNotiInfo.getNiItemCd() + "(" + goodsNotiInfo.getNiItemNm() + ")");
|
|
|
goods.setGoodsStat("10");
|
|
|
return goods;
|
|
|
@@ -1579,7 +1597,7 @@ public class TssGoodsService {
|
|
|
*
|
|
|
* @param goods
|
|
|
* @param excelMap
|
|
|
- * @return TsaGoods
|
|
|
+ * @return Goods
|
|
|
* @author eskim
|
|
|
* @since 2021. 01. 12
|
|
|
*/
|
|
|
@@ -1588,10 +1606,10 @@ public class TssGoodsService {
|
|
|
int index = 0;
|
|
|
for (GoodsNotiInfo goodsNotiInfo : goodsNotiList) {
|
|
|
|
|
|
- if (StringUtils.isEmpty(excelMap.getString("niContent" + (index + 1)))) {
|
|
|
+ if (StringUtils.isBlank(excelMap.getString("niContent" + (index + 1)).trim())) {
|
|
|
goodsNotiInfo.setNiContent(goodsNotiInfo.getNiContent());
|
|
|
} else {
|
|
|
- goodsNotiInfo.setNiContent(excelMap.getString("niContent" + (index + 1)));
|
|
|
+ goodsNotiInfo.setNiContent(excelMap.getString("niContent" + (index + 1)).trim());
|
|
|
}
|
|
|
goodsNotiInfo.setRegNo(TssSession.getInfo().getUserNo());
|
|
|
goodsNotiInfo.setUpdNo(TssSession.getInfo().getUserNo());
|
|
|
@@ -1605,7 +1623,7 @@ public class TssGoodsService {
|
|
|
*
|
|
|
* @param goods
|
|
|
* @param excelMap
|
|
|
- * @return TsaGoods
|
|
|
+ * @return Goods
|
|
|
* @author eskim
|
|
|
* @since 2021. 01. 13
|
|
|
*/
|
|
|
@@ -1623,4 +1641,1390 @@ public class TssGoodsService {
|
|
|
index++;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품대량등록 엑셀 저장 - 입점상품
|
|
|
+ *
|
|
|
+ * @param ecxelGoodsList, excelFilename, procJob(자사:createSelfGoods, 입점:createGoods)
|
|
|
+ * @return
|
|
|
+ * @author eskim
|
|
|
+ * @since 2021. 01. 19
|
|
|
+ */
|
|
|
+ @Transactional("shopTxnManager")
|
|
|
+ public String createExceluploadGoods(GagaMap gagaMap, String procJob) {
|
|
|
+
|
|
|
+ GoodsMass goodsMass = mapper.convertValue(gagaMap, GoodsMass.class);
|
|
|
+
|
|
|
+ // 상품기본정보
|
|
|
+ Goods goods = this.createGoodsInfo(goodsMass, procJob);
|
|
|
+
|
|
|
+ if ("10".equals(goods.getGoodsStat())) { // 정보 오류
|
|
|
+ this.setGoodsRegResult(goods, goodsMass, procJob);
|
|
|
+ return goods.getGoodsStat(); //continue
|
|
|
+ }
|
|
|
+
|
|
|
+ //상품코드 생성
|
|
|
+ goods.setGoodsCd(this.getGoodsCodeSeq("E", goods.getBrandCd())); // 입점상품 상품코드 생성
|
|
|
+
|
|
|
+ // 상품고시정보 - 항목및 기본값
|
|
|
+ Collection<GoodsNotiInfo> goodsNotiList = goodsDao.getItemkindNotiInfoList(goods);
|
|
|
+ if (goodsNotiList == null || goodsNotiList.isEmpty()) {
|
|
|
+ goods.setGoodsRegMsg("품목의 고시정보 없음");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ this.setGoodsRegResult(goods, goodsMass, procJob);
|
|
|
+ return goods.getGoodsStat();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 할인율
|
|
|
+ goods.setDcRate((int)(this.getDcRate(goods.getListPrice(), goods.getCurrPrice())));
|
|
|
+
|
|
|
+ Collection<Option> stockList = new ArrayList<>();
|
|
|
+ // 입점상품 사이즈 작업
|
|
|
+ if (StringUtils.isBlank(goodsMass.getOptStr())) {
|
|
|
+ goods.setGoodsRegMsg("옵션 정보 없음");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ this.setGoodsRegResult(goods, goodsMass, procJob);
|
|
|
+ return goods.getGoodsStat();
|
|
|
+ }
|
|
|
+
|
|
|
+ //옵션1[필수]^옵션2[선택]^추가금액^안전재고[필수]^판매재고[필수] |
|
|
|
+ //검정^90^0^0^10|검정^95^0^0^8|검정^100^0^0^5|파랑^90^0^0^15|파랑^95^0^0^5|파랑^100^0^0^1|파랑^105^0^0^7
|
|
|
+
|
|
|
+ String[] arrSizeCd = GagaStringUtil.cutTokenToArray(goodsMass.getOptStr().trim(), "|");
|
|
|
+ for (int i = 0; i < arrSizeCd.length; i++) {
|
|
|
+ String[] arrOptCd = GagaStringUtil.cutTokenToArray(arrSizeCd[i], "^");
|
|
|
+ if (arrOptCd.length != 5 ) {
|
|
|
+ goods.setGoodsRegMsg("옵션(SKU) " + (i+1)+ "번째 옵션구분자[^] 갯수 상이");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 옵션1 - 필수
|
|
|
+ if (StringUtils.isBlank(arrOptCd[0])) {
|
|
|
+ goods.setGoodsRegMsg("옵션(SKU) " + (i+1)+ "번째 옵션1 정보없음");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ // 추가금액 - 필수
|
|
|
+ if (StringUtils.isBlank(arrOptCd[2])) {
|
|
|
+ goods.setGoodsRegMsg("옵션(SKU) " + (i+1)+ "번째 추가금액 정보없음");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (!arrOptCd[2].trim().matches(NUMBER_PATTERN)) {
|
|
|
+ goods.setGoodsRegMsg("옵션(SKU) " + (i+1)+ "번째 추가금액 숫자 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ // 안전재고 - 필수
|
|
|
+ if (StringUtils.isBlank(arrOptCd[3])) {
|
|
|
+ goods.setGoodsRegMsg("옵션(SKU) " + (i+1)+ "번째 안전재고 정보없음");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (!arrOptCd[3].trim().matches(NUMBER_PATTERN)) {
|
|
|
+ goods.setGoodsRegMsg("옵션(SKU) " + (i+1)+ "번째 안전재고 숫자 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ // 판매재고 - 필수
|
|
|
+ if (StringUtils.isBlank(arrOptCd[4])) {
|
|
|
+ goods.setGoodsRegMsg("옵션(SKU) " + (i+1)+ "번째 판매재고 정보없음");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (!arrOptCd[4].trim().matches(NUMBER_PATTERN)) {
|
|
|
+ goods.setGoodsRegMsg("옵션(SKU) " + (i+1)+ "번째 판매재고 숫자 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ Option goodsStock = new Option();
|
|
|
+ goodsStock.setGoodsCd(goods.getGoodsCd());
|
|
|
+ goodsStock.setOptCd(goods.getGoodsCd() + "-" + (i+1));
|
|
|
+ goodsStock.setOptCd1(arrOptCd[0].trim());
|
|
|
+ goodsStock.setOptCd2(arrOptCd[1].trim());
|
|
|
+ goodsStock.setAddPrice(Integer.parseInt(arrOptCd[2]));
|
|
|
+ goodsStock.setBaseStockQty(Integer.parseInt(arrOptCd[3]));
|
|
|
+ goodsStock.setCurrStockQty(Integer.parseInt(arrOptCd[4]));
|
|
|
+ goodsStock.setSoldoutYn("N");
|
|
|
+ goodsStock.setDispOrd(i + 1);
|
|
|
+ goodsStock.setDispYn("Y");
|
|
|
+ goodsStock.setRegNo(goods.getRegNo());
|
|
|
+ goodsStock.setUpdNo(goods.getUpdNo());
|
|
|
+
|
|
|
+ stockList.add(goodsStock);
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("10".equals(goods.getGoodsStat())) { // 정보 오류
|
|
|
+ this.setGoodsRegResult(goods, goodsMass, procJob);
|
|
|
+ return goods.getGoodsStat(); //continue
|
|
|
+ }
|
|
|
+
|
|
|
+ // 상품상세 확인
|
|
|
+ if (!StringUtils.isBlank(goodsMass.getGoodsContent())) {
|
|
|
+ if (goodsMass.getGoodsContent().toLowerCase().indexOf("script") >= 0 ) {
|
|
|
+ goods.setGoodsRegMsg("상품상세 html script 선언 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ this.setGoodsRegResult(goods, goodsMass, procJob);
|
|
|
+ return goods.getGoodsStat();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ goodsDao.createGoods(goods); // 상품기본 저장
|
|
|
+ goodsDao.createGoodsSmmary(goods); // 상품통계 생성
|
|
|
+
|
|
|
+ this.createGoodsSize(goods, stockList); // 입점 상품사이즈 정보 자장
|
|
|
+
|
|
|
+ goodsMass.setGoodsCd(goods.getGoodsCd());
|
|
|
+
|
|
|
+ int index = 0;
|
|
|
+ // 상품 등록시 고시정보 처리
|
|
|
+ for (GoodsNotiInfo goodsNotiInfo : goodsNotiList) {
|
|
|
+ if (!StringUtils.isBlank(gagaMap.getString("niContent" + (index + 1)))) {
|
|
|
+ goodsNotiInfo.setNiContent(gagaMap.getString("niContent" + (index + 1)));
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("G005_006".equals(goodsNotiInfo.getNiItemCd())) { //제조국
|
|
|
+ if (!StringUtils.isBlank(goods.getOriginNm())) {
|
|
|
+ goodsNotiInfo.setNiContent(goods.getOriginNm());
|
|
|
+ }
|
|
|
+ } else if ("G005_009".equals(goodsNotiInfo.getNiItemCd())) { //제조년월
|
|
|
+ if (!StringUtils.isBlank(goods.getMakeYmd())) {
|
|
|
+ goodsNotiInfo.setNiContent(goods.getMakeYmd());
|
|
|
+ }
|
|
|
+ } else if ("G005_097".equals(goodsNotiInfo.getNiItemCd())) { //수입여부
|
|
|
+ if (!StringUtils.isBlank(goods.getOriginNm()) &&
|
|
|
+ (goods.getOriginNm().indexOf("대한민국") >= 0 || goods.getOriginNm().indexOf("한국") >= 0 || goods.getOriginNm().toUpperCase().indexOf("KOREA") >= 0)) {
|
|
|
+ goodsNotiInfo.setNiContent("N");
|
|
|
+ } else {
|
|
|
+ goodsNotiInfo.setNiContent("Y");
|
|
|
+ }
|
|
|
+ } else if ("G005_099".equals(goodsNotiInfo.getNiItemCd())) { //종류
|
|
|
+ if (!StringUtils.isBlank(goods.getItemkindNm())) {
|
|
|
+ goodsNotiInfo.setNiContent(goods.getItemkindNm());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+
|
|
|
+ //고시항목 필수값 확인
|
|
|
+ goods = this.getGoodsNotiCheck(goods, goodsNotiList, gagaMap, procJob);
|
|
|
+
|
|
|
+ //고시 필수 항목 미입력으로 상품 상태 변경
|
|
|
+ if ("G008_20".equals(goods.getGoodsStat())) {
|
|
|
+ goodsDao.updateGoodsStatOnly(goods);
|
|
|
+ }
|
|
|
+
|
|
|
+ this.createGoodsNoti(gagaMap, goodsNotiList); // 상품고시정보 저장
|
|
|
+
|
|
|
+ // 상품상세(입점)
|
|
|
+ if (!StringUtils.isBlank(goodsMass.getGoodsContent().trim())) {
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 사용자 검색어를 검색어에 적용
|
|
|
+ String goodsSnm = goodsDao.getGoodsSnm(goods.getGoodsCd());
|
|
|
+ if (!StringUtils.isBlank(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);
|
|
|
+
|
|
|
+ return goods.getGoodsStat();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품등록 - 상품기본정보 - 입점상품
|
|
|
+ *
|
|
|
+ * @param goodsMass
|
|
|
+ * @param excelFilename
|
|
|
+ * @author eskim
|
|
|
+ * @since 2021. 01. 19
|
|
|
+ */
|
|
|
+ private Goods createGoodsInfo(GoodsMass goodsMass, String procJob) {
|
|
|
+
|
|
|
+ Goods goods = new Goods();
|
|
|
+ goods.setGoodsStat("G008_20"); // 상품상태
|
|
|
+ goods.setGoodsRegMsg("이미지 등록 필요");
|
|
|
+ goods.setRegNo(TssSession.getInfo().getUserNo());
|
|
|
+ goods.setUpdNo(TssSession.getInfo().getUserNo());
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(goodsMass.getSupplyGoodsCd().trim())) {
|
|
|
+ goods.setGoodsRegMsg("공급업체 상품코드 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setSupplyGoodsCd(goodsMass.getSupplyGoodsCd().trim());
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(goodsMass.getSupplyCompCd().trim())) {
|
|
|
+ goods.setGoodsRegMsg("공급업체 코드 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setSupplyCompCd(goodsMass.getSupplyCompCd().trim());
|
|
|
+
|
|
|
+ // 상품코드 중복여부 확인 - 입점업체코드+입점상품코드
|
|
|
+ Goods goodsDup = goodsDao.getGoods(goods);
|
|
|
+ if (goodsDup != null) {
|
|
|
+ goods.setGoodsRegMsg("상품코드 중복등록요청");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 브랜드
|
|
|
+ if (StringUtils.isBlank(goodsMass.getBrandCd().trim())) {
|
|
|
+ goods.setGoodsRegMsg("브랜드코드 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setBrandCd(goodsMass.getBrandCd().trim()); // 브랜드 코드
|
|
|
+
|
|
|
+
|
|
|
+ // 상품명
|
|
|
+ if (StringUtils.isBlank(goodsMass.getGoodsNm().trim())) {
|
|
|
+ goods.setGoodsRegMsg("상품명 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setGoodsNm(goodsMass.getGoodsNm().trim().replaceAll("(\\r\\n|\\r|\\n|\\n\\r)", ""));
|
|
|
+
|
|
|
+ if (!StringUtils.isBlank(goodsMass.getGoodsTnm())) {
|
|
|
+ goods.setGoodsTnm(goodsMass.getGoodsTnm().trim().replaceAll("(\\r\\n|\\r|\\n|\\n\\r)", "")); // 상품 타이틀
|
|
|
+ }
|
|
|
+ if (!StringUtils.isBlank(goodsMass.getGoodsSnm1())) {
|
|
|
+ goods.setGoodsSnm1(goodsMass.getGoodsSnm1().trim().replaceAll("(\\r\\n|\\r|\\n|\\n\\r|\\s)", "")); // 상품 사용자 검색어
|
|
|
+ }
|
|
|
+
|
|
|
+ // 품목코드
|
|
|
+ if (StringUtils.isBlank(goodsMass.getItemkindCd().trim())) {
|
|
|
+ goods.setGoodsRegMsg("품목코드 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setItemkindCd(goodsMass.getItemkindCd().trim());
|
|
|
+
|
|
|
+ Itemkind itemkind = new Itemkind();
|
|
|
+ itemkind.setItemkindCd(goods.getItemkindCd());
|
|
|
+ itemkind.setUseYn("Y");
|
|
|
+ Collection<Itemkind> getItemkindList = goodsDao.getItemkindList(itemkind);
|
|
|
+ if (getItemkindList == null || getItemkindList.size() == 0) {
|
|
|
+ goods.setGoodsRegMsg("품목코드 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setItemkindNm(getItemkindList.iterator().next().getItemkindLeafNm()); //LEAF품목명
|
|
|
+
|
|
|
+ // 스타일 년도
|
|
|
+ if (StringUtils.isBlank(goodsMass.getStyleYear().trim()) || goodsMass.getStyleYear().trim().length() != 4 || !goodsMass.getStyleYear().trim().matches(NUMBER_PATTERN)) {
|
|
|
+ goods.setGoodsRegMsg("스타일 년도 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setStyleYear(goodsMass.getStyleYear().trim());
|
|
|
+
|
|
|
+ // 시즌
|
|
|
+ if (StringUtils.isBlank(goodsMass.getSeasonCd().trim())) {
|
|
|
+ goods.setGoodsRegMsg("시즌 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setSeasonCd(goodsMass.getSeasonCd().trim()); // 시즌
|
|
|
+
|
|
|
+ CommonCode commonCode = new CommonCode();
|
|
|
+ commonCode.setUseYn("Y");
|
|
|
+ commonCode.setCdGb("G006"); // 시즌
|
|
|
+ commonCode.setCd(goods.getSeasonCd());
|
|
|
+ Collection<CommonCode> styleYearList = rendererService.getCommonCodeList(commonCode);
|
|
|
+ if (styleYearList == null || styleYearList.isEmpty()) {
|
|
|
+ goods.setGoodsRegMsg("시즌 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 성별
|
|
|
+ if (StringUtils.isBlank(goodsMass.getSexGb().trim())) {
|
|
|
+ goods.setGoodsRegMsg("성별 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setSexGb(goodsMass.getSexGb().trim()); // 성별
|
|
|
+ commonCode.setCdGb("G007"); // 성별
|
|
|
+ commonCode.setCd(goods.getSexGb());
|
|
|
+ Collection<CommonCode> sexGbList = rendererService.getCommonCodeList(commonCode);
|
|
|
+ if (sexGbList == null || sexGbList.isEmpty()) {
|
|
|
+ goods.setGoodsRegMsg("성별 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 정상가
|
|
|
+ if (StringUtils.isBlank(goodsMass.getListPrice().trim())) {
|
|
|
+ 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.isBlank(goodsMass.getCurrPrice().trim())) {
|
|
|
+ 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);
|
|
|
+ // 원가
|
|
|
+ goods.setCostPrice(0);
|
|
|
+
|
|
|
+ // 상품구분
|
|
|
+ if (StringUtils.isBlank(goodsMass.getGoodsGb().trim())) {
|
|
|
+ goods.setGoodsRegMsg("상품구분 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setGoodsGb(goodsMass.getGoodsGb().trim());
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 정상이월
|
|
|
+ if (StringUtils.isBlank(goodsMass.getFormalGb().trim())) {
|
|
|
+ goods.setGoodsRegMsg("정상이월 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setFormalGb(goodsMass.getFormalGb().trim());
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 브랜드 확인
|
|
|
+ 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 = 0f;
|
|
|
+ float pntMrate = 0f;
|
|
|
+ float sellFeeRate = 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.isBlank(goodsMass.getOriginCd().trim())) {
|
|
|
+ goods.setGoodsRegMsg("원산지 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setOriginCd(goodsMass.getOriginCd().trim());
|
|
|
+
|
|
|
+ commonCode.setCdGb("G076"); // 원산지
|
|
|
+ commonCode.setCd(goods.getOriginCd());
|
|
|
+ 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.isBlank(goodsMass.getTaxGb().trim())) {
|
|
|
+ goods.setGoodsRegMsg("과세구분 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setTaxGb(goodsMass.getTaxGb().trim());
|
|
|
+ if (!"10".equals(goods.getTaxGb()) && !"20".equals(goods.getTaxGb())) {
|
|
|
+ goods.setGoodsRegMsg("과세구분 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+
|
|
|
+ //상품연령
|
|
|
+ if (!StringUtils.isBlank(goodsMass.getAgeGrpCd().trim())) {
|
|
|
+ goods.setAgeGrpCd(goodsMass.getAgeGrpCd().trim());
|
|
|
+
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //성인용품여부
|
|
|
+ if (StringUtils.isBlank(goodsMass.getAdultYn().trim())) {
|
|
|
+ goods.setGoodsRegMsg("성인용품여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setAdultYn(goodsMass.getAdultYn().trim());
|
|
|
+ if (!"Y".equals(goods.getAdultYn()) && !"N".equals(goods.getAdultYn())) {
|
|
|
+ goods.setGoodsRegMsg("성인용품여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 제조년월
|
|
|
+ if (StringUtils.isBlank(goodsMass.getMakeYmd().trim())) {
|
|
|
+ goods.setGoodsRegMsg("제조년월일 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setMakeYmd(goodsMass.getMakeYmd().trim());
|
|
|
+
|
|
|
+ SimpleDateFormat dateFormatParser = new SimpleDateFormat("yyyyMMdd");
|
|
|
+ dateFormatParser.setLenient(false);
|
|
|
+ try {
|
|
|
+ dateFormatParser.parse(goods.getMakeYmd());
|
|
|
+ } catch (Exception e) {
|
|
|
+ goods.setGoodsRegMsg("제조년월일 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+
|
|
|
+ goods.setGoodsType("G056_N"); //상품타입
|
|
|
+ goods.setDistributionGb("G065_20"); //유통구분
|
|
|
+ goods.setSelfGoodsYn("N"); // 자사상품여부
|
|
|
+ goods.setSelfMallYn("Y"); //자사몰 노출여부
|
|
|
+ goods.setErpStockLinkYn("N"); // ERP재고연동여부
|
|
|
+
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품 코드 생성
|
|
|
+ *
|
|
|
+ * @param goodsType - 상품타입
|
|
|
+ * @param goodsCdAfter - 상품시퀀스 앞에 붙는명
|
|
|
+ * @return
|
|
|
+ * @author eskim
|
|
|
+ * @since 2020. 10. 30
|
|
|
+ */
|
|
|
+ public String getGoodsCodeSeq(String goodsType, String goodsCdAfter) {
|
|
|
+
|
|
|
+ //상품코드 12자리
|
|
|
+ String goodsCd = "";
|
|
|
+ Goods goods = new Goods();
|
|
|
+ goodsDao.createGoodsSequence(goods);
|
|
|
+ String goodsSeq = GagaStringUtil.getLPadding(Integer.toString(goods.getGoodsSq()), 8, "0");
|
|
|
+ if ("S".equals(goodsType) || "D".equals(goodsType)) {
|
|
|
+ goodsCd = SELF_GOOODS_AFTER + goodsCdAfter + goodsSeq;
|
|
|
+
|
|
|
+ } else {
|
|
|
+ goodsCd = goodsCdAfter + goodsSeq; // 입점 : 브랜드코드
|
|
|
+ }
|
|
|
+ return goodsCd;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품등록 - 상품재고정보 (입점)
|
|
|
+ *
|
|
|
+ * @param goods
|
|
|
+ * @param excelMap
|
|
|
+ * @return Goods
|
|
|
+ * @author eskim
|
|
|
+ * @since 2021. 01. 19
|
|
|
+ */
|
|
|
+ private void createGoodsSize(Goods goods, Collection<Option> stockist) {
|
|
|
+
|
|
|
+ for (Option stock : stockist) {
|
|
|
+ goodsDao.saveStock(stock);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품대량수정 엑셀 저장
|
|
|
+ *
|
|
|
+ * @param ecxelGoodsList, procJob(updateGoods)
|
|
|
+ * @return
|
|
|
+ * @author eskim
|
|
|
+ * @since 2021. 01. 20
|
|
|
+ */
|
|
|
+ @Transactional("shopTxnManager")
|
|
|
+ public String updateMassExceluploadGoods(GagaMap gagaMap, String procJob) {
|
|
|
+
|
|
|
+ // 사용자의 관리 브랜드 조회
|
|
|
+ Collection<CommonCode> mdBrandList = rendererService.getAuthBrandList(TssSession.getInfo().getUserNo());
|
|
|
+
|
|
|
+ GoodsMass goodsMass = mapper.convertValue(gagaMap, GoodsMass.class);
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(goodsMass.getGoodsCd().trim())) {
|
|
|
+ throw new IllegalStateException("상품코드가 없습니다.");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 상품기본정보
|
|
|
+ Goods goodsData = new Goods();
|
|
|
+ goodsData.setGoodsCd(goodsMass.getGoodsCd().trim());
|
|
|
+ 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, mdBrandList, goodsOrigin);
|
|
|
+
|
|
|
+ if ("10".equals(goods.getGoodsStat())) { // 정보 오류
|
|
|
+ this.setGoodsRegResult(goods, goodsMass, procJob);
|
|
|
+ return goods.getGoodsStat();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 상품 고시
|
|
|
+ goods = this.getUpdateMassGoodsNotiCheck(goods, gagaMap, goodsOrigin);
|
|
|
+ if ("10".equals(goods.getGoodsStat())) { // 정보 오류
|
|
|
+ this.setGoodsRegResult(goods, goodsMass, procJob);
|
|
|
+ return goods.getGoodsStat();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 상품상세 수정
|
|
|
+
|
|
|
+ //log.info("[updateMassExceluploadGoods] goods={}", goods);
|
|
|
+ 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(TssSession.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.getChNotiYn())) {
|
|
|
+ this.updateGoodsNoti(goods, gagaMap, goodsOrigin); // 상품고시정보 저장
|
|
|
+ }
|
|
|
+
|
|
|
+ // 품목변경시 카테고리 자동 전시
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goods.getItemkindCd())) {
|
|
|
+ GoodsCategory goodsCategory = new GoodsCategory();
|
|
|
+ goodsCategory.setRegNo(TssSession.getInfo().getUserNo());
|
|
|
+ goodsCategory.setUpdNo(TssSession.getInfo().getUserNo());
|
|
|
+ goodsCategory.setGoodsCd(goods.getGoodsCd());
|
|
|
+ // displayService.deleteGoodsCategory(goodsCategory);
|
|
|
+ // goodsDao.createGoodsCategory(goods);
|
|
|
+ this.saveGoodsCategory(goods);
|
|
|
+ }
|
|
|
+
|
|
|
+ this.setGoodsRegResult(goods, goodsMass, procJob);
|
|
|
+
|
|
|
+ return goods.getGoodsStat();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품대량수정 - 상품기본정보
|
|
|
+ *
|
|
|
+ * @param goodsMass
|
|
|
+ * @param excelFilename
|
|
|
+ * @author eskim
|
|
|
+ * @since 2021. 1. 20
|
|
|
+ */
|
|
|
+ private Goods updateMassGoodsInfo(GoodsMass goodsMass, String procJob, Collection<CommonCode> mdBrandList, Goods goodsOrigin) {
|
|
|
+
|
|
|
+ Goods goods = new Goods();
|
|
|
+ goods.setChDataYn("N"); // 데이터 변경여부
|
|
|
+ goods.setGoodsRegMsg("상품정보 변경");
|
|
|
+ goods.setRegNo(TssSession.getInfo().getUserNo());
|
|
|
+ goods.setUpdNo(TssSession.getInfo().getUserNo());
|
|
|
+
|
|
|
+ goods.setGoodsCd(goodsMass.getGoodsCd().toUpperCase().trim()); // 상품코드
|
|
|
+
|
|
|
+ //촬영업체 skip(상품정보 수정할수 없음)
|
|
|
+ if ("G001_E000".equals(TssSession.getInfo().getRoleCd())) {
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 입점담당자 해당 브랜드 체크
|
|
|
+ if ("G001_B000".equals(TssSession.getInfo().getRoleCd())) {
|
|
|
+ // 해당MD 조회
|
|
|
+ if (mdBrandList == null || mdBrandList.isEmpty()) {
|
|
|
+ goods.setGoodsRegMsg("미관리 브랜드");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ boolean mdBrandFlag = false;
|
|
|
+ for (CommonCode commonCode : mdBrandList) {
|
|
|
+ if (goodsOrigin.getBrandCd().equals(commonCode.getCd())) {
|
|
|
+ mdBrandFlag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!mdBrandFlag) {
|
|
|
+ goods.setGoodsRegMsg("미관리 브랜드");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(goodsMass.getGoodsNm().trim())) {
|
|
|
+ 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().trim())) {
|
|
|
+ goods.setGoodsRegMsg("품목코드 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setItemkindCd(goodsMass.getItemkindCd().trim()); // 품목
|
|
|
+
|
|
|
+ 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");
|
|
|
+ }
|
|
|
+ // 스타일년도 확인
|
|
|
+ if (StringUtils.isBlank(goodsMass.getStyleYear().trim()) || goodsMass.getStyleYear().trim().length() != 4 || !goodsMass.getStyleYear().trim().matches(NUMBER_PATTERN)) {
|
|
|
+ goods.setGoodsRegMsg("스타일 년도 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setStyleYear(goodsMass.getStyleYear().trim());
|
|
|
+
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goods.getStyleYear())) {
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+
|
|
|
+ CommonCode commonCode = new CommonCode();
|
|
|
+ commonCode.setUseYn("Y");
|
|
|
+ // 시즌코드
|
|
|
+ if (StringUtils.isBlank(goodsMass.getSeasonCd().trim())) {
|
|
|
+ goods.setGoodsRegMsg("시즌코드 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setSeasonCd(goodsMass.getSeasonCd().trim());
|
|
|
+ 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().trim())) {
|
|
|
+ goods.setGoodsRegMsg("성별코드 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setSexGb(goodsMass.getSexGb().trim());
|
|
|
+ // 성별
|
|
|
+ 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().trim())) {
|
|
|
+ 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().trim())) {
|
|
|
+ goods.setGoodsRegMsg("판매수수료율 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ if (UPDATE_NO_PATTERN.equals(goodsMass.getSellFeeRate().trim())) {
|
|
|
+ goods.setSellFeeRate(0);
|
|
|
+ } else {
|
|
|
+
|
|
|
+ if (!GagaStringUtil.replace(goodsMass.getSellFeeRate().trim(), ".", "").matches(NUMBER_PATTERN)) {
|
|
|
+ goods.setGoodsRegMsg("판매수수료율 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ if (Integer.parseInt(goodsMass.getSellFeeRate().trim()) == 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(Integer.parseInt(GagaStringUtil.replace(goodsMass.getCurrPrice().trim(), ",", ""))); // 판매수수료율
|
|
|
+ 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(goods.getSellFeeRate());
|
|
|
+ }
|
|
|
+ goodsPriceRes.setApplyStdt(GagaDateUtil.getTodayDateTime()); //yyyymmddhhmiss
|
|
|
+ int toYear = Integer.parseInt(GagaDateUtil.getToday("yyyy")) + 4;
|
|
|
+ goodsPriceRes.setApplyEddt(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().trim())) {
|
|
|
+ goods.setGoodsRegMsg("상품구분 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setSexGb(goodsMass.getGoodsGb().trim());
|
|
|
+ // 상품구분
|
|
|
+ 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().trim())) {
|
|
|
+ goods.setGoodsRegMsg("정상이월구분 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setFormalGb(goodsMass.getFormalGb().trim()); // 정상이월
|
|
|
+ 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().trim())) {
|
|
|
+ goods.setGoodsRegMsg("선물주문가능여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ if ("Y".equals(goodsOrigin.getSelfGoodsYn())) {
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goodsMass.getGiftPackYn().trim())) {
|
|
|
+ goods.setGiftPackYn(goodsMass.getGiftPackYn().trim());
|
|
|
+ if (!"Y".equals(goods.getGiftPackYn()) && !"N".equals(goods.getGiftPackYn())) {
|
|
|
+ goods.setGoodsRegMsg("선물주문가능여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ goods.setGiftPackYn(goodsOrigin.getGiftPackYn());
|
|
|
+ }
|
|
|
+
|
|
|
+ //신규가입구매가능여부
|
|
|
+ if (StringUtils.isBlank(goodsMass.getNewCustOrdYn().trim())) {
|
|
|
+ goods.setGoodsRegMsg("신규가입구매가능여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ if ("Y".equals(goodsOrigin.getSelfGoodsYn())) {
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goodsMass.getNewCustOrdYn().trim())) {
|
|
|
+ goods.setNewCustOrdYn(goodsMass.getNewCustOrdYn().trim());
|
|
|
+ if (!"Y".equals(goods.getNewCustOrdYn()) && !"N".equals(goods.getNewCustOrdYn())) {
|
|
|
+ goods.setGoodsRegMsg("신규가입구매가능여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ goods.setNewCustOrdYn(goodsOrigin.getNewCustOrdYn());
|
|
|
+ }
|
|
|
+
|
|
|
+ //반품여부
|
|
|
+ if (StringUtils.isBlank(goodsMass.getReturnableYn().trim())) {
|
|
|
+ goods.setGoodsRegMsg("반품여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setReturnableYn(goodsMass.getReturnableYn().trim());
|
|
|
+ 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().trim())) {
|
|
|
+ goods.setGoodsRegMsg("교환여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setChangeableYn(goodsMass.getChangeableYn().trim());
|
|
|
+ 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().trim())) {
|
|
|
+ goods.setGoodsRegMsg("과세구분 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setTaxGb(goodsMass.getTaxGb().trim());
|
|
|
+ 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().trim())) {
|
|
|
+ goods.setGoodsRegMsg("상품연령 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setAgeGrpCd(goodsMass.getAgeGrpCd().trim());
|
|
|
+ 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().trim())) {
|
|
|
+ goods.setGoodsRegMsg("성인용품여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setAdultYn(goodsMass.getAdultYn().trim());
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goodsMass.getAdultYn().trim())) {
|
|
|
+ if (!"Y".equals(goods.getAdultYn()) && !"N".equals(goods.getAdultYn())) {
|
|
|
+ goods.setGoodsRegMsg("성인용품여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(goodsMass.getPntPrate())) {
|
|
|
+ goods.setGoodsRegMsg("PC포인트율 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goodsMass.getPntPrate())) {
|
|
|
+ try {
|
|
|
+ int pntPrate = Integer.parseInt(goodsMass.getPntPrate());
|
|
|
+ goods.setPntPrate(pntPrate);
|
|
|
+ } catch (Exception e) {
|
|
|
+ goods.setGoodsRegMsg("PC포인트율 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(goodsMass.getPrePpntUsableYn())) {
|
|
|
+ goods.setGoodsRegMsg("PC선포인트 사용여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goodsMass.getPrePpntUsableYn())) {
|
|
|
+ if ("Y".equals(goodsMass.getPrePpntUsableYn()) || "N".equals(goodsMass.getPrePpntUsableYn())) {
|
|
|
+ goods.setPrePpntUsableYn(goodsMass.getPrePpntUsableYn());
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ } else {
|
|
|
+ goods.setGoodsRegMsg("PC선포인트 사용여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(goodsMass.getPntMrate())) {
|
|
|
+ goods.setGoodsRegMsg("모바일포인트율 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goodsMass.getPntMrate())) {
|
|
|
+ try {
|
|
|
+ int pntMrate = Integer.parseInt(goodsMass.getPntMrate());
|
|
|
+ goods.setPntMrate(pntMrate);
|
|
|
+ } catch (Exception e) {
|
|
|
+ goods.setGoodsRegMsg("모바일포인트율 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(goodsMass.getPreMpntUsableYn())) {
|
|
|
+ goods.setGoodsRegMsg("모바일선포인트 사용여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(goodsMass.getPreMpntUsableYn())) {
|
|
|
+ if ("Y".equals(goodsMass.getPreMpntUsableYn()) || "N".equals(goodsMass.getPreMpntUsableYn())) {
|
|
|
+ goods.setPreMpntUsableYn(goodsMass.getPreMpntUsableYn());
|
|
|
+ goods.setChDataYn("Y");
|
|
|
+ } else {
|
|
|
+ goods.setGoodsRegMsg("모바일선포인트 사용여부 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품대량수정 - 상품고시정보 check
|
|
|
+ *
|
|
|
+ * @param goods
|
|
|
+ * @param excelMap
|
|
|
+ * @param goodsOrigin
|
|
|
+ * @return Goods
|
|
|
+ * @author eskim
|
|
|
+ * @since 2021. 01. 20
|
|
|
+ */
|
|
|
+ private Goods getUpdateMassGoodsNotiCheck(Goods goods, GagaMap excelMap, Goods goodsOrigin) {
|
|
|
+
|
|
|
+ String oldItemKindCd = goodsOrigin.getItemkindCd();
|
|
|
+ String itemkindCd = goods.getItemkindCd();
|
|
|
+ if (UPDATE_NO_PATTERN.equals(goods.getItemkindCd())) {
|
|
|
+ itemkindCd = oldItemKindCd;
|
|
|
+ }
|
|
|
+ // old 품목고시분류 조회
|
|
|
+ String oldNiClsfCd = "";
|
|
|
+ Goods goodsNoti = new Goods();
|
|
|
+ goodsNoti.setGoodsCd(goods.getGoodsCd());
|
|
|
+ goodsNoti.setSupplyCompCd(goodsOrigin.getSupplyCompCd());
|
|
|
+ goodsNoti.setItemkindCd(oldItemKindCd);
|
|
|
+ Collection<GoodsNotiInfo> oldGoodsNotiList = goodsDao.getItemkindNotiInfoList(goodsNoti);
|
|
|
+ if (oldGoodsNotiList != null && oldGoodsNotiList.isEmpty()) {
|
|
|
+ for (GoodsNotiInfo oldGoodsNotiInfo : oldGoodsNotiList) {
|
|
|
+ oldNiClsfCd = oldGoodsNotiInfo.getNiClsfCd();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 품목코드가 변경되었을 경우
|
|
|
+ if (!oldItemKindCd.equals(itemkindCd)) {
|
|
|
+ goods.setChNotiYn("Y");
|
|
|
+
|
|
|
+ // new 품목고시분류 조회
|
|
|
+ String newNiClsfCd = "";
|
|
|
+ goodsNoti.setItemkindCd(itemkindCd);
|
|
|
+ Collection<GoodsNotiInfo> newGoodsNotiList = goodsDao.getItemkindNotiInfoList(goodsNoti);
|
|
|
+ if (newGoodsNotiList == null || newGoodsNotiList.isEmpty()) {
|
|
|
+ goods.setGoodsRegMsg("품목의 고시정보 없음");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ } else {
|
|
|
+ for (GoodsNotiInfo newGoodsNotiInfo : newGoodsNotiList) {
|
|
|
+ newNiClsfCd = newGoodsNotiInfo.getNiClsfCd();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!oldNiClsfCd.equals(newNiClsfCd) && !UPDATE_NO_PATTERN.equals(excelMap.getString("niClsfCd"))) {
|
|
|
+ goods.setGoodsRegMsg("고시분류 오류");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 상품고시정보
|
|
|
+ Collection<GoodsNotiInfo> goodsNotiList = goodsDao.getItemkindNotiInfoList(goodsNoti);
|
|
|
+ if (goodsNotiList == null || goodsNotiList.isEmpty()) {
|
|
|
+ goods.setGoodsRegMsg("품목의 고시정보 없음");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(excelMap.getString("niClsfCd"))
|
|
|
+ && !oldNiClsfCd.equals(excelMap.getString("niClsfCd"))) {
|
|
|
+ goods.setGoodsRegMsg("고시분류 오류..");
|
|
|
+ goods.setGoodsStat("10");
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < 28; i++) {
|
|
|
+ String niContentVal = excelMap.getString("niContent" + (i + 1));
|
|
|
+ if (!UPDATE_NO_PATTERN.equals(niContentVal)) {
|
|
|
+ goods.setChNotiYn("Y");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return goods;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품대량수정 - 상품고시정보
|
|
|
+ *
|
|
|
+ * @param goods
|
|
|
+ * @param excelMap
|
|
|
+ * @return Goods
|
|
|
+ * @author eskim
|
|
|
+ * @since 2021. 01. 20
|
|
|
+ */
|
|
|
+ private void updateGoodsNoti(Goods goods, GagaMap excelMap, Goods goodsOrigin) {
|
|
|
+
|
|
|
+ String oldItemKindCd = goodsOrigin.getItemkindCd();
|
|
|
+ String itemkindCd = goods.getItemkindCd();
|
|
|
+ int index = 0;
|
|
|
+
|
|
|
+ if (UPDATE_NO_PATTERN.equals(goods.getItemkindCd())) {
|
|
|
+ itemkindCd = oldItemKindCd;
|
|
|
+ }
|
|
|
+
|
|
|
+ Collection<GoodsNotiInfo> newGoodsNotiList = new ArrayList<>();
|
|
|
+ // new 품목고시분류 조회
|
|
|
+ Goods goodsNoti = new Goods();
|
|
|
+ goodsNoti.setGoodsCd(goods.getGoodsCd());
|
|
|
+ goodsNoti.setSupplyCompCd(goodsOrigin.getSupplyCompCd());
|
|
|
+ // 품목코드가 변경되었을 경우
|
|
|
+ if (!oldItemKindCd.equals(itemkindCd)) {
|
|
|
+ goodsNoti.setItemkindCd(itemkindCd);
|
|
|
+ newGoodsNotiList = goodsDao.getItemkindNotiInfoList(goodsNoti);
|
|
|
+ } else {
|
|
|
+ // 원래 상품의 고시정보
|
|
|
+
|
|
|
+ GoodsNotiInfo goodsNotiInfo = new GoodsNotiInfo();
|
|
|
+ goodsNotiInfo.setGoodsCd(goods.getGoodsCd());
|
|
|
+ goodsNotiInfo.setSupplyVendorCd(goodsOrigin.getSupplyCompCd()); //수정해야함
|
|
|
+ goodsNotiInfo.setNiClsfCd(goodsOrigin.getNiClsfCd());
|
|
|
+ newGoodsNotiList = goodsDao.getGoodsNotiInfoList(goodsNotiInfo);
|
|
|
+ }
|
|
|
+ if (newGoodsNotiList != null && !newGoodsNotiList.isEmpty()) {
|
|
|
+
|
|
|
+ index = 0;
|
|
|
+ for (GoodsNotiInfo goodsNotiInfo : newGoodsNotiList) {
|
|
|
+
|
|
|
+ if (index == 0) {
|
|
|
+ goodsDao.deleteGoodsNotiInfo(goods);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(excelMap.getString("niContent" + (index + 1)))
|
|
|
+ || UPDATE_NO_PATTERN.equals(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
|
|
|
+ * @author eskim
|
|
|
+ * @since 2020. 4. 21.
|
|
|
+ */
|
|
|
+ private void saveGoodsCategory(Goods goods) {
|
|
|
+
|
|
|
+// GoodsCategory goodsCategory = new GoodsCategory();
|
|
|
+// goodsCategory.setRegNo(TssSession.getInfo().getUserNo());
|
|
|
+// goodsCategory.setUpdNo(TssSession.getInfo().getUserNo());
|
|
|
+// goodsCategory.setGoodsCd(goods.getGoodsCd());
|
|
|
+// displayService.deleteGoodsCategory(goodsCategory);
|
|
|
+//
|
|
|
+// Collection<ItemkindCategory> itemkindCategoryList = displayService.getItemkindCategoryList(goods.getItemkindCd());
|
|
|
+// for (ItemkindCategory itemkindCategory : itemkindCategoryList) {
|
|
|
+// TsaCategory category = new TsaCategory();
|
|
|
+// category.setCateGb(itemkindCategory.getCateGb());
|
|
|
+// category.setCateCd(itemkindCategory.getCateCd());
|
|
|
+// category = displayService.getCategory4srch(category);
|
|
|
+//
|
|
|
+// GoodsCategory GoodsCategory = new GoodsCategory();
|
|
|
+// GoodsCategory.setRegNo(TssSession.getInfo().getUserNo());
|
|
|
+// GoodsCategory.setUpdNo(TssSession.getInfo().getUserNo());
|
|
|
+// String[] goodsCdArr = {goods.getGoodsCd()};
|
|
|
+// GoodsCategory.setGoodsCdArr(goodsCdArr);
|
|
|
+// if (category.getCateGb() != null) {
|
|
|
+// GoodsCategory.setNcateGb(String.valueOf(category.getCateGb()));
|
|
|
+// }
|
|
|
+// if (category.getCateType() != null) {
|
|
|
+// GoodsCategory.setNcateType(String.valueOf(category.getCateType()));
|
|
|
+// }
|
|
|
+// if (category.getCateCd() != null) {
|
|
|
+// GoodsCategory.setNcateCd(String.valueOf(category.getCateCd()));
|
|
|
+// }
|
|
|
+// if (category.getTcateCd() != null) {
|
|
|
+// GoodsCategory.setNtcateCd(String.valueOf(category.getTcateCd()));
|
|
|
+// }
|
|
|
+// if (category.getMcateCd() != null) {
|
|
|
+// GoodsCategory.setNmcateCd(String.valueOf(category.getMcateCd()));
|
|
|
+// }
|
|
|
+// if (category.getScateCd() != null) {
|
|
|
+// GoodsCategory.setNscateCd(String.valueOf(category.getScateCd()));
|
|
|
+// }
|
|
|
+// if (category.getDcateCd() != null) {
|
|
|
+// GoodsCategory.setNdcateCd(String.valueOf(category.getDcateCd()));
|
|
|
+// }
|
|
|
+// displayService.moveGoodsCategory(GoodsCategory);
|
|
|
+// }
|
|
|
+ }
|
|
|
}
|