|
|
@@ -12,8 +12,11 @@ import com.style24.admin.biz.dao.TsaGoodsDao;
|
|
|
import com.style24.admin.support.env.TsaConstants;
|
|
|
import com.style24.admin.support.security.session.TsaSession;
|
|
|
import com.style24.core.support.message.TscMessageByLocale;
|
|
|
+import com.style24.persistence.domain.Brand;
|
|
|
import com.style24.persistence.domain.Color;
|
|
|
import com.style24.persistence.domain.Goods;
|
|
|
+import com.style24.persistence.domain.GoodsDesc;
|
|
|
+import com.style24.persistence.domain.GoodsNotiInfo;
|
|
|
import com.style24.persistence.domain.GoodsSearch;
|
|
|
import com.style24.persistence.domain.Itemkind;
|
|
|
import com.style24.persistence.domain.NotiInfo;
|
|
|
@@ -44,6 +47,9 @@ public class TsaGoodsService {
|
|
|
@Autowired
|
|
|
private TsaGoodsDao goodsDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TsaBusinessService businessService;
|
|
|
+
|
|
|
/**
|
|
|
* 품목 목록
|
|
|
* @param itemkind
|
|
|
@@ -276,4 +282,198 @@ public class TsaGoodsService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 상품 이미지 등록여부 조회
|
|
|
+ *
|
|
|
+ * @param goods
|
|
|
+ * @return
|
|
|
+ * @author eskim
|
|
|
+ * @since 2020. 10. 21
|
|
|
+ */
|
|
|
+ public Collection<Goods> getGoodsImgsYn(Goods goods) {
|
|
|
+ return goodsDao.getGoodsImgsYn(goods);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품 상세
|
|
|
+ *
|
|
|
+ * @param goods
|
|
|
+ * @return
|
|
|
+ * @author eskim
|
|
|
+ * @since 2020. 10. 22
|
|
|
+ */
|
|
|
+ public Goods getGoods(Goods goods) {
|
|
|
+ // 상품기본정보
|
|
|
+ Goods resultGoods = goodsDao.getGoods(goods);
|
|
|
+
|
|
|
+ // 상품 상세
|
|
|
+ return this.getGoodsDesc(resultGoods);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품 상세 조회
|
|
|
+ *
|
|
|
+ * @param resultGoods
|
|
|
+ * @return
|
|
|
+ * @author eskim
|
|
|
+ * @since 2020. 10. 22
|
|
|
+ */
|
|
|
+ private Goods getGoodsDesc(Goods resultGoods) {
|
|
|
+
|
|
|
+ GoodsDesc goods = new GoodsDesc();
|
|
|
+ goods.setGoodsCd(resultGoods.getGoodsCd());
|
|
|
+
|
|
|
+ // goods.setDescGb("10");
|
|
|
+ // String goodsDesc = this.getGoodsDescList(goods);
|
|
|
+ // resultGoods.setGoodsDesc(goodsDesc);
|
|
|
+
|
|
|
+ // 상품 상세 pc 상단
|
|
|
+ goods.setDescGb("20");
|
|
|
+ String goodsPcTopDesc = this.getGoodsDescList(goods);
|
|
|
+ resultGoods.setGoodsPcTopDesc(goodsPcTopDesc);
|
|
|
+
|
|
|
+ // 상품 상세 pc 하단
|
|
|
+ goods.setDescGb("30");
|
|
|
+ String goodsPcDownDesc = this.getGoodsDescList(goods);
|
|
|
+ resultGoods.setGoodsPcDownDesc(goodsPcDownDesc);
|
|
|
+
|
|
|
+ // 상품 상세 mobile 상단
|
|
|
+ goods.setDescGb("40");
|
|
|
+ String goodsMobileTopDesc = this.getGoodsDescList(goods);
|
|
|
+ resultGoods.setGoodsMobileTopDesc(goodsMobileTopDesc);
|
|
|
+
|
|
|
+ // 상품 상세 mpbile 하단
|
|
|
+ goods.setDescGb("50");
|
|
|
+ String goodsMobileDownDesc = this.getGoodsDescList(goods);
|
|
|
+ resultGoods.setGoodsMobileDownDesc(goodsMobileDownDesc);
|
|
|
+
|
|
|
+ return resultGoods;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품 상세구분별 컨텐츠 조회
|
|
|
+ *
|
|
|
+ * @param goods
|
|
|
+ * @return
|
|
|
+ * @author eskim
|
|
|
+ * @since 2020. 10. 22
|
|
|
+ */
|
|
|
+ private String getGoodsDescList(GoodsDesc goodsDesc) {
|
|
|
+ Collection<GoodsDesc> goodsDescList = goodsDao.getGoodsDescList(goodsDesc);
|
|
|
+ StringBuilder goodsDescSb = new StringBuilder();
|
|
|
+ if (goodsDescList != null && !goodsDescList.isEmpty()) {
|
|
|
+ for (GoodsDesc tmpGoodsDesc : goodsDescList) {
|
|
|
+ goodsDescSb.append(tmpGoodsDesc.getGoodsDesc());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return goodsDescSb.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품 정보고시 조회
|
|
|
+ *
|
|
|
+ * @param goods
|
|
|
+ * @return
|
|
|
+ * @author eskim
|
|
|
+ * @since 2020. 10. 22
|
|
|
+ */
|
|
|
+ public Collection<GoodsNotiInfo> getGoodsNotiInfoList(GoodsNotiInfo goodsNotiInfo) {
|
|
|
+ return goodsDao.getGoodsNotiInfoList(goodsNotiInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품 수정 항목 일괄변경
|
|
|
+ *
|
|
|
+ * @param goods
|
|
|
+ * @author eskim
|
|
|
+ * @since 2020. 01. 17
|
|
|
+ */
|
|
|
+ @Transactional("shopTxnManager")
|
|
|
+ public void updateGoodsState(Goods goods) {
|
|
|
+ if (goods == null || (goods.getArrGoodsCd() == null && goods.getArrGoodsCd().length <= 0)) {
|
|
|
+ throw new IllegalStateException(message.getMessage("FAIL_1001"));
|
|
|
+ }
|
|
|
+
|
|
|
+ goods.setRegNo(TsaSession.getInfo().getUserNo());
|
|
|
+ goods.setUpdNo(TsaSession.getInfo().getUserNo());
|
|
|
+
|
|
|
+ if (goods.getArrGoodsCd().length > 0) {
|
|
|
+ for (String goodsCd : goods.getArrGoodsCd()) {
|
|
|
+
|
|
|
+ goods.setGoodsCd(goodsCd);
|
|
|
+ // 이력생성
|
|
|
+ goodsDao.createGoodsHst(goods);
|
|
|
+
|
|
|
+ if ("formalGb".equals(goods.getProcJob())) {
|
|
|
+ // 상품브랜드 조회
|
|
|
+ Goods originGoods = goodsDao.getGoods(goods);
|
|
|
+ // 브랜드 확인
|
|
|
+ goods.setPntPrate(originGoods.getPntPrate()); // 포인트적립율(PC)
|
|
|
+ goods.setPntMrate(originGoods.getPntMrate()); // 포인트적립율(MOBILE)
|
|
|
+ Brand brand = new Brand();
|
|
|
+ brand.setBrandCd(originGoods.getBrandCd());
|
|
|
+ Collection<Brand> brandList = businessService.getBrandList(brand);
|
|
|
+ if (brandList != null && !brandList.isEmpty()) {
|
|
|
+ float pntPrate = 0;
|
|
|
+ float pntMrate = 0;
|
|
|
+ for (Brand tmpBrand : brandList) {
|
|
|
+ if ("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)
|
|
|
+ }
|
|
|
+ } else if ("goodsStat".equals(goods.getProcJob())) {
|
|
|
+ // 상품브랜드 조회
|
|
|
+ Goods originGoods = goodsDao.getGoods(goods);
|
|
|
+
|
|
|
+ // 승인일
|
|
|
+ if (!goods.getGoodsStat().equals(originGoods.getGoodsStat()) && "90".equals(goods.getGoodsStat())) {
|
|
|
+ goods.setChGoodsStatYn("Y");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 상품정보 변경
|
|
|
+ goodsDao.updateGoodsState(goods);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ // 이력생성
|
|
|
+ goodsDao.createGoodsHst(goods);
|
|
|
+ if ("formalGb".equals(goods.getProcJob())) {
|
|
|
+ // 상품브랜드 조회
|
|
|
+ Goods originGoods = goodsDao.getGoods(goods);
|
|
|
+ // 브랜드 확인
|
|
|
+ goods.setPntPrate(originGoods.getPntPrate()); // 포인트적립율(PC)
|
|
|
+ goods.setPntMrate(originGoods.getPntMrate()); // 포인트적립율(MOBILE)
|
|
|
+ Brand brand = new Brand();
|
|
|
+ brand.setBrandCd(originGoods.getBrandCd());
|
|
|
+ Collection<Brand> brandList = businessService.getBrandList(brand);
|
|
|
+ if (brandList != null && !brandList.isEmpty()) {
|
|
|
+ float pntPrate = 0;
|
|
|
+ float pntMrate = 0;
|
|
|
+ for (Brand tmpBrand : brandList) {
|
|
|
+ if ("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)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 상품정보 변경
|
|
|
+ goodsDao.updateGoodsState(goods);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|