Quellcode durchsuchen

결제금액 유효성 체크 보완

jsh77b vor 4 Jahren
Ursprung
Commit
8df7136eca

+ 88 - 5
src/main/java/com/style24/front/biz/service/TsfOrderService.java

@@ -2187,32 +2187,115 @@ public class TsfOrderService {
 	 * @author jsh77b
 	 * @since 2021. 07. 23
 	 */
+	@SuppressWarnings("unchecked")
 	public String orderAmtValidationCheck(Order order) {
 		String result = "";
 		
 		Order po = new Order();
 		
-		// 장바구니정보 및 상품쿠폰정보, 장바구니쿠폰정보, 선포인트정보, 포인트정보, 상품권정보
+		// 1. 장바구니정보 및 상품쿠폰정보, 장바구니쿠폰정보, 선포인트정보, 포인트정보, 상품권정보
 		Collection<Order> orderDetailList = order.getOrderDetailList();
 		int [] cartSqArr = new int[orderDetailList.size()];
 		int idx = 0;
 		for (Order vo : orderDetailList) {
 			cartSqArr[idx] = vo.getCartSq();
+			idx++;
 		}
 		
 		po.setCartSqArr(cartSqArr);
+		po.setCustNo(order.getCustNo());
 		
-		// 판매가정보, 즉시할인금액, 옵션금액, 다다익선적용금액 정보 조회
+		// 2. 판매가정보, 즉시할인금액, 옵션금액, 다다익선적용금액 정보 조회
 		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) {
+			log.info("----------------------------------------------------------------------------");
+			
+			// 주문금액설정
+			ordAmt = (od.getCurrPrice() + od.getOptAddPrice()) * od.getGoodsQty();
+			od.setOrdAmt(ordAmt);
+						
+			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("pntPrate ::: {}"			, od.getPntPrate());
+			log.info("pntMrate ::: {}"			, od.getPntMrate());
+			
+			// 상품쿠폰, 장바구니쿠폰 적용
+			for (Order vo : orderDetailList) {
+				if (od.getCartSq().equals(vo.getCartSq())) {
+					log.info("vo.getCartSq() ----> {}", vo.getCartSq());
+					log.info("vo.getGoodsCpnSq() ----> {}", vo.getGoodsCpnSq());
+					log.info("vo.getCartCpnSq() ----> {}", vo.getCartCpnSq());
+					log.info("vo.getPntDcAmt() ----> {}", vo.getPntDcAmt());
+					log.info("vo.getGfcdUseAmt() ----> {}", vo.getGfcdUseAmt());
+					
+					od.setGoodsCpnSq(vo.getGoodsCpnSq());
+					od.setCartCpnSq(vo.getCartCpnSq());
+					od.setPntDcAmt(vo.getPntDcAmt());
+					od.setGfcdUseAmt(vo.getGfcdUseAmt());
+				}
+			}
+			
+			log.info("pntDcAmt ::: {}"			, od.getPntDcAmt());
+			log.info("gfcdUseAmt ::: {}"		, od.getGfcdUseAmt());
+			log.info("----------------------------------------------------------------------------");
+		}
 		
-		
-		
-		
+		// 상품쿠폰, 장바구니쿠폰 적용 금액
+		for (Order od : tmtbGoodsApplyList) {
+			log.info("----------------------------------------------------------------------------");	
+			for (Order tmtbGoods : goodsApplyCpnList) {
+				if (od.getCartSq().equals(tmtbGoods.getCartSq())) {
+					log.info("vo.getCartSq() ::: {}", od.getCartSq());
+					for (Order goodsCpn : tmtbGoods.getGoodsCpnList()) {
+						if (od.getGoodsCpnSq() == goodsCpn.getCustCpnSq()) {
+							log.info("vo.getGoodsCpnSq() ::: {}", od.getGoodsCpnSq());
+							log.info("goodsCpn.getCpnDcAmt() ::: {}", goodsCpn.getCpnDcAmt());
+							
+							od.setGoodsCpnDcAmt(goodsCpn.getCpnDcAmt());
+						}
+					}
+				}
+			}
+			
+			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());
+						}
+					}
+				}
+			}
+			log.info("----------------------------------------------------------------------------");	
+		}
 		
 		return result;
 	}

+ 0 - 2
src/main/java/com/style24/front/biz/web/TsfOrderController.java

@@ -868,7 +868,6 @@ public class TsfOrderController extends TsfBaseController {
 		}
 		
 		// 2.1 주문금액유효성체크
-		/*
 		resultStr = orderService.orderAmtValidationCheck(order);
 		
 		// 주문금액유효성체크 실패
@@ -877,7 +876,6 @@ public class TsfOrderController extends TsfBaseController {
 			mav.setViewName(super.getDeviceViewName("order/OrderEmpty"));
 			return mav;
 		}
-		*/
 		
 		// 3. 주문기본정보등록(주문접수)
 		coreOrderService.createPreOrder(order);

+ 4 - 5
src/main/webapp/WEB-INF/views/web/order/OrderFormWeb.html

@@ -617,7 +617,7 @@ $(document).ready( function() {
 	custemerInfoSet();
 	
 	// 999. 개발화면정보설정
-	var devTemp = false;
+	var devTemp = true;
 	var arr = []
 	arr[0] = "orderInfo";
 	arr[1] = "freegiftInfo";
@@ -1792,14 +1792,12 @@ var custGoodsCpnInit = function() {
 
 	// 최대할인율 쿠폰적용
 	$('.goodsCpn').each(function(index){
-		cpnIndex 		= 0;
 		cpnApplyTemp 	= false;
 		
 		// select 박스 반복문 실행
 		$(this).find("ul li").each(function(i){
-			cpnIndex++;
 			if (cpnApplyTemp == false) {
-				if (custCpnDuplicationCheck($(this).attr("value"), cpnIndex)) {
+				if (custCpnDuplicationCheck($(this).attr("value"), index)) {
 					// 쿠폰적용
 					custCpnApply($(this));
 					// 쿠폰할인적용
@@ -1809,7 +1807,7 @@ var custGoodsCpnInit = function() {
 			
 			// 쿠폰 select 버튼기능
 			$(this).on("click", function(){
-				if (custCpnDuplicationCheck($(this).attr("value"), cpnIndex)) {
+				if (custCpnDuplicationCheck($(this).attr("value"), index)) {
 					// 쿠폰적용
 					custCpnApplyTemp($(this));
 					// 쿠폰할인적용
@@ -1884,6 +1882,7 @@ var custCpnDuplicationCheck = function(custCpnSq, index) {
 	$(".goodsCpn input[name='custCpnSq']").each(function(i){
 		if (index != i) {
 			selCustSq = $(this).val();
+			
 			if (selCustSq == custCpnSq) {
 				cnt++;
 			}