|
@@ -759,13 +759,6 @@ public class TsfOrderService {
|
|
|
resultStr = "포인트 할인 금액정보가 잘못 되었습니다.";
|
|
resultStr = "포인트 할인 금액정보가 잘못 되었습니다.";
|
|
|
return resultStr;
|
|
return resultStr;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- /*
|
|
|
|
|
- if (gfcdUseSumAmt != order.getGfcdUseSumAmt()) {
|
|
|
|
|
- resultStr = "상품권 사용 금액정보가 잘못 되었습니다.";
|
|
|
|
|
- return resultStr;
|
|
|
|
|
- }
|
|
|
|
|
- */
|
|
|
|
|
|
|
|
|
|
if (realOrdSumAmt != order.getRealOrdSumAmt()) {
|
|
if (realOrdSumAmt != order.getRealOrdSumAmt()) {
|
|
|
resultStr = "실결제 금액정보가 잘못 되었습니다.";
|
|
resultStr = "실결제 금액정보가 잘못 되었습니다.";
|
|
@@ -787,8 +780,7 @@ public class TsfOrderService {
|
|
|
int usGfcdAmt = 0;
|
|
int usGfcdAmt = 0;
|
|
|
|
|
|
|
|
for (Order orderDetail : orderDetailList) {
|
|
for (Order orderDetail : orderDetailList) {
|
|
|
-
|
|
|
|
|
- // TODO
|
|
|
|
|
|
|
+
|
|
|
// 2.1 상품 재고 확인 (상품정보유효성체크)
|
|
// 2.1 상품 재고 확인 (상품정보유효성체크)
|
|
|
Collection<Cart> params = new ArrayList<Cart>();
|
|
Collection<Cart> params = new ArrayList<Cart>();
|
|
|
Cart cart = new Cart();
|
|
Cart cart = new Cart();
|
|
@@ -911,12 +903,7 @@ public class TsfOrderService {
|
|
|
resultStr = "선택하신 사은품의 재고가 부족 합니다.";
|
|
resultStr = "선택하신 사은품의 재고가 부족 합니다.";
|
|
|
return resultStr;
|
|
return resultStr;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // 7. 상품금액체크
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
return resultStr;
|
|
return resultStr;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -2188,34 +2175,236 @@ public class TsfOrderService {
|
|
|
* @author jsh77b
|
|
* @author jsh77b
|
|
|
* @since 2021. 07. 23
|
|
* @since 2021. 07. 23
|
|
|
*/
|
|
*/
|
|
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
public String orderAmtValidationCheck(Order order) {
|
|
public String orderAmtValidationCheck(Order order) {
|
|
|
- String result = "";
|
|
|
|
|
|
|
+ String resultStr = "SUCCESS";
|
|
|
|
|
|
|
|
Order po = new Order();
|
|
Order po = new Order();
|
|
|
|
|
|
|
|
- // 장바구니정보 및 상품쿠폰정보, 장바구니쿠폰정보, 선포인트정보, 포인트정보, 상품권정보
|
|
|
|
|
|
|
+ // 1. 장바구니정보 및 상품쿠폰정보, 장바구니쿠폰정보, 선포인트정보, 포인트정보, 상품권정보
|
|
|
Collection<Order> orderDetailList = order.getOrderDetailList();
|
|
Collection<Order> orderDetailList = order.getOrderDetailList();
|
|
|
int [] cartSqArr = new int[orderDetailList.size()];
|
|
int [] cartSqArr = new int[orderDetailList.size()];
|
|
|
int idx = 0;
|
|
int idx = 0;
|
|
|
for (Order vo : orderDetailList) {
|
|
for (Order vo : orderDetailList) {
|
|
|
cartSqArr[idx] = vo.getCartSq();
|
|
cartSqArr[idx] = vo.getCartSq();
|
|
|
|
|
+ idx++;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
po.setCartSqArr(cartSqArr);
|
|
po.setCartSqArr(cartSqArr);
|
|
|
|
|
+ po.setCustNo(order.getCustNo());
|
|
|
|
|
|
|
|
- // 판매가정보, 즉시할인금액, 옵션금액, 다다익선적용금액 정보 조회
|
|
|
|
|
|
|
+ // 2. 판매가정보, 즉시할인금액, 옵션금액, 다다익선적용금액 정보 조회
|
|
|
Collection<Order> tmtbGoodsApplyList = cartService.getMoreBetterAmtList(po);
|
|
Collection<Order> tmtbGoodsApplyList = cartService.getMoreBetterAmtList(po);
|
|
|
|
|
|
|
|
|
|
+ // 5 상품쿠폰, 장바구니쿠폰 목록 조회
|
|
|
|
|
+ GagaMap goodsCartCpnMap = coreOrderService.getGoodsCartCpnApplyGoodsList(order);
|
|
|
|
|
|
|
|
|
|
+ Collection<Order> goodsCpnList = (Collection<Order>) goodsCartCpnMap.get("goodsCpnList");
|
|
|
|
|
+ Collection<Order> cartCpnList = (Collection<Order>) goodsCartCpnMap.get("cartCpnList");
|
|
|
|
|
+ Collection<Order> cartCpnIdList = (Collection<Order>) goodsCartCpnMap.get("cartCpnIdList");
|
|
|
|
|
+
|
|
|
|
|
+ // 6 상품쿠폰 적용된 상품 목록(상품기준)
|
|
|
|
|
+ Collection<Order> goodsApplyCpnList = coreOrderService.getGoodsCpnApplyList(tmtbGoodsApplyList, goodsCpnList);
|
|
|
|
|
|
|
|
|
|
+ // 7. 장바구니쿠폰(장바구니기준 상품목록)
|
|
|
|
|
+ cartCpnList = coreOrderService.getCartCpnApplyList(tmtbGoodsApplyList, cartCpnList, cartCpnIdList);
|
|
|
|
|
|
|
|
|
|
+ int ordAmt = 0;
|
|
|
|
|
|
|
|
|
|
+ for (Order od : tmtbGoodsApplyList) {
|
|
|
|
|
+ // 주문금액설정
|
|
|
|
|
+ ordAmt = (od.getCurrPrice() + od.getOptAddPrice()) * od.getGoodsQty();
|
|
|
|
|
+ od.setOrdAmt(ordAmt);
|
|
|
|
|
+
|
|
|
|
|
+ // 상품쿠폰시퀀스, 장바구니쿠폰시퀀스 적용
|
|
|
|
|
+ for (Order vo : orderDetailList) {
|
|
|
|
|
+ if (od.getCartSq().equals(vo.getCartSq())) {
|
|
|
|
|
+ od.setGoodsCpnSq(vo.getGoodsCpnSq());
|
|
|
|
|
+ od.setCartCpnSq(vo.getCartCpnSq());
|
|
|
|
|
+ od.setPrePntDcAmtYn(vo.getPrePntDcAmtYn());
|
|
|
|
|
+ od.setPntDcAmt(vo.getPntDcAmt());
|
|
|
|
|
+ od.setGfcdUseAmt(vo.getGfcdUseAmt());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ // 상품쿠폰 적용 금액
|
|
|
|
|
+ for (Order od : tmtbGoodsApplyList) {
|
|
|
|
|
+ for (Order tmtbGoods : goodsApplyCpnList) {
|
|
|
|
|
+ if (od.getCartSq().equals(tmtbGoods.getCartSq())) {
|
|
|
|
|
+ for (Order goodsCpn : tmtbGoods.getGoodsCpnList()) {
|
|
|
|
|
+ if (od.getGoodsCpnSq() == goodsCpn.getCustCpnSq()) {
|
|
|
|
|
+ od.setGoodsCpnDcAmt(goodsCpn.getCpnDcAmt());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ String dcWay = "";
|
|
|
|
|
+ int dcVal = 0;
|
|
|
|
|
+ int maxDcAmt = 0;
|
|
|
|
|
+ int cartCpnDcSumAmt = 0;
|
|
|
|
|
+ int leftAmt = 0;
|
|
|
|
|
+ int index = 1;
|
|
|
|
|
|
|
|
|
|
+ // 장바구니쿠폰 적용 금액
|
|
|
|
|
+ for (Order od : tmtbGoodsApplyList) {
|
|
|
|
|
+ for (Order cartCpn : cartCpnList) {
|
|
|
|
|
+ if (od.getCartCpnSq() == cartCpn.getCustCpnSq()) {
|
|
|
|
|
+ for (int i=0 ; i<cartCpn.getCartCpnCartSqArr().length ; i++) {
|
|
|
|
|
+ if (od.getCartSq().equals(cartCpn.getCartCpnCartSqArr()[i])) {
|
|
|
|
|
+ dcWay = cartCpn.getDcWay();
|
|
|
|
|
+ dcVal = cartCpn.getDcVal();
|
|
|
|
|
+ maxDcAmt = cartCpn.getMaxDcAmt();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ // 상품쿠폰, 장바구니쿠폰 적용 금액
|
|
|
|
|
+ int ordDcSumAmt = 0;
|
|
|
|
|
+ int ordDcAmt = 0;
|
|
|
|
|
|
|
|
- return result;
|
|
|
|
|
|
|
+ for (Order od : tmtbGoodsApplyList) {
|
|
|
|
|
+ // 주문할인금액설정
|
|
|
|
|
+ ordDcAmt = od.getOrdAmt() - od.getTmtb1DcAmt() - od.getTmtb2DcAmt() - od.getGoodsCpnDcAmt();
|
|
|
|
|
+ ordDcSumAmt = ordDcSumAmt + ordDcAmt;
|
|
|
|
|
+
|
|
|
|
|
+ // 율할인일때 할인금액 적용
|
|
|
|
|
+ if ("G240_11".equals(dcWay)) {
|
|
|
|
|
+ for (Order cartCpn : cartCpnList) {
|
|
|
|
|
+ if (od.getCartCpnSq() == cartCpn.getCustCpnSq()) {
|
|
|
|
|
+ for (int i=0 ; i<cartCpn.getCartCpnCartSqArr().length ; i++) {
|
|
|
|
|
+ if (od.getCartSq().equals(cartCpn.getCartCpnCartSqArr()[i])) {
|
|
|
|
|
+ int cartCpnDcAmt = (ordDcAmt * cartCpn.getDcVal()) / 100;
|
|
|
|
|
+ cartCpnDcSumAmt = cartCpnDcSumAmt + cartCpnDcAmt;
|
|
|
|
|
+ od.setCartCpnDcAmt(cartCpnDcAmt);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 2021.04.19 최대금액 체크
|
|
|
|
|
+ if (maxDcAmt > cartCpnDcSumAmt || maxDcAmt == 0) {
|
|
|
|
|
+ log.info("장바구니쿠폰 할인 ::: {} ", dcVal);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 최대값 적용 일때는 금액할인 방식을 적용
|
|
|
|
|
+ cartCpnDcSumAmt = maxDcAmt;
|
|
|
|
|
+ dcVal = cartCpnDcSumAmt;
|
|
|
|
|
+ dcWay = "G240_10";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 금액일때 할인금액 적용
|
|
|
|
|
+ if ("G240_10".equals(dcWay)) {
|
|
|
|
|
+ cartCpnDcSumAmt = dcVal;
|
|
|
|
|
+ leftAmt = dcVal;
|
|
|
|
|
+ index = 1;
|
|
|
|
|
+
|
|
|
|
|
+ for (Order cartCpn : cartCpnList) {
|
|
|
|
|
+ for (Order od : tmtbGoodsApplyList) {
|
|
|
|
|
+ // 장바구니 쿠폰 시퀀스 체크
|
|
|
|
|
+ if (od.getCartCpnSq() == cartCpn.getCustCpnSq()) {
|
|
|
|
|
+ for (int i=0 ; i<cartCpn.getCartCpnCartSqArr().length ; i++) {
|
|
|
|
|
+ // 장바구니 시퀀스 체크
|
|
|
|
|
+ if (od.getCartSq().equals(cartCpn.getCartCpnCartSqArr()[i])) {
|
|
|
|
|
+
|
|
|
|
|
+ // 주문금액 - 할인금액(상품쿠폰할인금액)
|
|
|
|
|
+ ordDcAmt = od.getOrdAmt() - od.getTmtb1DcAmt() - od.getTmtb2DcAmt() - od.getGoodsCpnDcAmt();
|
|
|
|
|
+ double tempDiv1 = (double) ordDcAmt / ordDcSumAmt;
|
|
|
|
|
+ double tempDiv2 = (double) tempDiv1 * 100.0;
|
|
|
|
|
+ double tempDiv = (double) Math.round((tempDiv2) * 100.0) / 100.0;
|
|
|
|
|
+
|
|
|
|
|
+ int cartCpnDcAmt = 0;
|
|
|
|
|
+
|
|
|
|
|
+ if (index == cartCpn.getCartCpnCartSqArr().length) {
|
|
|
|
|
+ cartCpnDcAmt = leftAmt;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ double tempCartCpnDcAmt = (cartCpnDcSumAmt * tempDiv) / 100;
|
|
|
|
|
+ cartCpnDcAmt = (int) tempCartCpnDcAmt;
|
|
|
|
|
+ leftAmt = leftAmt - cartCpnDcAmt;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ od.setCartCpnDcAmt(cartCpnDcAmt);
|
|
|
|
|
+
|
|
|
|
|
+ index++;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ int cartDcSumAmt = 0;
|
|
|
|
|
+
|
|
|
|
|
+ for (Order od : tmtbGoodsApplyList) {
|
|
|
|
|
+ log.info("----------------------------------------------------------------------------");
|
|
|
|
|
+ log.info("cartSq ::: {}" , od.getCartSq());
|
|
|
|
|
+ log.info("orgCurrPrice ::: {}" , od.getOrgCurrPrice());
|
|
|
|
|
+ log.info("cpn1DcAmt ::: {}" , od.getOrgCurrPrice() - od.getCurrPrice());
|
|
|
|
|
+ log.info("optAddPrice ::: {}" , od.getOptAddPrice());
|
|
|
|
|
+ log.info("goodsQty ::: {}" , od.getGoodsQty());
|
|
|
|
|
+ log.info("ordAmt ::: {}" , od.getOrdAmt());
|
|
|
|
|
+ log.info("tmtb1DcAmt ::: {}" , od.getTmtb1DcAmt());
|
|
|
|
|
+ log.info("tmtb2DcAmt ::: {}" , od.getTmtb2DcAmt());
|
|
|
|
|
+ log.info("prePntDcAmt ::: {}" , od.getPrePntDcAmt());
|
|
|
|
|
+ log.info("goodsCpnDcAmt ::: {}" , od.getGoodsCpnDcAmt());
|
|
|
|
|
+ log.info("cartCpnDcAmt ::: {}" , od.getCartCpnDcAmt());
|
|
|
|
|
+ log.info("pntDcAmt ::: {}" , od.getPntDcAmt());
|
|
|
|
|
+ log.info("gfcdUseAmt ::: {}" , od.getGfcdUseAmt());
|
|
|
|
|
+
|
|
|
|
|
+ for (Order vo : orderDetailList) {
|
|
|
|
|
+ if (od.getCartSq().equals(vo.getCartSq())) {
|
|
|
|
|
+ if (od.getOrdAmt() != vo.getOrdAmt()) {
|
|
|
|
|
+ resultStr = "주문금액정보가 잘못 되었습니다.";
|
|
|
|
|
+ return resultStr;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (od.getTmtb1DcAmt() != vo.getTmtb1DcAmt()) {
|
|
|
|
|
+ resultStr = "다다익선수량 할인 금액정보가 잘못 되었습니다.";
|
|
|
|
|
+ return resultStr;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (od.getTmtb2DcAmt() != vo.getTmtb2DcAmt()) {
|
|
|
|
|
+ resultStr = "다다익선금액 할인 금액정보가 잘못 되었습니다.";
|
|
|
|
|
+ return resultStr;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (od.getGoodsCpnDcAmt() != vo.getGoodsCpnDcAmt()) {
|
|
|
|
|
+ resultStr = "상품쿠폰 할인 금액정보가 잘못 되었습니다.";
|
|
|
|
|
+ return resultStr;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ if (od.getCartCpnDcAmt() != vo.getCartCpnDcAmt()) {
|
|
|
|
|
+ resultStr = "장바구니쿠폰 할인 금액정보가 잘못 되었습니다.";
|
|
|
|
|
+ return resultStr;
|
|
|
|
|
+ }
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
|
|
+ if ("Y".equals(od.getPrePntDcAmtYn())) {
|
|
|
|
|
+ if (od.getPrePntDcAmt() != vo.getPrePntDcAmt()) {
|
|
|
|
|
+ resultStr = "선포인트 할인 금액정보가 잘못 되었습니다.";
|
|
|
|
|
+ return resultStr;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ cartDcSumAmt = cartDcSumAmt + od.getCartCpnDcAmt();
|
|
|
|
|
+ log.info("----------------------------------------------------------------------------");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 2021.10.13 장바구니금액
|
|
|
|
|
+ if (order.getCartCpnDcSumAmt() != cartDcSumAmt) {
|
|
|
|
|
+ resultStr = "장바구니쿠폰 할인 금액정보가 잘못 되었습니다.";
|
|
|
|
|
+ return resultStr;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return resultStr;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|