|
@@ -60,7 +60,10 @@ public class TsfCartService {
|
|
|
* 세트 : goodsCd,
|
|
* 세트 : goodsCd,
|
|
|
* @param params
|
|
* @param params
|
|
|
*/
|
|
*/
|
|
|
- public void saveCartInfo(Collection<Cart> params) {
|
|
|
|
|
|
|
+ public GagaMap saveCartInfo(Collection<Cart> params) {
|
|
|
|
|
+ GagaMap result = new GagaMap();
|
|
|
|
|
+ List<Integer> cartSqList = new ArrayList<>();
|
|
|
|
|
+
|
|
|
// 로그인 유무 확인 (로그인이 되어 있지 않으면 regNo 를 0으로 장바구니에 저장한다.)
|
|
// 로그인 유무 확인 (로그인이 되어 있지 않으면 regNo 를 0으로 장바구니에 저장한다.)
|
|
|
Login login = new Login();
|
|
Login login = new Login();
|
|
|
if(TsfSession.isLogin()) {
|
|
if(TsfSession.isLogin()) {
|
|
@@ -69,68 +72,153 @@ public class TsfCartService {
|
|
|
login.setCustNo(0);
|
|
login.setCustNo(0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ String goodsType = params.iterator().next().getGoodsType();
|
|
|
|
|
+ String cartGb = params.iterator().next().getCartGb();
|
|
|
|
|
+ if(StringUtils.isEmpty(goodsType)) {
|
|
|
|
|
+ goodsType = params.iterator().next().getCartCompsList().iterator().next().getGoodsType();
|
|
|
|
|
+ cartGb = params.iterator().next().getCartCompsList().iterator().next().getCartGb();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ log.info("CHECK GOODS_TYPE ::::: {}", goodsType);
|
|
|
|
|
+
|
|
|
// 장바구니 상품 및 재고 가능 여부 체크
|
|
// 장바구니 상품 및 재고 가능 여부 체크
|
|
|
- for (Cart param : params) {
|
|
|
|
|
- param.setCustNo(login.getCustNo());
|
|
|
|
|
- // 상품 마스터 정보 확인
|
|
|
|
|
- Goods goods = new Goods();
|
|
|
|
|
- goods.setGoodsCd(param.getGoodsCd());
|
|
|
|
|
- goods.setFrontGb(TsfSession.getFrontGb());
|
|
|
|
|
- goods.setSiteCd(TscConstants.Site.STYLE24.value());
|
|
|
|
|
-
|
|
|
|
|
- goods = goodsService.getGoodsInfo(goods);
|
|
|
|
|
-
|
|
|
|
|
- if (goods == null) {
|
|
|
|
|
- throw new IllegalArgumentException("상품 정보가 존재하지 않습니다.");
|
|
|
|
|
- }
|
|
|
|
|
- if (TscConstants.GoodsStat.SOLDOUT.value().equals(goods.getGoodsStat())) {
|
|
|
|
|
- throw new IllegalArgumentException("품절입니다.");
|
|
|
|
|
- } else if (!TscConstants.GoodsStat.SOLDOUT.value().equals(goods.getGoodsStat()) && !TscConstants.GoodsStat.APPR.value().equals(goods.getGoodsStat())) {
|
|
|
|
|
- throw new IllegalArgumentException("판매중인 상품이 아닙니다.");
|
|
|
|
|
- } else if (param.getGoodsQty() > goods.getMaxOrdQty()) {
|
|
|
|
|
- throw new IllegalArgumentException(goods.getGoodsNm() + " 상품의 최대 구매 수량은 " + goods.getMaxOrdQty() + " 입니다.");
|
|
|
|
|
- } else if (param.getGoodsQty() < goods.getMinOrdQty()) {
|
|
|
|
|
- throw new IllegalArgumentException(goods.getGoodsNm() + " 상품의 최소 구매 수량은 " + goods.getMinOrdQty() + " 입니다.");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if(TscConstants.GoodsType.SET.value().equals(goodsType)) {
|
|
|
|
|
+ for (Cart goodsParams : params) {
|
|
|
|
|
+ for (Cart param : goodsParams.getCartCompsList()) {
|
|
|
|
|
+ param.setCustNo(login.getCustNo());
|
|
|
|
|
+ // 상품 마스터 정보 확인
|
|
|
|
|
+ Goods goods = new Goods();
|
|
|
|
|
+ goods.setGoodsCd(param.getGoodsCd());
|
|
|
|
|
+ goods.setFrontGb(TsfSession.getFrontGb());
|
|
|
|
|
+ goods.setSiteCd(TscConstants.Site.STYLE24.value());
|
|
|
|
|
+
|
|
|
|
|
+ goods = goodsService.getGoodsInfo(goods);
|
|
|
|
|
+
|
|
|
|
|
+ if (goods == null) {
|
|
|
|
|
+ result.put("message", "상품 정보가 존재하지 않습니다.");
|
|
|
|
|
+ return result;
|
|
|
|
|
+ } else if (TscConstants.GoodsStat.SOLDOUT.value().equals(goods.getGoodsStat())) {
|
|
|
|
|
+ result.put("message", "품절입니다.");
|
|
|
|
|
+ return result;
|
|
|
|
|
+ } else if (!TscConstants.GoodsStat.SOLDOUT.value().equals(goods.getGoodsStat()) && !TscConstants.GoodsStat.APPR.value().equals(goods.getGoodsStat())) {
|
|
|
|
|
+ result.put("message", "판매중인 상품이 아닙니다.");
|
|
|
|
|
+ return result;
|
|
|
|
|
+ } else if (param.getGoodsQty() > goods.getMaxOrdQty()) {
|
|
|
|
|
+ result.put("message", goods.getGoodsNm() + " 상품의 최대 구매 수량은 " + goods.getMaxOrdQty() + " 입니다.");
|
|
|
|
|
+ return result;
|
|
|
|
|
+ } else if (param.getGoodsQty() < goods.getMinOrdQty()) {
|
|
|
|
|
+ result.put("message", goods.getGoodsNm() + " 상품의 최소 구매 수량은 " + goods.getMinOrdQty() + " 입니다.");
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- // 상품 재고 확인
|
|
|
|
|
- GoodsStock checkParam = new GoodsStock();
|
|
|
|
|
- checkParam.setGoodsCd(param.getGoodsCd());
|
|
|
|
|
- checkParam.setItemCd(param.getItemCd());
|
|
|
|
|
- checkParam.setOptCd(param.getOptCd());
|
|
|
|
|
- checkParam.setGoodsQty(param.getGoodsQty());
|
|
|
|
|
- checkParam.setGoodsType(param.getGoodsType());
|
|
|
|
|
- String stockResult = goodsService.getCheckStock(checkParam);
|
|
|
|
|
|
|
+ // 상품 재고 확인
|
|
|
|
|
+ GoodsStock checkParam = new GoodsStock();
|
|
|
|
|
+ checkParam.setGoodsCd(param.getGoodsCd());
|
|
|
|
|
+ checkParam.setItemCd(param.getItemCd());
|
|
|
|
|
+ checkParam.setOptCd(param.getOptCd());
|
|
|
|
|
+ checkParam.setGoodsQty(param.getGoodsQty());
|
|
|
|
|
+ checkParam.setGoodsType(param.getGoodsType());
|
|
|
|
|
+ String stockResult = goodsService.getCheckStock(checkParam);
|
|
|
|
|
+
|
|
|
|
|
+ if (!"SUCCESS".equals(stockResult)) {
|
|
|
|
|
+ result.put("message", stockResult);
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if (!"SUCCESS".equals(stockResult)) {
|
|
|
|
|
- throw new IllegalArgumentException(stockResult);
|
|
|
|
|
|
|
+ // 금일 주문 수량 체크
|
|
|
|
|
+ if (!StringUtils.isEmpty(param.getCartGb()) && "O".equals(param.getCartGb())) {
|
|
|
|
|
+ int goodsCartCnt = 0;
|
|
|
|
|
+ if(param.getCustNo() != 0) {
|
|
|
|
|
+ goodsCartCnt = cartDao.getGoodsTodayOrderCnt(param);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (param.getGoodsQty() + goodsCartCnt > goods.getDayMaxOrdQty()) {
|
|
|
|
|
+ result.put("message", "1일 구매한도 수량이 초과되었습니다.");
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ saveSetTypeCartInfo(params, cartSqList);
|
|
|
}
|
|
}
|
|
|
|
|
+ } else {
|
|
|
|
|
+ for (Cart param : params) {
|
|
|
|
|
+ param.setCustNo(login.getCustNo());
|
|
|
|
|
+ // 상품 마스터 정보 확인
|
|
|
|
|
+ Goods goods = new Goods();
|
|
|
|
|
+ goods.setGoodsCd(param.getGoodsCd());
|
|
|
|
|
+ goods.setFrontGb(TsfSession.getFrontGb());
|
|
|
|
|
+ goods.setSiteCd(TscConstants.Site.STYLE24.value());
|
|
|
|
|
+
|
|
|
|
|
+ goods = goodsService.getGoodsInfo(goods);
|
|
|
|
|
|
|
|
- // 금일 주문 수량 체크
|
|
|
|
|
- if (!StringUtils.isEmpty(param.getCartGb()) && "O".equals(param.getCartGb())) {
|
|
|
|
|
- int goodsCartCnt = 0;
|
|
|
|
|
- if(param.getCustNo() != 0) {
|
|
|
|
|
- goodsCartCnt = cartDao.getGoodsTodayOrderCnt(param);
|
|
|
|
|
|
|
+ log.info("CHECK :::::::::::::::: 0 ::::::::::::::::::::::");
|
|
|
|
|
+
|
|
|
|
|
+ if (goods == null) {
|
|
|
|
|
+ log.info("CHECK :::::::::::::::: 1 ::::::::::::::::::::::");
|
|
|
|
|
+ result.put("message", "상품 정보가 존재하지 않습니다.");
|
|
|
|
|
+ return result;
|
|
|
|
|
+ } else if (TscConstants.GoodsStat.SOLDOUT.value().equals(goods.getGoodsStat())) {
|
|
|
|
|
+ log.info("CHECK :::::::::::::::: 2 ::::::::::::::::::::::");
|
|
|
|
|
+ result.put("message", "품절입니다");
|
|
|
|
|
+ return result;
|
|
|
|
|
+ } else if (!TscConstants.GoodsStat.SOLDOUT.value().equals(goods.getGoodsStat()) && !TscConstants.GoodsStat.APPR.value().equals(goods.getGoodsStat())) {
|
|
|
|
|
+ log.info("CHECK :::::::::::::::: 3 ::::::::::::::::::::::");
|
|
|
|
|
+ result.put("message", "판매중인 상품이 아닙니다.");
|
|
|
|
|
+ return result;
|
|
|
|
|
+ } else if (param.getGoodsQty() > goods.getMaxOrdQty()) {
|
|
|
|
|
+ log.info("CHECK :::::::::::::::: 4 ::::::::::::::::::::::");
|
|
|
|
|
+ result.put("message", goods.getGoodsNm() + " 상품의 최대 구매 수량은 " + goods.getMaxOrdQty() + " 입니다.");
|
|
|
|
|
+ return result;
|
|
|
|
|
+ } else if (param.getGoodsQty() < goods.getMinOrdQty()) {
|
|
|
|
|
+ log.info("CHECK :::::::::::::::: 5 ::::::::::::::::::::::");
|
|
|
|
|
+ result.put("message", goods.getGoodsNm() + " 상품의 최소 구매 수량은 " + goods.getMinOrdQty() + " 입니다.");
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (param.getGoodsQty() + goodsCartCnt > goods.getDayMaxOrdQty()) {
|
|
|
|
|
- throw new IllegalArgumentException("1일 구매한도 수량이 초과되었습니다.");
|
|
|
|
|
|
|
+ log.info("CHECK :::::::::::::::: 6 ::::::::::::::::::::::");
|
|
|
|
|
+
|
|
|
|
|
+ // 상품 재고 확인
|
|
|
|
|
+ GoodsStock checkParam = new GoodsStock();
|
|
|
|
|
+ checkParam.setGoodsCd(param.getGoodsCd());
|
|
|
|
|
+ checkParam.setItemCd(param.getItemCd());
|
|
|
|
|
+ checkParam.setOptCd(param.getOptCd());
|
|
|
|
|
+ checkParam.setGoodsQty(param.getGoodsQty());
|
|
|
|
|
+ checkParam.setGoodsType(param.getGoodsType());
|
|
|
|
|
+ String stockResult = goodsService.getCheckStock(checkParam);
|
|
|
|
|
+
|
|
|
|
|
+ if (!"SUCCESS".equals(stockResult)) {
|
|
|
|
|
+ result.put("message", stockResult);
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 금일 주문 수량 체크
|
|
|
|
|
+ if (!StringUtils.isEmpty(param.getCartGb()) && "O".equals(param.getCartGb())) {
|
|
|
|
|
+ int goodsCartCnt = 0;
|
|
|
|
|
+ if(param.getCustNo() != 0) {
|
|
|
|
|
+ goodsCartCnt = cartDao.getGoodsTodayOrderCnt(param);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (param.getGoodsQty() + goodsCartCnt > goods.getDayMaxOrdQty()) {
|
|
|
|
|
+ result.put("message", "1일 구매한도 수량이 초과되었습니다.");
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- // 장바구니 정보 수정
|
|
|
|
|
- if (TscConstants.GoodsType.SET.value().equals(params.iterator().next().getGoodsType())) {
|
|
|
|
|
- // 세트상품일 경우
|
|
|
|
|
- saveSetTypeCartInfo(params);
|
|
|
|
|
- } else {
|
|
|
|
|
- // 세트 상품이 아닐 경우
|
|
|
|
|
- saveNormalDealCartInfo(params);
|
|
|
|
|
|
|
+ saveNormalDealCartInfo(params, cartSqList);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ result.put("cartSqList", cartSqList);
|
|
|
|
|
+ result.put("goodsType", goodsType);
|
|
|
|
|
+ result.put("cartGb", cartGb);
|
|
|
|
|
+ result.put("message", "SUCCESS");
|
|
|
|
|
+
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Transactional("shopTxnManager")
|
|
@Transactional("shopTxnManager")
|
|
|
- public void saveSetTypeCartInfo(Collection<Cart> params) {
|
|
|
|
|
|
|
+ public void saveSetTypeCartInfo(Collection<Cart> params, List<Integer> cartSqs) {
|
|
|
Cart cart = new Cart();
|
|
Cart cart = new Cart();
|
|
|
StringBuilder sb = new StringBuilder();
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
|
@@ -149,80 +237,82 @@ public class TsfCartService {
|
|
|
cart.setJsessionId(TscSession.getSessionId());
|
|
cart.setJsessionId(TscSession.getSessionId());
|
|
|
|
|
|
|
|
// 장바구니 보유 CART_SQ 쿼리
|
|
// 장바구니 보유 CART_SQ 쿼리
|
|
|
- int i = 1;
|
|
|
|
|
- for (Cart param : params) {
|
|
|
|
|
- sb.append("SELECT CD.CART_SQ \n FROM TB_CART_DETAIL CD \n INNER JOIN TB_CART C \n ON CD.CART_SQ = C.CART_SQ \n WHERE C.CUST_NO = ");
|
|
|
|
|
-
|
|
|
|
|
- if (cart.getCustNo() == 0) {
|
|
|
|
|
- sb.append(cart.getCustNo()).append("\n AND JSESSION_ID = '").append(cart.getJsessionId()).append("'");
|
|
|
|
|
- } else {
|
|
|
|
|
- sb.append(cart.getCustNo());
|
|
|
|
|
- }
|
|
|
|
|
- sb.append("\n AND CD.ITEM_CD = '").append(param.getItemCd()).append("' \n AND CD.OPT_CD = '").append(param.getOptCd()).append("'");
|
|
|
|
|
- if (i < params.size()) {
|
|
|
|
|
- i++;
|
|
|
|
|
- sb.append("\n UNION ALL \n");
|
|
|
|
|
|
|
+ for (Cart carts : params) {
|
|
|
|
|
+ int i = 1;
|
|
|
|
|
+ Collection<Cart> cartInfos = carts.getCartCompsList();
|
|
|
|
|
+ sb = new StringBuilder();
|
|
|
|
|
+ for(Cart param : cartInfos) {
|
|
|
|
|
+ sb.append("SELECT CD.CART_SQ \n FROM TB_CART_DETAIL CD \n INNER JOIN TB_CART C \n ON CD.CART_SQ = C.CART_SQ \n WHERE C.CUST_NO = ");
|
|
|
|
|
+
|
|
|
|
|
+ if (cart.getCustNo() == 0) {
|
|
|
|
|
+ sb.append(cart.getCustNo()).append("\n AND JSESSION_ID = '").append(cart.getJsessionId()).append("'");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ sb.append(cart.getCustNo());
|
|
|
|
|
+ }
|
|
|
|
|
+ sb.append("\n AND CD.ITEM_CD = '").append(param.getItemCd()).append("' \n AND CD.OPT_CD = '").append(param.getOptCd()).append("'");
|
|
|
|
|
+ if (i < cartInfos.size()) {
|
|
|
|
|
+ i++;
|
|
|
|
|
+ sb.append("\n UNION ALL \n");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // cart 정보 세팅
|
|
|
|
|
- cart.setContentsLoc(params.iterator().next().getContentsLoc());
|
|
|
|
|
- cart.setAfLinkCd(params.iterator().next().getAfLinkCd());
|
|
|
|
|
- cart.setIthrCd(params.iterator().next().getIthrCd());
|
|
|
|
|
- cart.setPlanDtlSq(params.iterator().next().getPlanDtlSq());
|
|
|
|
|
- cart.setGoodsCd(params.iterator().next().getGoodsCd());
|
|
|
|
|
- cart.setGoodsQty(params.iterator().next().getGoodsQty());
|
|
|
|
|
- cart.setGoodsType(params.iterator().next().getGoodsType());
|
|
|
|
|
- cart.setItemCdSql(sb.toString());
|
|
|
|
|
|
|
|
|
|
- Collection<Cart> cartSqList = null;
|
|
|
|
|
-
|
|
|
|
|
- if (!StringUtils.isEmpty(params.iterator().next().getCartGb()) && "C".equals(params.iterator().next().getCartGb())) {
|
|
|
|
|
- cart.setCartGb(TscConstants.CartGb.CART.value());
|
|
|
|
|
- // 같은 장바구니 상품 확인
|
|
|
|
|
- cartSqList = cartDao.selectHasSetItemCartList(cart);
|
|
|
|
|
- } else if (!StringUtils.isEmpty(params.iterator().next().getCartGb()) && "O".equals(params.iterator().next().getCartGb())) {
|
|
|
|
|
- if ("P".equals(TsfSession.getFrontGb())) {
|
|
|
|
|
- cart.setCartGb(TscConstants.CartGb.PC_ORDER.value());
|
|
|
|
|
|
|
+ // cart 정보 세팅
|
|
|
|
|
+ cart.setContentsLoc(cartInfos.iterator().next().getContentsLoc());
|
|
|
|
|
+ cart.setAfLinkCd(cartInfos.iterator().next().getAfLinkCd());
|
|
|
|
|
+ cart.setIthrCd(cartInfos.iterator().next().getIthrCd());
|
|
|
|
|
+ cart.setPlanDtlSq(cartInfos.iterator().next().getPlanDtlSq());
|
|
|
|
|
+ cart.setGoodsCd(cartInfos.iterator().next().getGoodsCd());
|
|
|
|
|
+ cart.setGoodsQty(cartInfos.iterator().next().getGoodsQty());
|
|
|
|
|
+ cart.setGoodsType(cartInfos.iterator().next().getGoodsType());
|
|
|
|
|
+ cart.setItemCdSql(sb.toString());
|
|
|
|
|
+
|
|
|
|
|
+ Collection<Cart> cartSqList = null;
|
|
|
|
|
+
|
|
|
|
|
+ if (!StringUtils.isEmpty(cartInfos.iterator().next().getCartGb()) && "C".equals(cartInfos.iterator().next().getCartGb())) {
|
|
|
|
|
+ cart.setCartGb(TscConstants.CartGb.CART.value());
|
|
|
|
|
+ // 같은 장바구니 상품 확인
|
|
|
|
|
+ cartSqList = cartDao.selectHasSetItemCartList(cart);
|
|
|
|
|
+ } else if (!StringUtils.isEmpty(cartInfos.iterator().next().getCartGb()) && "O".equals(cartInfos.iterator().next().getCartGb())) {
|
|
|
|
|
+ if ("P".equals(TsfSession.getFrontGb())) {
|
|
|
|
|
+ cart.setCartGb(TscConstants.CartGb.PC_ORDER.value());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ cart.setCartGb(TscConstants.CartGb.MOB_ORDER.value());
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
- cart.setCartGb(TscConstants.CartGb.MOB_ORDER.value());
|
|
|
|
|
|
|
+ cart.setCartGb(TscConstants.CartGb.CREATE_ORDER.value());
|
|
|
}
|
|
}
|
|
|
- } else {
|
|
|
|
|
- cart.setCartGb(TscConstants.CartGb.CREATE_ORDER.value());
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- if (cartSqList != null && cartSqList.size() > 0) { // 장바구니 기존재
|
|
|
|
|
- if (cartSqList.size() > 1) { // 장바구니 조회 결과 이상시 insert or select 수정 필요
|
|
|
|
|
- throw new IllegalArgumentException("장바구니 조회에 실패하였습니다. 관리자에게 문의해주세요.");
|
|
|
|
|
|
|
+ if (cartSqList != null && cartSqList.size() > 0) { // 장바구니 기존재
|
|
|
|
|
+ if (cartSqList.size() > 1) { // 장바구니 조회 결과 이상시 insert or select 수정 필요
|
|
|
|
|
+ throw new IllegalArgumentException("장바구니 조회에 실패하였습니다. 관리자에게 문의해주세요.");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ cart.setCartSq(cartSqList.iterator().next().getCartSq());
|
|
|
|
|
+ cartSqs.add(cart.getCartSq());
|
|
|
|
|
+ cartDao.updateCartInfo(cart); // 장바구니 정보 수정
|
|
|
|
|
+ cartDao.insertCartHst(cart); // 장바구니 수정 이력 저장
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
- cart.setCartSq(cartSqList.iterator().next().getCartSq());
|
|
|
|
|
- cartDao.updateCartInfo(cart); // 장바구니 정보 수정
|
|
|
|
|
- cartDao.insertCartHst(cart); // 장바구니 수정 이력 저장
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ cartDao.insertCartInfo(cart); // 장바구니 마스터 정보 저장
|
|
|
|
|
+ cartDao.insertCartHst(cart); // 장바구니 이력 정보 저장
|
|
|
|
|
|
|
|
- for (Cart param : params) {
|
|
|
|
|
- param.setCartSq(cart.getCartSq());
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- cartDao.insertCartInfo(cart); // 장바구니 마스터 정보 저장
|
|
|
|
|
- cartDao.insertCartHst(cart); // 장바구니 이력 정보 저장
|
|
|
|
|
-
|
|
|
|
|
- TsfSession.setAttribute("cartSqArr", cart.getCartSq()+"");
|
|
|
|
|
|
|
+ cartSqs.add(cart.getCartSq());
|
|
|
|
|
+ TsfSession.setAttribute("cartSqArr", cart.getCartSq()+"");
|
|
|
|
|
|
|
|
- for (Cart param : params) {
|
|
|
|
|
- param.setCartSq(cart.getCartSq());
|
|
|
|
|
- param.setRegNo(cart.getRegNo());
|
|
|
|
|
- param.setCustNo(cart.getCustNo());
|
|
|
|
|
- param.setUpdNo(cart.getUpdNo());
|
|
|
|
|
|
|
+ for (Cart param : cartInfos) {
|
|
|
|
|
+ param.setCartSq(cart.getCartSq());
|
|
|
|
|
+ param.setRegNo(cart.getRegNo());
|
|
|
|
|
+ param.setCustNo(cart.getCustNo());
|
|
|
|
|
+ param.setUpdNo(cart.getUpdNo());
|
|
|
|
|
|
|
|
- cartDao.insertCartDetailInfo(param); // 장바구니 상세 저장
|
|
|
|
|
- cartDao.insertCartDetailHst(param); // 장바구니 상세 이력 저장
|
|
|
|
|
|
|
+ cartDao.insertCartDetailInfo(param); // 장바구니 상세 저장
|
|
|
|
|
+ cartDao.insertCartDetailHst(param); // 장바구니 상세 이력 저장
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Transactional("shopTxnManager")
|
|
@Transactional("shopTxnManager")
|
|
|
- public void saveNormalDealCartInfo(Collection<Cart> params) {
|
|
|
|
|
|
|
+ public void saveNormalDealCartInfo(Collection<Cart> params, List<Integer> cartSqs) {
|
|
|
Cart cart = new Cart();
|
|
Cart cart = new Cart();
|
|
|
// 로그인 정보
|
|
// 로그인 정보
|
|
|
if(TsfSession.isLogin()) {
|
|
if(TsfSession.isLogin()) {
|
|
@@ -265,6 +355,7 @@ public class TsfCartService {
|
|
|
throw new IllegalArgumentException("장바구니 조회에 실패하였습니다. 관리자에게 문의해주세요.");
|
|
throw new IllegalArgumentException("장바구니 조회에 실패하였습니다. 관리자에게 문의해주세요.");
|
|
|
} else {
|
|
} else {
|
|
|
item.setCartSq(cartSqList.iterator().next());
|
|
item.setCartSq(cartSqList.iterator().next());
|
|
|
|
|
+ cartSqs.add(item.getCartSq());
|
|
|
cartDao.updateCartInfo(item);
|
|
cartDao.updateCartInfo(item);
|
|
|
cartDao.insertCartHst(item); // 장바구니 수정 이력 저장
|
|
cartDao.insertCartHst(item); // 장바구니 수정 이력 저장
|
|
|
}
|
|
}
|
|
@@ -274,6 +365,7 @@ public class TsfCartService {
|
|
|
cartDao.insertCartDetailInfo(item); // 장바구니 상세 저장
|
|
cartDao.insertCartDetailInfo(item); // 장바구니 상세 저장
|
|
|
cartDao.insertCartDetailHst(item); // 장바구니 수정 이력 저장
|
|
cartDao.insertCartDetailHst(item); // 장바구니 수정 이력 저장
|
|
|
|
|
|
|
|
|
|
+ cartSqs.add(item.getCartSq());
|
|
|
sendCartSqList.add(item.getCartSq() + "");
|
|
sendCartSqList.add(item.getCartSq() + "");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|