일반주문 할인 및 배송비 계산 수정(1)
This commit is contained in:
@@ -2,7 +2,6 @@ package com.wb.domainserver.domain.gcone.goods.purchs.service;
|
|||||||
|
|
||||||
import com.nimbusds.jose.shaded.gson.Gson;
|
import com.nimbusds.jose.shaded.gson.Gson;
|
||||||
import com.wb.domainserver.domain.admin.instcSle.mtng.service.BOMaMtngService;
|
import com.wb.domainserver.domain.admin.instcSle.mtng.service.BOMaMtngService;
|
||||||
import com.wb.domainserver.domain.admin.instcSle.mtng.vo.BOInstcSleVO;
|
|
||||||
import com.wb.domainserver.domain.gcone.bbs.cnslt.service.BOCnsltService;
|
import com.wb.domainserver.domain.gcone.bbs.cnslt.service.BOCnsltService;
|
||||||
import com.wb.domainserver.domain.gcone.bbs.cnslt.vo.BOCnsltVO;
|
import com.wb.domainserver.domain.gcone.bbs.cnslt.vo.BOCnsltVO;
|
||||||
import com.wb.domainserver.domain.gcone.common.service.BOCommonService;
|
import com.wb.domainserver.domain.gcone.common.service.BOCommonService;
|
||||||
@@ -12,7 +11,6 @@ import com.wb.domainserver.domain.gcone.ordr.ordr.mapper.BOOrdrMapper;
|
|||||||
import com.wb.domainserver.domain.gcone.ordr.ordr.vo.BOOrderRestAmtVO;
|
import com.wb.domainserver.domain.gcone.ordr.ordr.vo.BOOrderRestAmtVO;
|
||||||
import com.wb.domainserver.exception.WnbtRestException;
|
import com.wb.domainserver.exception.WnbtRestException;
|
||||||
import com.wb.domainserver.security.authentication.AnonymousUser;
|
import com.wb.domainserver.security.authentication.AnonymousUser;
|
||||||
import com.wb.domainserver.security.authentication.MemberJwtToken;
|
|
||||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||||
import com.wb.domainserver.util.string.StringUtil;
|
import com.wb.domainserver.util.string.StringUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -25,7 +23,6 @@ import org.springframework.util.StringUtils;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -98,6 +95,7 @@ public class BOOrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String ordrTyCd = (String) param.get("ordrTyCd");
|
String ordrTyCd = (String) param.get("ordrTyCd");
|
||||||
|
String bfOrdrTyCd = (String) param.get("ordrTyCd");
|
||||||
|
|
||||||
log.debug("insertMngrOrdrRegist-param : {}", param);
|
log.debug("insertMngrOrdrRegist-param : {}", param);
|
||||||
|
|
||||||
@@ -105,313 +103,6 @@ public class BOOrderService {
|
|||||||
0. 배송 정책에 따른 배송지 세팅
|
0. 배송 정책에 따른 배송지 세팅
|
||||||
***************************** */
|
***************************** */
|
||||||
|
|
||||||
// /** 여러곳 배송 배송지 세팅 시작 */
|
|
||||||
// LinkedHashMap<String, Object> multiOrdrDlvylcMap = new LinkedHashMap<>();
|
|
||||||
// List<LinkedHashMap<String, Object>> dlvylcListMulti = new ArrayList<>();
|
|
||||||
//
|
|
||||||
// multiOrdrDlvylcMap = (LinkedHashMap) param.get("multiOrdrDlvylc");
|
|
||||||
// log.debug("multiOrdrDlvylcMap : {}", multiOrdrDlvylcMap);
|
|
||||||
//
|
|
||||||
// // DlvyGroupList 조회
|
|
||||||
// List<DataMap> DlvyGroupList = new ArrayList<>();
|
|
||||||
//
|
|
||||||
// goodsList.forEach(goods -> {
|
|
||||||
// DataMap item = new DataMap();
|
|
||||||
//
|
|
||||||
// item.put("goodsInnb", new BigInteger(String.valueOf(goods.get("goodsInnb"))));
|
|
||||||
// item.put("goodsOptnInnb", new BigInteger(String.valueOf(goods.get("goodsOptnInnb"))));
|
|
||||||
// item.put("dlvyGroupInnb", new BigInteger(String.valueOf(goods.get("dlvyGroupInnb"))));
|
|
||||||
// item.put("subSlepric", new BigDecimal(String.valueOf(( (int) goods.get("slepric") * (int) goods.get("qy")) - (int) goods.get("dscntAmt") )));
|
|
||||||
// item.put("qy", new BigDecimal(String.valueOf((int) goods.get("qy"))));
|
|
||||||
// item.put("mbrInnb", String.valueOf(goods.get("mbrInnb")));
|
|
||||||
//
|
|
||||||
// DlvyGroupList.add(item);
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// DlvyGroupList.sort(Comparator.comparing((DataMap map) -> (BigInteger) map.get("goodsInnb")).thenComparing((DataMap map) -> (BigInteger) map.get("goodsOptnInnb")) .thenComparing((DataMap map) -> (BigInteger) map.get("dlvyGroupInnb"))); // 정렬
|
|
||||||
//
|
|
||||||
// // 배송그룹고유번호별 상품목록
|
|
||||||
// Map<BigInteger, List<DataMap>> goodsByDlvyGroupMap = DlvyGroupList.stream().collect(Collectors.groupingBy(m -> ((BigInteger) m.get("dlvyGroupInnb")), HashMap::new, Collectors.toList()));
|
|
||||||
//
|
|
||||||
// String dlvylcAreaCd = (String) shipping.get("dlvylcAreaCd");
|
|
||||||
// String ordrAdressZip = StringUtil.isNullToString(shipping.get("dlvylcZip"));
|
|
||||||
// String prefcd = (String) shipping.get("prefcd");
|
|
||||||
// String defaultAdressAt = "N";
|
|
||||||
// String sopmalCode = sopmalCd;
|
|
||||||
//
|
|
||||||
// DataMap defaultAdressVO = new DataMap() {{ //
|
|
||||||
// put("sopmalCd", sopmalCode); // 쇼핑몰 코드
|
|
||||||
// put("zip", ordrAdressZip); // 우편번호
|
|
||||||
// put("prefcd", prefcd); // 도도부현코드
|
|
||||||
// }};
|
|
||||||
//
|
|
||||||
// if("KR".equals(dlvylcAreaCd)){
|
|
||||||
// defaultAdressAt = boOrdrMapper.selectBODefaultAdressAtInqire(defaultAdressVO);
|
|
||||||
// }
|
|
||||||
// if("JP".equals(dlvylcAreaCd)){
|
|
||||||
// defaultAdressAt = boOrdrMapper.selectBODefaultAdressAtInqire2(defaultAdressVO);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// List<DataMap> dlvyAmtByDlvyGroupList = new ArrayList<>();
|
|
||||||
//
|
|
||||||
// for (Map.Entry<BigInteger, List<DataMap>> dlvyGroupEtry : goodsByDlvyGroupMap.entrySet()) {
|
|
||||||
// int dlvyGroupInnb = dlvyGroupEtry.getKey().intValue();
|
|
||||||
// List<DataMap> goodsByDlvyGroupList = dlvyGroupEtry.getValue();
|
|
||||||
//
|
|
||||||
// DataMap shippingParam = new DataMap() {{
|
|
||||||
// put("dlvyGroupInnb", dlvyGroupInnb);
|
|
||||||
// put("sopmalCd", sopmalCode);
|
|
||||||
// }};
|
|
||||||
//
|
|
||||||
// DataMap shippingGrouping = mapper.selectShippingGrouping(shippingParam);
|
|
||||||
//
|
|
||||||
// // "KR".equals(dlvylcAreaCd)인 경우
|
|
||||||
// String itemDlvyGroupDvCd = (String) shippingGrouping.get("dlvyGroupDvCd");
|
|
||||||
// BigDecimal itemDftDlvyAmt = (BigDecimal) shippingGrouping.get("dftDlvyAmt"); // 기본배송비
|
|
||||||
// BigDecimal itemDlvyAmt = itemDftDlvyAmt; // 배송비
|
|
||||||
// String itemDlvyAreaAditAt = (String) shippingGrouping.get("dlvyAreaAditAt"); // 도서산간 추가 배송비 조건
|
|
||||||
// BigDecimal itemAreaAditDlvyAmt = (BigDecimal) shippingGrouping.get("areaAditDlvyAmt"); // 도서산간 추가 배송비
|
|
||||||
// String itemAmtCndUseAt = (String) shippingGrouping.get("amtCndUseAt"); // 금액조건
|
|
||||||
// BigDecimal itemAmtCndAditAmt = (BigDecimal) shippingGrouping.get("amtCndAditAmt");
|
|
||||||
// String itemCntCndUseAt = (String) shippingGrouping.get("cntCndUseAt"); // 수량조건
|
|
||||||
// BigDecimal itemCntCndAditAmt = (BigDecimal) shippingGrouping.get("cntCndAditAmt"); // 수량
|
|
||||||
//
|
|
||||||
// if("JP".equals(dlvylcAreaCd)){
|
|
||||||
// itemDftDlvyAmt = (BigDecimal) shippingGrouping.get("dftDlvyAmt2"); // 기본배송비
|
|
||||||
// itemDlvyAmt = itemDftDlvyAmt; // 배송비
|
|
||||||
// itemDlvyAreaAditAt = (String) shippingGrouping.get("dlvyAreaAditAt2"); // 도서산간 추가 배송비 조건
|
|
||||||
// itemAreaAditDlvyAmt = (BigDecimal) shippingGrouping.get("areaAditDlvyAmt2"); // 도서산간 추가 배송비
|
|
||||||
// itemAmtCndUseAt = (String) shippingGrouping.get("amtCndUseAt2"); // 금액조건
|
|
||||||
// itemAmtCndAditAmt = (BigDecimal) shippingGrouping.get("amtCndAditAmt");
|
|
||||||
// itemCntCndUseAt = (String) shippingGrouping.get("cntCndUseAt2"); // 수량조건
|
|
||||||
// itemCntCndAditAmt = (BigDecimal) shippingGrouping.get("cntCndAditAmt2"); // 수량
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if ("01".equals(ordrTyCd) || "03".equals(ordrTyCd) || "04".equals(ordrTyCd) || "06".equals(ordrTyCd)) { // 일반주문, 회원 개인결제, 정기배송
|
|
||||||
//
|
|
||||||
// // 무료배송(조건부)
|
|
||||||
// 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 ("Y".equals(itemCntCndUseAt) && itemCntCndAditAmt.compareTo(BigDecimal.ZERO) > 0) {
|
|
||||||
//
|
|
||||||
// for (DataMap goodsMap : goodsByDlvyGroupList) {
|
|
||||||
//
|
|
||||||
// BigDecimal qy = (BigDecimal) goodsMap.get("qy"); // 수량
|
|
||||||
// BigDecimal unitQy = qy.divide(itemCntCndAditAmt, 0, RoundingMode.CEILING); // 단위수량
|
|
||||||
//
|
|
||||||
// int goodsQy = unitQy.intValue();
|
|
||||||
//
|
|
||||||
// // cntCndAditAmt(설정수량)보다 qy가 큰 경우
|
|
||||||
// if (qy.compareTo(itemCntCndAditAmt) > 0) {
|
|
||||||
//
|
|
||||||
// } else {
|
|
||||||
// // 수량당 배송비가 1인경우
|
|
||||||
// }
|
|
||||||
// } // for
|
|
||||||
//
|
|
||||||
// } else {
|
|
||||||
//
|
|
||||||
// for (DataMap goodsMap : goodsByDlvyGroupList) {
|
|
||||||
// BigDecimal qy = (BigDecimal) goodsMap.get("qy"); // 수량
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// List<LinkedHashMap> itemGoodsList = new ArrayList<>();
|
|
||||||
// itemGoodsList.add(goodsList.get(i));
|
|
||||||
// for (LinkedHashMap<String, Object> itemGoodsMap : itemGoodsList) {
|
|
||||||
// itemGoodsMap.put("qy", qy.intValue());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// List<LinkedHashMap> itempPrsntList = new ArrayList<>();
|
|
||||||
// if(!prsntList.isEmpty()){
|
|
||||||
// itempPrsntList.add(prsntList.get(i));
|
|
||||||
// for (LinkedHashMap<String, Object> itemPrsntMap : itempPrsntList) {
|
|
||||||
// itemPrsntMap.put("qy", qy.intValue());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// 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);
|
|
||||||
//
|
|
||||||
// // 추가배송비 계산 (MUL)
|
|
||||||
// if (!StringUtils.isEmpty(itemDlvyAreaAditAt) && "Y".equals(itemDlvyAreaAditAt)) {
|
|
||||||
// if (!StringUtils.isEmpty(defaultAdressAt) && "Y".equals(defaultAdressAt)) {
|
|
||||||
// itemDlvyAmt = itemDlvyAmt.add(itemAreaAditDlvyAmt); // 유료 배송 도서산간 추가 배송비
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// for(DataMap goodsMap : goodsByDlvyGroupList) {
|
|
||||||
//// BigDecimal goodsQy = (int) goodsMap.get("qy"); // 수량
|
|
||||||
// BigDecimal qy = (BigDecimal) goodsMap.get("qy"); // 수량
|
|
||||||
//
|
|
||||||
// if ("03".equals(itemDlvyGroupDvCd) && "Y".equals(itemCntCndUseAt)) {
|
|
||||||
//
|
|
||||||
//// BigDecimal qy = (BigDecimal) goodsList.get(i).get("qy"); // 수량
|
|
||||||
//// BigDecimal qy = new BigDecimal(String.valueOf(goodsList.get(i).get("qy"))); // 수량
|
|
||||||
// BigDecimal unitQy = qy.divide(itemCntCndAditAmt, 0, RoundingMode.CEILING); // 단위수량
|
|
||||||
//
|
|
||||||
// int goodsQy = unitQy.intValue();
|
|
||||||
//
|
|
||||||
// for(int j=0;j<goodsQy;j++) {
|
|
||||||
//
|
|
||||||
// List<LinkedHashMap> itemGoodsList = new ArrayList<>();
|
|
||||||
// itemGoodsList.add(goodsList.get(i));
|
|
||||||
// for (LinkedHashMap<String, Object> itemGoodsMap : itemGoodsList) {
|
|
||||||
// if((goodsQy-j) > 1){
|
|
||||||
// itemGoodsMap.put("qy", itemCntCndAditAmt.intValue());
|
|
||||||
// } else {
|
|
||||||
// itemGoodsMap.put("qy", qy.intValue() - (itemCntCndAditAmt.intValue() * j));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// List<LinkedHashMap> itempPrsntList = new ArrayList<>();
|
|
||||||
// if(!prsntList.isEmpty()){
|
|
||||||
// itempPrsntList.add(prsntList.get(i));
|
|
||||||
// for (LinkedHashMap<String, Object> itemPrsntMap : itempPrsntList) {
|
|
||||||
// if((goodsQy-j) > 1){
|
|
||||||
// itemPrsntMap.put("qy", itemCntCndAditAmt.intValue());
|
|
||||||
// } else {
|
|
||||||
// itemPrsntMap.put("qy", qy.intValue() - (itemCntCndAditAmt.intValue() * j));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// 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 {
|
|
||||||
//
|
|
||||||
// BigDecimal qy = new BigDecimal(String.valueOf(goodsList.get(i).get("qy"))); // 수량
|
|
||||||
//
|
|
||||||
// List<LinkedHashMap> itemGoodsList = new ArrayList<>();
|
|
||||||
// itemGoodsList.add(goodsList.get(i));
|
|
||||||
// for (LinkedHashMap<String, Object> itemGoodsMap : itemGoodsList) {
|
|
||||||
// itemGoodsMap.put("qy", qy.intValue());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// List<LinkedHashMap> itempPrsntList = new ArrayList<>();
|
|
||||||
// if(!prsntList.isEmpty()){
|
|
||||||
// itempPrsntList.add(prsntList.get(i));
|
|
||||||
// for (LinkedHashMap<String, Object> itemPrsntMap : itempPrsntList) {
|
|
||||||
// itemPrsntMap.put("qy", qy.intValue());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// 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);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// } // for
|
|
||||||
//
|
|
||||||
// // 배송지가 1개 이상이면 여러곳 배송으로 변경
|
|
||||||
// if(dlvylcListMulti.size() > 1) {
|
|
||||||
// ordrTyCd = "05";
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// } else if ("05".equals(ordrTyCd)) { // 여러곳 배송, 선물하기
|
|
||||||
// if (!CollectionUtils.isEmpty(multiOrdrDlvylcMap)) {
|
|
||||||
// // 배송지 리스트
|
|
||||||
// dlvylcListMulti = (List<LinkedHashMap<String, Object>>) multiOrdrDlvylcMap.get("dlvylc");
|
|
||||||
// log.debug("dlvylcListMulti : {}", dlvylcListMulti);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// /** 여러곳 배송 배송지 세팅 종료 */
|
|
||||||
//
|
|
||||||
//// dlvyAmtByDlvyGroupList.add(dlvyGroupMap); // 배송그룹별 배송비 목록
|
|
||||||
// } // for : dlvyGroupEtry
|
|
||||||
|
|
||||||
|
|
||||||
/** 여러곳 배송 배송지 세팅 시작 */
|
/** 여러곳 배송 배송지 세팅 시작 */
|
||||||
LinkedHashMap<String, Object> multiOrdrDlvylcMap = new LinkedHashMap<>();
|
LinkedHashMap<String, Object> multiOrdrDlvylcMap = new LinkedHashMap<>();
|
||||||
List<LinkedHashMap<String, Object>> dlvylcListMulti = new ArrayList<>();
|
List<LinkedHashMap<String, Object>> dlvylcListMulti = new ArrayList<>();
|
||||||
@@ -423,13 +114,15 @@ public class BOOrderService {
|
|||||||
String ordrAdressZip = StringUtil.isNullToString(shipping.get("dlvylcZip"));
|
String ordrAdressZip = StringUtil.isNullToString(shipping.get("dlvylcZip"));
|
||||||
String prefcd = (String) shipping.get("prefcd");
|
String prefcd = (String) shipping.get("prefcd");
|
||||||
String defaultAdressAt = "N";
|
String defaultAdressAt = "N";
|
||||||
String finalSopmalCd = sopmalCd;
|
String sopmalCode = sopmalCd;
|
||||||
|
|
||||||
DataMap defaultAdressVO = new DataMap() {{ //
|
DataMap defaultAdressVO = new DataMap() {{ //
|
||||||
put("sopmalCd", finalSopmalCd); // 쇼핑몰 코드
|
put("sopmalCd", sopmalCode); // 쇼핑몰 코드
|
||||||
put("zip", ordrAdressZip); // 우편번호
|
put("zip", ordrAdressZip); // 우편번호
|
||||||
put("prefcd", prefcd); // 도도부현코드
|
put("prefcd", prefcd); // 도도부현코드
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
// 추가 배송비 여부 조회
|
||||||
if("KR".equals(dlvylcAreaCd)){
|
if("KR".equals(dlvylcAreaCd)){
|
||||||
defaultAdressAt = boOrdrMapper.selectBODefaultAdressAtInqire(defaultAdressVO);
|
defaultAdressAt = boOrdrMapper.selectBODefaultAdressAtInqire(defaultAdressVO);
|
||||||
}
|
}
|
||||||
@@ -437,13 +130,45 @@ public class BOOrderService {
|
|||||||
defaultAdressAt = boOrdrMapper.selectBODefaultAdressAtInqire2(defaultAdressVO);
|
defaultAdressAt = boOrdrMapper.selectBODefaultAdressAtInqire2(defaultAdressVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DlvyGroupList 조회
|
||||||
|
List<DataMap> DlvyGroupList = new ArrayList<>();
|
||||||
|
|
||||||
|
goodsList.forEach(goods -> {
|
||||||
|
DataMap item = new DataMap();
|
||||||
|
|
||||||
|
item.put("goodsInnb", new BigInteger(String.valueOf(goods.get("goodsInnb"))));
|
||||||
|
item.put("goodsOptnInnb", new BigInteger(String.valueOf(goods.get("goodsOptnInnb"))));
|
||||||
|
item.put("dlvyGroupInnb", new BigInteger(String.valueOf(goods.get("dlvyGroupInnb"))));
|
||||||
|
item.put("qy", new BigInteger(String.valueOf((int) goods.get("qy"))));
|
||||||
|
|
||||||
|
item.put("dscntApplyAmt", new BigInteger(String.valueOf((int) goods.get("dscntApplyAmt"))));
|
||||||
|
item.put("slepric", new BigInteger(String.valueOf((int) goods.get("slepric"))));
|
||||||
|
item.put("subSlepric", new BigInteger(String.valueOf((int) goods.get("subSlepric"))));
|
||||||
|
item.put("dscntAmt", new BigInteger(String.valueOf((int) goods.get("dscntAmt"))));
|
||||||
|
|
||||||
|
// dscntApplyAmt 4500
|
||||||
|
// slepric 5000
|
||||||
|
// subSlepric 5000
|
||||||
|
// dscntAmt 500
|
||||||
|
|
||||||
|
item.put("mbrInnb", new BigInteger(String.valueOf(goods.get("mbrInnb"))));
|
||||||
|
item.put("mbrDvCd", String.valueOf(goods.get("mbrDvCd")));
|
||||||
|
item.put("sopmalCd", String.valueOf(goods.get("sopmalCd")));
|
||||||
|
|
||||||
|
DlvyGroupList.add(item);
|
||||||
|
});
|
||||||
|
|
||||||
|
DlvyGroupList.sort(Comparator.comparing((DataMap map) -> (BigInteger) map.get("goodsInnb")).thenComparing((DataMap map) -> (BigInteger) map.get("goodsOptnInnb")) .thenComparing((DataMap map) -> (BigInteger) map.get("dlvyGroupInnb"))); // 정렬
|
||||||
|
|
||||||
|
// 배송그룹고유번호별 상품목록
|
||||||
|
Map<BigInteger, List<DataMap>> goodsByDlvyGroupMap = DlvyGroupList.stream().collect(Collectors.groupingBy(m -> ((BigInteger) m.get("dlvyGroupInnb")), HashMap::new, Collectors.toList()));
|
||||||
|
|
||||||
|
List<DataMap> dlvyAmtByDlvyGroupList = new ArrayList<>();
|
||||||
|
|
||||||
if ("01".equals(ordrTyCd) || "03".equals(ordrTyCd) || "04".equals(ordrTyCd) || "06".equals(ordrTyCd)) { // 일반주문, 회원 개인결제, 정기배송
|
if ("01".equals(ordrTyCd) || "03".equals(ordrTyCd) || "04".equals(ordrTyCd) || "06".equals(ordrTyCd)) { // 일반주문, 회원 개인결제, 정기배송
|
||||||
|
for (Map.Entry<BigInteger, List<DataMap>> dlvyGroupEtry : goodsByDlvyGroupMap.entrySet()) {
|
||||||
for(int i=0;i<goodsList.size();i++) {
|
int dlvyGroupInnb = dlvyGroupEtry.getKey().intValue();
|
||||||
int goodsQy = (int) goodsList.get(i).get("qy");
|
List<DataMap> goodsByDlvyGroupList = dlvyGroupEtry.getValue();
|
||||||
int dlvyGroupInnb = (int) goodsList.get(i).get("dlvyGroupInnb");
|
|
||||||
String sopmalCode = sopmalCd;
|
|
||||||
|
|
||||||
DataMap shippingParam = new DataMap() {{
|
DataMap shippingParam = new DataMap() {{
|
||||||
put("dlvyGroupInnb", dlvyGroupInnb);
|
put("dlvyGroupInnb", dlvyGroupInnb);
|
||||||
@@ -474,44 +199,155 @@ public class BOOrderService {
|
|||||||
itemCntCndAditAmt = (BigDecimal) shippingGrouping.get("cntCndAditAmt2"); // 수량
|
itemCntCndAditAmt = (BigDecimal) shippingGrouping.get("cntCndAditAmt2"); // 수량
|
||||||
}
|
}
|
||||||
|
|
||||||
// 추가배송비 계산 (MUL)
|
|
||||||
if (!StringUtils.isEmpty(itemDlvyAreaAditAt) && "Y".equals(itemDlvyAreaAditAt)) {
|
|
||||||
if (!StringUtils.isEmpty(defaultAdressAt) && "Y".equals(defaultAdressAt)) {
|
// // 무료배송(조건부)
|
||||||
itemDlvyAmt = itemDlvyAmt.add(itemAreaAditDlvyAmt); // 유료 배송 도서산간 추가 배송비
|
// 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)) { // 유료배송
|
||||||
|
|
||||||
|
// 추가배송비 계산 (MUL)
|
||||||
|
if (!StringUtils.isEmpty(itemDlvyAreaAditAt) && "Y".equals(itemDlvyAreaAditAt)) {
|
||||||
|
if (!StringUtils.isEmpty(defaultAdressAt) && "Y".equals(defaultAdressAt)) {
|
||||||
|
itemDlvyAmt = itemDlvyAmt.add(itemAreaAditDlvyAmt); // 유료 배송 도서산간 추가 배송비
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ("03".equals(itemDlvyGroupDvCd) && "Y".equals(itemCntCndUseAt)) {
|
// 유료배송 + 수량 조건
|
||||||
|
if ("Y".equals(itemCntCndUseAt) && itemCntCndAditAmt.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
// 수량 조건 있을 경우
|
||||||
|
for (DataMap goodsMap : goodsByDlvyGroupList) {
|
||||||
|
|
||||||
// BigDecimal qy = (BigDecimal) goodsList.get(i).get("qy"); // 수량
|
BigDecimal qy = new BigDecimal(String.valueOf(goodsMap.get("qy"))); // 수량
|
||||||
BigDecimal qy = new BigDecimal(String.valueOf(goodsList.get(i).get("qy"))); // 수량
|
BigDecimal unitQy = qy.divide(itemCntCndAditAmt, 0, RoundingMode.CEILING); // 단위수량
|
||||||
BigDecimal unitQy = qy.divide(itemCntCndAditAmt, 0, RoundingMode.CEILING); // 단위수량
|
BigDecimal goodsDscntAmt = new BigDecimal(String.valueOf(goodsMap.get("dscntAmt")));
|
||||||
|
BigInteger unitDscntAmt = BigInteger.valueOf(goodsDscntAmt.intValue());
|
||||||
|
|
||||||
goodsQy = unitQy.intValue();
|
int goodsQy = unitQy.intValue();
|
||||||
|
|
||||||
for(int j=0;j<goodsQy;j++) {
|
// cntCndAditAmt(설정수량)으로 배송 나누기
|
||||||
|
for (int j = 0; j < goodsQy; j++) {
|
||||||
|
|
||||||
|
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("slepric", new BigInteger(String.valueOf(goodsMap.get("slepric"))).intValue());
|
||||||
|
goodsMap.put("mbrInnb", new BigInteger(String.valueOf(goodsMap.get("mbrInnb"))).intValue());
|
||||||
|
|
||||||
|
// cntCndAditAmt(설정수량)단위로 으로 goodsList qy(수량) 설정
|
||||||
|
if ((goodsQy - j) > 1) {
|
||||||
|
goodsMap.put("qy", itemCntCndAditAmt.intValue());
|
||||||
|
} else {
|
||||||
|
goodsMap.put("qy", qy.intValue() - (itemCntCndAditAmt.intValue() * j));
|
||||||
|
}
|
||||||
|
|
||||||
|
// goodsDscntAmt(할인금액)이 있을 경우
|
||||||
|
if (goodsDscntAmt.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
unitDscntAmt = new BigInteger(String.valueOf(goodsDscntAmt.divide(qy, 0, RoundingMode.DOWN))); // 소수점이하 나머지 버림
|
||||||
|
goodsMap.put("dscntAmt", unitDscntAmt.intValueExact());
|
||||||
|
goodsMap.put("subSlepric", new BigInteger(String.valueOf(((int) goodsMap.get("slepric") * (int) goodsMap.get("qy")))).intValueExact());
|
||||||
|
goodsMap.put("dscntApplyAmt", new BigInteger(String.valueOf(((int) goodsMap.get("slepric") * (int) goodsMap.get("qy")) - (int) goodsMap.get("dscntAmt"))).intValueExact());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// goodsDscntAmt(할인금액)이 0일 경우
|
||||||
|
goodsMap.put("dscntAmt", unitDscntAmt.intValueExact());
|
||||||
|
goodsMap.put("subSlepric", new BigInteger(String.valueOf(((int) goodsMap.get("slepric") * (int) goodsMap.get("qy")))).intValueExact());
|
||||||
|
goodsMap.put("dscntApplyAmt", new BigInteger(String.valueOf(((int) goodsMap.get("slepric") * (int) goodsMap.get("qy")) - (int) goodsMap.get("dscntAmt"))).intValueExact());
|
||||||
|
}
|
||||||
|
|
||||||
|
// item.put("subSlepric", new BigDecimal(String.valueOf(( (int) goods.get("slepric") * (int) goods.get("qy")) - (int) goods.get("dscntAmt") )));
|
||||||
|
|
||||||
|
// GoodsList에 추가
|
||||||
|
List<LinkedHashMap> itemGoodsList = new ArrayList<>();
|
||||||
|
itemGoodsList.add(new LinkedHashMap<>(goodsMap));
|
||||||
|
|
||||||
|
List<LinkedHashMap> itempPrsntList = new ArrayList<>();
|
||||||
|
// if(!prsntList.isEmpty()){
|
||||||
|
// itempPrsntList.add(prsntList.get(i));
|
||||||
|
// for (LinkedHashMap<String, Object> itemPrsntMap : itempPrsntList) {
|
||||||
|
// if((goodsQy-j) > 1){
|
||||||
|
// itemPrsntMap.put("qy", itemCntCndAditAmt.intValue());
|
||||||
|
// } else {
|
||||||
|
// itemPrsntMap.put("qy", qy.intValue() - (itemCntCndAditAmt.intValue() * j));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
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);
|
||||||
|
} // for j
|
||||||
|
|
||||||
|
} // for goodsByDlvyGroupList
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// 수량 조건 없을 경우
|
||||||
|
|
||||||
List<LinkedHashMap> itemGoodsList = new ArrayList<>();
|
List<LinkedHashMap> itemGoodsList = new ArrayList<>();
|
||||||
itemGoodsList.add(goodsList.get(i));
|
|
||||||
for (LinkedHashMap<String, Object> itemGoodsMap : itemGoodsList) {
|
for (DataMap goodsMap : goodsByDlvyGroupList) {
|
||||||
if((goodsQy-j) > 1){
|
// BigDecimal qy = (BigDecimal) goodsMap.get("qy"); // 수량
|
||||||
itemGoodsMap.put("qy", itemCntCndAditAmt.intValue());
|
goodsMap.put("goodsInnb", new BigInteger(String.valueOf(goodsMap.get("goodsInnb"))).intValue());
|
||||||
} else {
|
goodsMap.put("goodsOptnInnb", new BigInteger(String.valueOf(goodsMap.get("goodsOptnInnb"))).intValue());
|
||||||
itemGoodsMap.put("qy", qy.intValue() - (itemCntCndAditAmt.intValue() * j));
|
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<>();
|
List<LinkedHashMap> itempPrsntList = new ArrayList<>();
|
||||||
if(prsntList != null && !prsntList.isEmpty()){
|
// if(!prsntList.isEmpty()){
|
||||||
itempPrsntList.add(prsntList.get(i));
|
// itempPrsntList.add(prsntList.get(i));
|
||||||
for (LinkedHashMap<String, Object> itemPrsntMap : itempPrsntList) {
|
// for (LinkedHashMap<String, Object> itemPrsntMap : itempPrsntList) {
|
||||||
if((goodsQy-j) > 1){
|
// itemPrsntMap.put("qy", qy.intValue());
|
||||||
itemPrsntMap.put("qy", itemCntCndAditAmt.intValue());
|
// }
|
||||||
} else {
|
// }
|
||||||
itemPrsntMap.put("qy", qy.intValue() - (itemCntCndAditAmt.intValue() * j));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LinkedHashMap<String, Object> dlvyMap = new LinkedHashMap<>();
|
LinkedHashMap<String, Object> dlvyMap = new LinkedHashMap<>();
|
||||||
|
|
||||||
@@ -538,23 +374,43 @@ public class BOOrderService {
|
|||||||
|
|
||||||
dlvylcListMulti.add(dlvyMap);
|
dlvylcListMulti.add(dlvyMap);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
|
|
||||||
BigDecimal qy = new BigDecimal(String.valueOf(goodsList.get(i).get("qy"))); // 수량
|
// } // DlvyGroupDvCd 무료배송, 유료배송
|
||||||
|
} else { // 조건부 무료 or 무료 배송일 경우
|
||||||
|
// 추가배송비 계산 (MUL)
|
||||||
|
if (!StringUtils.isEmpty(itemDlvyAreaAditAt) && "Y".equals(itemDlvyAreaAditAt)) {
|
||||||
|
if (!StringUtils.isEmpty(defaultAdressAt) && "Y".equals(defaultAdressAt)) {
|
||||||
|
itemDlvyAmt = itemDlvyAmt.add(itemAreaAditDlvyAmt); // 유료 배송 도서산간 추가 배송비
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<LinkedHashMap> itemGoodsList = new ArrayList<>();
|
List<LinkedHashMap> itemGoodsList = new ArrayList<>();
|
||||||
itemGoodsList.add(goodsList.get(i));
|
|
||||||
for (LinkedHashMap<String, Object> itemGoodsMap : itemGoodsList) {
|
for (DataMap goodsMap : goodsByDlvyGroupList) {
|
||||||
itemGoodsMap.put("qy", qy.intValue());
|
// BigDecimal qy = (BigDecimal) goodsMap.get("qy"); // 수량
|
||||||
|
|
||||||
|
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<>();
|
List<LinkedHashMap> itempPrsntList = new ArrayList<>();
|
||||||
if(prsntList != null && !prsntList.isEmpty()){
|
// if(!prsntList.isEmpty()){
|
||||||
itempPrsntList.add(prsntList.get(i));
|
// itempPrsntList.add(prsntList.get(i));
|
||||||
for (LinkedHashMap<String, Object> itemPrsntMap : itempPrsntList) {
|
// for (LinkedHashMap<String, Object> itemPrsntMap : itempPrsntList) {
|
||||||
itemPrsntMap.put("qy", qy.intValue());
|
// itemPrsntMap.put("qy", qy.intValue());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
LinkedHashMap<String, Object> dlvyMap = new LinkedHashMap<>();
|
LinkedHashMap<String, Object> dlvyMap = new LinkedHashMap<>();
|
||||||
|
|
||||||
@@ -580,9 +436,10 @@ public class BOOrderService {
|
|||||||
dlvyMap.put("prsntList", itempPrsntList); //prsntList.get(i));
|
dlvyMap.put("prsntList", itempPrsntList); //prsntList.get(i));
|
||||||
|
|
||||||
dlvylcListMulti.add(dlvyMap);
|
dlvylcListMulti.add(dlvyMap);
|
||||||
}
|
|
||||||
|
|
||||||
} // for
|
}
|
||||||
|
// dlvyAmtByDlvyGroupList.add(dlvyGroupMap); // 배송그룹별 배송비 목록
|
||||||
|
} // for : dlvyGroupEtry
|
||||||
|
|
||||||
// 배송지가 1개 이상이면 여러곳 배송으로 변경
|
// 배송지가 1개 이상이면 여러곳 배송으로 변경
|
||||||
if(dlvylcListMulti.size() > 1) {
|
if(dlvylcListMulti.size() > 1) {
|
||||||
@@ -599,7 +456,6 @@ public class BOOrderService {
|
|||||||
/** 여러곳 배송 배송지 세팅 종료 */
|
/** 여러곳 배송 배송지 세팅 종료 */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* *****************************
|
/* *****************************
|
||||||
1. 주문등록(GC_ORDER)
|
1. 주문등록(GC_ORDER)
|
||||||
***************************** */
|
***************************** */
|
||||||
@@ -1166,6 +1022,9 @@ public class BOOrderService {
|
|||||||
***************************************** */
|
***************************************** */
|
||||||
BOOrderSetleVO setleVO = insertSetle(orderVO, setle, insertedGoodsList, enuri, purchsr); // 결제 정보 등록
|
BOOrderSetleVO setleVO = insertSetle(orderVO, setle, insertedGoodsList, enuri, purchsr); // 결제 정보 등록
|
||||||
|
|
||||||
|
// 결제금액 원화로 변경
|
||||||
|
// setleVO.setSetleAmt(setleVO.getWonSetleAmt());
|
||||||
|
|
||||||
content.put("ordr", orderVO);
|
content.put("ordr", orderVO);
|
||||||
content.put("setle", setleVO);
|
content.put("setle", setleVO);
|
||||||
content.put("shipping", shippingEscrowVO);
|
content.put("shipping", shippingEscrowVO);
|
||||||
|
|||||||
@@ -2298,15 +2298,16 @@ public class BOPurchsService {
|
|||||||
|
|
||||||
BigDecimal goodsQy = new BigDecimal(0);
|
BigDecimal goodsQy = new BigDecimal(0);
|
||||||
|
|
||||||
for (DataMap goodsMap : goodsByDlvyGroupList) {
|
// 수량 조건
|
||||||
|
if ("Y".equals(cntCndUseAt) && cntCndAditAmt.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
|
||||||
BigDecimal qy = (BigDecimal) goodsMap.get("qy"); // 수량
|
for (DataMap goodsMap : goodsByDlvyGroupList) {
|
||||||
|
|
||||||
// 수량 조건
|
BigDecimal qy = (BigDecimal) goodsMap.get("qy"); // 수량
|
||||||
if ("Y".equals(cntCndUseAt)) {
|
|
||||||
|
|
||||||
qy = (BigDecimal) goodsMap.get("qy"); // 수량
|
qy = (BigDecimal) goodsMap.get("qy"); // 수량
|
||||||
|
|
||||||
|
// cntCndAditAmt(설정수량)보다 qy가 큰 경우
|
||||||
if (qy.compareTo(cntCndAditAmt) > 0) {
|
if (qy.compareTo(cntCndAditAmt) > 0) {
|
||||||
goodsQy = qy.divide(cntCndAditAmt, 0, RoundingMode.CEILING);
|
goodsQy = qy.divide(cntCndAditAmt, 0, RoundingMode.CEILING);
|
||||||
//배송비 합(같은상품 수량당 배송비 책정)
|
//배송비 합(같은상품 수량당 배송비 책정)
|
||||||
@@ -2330,17 +2331,19 @@ public class BOPurchsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} //for
|
||||||
//수량 조건 없는 경우
|
} else {
|
||||||
paidDlvyAmt = paidDlvyAmt.add(dlvyAmt); // 유료배송비 합
|
//수량 조건 없는 경우
|
||||||
// 추가배송비 계산
|
paidDlvyAmt = paidDlvyAmt.add(dlvyAmt); // 유료배송비 합
|
||||||
if (!StringUtils.isEmpty(dlvyAreaAditAt) && "Y".equals(dlvyAreaAditAt)) {
|
|
||||||
if (!StringUtils.isEmpty(defaultAdressAt) && "Y".equals(defaultAdressAt)) {
|
// 추가배송비 계산
|
||||||
addPaidDlvyAmt = addPaidDlvyAmt.add(areaAditDlvyAmt); // 유료 배송 도서산간 추가 배송비
|
if (!StringUtils.isEmpty(dlvyAreaAditAt) && "Y".equals(dlvyAreaAditAt)) {
|
||||||
}
|
if (!StringUtils.isEmpty(defaultAdressAt) && "Y".equals(defaultAdressAt)) {
|
||||||
|
addPaidDlvyAmt = addPaidDlvyAmt.add(areaAditDlvyAmt); // 유료 배송 도서산간 추가 배송비
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} //for
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dlvyAmt = new BigDecimal(0);
|
dlvyAmt = new BigDecimal(0);
|
||||||
dftDlvyAmt = new BigDecimal(0);
|
dftDlvyAmt = new BigDecimal(0);
|
||||||
|
|||||||
@@ -3310,9 +3310,11 @@ public class OrdrController {
|
|||||||
try {
|
try {
|
||||||
//계산결과 총결제금액
|
//계산결과 총결제금액
|
||||||
String resultSetleAmt = "";
|
String resultSetleAmt = "";
|
||||||
|
String resultWonSetleAmt = "";
|
||||||
//주문요청 총결제금액
|
//주문요청 총결제금액
|
||||||
//회원/비회원 총결제금액
|
//회원/비회원 총결제금액
|
||||||
String reqSetleAmt = StringUtil.isNullToString(setle.get("rlSetleAmt"));
|
String reqSetleAmt = StringUtil.isNullToString(setle.get("rlSetleAmt"));
|
||||||
|
String reqWonSetleAmt = StringUtil.isNullToString(setle.get("wonRlSetleAmt"));
|
||||||
//재계산된 총결제금액관련정보
|
//재계산된 총결제금액관련정보
|
||||||
Map<String, Object> resultAmt;
|
Map<String, Object> resultAmt;
|
||||||
if(isSubsvc) {
|
if(isSubsvc) {
|
||||||
@@ -3326,6 +3328,9 @@ public class OrdrController {
|
|||||||
if(setleExpectAmt.containsKey("setleAmt")){
|
if(setleExpectAmt.containsKey("setleAmt")){
|
||||||
resultSetleAmt = StringUtil.isNullToString(setleExpectAmt.get("setleAmt"));
|
resultSetleAmt = StringUtil.isNullToString(setleExpectAmt.get("setleAmt"));
|
||||||
}
|
}
|
||||||
|
if(setleExpectAmt.containsKey("setleAmtKr")){
|
||||||
|
resultWonSetleAmt = StringUtil.isNullToString(setleExpectAmt.get("setleAmtKr"));
|
||||||
|
}
|
||||||
|
|
||||||
//주문요청의 총결제금액과 계산된 총결제금액이 서로 다를 경우
|
//주문요청의 총결제금액과 계산된 총결제금액이 서로 다를 경우
|
||||||
if(!resultSetleAmt.equals(reqSetleAmt)
|
if(!resultSetleAmt.equals(reqSetleAmt)
|
||||||
@@ -3334,6 +3339,13 @@ public class OrdrController {
|
|||||||
content.put("result", "Y");
|
content.put("result", "Y");
|
||||||
content.put("message", PurchsValidCode.purchsValidMsg("setleAmt"));
|
content.put("message", PurchsValidCode.purchsValidMsg("setleAmt"));
|
||||||
}
|
}
|
||||||
|
if(!resultWonSetleAmt.equals(reqWonSetleAmt)
|
||||||
|
&& StringUtils.hasText(reqWonSetleAmt)
|
||||||
|
&& StringUtils.hasText(resultWonSetleAmt)){
|
||||||
|
content.put("result", "Y");
|
||||||
|
content.put("message", PurchsValidCode.purchsValidMsg("setleAmt"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (WnbtRestException wre) {
|
} catch (WnbtRestException wre) {
|
||||||
log.error(wre.getMessage());
|
log.error(wre.getMessage());
|
||||||
|
|||||||
@@ -5007,6 +5007,7 @@
|
|||||||
<!-- PG로그 가상계좌 검증키 조회 -->
|
<!-- PG로그 가상계좌 검증키 조회 -->
|
||||||
<select id="selectPglogVirtualKey" parameterType="dataMap" resultType="dataMap">
|
<select id="selectPglogVirtualKey" parameterType="dataMap" resultType="dataMap">
|
||||||
SELECT ROUND(GOR.RL_SETLE_AMT) AS RL_SETLE_AMT
|
SELECT ROUND(GOR.RL_SETLE_AMT) AS RL_SETLE_AMT
|
||||||
|
, ROUND(GOR.WON_RL_SETLE_AMT) AS WON_RL_SETLE_AMT
|
||||||
, GOR.ORDRR_NM
|
, GOR.ORDRR_NM
|
||||||
, GOPL.SETLER_NM
|
, GOPL.SETLER_NM
|
||||||
, GOPL.DELNG_NB
|
, GOPL.DELNG_NB
|
||||||
@@ -5029,7 +5030,7 @@
|
|||||||
AND GOR.SOPMAL_CD = GOPL.SOPMAL_CD
|
AND GOR.SOPMAL_CD = GOPL.SOPMAL_CD
|
||||||
WHERE GOR.SOPMAL_CD = #{sopmalCd}
|
WHERE GOR.SOPMAL_CD = #{sopmalCd}
|
||||||
AND GOR.ORDR_INNB = #{ordrInnb}
|
AND GOR.ORDR_INNB = #{ordrInnb}
|
||||||
AND GOPL.SETLE_MTH_CD IN ('04','05','06')
|
-- AND GOPL.SETLE_MTH_CD IN ('04','05','06')
|
||||||
ORDER BY GOPL.PG_LOG_INNB ASC
|
ORDER BY GOPL.PG_LOG_INNB ASC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
Reference in New Issue
Block a user