|
@@ -245,15 +245,43 @@ public class TsfCartService {
|
|
|
// 품절체크
|
|
// 품절체크
|
|
|
for(Order goods : cartGoodsList) {
|
|
for(Order goods : cartGoodsList) {
|
|
|
// 상품 재고 확인
|
|
// 상품 재고 확인
|
|
|
- /*GoodsStock checkParam = new GoodsStock();
|
|
|
|
|
- checkParam.setGoodsCd(goods.getGoodsCd());
|
|
|
|
|
- checkParam.setItemCd(goods.getItemCd());
|
|
|
|
|
- checkParam.setOptCd(goods.getOptCd());
|
|
|
|
|
- checkParam.setGoodsQty(goods.getGoodsQty());
|
|
|
|
|
- checkParam.setGoodsType(goods.getGoodsType());
|
|
|
|
|
- String stockResult = goodsService.getCheckStock(checkParam);*/
|
|
|
|
|
|
|
+ GoodsStock checkParam = new GoodsStock();
|
|
|
|
|
|
|
|
- String stockResult = "SUCCESS";
|
|
|
|
|
|
|
+ String stockResult = "";
|
|
|
|
|
+ // 세트 상품일 경우
|
|
|
|
|
+ if(TscConstants.GoodsType.SET.value().equals(goods.getGoodsType())) {
|
|
|
|
|
+ Order tempItem = new Order();
|
|
|
|
|
+ // 세트 구성품이 여러개일 경우
|
|
|
|
|
+ if (goods.getItemCd().contains(",")) {
|
|
|
|
|
+ tempItem.setItemCdArr(goods.getItemCd().split(","));
|
|
|
|
|
+ tempItem.setOptCdArr(goods.getOptCd().split(","));
|
|
|
|
|
+ for(int i = 0 ; i < tempItem.getItemCdArr().length ; i++) {
|
|
|
|
|
+ checkParam.setGoodsCd(goods.getGoodsCd());
|
|
|
|
|
+ checkParam.setItemCd(tempItem.getItemCdArr()[i]);
|
|
|
|
|
+ checkParam.setOptCd(tempItem.getOptCdArr()[i]);
|
|
|
|
|
+ checkParam.setGoodsQty(goods.getGoodsQty());
|
|
|
|
|
+ checkParam.setGoodsType(goods.getGoodsType());
|
|
|
|
|
+ stockResult = goodsService.getCheckStock(checkParam);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else { // 세트 구성품이 하나일 경우
|
|
|
|
|
+ checkParam.setGoodsCd(goods.getGoodsCd());
|
|
|
|
|
+ checkParam.setItemCd(goods.getItemCd());
|
|
|
|
|
+ checkParam.setOptCd(goods.getOptCd());
|
|
|
|
|
+ checkParam.setGoodsQty(goods.getGoodsQty());
|
|
|
|
|
+ checkParam.setGoodsType(goods.getGoodsType());
|
|
|
|
|
+ stockResult = goodsService.getCheckStock(checkParam);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 세트상품이 아닐 경우
|
|
|
|
|
+ checkParam.setGoodsCd(goods.getGoodsCd());
|
|
|
|
|
+ checkParam.setItemCd(goods.getItemCd());
|
|
|
|
|
+ checkParam.setOptCd(goods.getOptCd());
|
|
|
|
|
+ checkParam.setGoodsQty(goods.getGoodsQty());
|
|
|
|
|
+ checkParam.setGoodsType(goods.getGoodsType());
|
|
|
|
|
+ stockResult = goodsService.getCheckStock(checkParam);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //String stockResult = "SUCCESS";
|
|
|
|
|
|
|
|
if("SUCCESS".equals(stockResult)) {
|
|
if("SUCCESS".equals(stockResult)) {
|
|
|
goods.setSoldoutYn("N");
|
|
goods.setSoldoutYn("N");
|
|
@@ -289,6 +317,9 @@ public class TsfCartService {
|
|
|
// 자사 / 입점업체 리스트 분리
|
|
// 자사 / 입점업체 리스트 분리
|
|
|
order = getCartDelvGoodsCntList(cartGoodsList);
|
|
order = getCartDelvGoodsCntList(cartGoodsList);
|
|
|
|
|
|
|
|
|
|
+ // 총계 금액 계산
|
|
|
|
|
+ setCartListTotAmtInfo(cartGoodsList, order);
|
|
|
|
|
+
|
|
|
return order;
|
|
return order;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -645,4 +676,34 @@ public class TsfCartService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public void setCartListTotAmtInfo(Collection<Order> cartGoodsList, Order order) {
|
|
|
|
|
+ // 장바구니 합계 금액 계산
|
|
|
|
|
+ int notSoldoutCnt = 0;
|
|
|
|
|
+ for(Order cart : cartGoodsList) {
|
|
|
|
|
+ if("N".equals(cart.getSoldoutYn())) {
|
|
|
|
|
+ notSoldoutCnt++;
|
|
|
|
|
+ // 상품 금액 합계
|
|
|
|
|
+ order.setSumOrdAmt(order.getSumOrdAmt() + cart.getCurrPrice());
|
|
|
|
|
+
|
|
|
|
|
+ // 할인 제외 금액 총계
|
|
|
|
|
+ if(cart.getTmtbDcAmt() == 0) {
|
|
|
|
|
+ order.setSumRealPayAmt(order.getSumRealPayAmt() + cart.getCurrPrice());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ order.setSumRealPayAmt(order.getSumRealPayAmt() + cart.getTmtbDcAmt());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 배송비 합계
|
|
|
|
|
+ if("Y".equals(cart.getFirstCompYn())) {
|
|
|
|
|
+ order.setTotDelvFee(order.getTotDelvFee() + cart.getDelvFee());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 상품 할인금액 총계
|
|
|
|
|
+ order.setTotDcAmt(order.getSumRealPayAmt() - order.getSumOrdAmt());
|
|
|
|
|
+
|
|
|
|
|
+ // 장바구니 총액 계산 상품 총 수량
|
|
|
|
|
+ order.setTotCartCnt(notSoldoutCnt);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|