|
|
@@ -759,13 +759,6 @@ public class TsfOrderService {
|
|
|
resultStr = "포인트 할인 금액정보가 잘못 되었습니다.";
|
|
|
return resultStr;
|
|
|
}
|
|
|
-
|
|
|
- /*
|
|
|
- if (gfcdUseSumAmt != order.getGfcdUseSumAmt()) {
|
|
|
- resultStr = "상품권 사용 금액정보가 잘못 되었습니다.";
|
|
|
- return resultStr;
|
|
|
- }
|
|
|
- */
|
|
|
|
|
|
if (realOrdSumAmt != order.getRealOrdSumAmt()) {
|
|
|
resultStr = "실결제 금액정보가 잘못 되었습니다.";
|
|
|
@@ -787,8 +780,7 @@ public class TsfOrderService {
|
|
|
int usGfcdAmt = 0;
|
|
|
|
|
|
for (Order orderDetail : orderDetailList) {
|
|
|
-
|
|
|
- // TODO
|
|
|
+
|
|
|
// 2.1 상품 재고 확인 (상품정보유효성체크)
|
|
|
Collection<Cart> params = new ArrayList<Cart>();
|
|
|
Cart cart = new Cart();
|
|
|
@@ -911,12 +903,7 @@ public class TsfOrderService {
|
|
|
resultStr = "선택하신 사은품의 재고가 부족 합니다.";
|
|
|
return resultStr;
|
|
|
}
|
|
|
-
|
|
|
- // 7. 상품금액체크
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
return resultStr;
|
|
|
|
|
|
}
|
|
|
@@ -2189,7 +2176,7 @@ public class TsfOrderService {
|
|
|
*/
|
|
|
@SuppressWarnings("unchecked")
|
|
|
public String orderAmtValidationCheck(Order order) {
|
|
|
- String result = "";
|
|
|
+ String resultStr = "SUCCESS";
|
|
|
|
|
|
Order po = new Order();
|
|
|
|
|
|
@@ -2240,7 +2227,7 @@ public class TsfOrderService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 상품쿠폰, 장바구니쿠폰 적용 금액
|
|
|
+ // 상품쿠폰 적용 금액
|
|
|
for (Order od : tmtbGoodsApplyList) {
|
|
|
for (Order tmtbGoods : goodsApplyCpnList) {
|
|
|
if (od.getCartSq().equals(tmtbGoods.getCartSq())) {
|
|
|
@@ -2253,11 +2240,103 @@ public class TsfOrderService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ 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;
|
|
|
|
|
|
+ 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++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
for (Order od : tmtbGoodsApplyList) {
|
|
|
log.info("----------------------------------------------------------------------------");
|
|
|
log.info("cartSq ::: {}" , od.getCartSq());
|
|
|
@@ -2270,39 +2349,51 @@ public class TsfOrderService {
|
|
|
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());
|
|
|
- log.info("pntPrate ::: {}" , od.getPntPrate());
|
|
|
- log.info("pntMrate ::: {}" , od.getPntMrate());
|
|
|
-
|
|
|
- if ("Y".equals(od.getPrePntDcAmtYn())) {
|
|
|
- ordDcAmt = od.getOrdAmt() - od.getTmtb1DcAmt() - od.getTmtb2DcAmt() - od.getGoodsCpnDcAmt() - od.getPrePntDcAmt();
|
|
|
- } else {
|
|
|
- ordDcAmt = od.getOrdAmt() - od.getTmtb1DcAmt() - od.getTmtb2DcAmt() - od.getGoodsCpnDcAmt();
|
|
|
- }
|
|
|
-
|
|
|
- ordDcSumAmt = ordDcSumAmt + ordDcAmt;
|
|
|
+ log.info("gfcdUseAmt ::: {}" , od.getGfcdUseAmt());
|
|
|
|
|
|
- /*
|
|
|
- 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])) {
|
|
|
- log.info("vo.getCartSq() ::: {}", od.getCartSq());
|
|
|
- log.info("cartCpn.getCpnSq() ::: {}", cartCpn.getCpnSq());
|
|
|
- log.info("cartCpn.getDcWay() ::: {}", cartCpn.getDcWay());
|
|
|
- log.info("cartCpn.getDcVal() ::: {}", cartCpn.getDcVal());
|
|
|
- log.info("cartCpn.getMaxDcAmt() ::: {}", cartCpn.getMaxDcAmt());
|
|
|
- log.info("cartCpn.getBuyLimitAmt() ::: {}", cartCpn.getBuyLimitAmt());
|
|
|
+ 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;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- */
|
|
|
|
|
|
log.info("----------------------------------------------------------------------------");
|
|
|
}
|
|
|
- return result;
|
|
|
+
|
|
|
+
|
|
|
+ return resultStr;
|
|
|
}
|
|
|
|
|
|
/**
|