일반주문 할인 및 배송비 계산 수정(2)
This commit is contained in:
@@ -159,6 +159,8 @@ public class BOOrderService {
|
|||||||
DlvyGroupList.add(item);
|
DlvyGroupList.add(item);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
BigDecimal bundleDlvyAmtYSlepricSum = new BigDecimal(0); // 조건부 무료배송 묶음 O : 상품금액 합
|
||||||
|
|
||||||
DlvyGroupList.sort(Comparator.comparing((DataMap map) -> (BigInteger) map.get("goodsInnb")).thenComparing((DataMap map) -> (BigInteger) map.get("goodsOptnInnb")) .thenComparing((DataMap map) -> (BigInteger) map.get("dlvyGroupInnb"))); // 정렬
|
DlvyGroupList.sort(Comparator.comparing((DataMap map) -> (BigInteger) map.get("goodsInnb")).thenComparing((DataMap map) -> (BigInteger) map.get("goodsOptnInnb")) .thenComparing((DataMap map) -> (BigInteger) map.get("dlvyGroupInnb"))); // 정렬
|
||||||
|
|
||||||
// 배송그룹고유번호별 상품목록
|
// 배송그룹고유번호별 상품목록
|
||||||
@@ -184,6 +186,8 @@ public class BOOrderService {
|
|||||||
BigDecimal itemDlvyAmt = itemDftDlvyAmt; // 배송비
|
BigDecimal itemDlvyAmt = itemDftDlvyAmt; // 배송비
|
||||||
String itemDlvyAreaAditAt = (String) shippingGrouping.get("dlvyAreaAditAt"); // 도서산간 추가 배송비 조건
|
String itemDlvyAreaAditAt = (String) shippingGrouping.get("dlvyAreaAditAt"); // 도서산간 추가 배송비 조건
|
||||||
BigDecimal itemAreaAditDlvyAmt = (BigDecimal) shippingGrouping.get("areaAditDlvyAmt"); // 도서산간 추가 배송비
|
BigDecimal itemAreaAditDlvyAmt = (BigDecimal) shippingGrouping.get("areaAditDlvyAmt"); // 도서산간 추가 배송비
|
||||||
|
String itemBundleDlvyUseAt = (String) shippingGrouping.get("bundleDlvyUseAt"); // 묶음배송 사용여부
|
||||||
|
BigDecimal itemBundleDlvyCndAmt = (BigDecimal) shippingGrouping.get("bundleDlvyCndAmt"); // 묶음배송 사용금액
|
||||||
String itemAmtCndUseAt = (String) shippingGrouping.get("amtCndUseAt"); // 금액조건
|
String itemAmtCndUseAt = (String) shippingGrouping.get("amtCndUseAt"); // 금액조건
|
||||||
BigDecimal itemAmtCndAditAmt = (BigDecimal) shippingGrouping.get("amtCndAditAmt");
|
BigDecimal itemAmtCndAditAmt = (BigDecimal) shippingGrouping.get("amtCndAditAmt");
|
||||||
String itemCntCndUseAt = (String) shippingGrouping.get("cntCndUseAt"); // 수량조건
|
String itemCntCndUseAt = (String) shippingGrouping.get("cntCndUseAt"); // 수량조건
|
||||||
@@ -194,34 +198,15 @@ public class BOOrderService {
|
|||||||
itemDlvyAmt = itemDftDlvyAmt; // 배송비
|
itemDlvyAmt = itemDftDlvyAmt; // 배송비
|
||||||
itemDlvyAreaAditAt = (String) shippingGrouping.get("dlvyAreaAditAt2"); // 도서산간 추가 배송비 조건
|
itemDlvyAreaAditAt = (String) shippingGrouping.get("dlvyAreaAditAt2"); // 도서산간 추가 배송비 조건
|
||||||
itemAreaAditDlvyAmt = (BigDecimal) shippingGrouping.get("areaAditDlvyAmt2"); // 도서산간 추가 배송비
|
itemAreaAditDlvyAmt = (BigDecimal) shippingGrouping.get("areaAditDlvyAmt2"); // 도서산간 추가 배송비
|
||||||
|
itemBundleDlvyUseAt = (String) shippingGrouping.get("bundleDlvyUseAt2"); // 묶음배송 사용여부
|
||||||
|
itemBundleDlvyCndAmt = (BigDecimal) shippingGrouping.get("bundleDlvyCndAmt2"); // 묶음배송 사용금액
|
||||||
itemAmtCndUseAt = (String) shippingGrouping.get("amtCndUseAt2"); // 금액조건
|
itemAmtCndUseAt = (String) shippingGrouping.get("amtCndUseAt2"); // 금액조건
|
||||||
itemAmtCndAditAmt = (BigDecimal) shippingGrouping.get("amtCndAditAmt");
|
itemAmtCndAditAmt = (BigDecimal) shippingGrouping.get("amtCndAditAmt");
|
||||||
itemCntCndUseAt = (String) shippingGrouping.get("cntCndUseAt2"); // 수량조건
|
itemCntCndUseAt = (String) shippingGrouping.get("cntCndUseAt2"); // 수량조건
|
||||||
itemCntCndAditAmt = (BigDecimal) shippingGrouping.get("cntCndAditAmt2"); // 수량
|
itemCntCndAditAmt = (BigDecimal) shippingGrouping.get("cntCndAditAmt2"); // 수량
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// else if ("03".equals(itemDlvyGroupDvCd)) { // 유료배송
|
||||||
|
|
||||||
// // 무료배송(조건부)
|
|
||||||
// if ("01".equals(itemDlvyGroupDvCd)) {
|
|
||||||
//
|
|
||||||
// // 추가배송비 계산 (MUL)
|
|
||||||
// if (!StringUtils.isEmpty(itemDlvyAreaAditAt) && "Y".equals(itemDlvyAreaAditAt)) {
|
|
||||||
// if (!StringUtils.isEmpty(defaultAdressAt) && "Y".equals(defaultAdressAt)) {
|
|
||||||
// itemDlvyAmt = itemDlvyAmt.add(itemAreaAditDlvyAmt); // 유료 배송 도서산간 추가 배송비
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// } else if ("02".equals(itemDlvyGroupDvCd)) { // 무료 배송일 경우
|
|
||||||
//
|
|
||||||
// // 추가배송비 계산 (MUL)
|
|
||||||
// if (!StringUtils.isEmpty(itemDlvyAreaAditAt) && "Y".equals(itemDlvyAreaAditAt)) {
|
|
||||||
// if (!StringUtils.isEmpty(defaultAdressAt) && "Y".equals(defaultAdressAt)) {
|
|
||||||
// itemDlvyAmt = itemDlvyAmt.add(itemAreaAditDlvyAmt); // 유료 배송 도서산간 추가 배송비
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// } else if ("03".equals(itemDlvyGroupDvCd)) { // 유료배송
|
|
||||||
if ("03".equals(itemDlvyGroupDvCd) || subsvcAt) { // 유료배송
|
if ("03".equals(itemDlvyGroupDvCd) || subsvcAt) { // 유료배송
|
||||||
|
|
||||||
// 추가배송비 계산 (MUL)
|
// 추가배송비 계산 (MUL)
|
||||||
@@ -378,6 +363,110 @@ public class BOOrderService {
|
|||||||
|
|
||||||
// } // DlvyGroupDvCd 무료배송, 유료배송
|
// } // DlvyGroupDvCd 무료배송, 유료배송
|
||||||
} else { // 조건부 무료 or 무료 배송일 경우
|
} else { // 조건부 무료 or 무료 배송일 경우
|
||||||
|
|
||||||
|
// 무료배송(조건부)
|
||||||
|
if ("01".equals(itemDlvyGroupDvCd)) {
|
||||||
|
|
||||||
|
List<LinkedHashMap> itemGoodsList = new ArrayList<>();
|
||||||
|
|
||||||
|
for (DataMap goodsMap : goodsByDlvyGroupList) {
|
||||||
|
|
||||||
|
BigDecimal subSlepric = new BigDecimal(String.valueOf(goodsMap.get("subSlepric"))); // 판매가 * 수량
|
||||||
|
|
||||||
|
// 금액 조건
|
||||||
|
if ("Y".equals(itemAmtCndUseAt)) {
|
||||||
|
// subSlepric(금액)이 무료배송 금액조건보다 클 경우 [상품 기준]
|
||||||
|
if (subSlepric.compareTo(itemAmtCndAditAmt) > 0) {
|
||||||
|
itemDlvyAmt = new BigDecimal(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 수량 조건
|
||||||
|
if ("Y".equals(itemCntCndUseAt)) {
|
||||||
|
BigDecimal qy = new BigDecimal(String.valueOf(goodsMap.get("qy"))); // 수량
|
||||||
|
|
||||||
|
// qy(수량)이 무료배송 수량조건보다 클 경우 [상품 기준]
|
||||||
|
if (qy.compareTo(itemCntCndAditAmt) > 0) {
|
||||||
|
itemDlvyAmt = new BigDecimal(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 묶음배송 조건 사용여부 [상품리스트 전체 기준]
|
||||||
|
if ("Y".equals(itemBundleDlvyUseAt)) { // 묶음 O
|
||||||
|
|
||||||
|
// 묶음배송 사용여부 Y && 상품건수 1개 이상
|
||||||
|
if (goodsByDlvyGroupList.size() > 0) {
|
||||||
|
// 묶음배송 조건금액이 있으면
|
||||||
|
if (itemBundleDlvyCndAmt != null && itemBundleDlvyCndAmt.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
|
||||||
|
bundleDlvyAmtYSlepricSum = bundleDlvyAmtYSlepricSum.add(subSlepric);
|
||||||
|
|
||||||
|
// bundleDlvyAmtYSlepricSum 값이 itemBundleDlvyCndAmt 보다 크거나 같으면( 묶음배송 무료조건을 만족하면)
|
||||||
|
if (bundleDlvyAmtYSlepricSum.compareTo(itemBundleDlvyCndAmt) >= 0) {
|
||||||
|
itemDlvyAmt = new BigDecimal(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// multi shipping -> goodsList int값으로 변환
|
||||||
|
goodsMap.put("goodsInnb", new BigInteger(String.valueOf(goodsMap.get("goodsInnb"))).intValue());
|
||||||
|
goodsMap.put("goodsOptnInnb", new BigInteger(String.valueOf(goodsMap.get("goodsOptnInnb"))).intValue());
|
||||||
|
goodsMap.put("dlvyGroupInnb", new BigInteger(String.valueOf(goodsMap.get("dlvyGroupInnb"))).intValue());
|
||||||
|
goodsMap.put("qy", new BigInteger(String.valueOf(goodsMap.get("qy"))).intValue());
|
||||||
|
|
||||||
|
goodsMap.put("dscntApplyAmt", new BigInteger(String.valueOf(goodsMap.get("dscntApplyAmt"))).intValue());
|
||||||
|
goodsMap.put("slepric", new BigInteger(String.valueOf(goodsMap.get("slepric"))).intValue());
|
||||||
|
goodsMap.put("subSlepric", new BigInteger(String.valueOf(goodsMap.get("subSlepric"))).intValue());
|
||||||
|
goodsMap.put("dscntAmt", new BigInteger(String.valueOf(goodsMap.get("dscntAmt"))).intValue());
|
||||||
|
goodsMap.put("mbrInnb", new BigInteger(String.valueOf(goodsMap.get("mbrInnb"))).intValue());
|
||||||
|
|
||||||
|
itemGoodsList.add(new LinkedHashMap<>(goodsMap));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
List<LinkedHashMap> itempPrsntList = new ArrayList<>();
|
||||||
|
// if(!prsntList.isEmpty()){
|
||||||
|
// itempPrsntList.add(prsntList.get(i));
|
||||||
|
// for (LinkedHashMap<String, Object> itemPrsntMap : itempPrsntList) {
|
||||||
|
// itemPrsntMap.put("qy", qy.intValue());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 추가배송비 계산 (MUL)
|
||||||
|
if (!StringUtils.isEmpty(itemDlvyAreaAditAt) && "Y".equals(itemDlvyAreaAditAt)) {
|
||||||
|
if (!StringUtils.isEmpty(defaultAdressAt) && "Y".equals(defaultAdressAt)) {
|
||||||
|
itemDlvyAmt = itemDlvyAmt.add(itemAreaAditDlvyAmt); // 유료 배송 도서산간 추가 배송비
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LinkedHashMap<String, Object> dlvyMap = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
dlvyMap.put("dftDlvyAmt", itemDftDlvyAmt.intValue());
|
||||||
|
dlvyMap.put("dlvyAmt", itemDlvyAmt.intValue());
|
||||||
|
dlvyMap.put("couponInnb", 0);
|
||||||
|
dlvyMap.put("dwldCouponInnb", 0);
|
||||||
|
dlvyMap.put("dplctDscntAt", "");
|
||||||
|
dlvyMap.put("otrCouponSmtmUseAt", "");
|
||||||
|
dlvyMap.put("mngrFreeDlvyUseAt", "N");
|
||||||
|
dlvyMap.put("dlvylcAreaCd", shipping.get("dlvylcAreaCd"));
|
||||||
|
dlvyMap.put("cstmclerCd", shipping.get("cstmclerCd"));
|
||||||
|
dlvyMap.put("dlvylcZip", shipping.get("dlvylcZip"));
|
||||||
|
dlvyMap.put("prefcd", shipping.get("prefcd"));
|
||||||
|
dlvyMap.put("recpntNm", shipping.get("recpntNm"));
|
||||||
|
dlvyMap.put("recpntMbtlnb", shipping.get("recpntMbtlnb"));
|
||||||
|
dlvyMap.put("dlvylcAdresDvCd", shipping.get("dlvylcAdresDvCd"));
|
||||||
|
dlvyMap.put("dlvylcLnbAdres", shipping.get("dlvylcLnbAdres"));
|
||||||
|
dlvyMap.put("dlvylcRnmAdres", shipping.get("dlvylcRnmAdres"));
|
||||||
|
dlvyMap.put("dlvylcAdresDtl", shipping.get("dlvylcAdresDtl"));
|
||||||
|
dlvyMap.put("dlvyMssageCn", shipping.get("dlvyMssageCn"));
|
||||||
|
dlvyMap.put("goodsList", itemGoodsList);
|
||||||
|
dlvyMap.put("prsntList", itempPrsntList); //prsntList.get(i));
|
||||||
|
|
||||||
|
dlvylcListMulti.add(dlvyMap);
|
||||||
|
|
||||||
|
} else if ("02".equals(itemDlvyGroupDvCd)) { // 무료 배송일 경우
|
||||||
|
|
||||||
// 추가배송비 계산 (MUL)
|
// 추가배송비 계산 (MUL)
|
||||||
if (!StringUtils.isEmpty(itemDlvyAreaAditAt) && "Y".equals(itemDlvyAreaAditAt)) {
|
if (!StringUtils.isEmpty(itemDlvyAreaAditAt) && "Y".equals(itemDlvyAreaAditAt)) {
|
||||||
if (!StringUtils.isEmpty(defaultAdressAt) && "Y".equals(defaultAdressAt)) {
|
if (!StringUtils.isEmpty(defaultAdressAt) && "Y".equals(defaultAdressAt)) {
|
||||||
@@ -439,6 +528,8 @@ public class BOOrderService {
|
|||||||
dlvylcListMulti.add(dlvyMap);
|
dlvylcListMulti.add(dlvyMap);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // 조건부 무료 or 무료 배송일 경우
|
||||||
// dlvyAmtByDlvyGroupList.add(dlvyGroupMap); // 배송그룹별 배송비 목록
|
// dlvyAmtByDlvyGroupList.add(dlvyGroupMap); // 배송그룹별 배송비 목록
|
||||||
} // for : dlvyGroupEtry
|
} // for : dlvyGroupEtry
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user