ソースを参照

Merge branch 'style' into yujung_style

yujung 4 年 前
コミット
b53adcf08d

+ 208 - 19
src/main/java/com/style24/front/biz/service/TsfOrderService.java

@@ -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;
 		
 	}
@@ -2188,34 +2175,236 @@ public class TsfOrderService {
 	 * @author jsh77b
 	 * @since 2021. 07. 23
 	 */
+	@SuppressWarnings("unchecked")
 	public String orderAmtValidationCheck(Order order) {
-		String result = "";
+		String resultStr = "SUCCESS";
 		
 		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) {
+			// 주문금액설정
+			ordAmt = (od.getCurrPrice() + od.getOptAddPrice()) * od.getGoodsQty();
+			od.setOrdAmt(ordAmt);
+			
+			// 상품쿠폰시퀀스, 장바구니쿠폰시퀀스 적용
+			for (Order vo : orderDetailList) {
+				if (od.getCartSq().equals(vo.getCartSq())) {
+					od.setGoodsCpnSq(vo.getGoodsCpnSq());
+					od.setCartCpnSq(vo.getCartCpnSq());
+					od.setPrePntDcAmtYn(vo.getPrePntDcAmtYn());
+					od.setPntDcAmt(vo.getPntDcAmt());
+					od.setGfcdUseAmt(vo.getGfcdUseAmt());
+				}
+			}
+		}
 		
+		// 상품쿠폰 적용 금액
+		for (Order od : tmtbGoodsApplyList) {	
+			for (Order tmtbGoods : goodsApplyCpnList) {
+				if (od.getCartSq().equals(tmtbGoods.getCartSq())) {
+					for (Order goodsCpn : tmtbGoods.getGoodsCpnList()) {
+						if (od.getGoodsCpnSq() == goodsCpn.getCustCpnSq()) {
+							od.setGoodsCpnDcAmt(goodsCpn.getCpnDcAmt());
+						}
+					}
+				}
+			}
+		}
 		
+		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;
 		
-		return result;
+		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++;
+							}
+						}
+					}
+				}
+			}
+		}
+		
+		int cartDcSumAmt = 0;
+		
+		for (Order od : tmtbGoodsApplyList) {
+			log.info("----------------------------------------------------------------------------");
+			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("goodsCpnDcAmt ::: {}"		, od.getGoodsCpnDcAmt());
+			log.info("cartCpnDcAmt ::: {}"		, od.getCartCpnDcAmt());
+			log.info("pntDcAmt ::: {}"			, od.getPntDcAmt());
+			log.info("gfcdUseAmt ::: {}"		, od.getGfcdUseAmt());		
+			
+			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;
+						}
+					}
+				}
+			}
+			
+			cartDcSumAmt = cartDcSumAmt + od.getCartCpnDcAmt();
+			log.info("----------------------------------------------------------------------------");	
+		}
+		
+		// 2021.10.13 장바구니금액 
+		if (order.getCartCpnDcSumAmt() != cartDcSumAmt) {
+			resultStr = "장바구니쿠폰 할인 금액정보가 잘못 되었습니다.";
+			return resultStr;
+		}
+
+		return resultStr;
 	}
 
 	/**

+ 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);

+ 3 - 1
src/main/webapp/WEB-INF/views/mob/goods/GoodsDetailFormMob.html

@@ -434,7 +434,9 @@
 													or #strings.contains(goodsImgList,'_C4')
 													or #strings.contains(goodsImgList,'_C5')}">
 					<span class="tit_view">OUTFIT VIEW</span>
-					<span class="model_info">(모델정보 : 185cm / 78kg / XL 착용)</span>
+					<th:block th:each="goodsImg, status : ${goodsImgList}" th:if="${status.first}">
+					<span class="model_info" th:text="${goodsImg.modelInfo}">(모델정보 : 185cm / 78kg / XL 착용)</span>
+					</th:block>
 					<div class="view">
 						<th:block th:each="goodsImg, status : ${goodsImgList}" th:if="${#strings.contains(goodsImg.sysImgNm,'_C1')
 																					or #strings.contains(goodsImg.sysImgNm,'_C2')

+ 6 - 3
src/main/webapp/WEB-INF/views/mob/order/OrderFormMob.html

@@ -2267,8 +2267,8 @@ var custCpnApply = function(obj, idx, cpnType) {
 			});
 		});
 		
-		// 장바구니쿠폰 결제가능수단목록조회
-		if (obj.find("input[name='payTypeArr']").length > 0) {
+		// 장바구니쿠폰 결제가능수단목록조회 2021.10.09 장바구니쿠폰 PG 제어 보정
+		if (obj.find("input[name='payTypeArr']").length > 0 && obj.find("input[name='payTypeArr']").length < 4) {
 			$("#orderForm input[name=rdi-paynormal]").attr("disabled", true);
 			$("#orderForm input[name=rdi-paynormal]").attr("checked", false);
 			
@@ -2302,6 +2302,9 @@ var custCpnApply = function(obj, idx, cpnType) {
 			leftAmt			= dcVal;
 			index 			= 1;
 			
+			// 2021.10.10 장바구니쿠폰 길이 수정 (장바구니쿠폰 적용되지 않은 상품도 있을듯 싶음)
+			cartSqLen = obj.find("input[name='cartCpnCartSq']").length;
+			
 			// 장바구니쿠폰 해당 장바구니상품들 할인가 적용
 			obj.find("input[name='cartCpnCartSq']").each(function(){
 				var cartCpnCartSq 		= $(this).val();
@@ -2318,7 +2321,7 @@ var custCpnApply = function(obj, idx, cpnType) {
 						var goodsCpnDcAmt 	= parseInt($(this).parent().find(".goodsCpnDcAmt").text());
 						
 						var tempAmt 		= ((orgCurrPrice - cpn1DcAmt) * goodsQty) - tmtb1DcAmt - tmtb2DcAmt - goodsCpnDcAmt;
-						var tempDiv 		= (tempAmt / tempSumAmt) * 100;
+						var tempDiv 		= ((tempAmt / tempSumAmt) * 100).toFixed(2);
 						var cartCpnDcAmt	= 0;
 				
 						if (index == cartSqLen) {

+ 10 - 8
src/main/webapp/WEB-INF/views/web/order/OrderFormWeb.html

@@ -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++;
 			}
@@ -2078,8 +2077,8 @@ var custCpnApply = function(obj) {
 			});
 		});
 		
-		// 장바구니쿠폰 결제가능수단목록조회
-		if (obj.find("input[name='payTypeArr']").length > 0) {
+		// 장바구니쿠폰 결제가능수단목록조회 2021.10.09 장바구니쿠폰 PG 제어 보정
+		if (obj.find("input[name='payTypeArr']").length > 0 && obj.find("input[name='payTypeArr']").length < 4) {
 			$("#orderForm input[name=rdi-paynormal]").attr("disabled", true);
 			$("#orderForm input[name=rdi-paynormal]").attr("checked", false);
 			
@@ -2114,7 +2113,10 @@ var custCpnApply = function(obj) {
 		if (dcWay == "G240_10") {
 			cartCpnDcSumAmt = dcVal;
 			leftAmt			= dcVal;
-			index 			= 1;
+			index			= 1;
+			
+			// 2021.10.10 장바구니쿠폰 길이 수정 (장바구니쿠폰 적용되지 않은 상품도 있을듯 싶음)
+			cartSqLen = obj.find("input[name='cartCpnCartSq']").length;
 			
 			// 장바구니쿠폰 해당 장바구니상품들 할인가 적용
 			obj.find("input[name='cartCpnCartSq']").each(function(){
@@ -2132,7 +2134,7 @@ var custCpnApply = function(obj) {
 						var goodsCpnDcAmt 	= parseInt($(this).parent().find(".goodsCpnDcAmt").text());
 						
 						var tempAmt 		= ((orgCurrPrice - cpn1DcAmt) * goodsQty) - tmtb1DcAmt - tmtb2DcAmt - goodsCpnDcAmt;
-						var tempDiv 		= (tempAmt / tempSumAmt) * 100;
+						var tempDiv 		= ((tempAmt / tempSumAmt) * 100).toFixed(2);
 						var cartCpnDcAmt	= 0;
 				
 						if (index == cartSqLen) {

+ 1 - 1
src/main/webapp/ux/pc/css/layout.css

@@ -2614,7 +2614,7 @@ ul.maintabs li [class^='box_depth'] {display:none; position:absolute; left:100%;
 	.pd_detail .area_desc .desc_wrap .descript_box .desc_info .price_blk del.org_price em {font-size:20px;}
 	.pd_detail .area_desc .desc_wrap .descript_box .desc_info .price_blk .save_point {position:relative; display:block; width:100%; height:14px; margin-top:15px; padding-left:22px; color:#888; font-size:14px; font-weight:200;}
 	.pd_detail .area_desc .desc_wrap .descript_box .desc_info .price_blk .save_point::before {content:''; position:absolute; left:0; top:50%; transform:translateY(-50%); display:inline-block; width:16px; height:16px; background:url('//image.istyle24.com/Style24/images/pc/ico_point_sm.png') no-repeat 50% 50%;}
-	.pd_detail .area_desc .desc_wrap .descript_box .desc_info .price_blk .btn_coupon {position:absolute; right:0; bottom:32px; width:77px; height:34px; padding:10px; border:none; box-sizing:border-box; font-size:14px; z-index:2;}
+	.pd_detail .area_desc .desc_wrap .descript_box .desc_info .price_blk .btn_coupon {position:absolute; right:0; bottom:0px; width:77px; height:34px; padding:10px; border:none; box-sizing:border-box; font-size:14px; z-index:2;}
 	.pd_detail .area_desc .desc_wrap .descript_box .desc_info .price_blk .btn_coupon span {font-size:14px; font-weight:200;}
 	.pd_detail .area_desc .desc_wrap .descript_box .desc_status {margin-top:30px; padding:17px 20px; background:#fff6f2; color:#fd4802; font-size:16px; font-weight:300; padding-left:20px;}