|
|
@@ -4,6 +4,7 @@ import java.text.NumberFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collection;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -942,23 +943,27 @@ public class TscOrderService {
|
|
|
|
|
|
// 1. 장바구니쿠폰 ID 목록
|
|
|
for (Order cartCpnId : cartCpnIdList) {
|
|
|
- Boolean temp = true;
|
|
|
int cpnDcAmt = 0;
|
|
|
int ordAmtSum = 0;
|
|
|
- int i = 0;
|
|
|
- int len = tmtbGoodsApplyList.size();
|
|
|
- int[] cartCpnCartSqArr = new int[len];
|
|
|
+ List<Integer> result = new ArrayList<>();
|
|
|
+ List<Integer> dataList = new ArrayList<>();
|
|
|
+ Boolean temp = true;
|
|
|
|
|
|
// 2. 장바구니쿠폰 상품 연결 확인 목록
|
|
|
for (Order cartCpn : cartCpnAllList) {
|
|
|
// 3. 쿠폰 ID 기준으로 데이타 체크
|
|
|
if (cartCpnId.getCpnId().equals(cartCpn.getCpnId())) {
|
|
|
+ //if (cartCpnId.getCustCpnSq().equals(cartCpn.getCustCpnSq())) {
|
|
|
+
|
|
|
for (Order tmtbGoods : tmtbGoodsApplyList) {
|
|
|
if ("A".equals(cartCpn.getApplyScope()) || tmtbGoods.getGoodsCd().equals(cartCpn.getGoodsCd())) {
|
|
|
- cartCpnCartSqArr[i] = tmtbGoods.getCartSq();
|
|
|
- i++;
|
|
|
|
|
|
- // 3.1최소주문금액을 체크를 위한 해당 상품 주문금액 합계
|
|
|
+ // 2021.09.07 장바구니쿠폰 오류 수정
|
|
|
+ if (tmtbGoods.getCartSq() > 0) {
|
|
|
+ dataList.add(tmtbGoods.getCartSq());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 3.1 최소주문금액을 체크를 위한 해당 상품 주문금액 합계
|
|
|
if (tmtbGoods.getTmtbDcAmt() > 0) {
|
|
|
ordAmtSum = ordAmtSum + tmtbGoods.getTmtbDcAmt();
|
|
|
} else {
|
|
|
@@ -979,32 +984,37 @@ public class TscOrderService {
|
|
|
if ("G240_10".equals(cartCpn.getDcWay())) {
|
|
|
cpnDcAmt = cartCpn.getDcVal();
|
|
|
}
|
|
|
-
|
|
|
- // 7. 할인금액 최대값보다 작으면 적용 or getMaxDcAmt( == 0 이면 무제한
|
|
|
- if (cartCpn.getMaxDcAmt() > cpnDcAmt || cartCpn.getMaxDcAmt() == 0) {
|
|
|
- cartCpn.setCpnDcAmt(cpnDcAmt);
|
|
|
- } else {
|
|
|
- cartCpn.setCpnDcAmt(cartCpn.getMaxDcAmt());
|
|
|
- }
|
|
|
-
|
|
|
- // 최소금액주문이상일때 쿠폰사용불가
|
|
|
- if (cartCpn.getBuyLimitAmt() > ordAmtSum) {
|
|
|
- cartCpn.setCartCpnCartSqArr(null);
|
|
|
- } else {
|
|
|
- cartCpn.setCartCpnCartSqArr(cartCpnCartSqArr);
|
|
|
-
|
|
|
- // 2021.05.16 중복쿠폰제거
|
|
|
- for (int j=0 ; j<cartApplyCpnList.size() ; j++) {
|
|
|
- Order cartCpn1 = cartApplyCpnList.get(j);
|
|
|
- if (cartCpn1.getCustCpnSq().equals(cartCpn.getCustCpnSq())) {
|
|
|
- temp = false;
|
|
|
- }
|
|
|
- }
|
|
|
- if (temp) {
|
|
|
- cartApplyCpnList.add(cartCpn);
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 7. 할인금액 최대값보다 작으면 적용 or getMaxDcAmt( == 0 이면 무제한
|
|
|
+ if (cartCpnId.getMaxDcAmt() > cpnDcAmt || cartCpnId.getMaxDcAmt() == 0) {
|
|
|
+ cartCpnId.setCpnDcAmt(cpnDcAmt);
|
|
|
+ } else {
|
|
|
+ cartCpnId.setCpnDcAmt(cartCpnId.getMaxDcAmt());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 최소금액주문이상일때 쿠폰사용불가
|
|
|
+ if (cartCpnId.getBuyLimitAmt() > ordAmtSum) {
|
|
|
+ cartCpnId.setCartCpnCartSqArr(null);
|
|
|
+ } else {
|
|
|
+ // 2021.09.07 장바구니쿠폰 오류 수정
|
|
|
+ result = dataList.stream().distinct().collect(Collectors.toList());
|
|
|
+ int [] cartCpnCartSqArr = result.stream().mapToInt(Integer::intValue).toArray();
|
|
|
+
|
|
|
+ cartCpnId.setCartCpnCartSqArr(cartCpnCartSqArr);
|
|
|
+
|
|
|
+ temp = true;
|
|
|
+ // 2021.05.16 중복쿠폰제거
|
|
|
+ for (int j=0 ; j<cartApplyCpnList.size() ; j++) {
|
|
|
+ Order cartCpn1 = cartApplyCpnList.get(j);
|
|
|
+ if (cartCpn1.getCustCpnSq().equals(cartCpnId.getCustCpnSq())) {
|
|
|
+ temp = false;
|
|
|
}
|
|
|
}
|
|
|
+ if (temp) {
|
|
|
+ cartApplyCpnList.add(cartCpnId);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|