فهرست منبع

Merge remote-tracking branch 'origin/xodud1202' into order2

# Conflicts:
#	src/main/java/com/style24/front/biz/web/TsfOrderController.java
card007 5 سال پیش
والد
کامیت
a7d8adaca6

+ 2 - 2
src/main/java/com/style24/front/biz/dao/TsfCartDao.java

@@ -18,13 +18,13 @@ import com.style24.persistence.domain.Order;
 public interface TsfCartDao {
 
 	/**
-	 * 장바구니 대상 상품 수량 조회
+	 * 장바구니 대상 상품 주문 수량 조회
 	 * @param Cart
 	 * @return
 	 * @author xodud1202
 	 * @since 2021. 02. 01
 	 */
-	int getHasGoodsCartCnt(Cart cart);
+	int getGoodsTodayOrderCnt(Cart cart);
 
 	/**
 	 * 장바구니 등록 상품 확인

+ 15 - 13
src/main/java/com/style24/front/biz/service/TsfCartService.java

@@ -58,19 +58,17 @@ public class TsfCartService {
 	 * @param params
 	 */
 	public void saveCartInfo(Collection<Cart> params) {
-		String goodsType = "";
-
 		// 로그인 유무 확인 (로그인이 되어 있지 않으면 regNo 를 0으로 장바구니에 저장한다.)
 		Login login = new Login();
 		if(TsfSession.isLogin()) {
 			login = TsfSession.getInfo();
 		} else {
-			 login.setCustNo(0);
+			login.setCustNo(0);
 		}
 
 		// 장바구니 상품 및 재고 가능 여부 체크
 		for (Cart param : params) {
-
+			param.setCustNo(login.getCustNo());
 			// 상품 마스터 정보 확인
 			Goods goods = new Goods();
 			goods.setGoodsCd(param.getGoodsCd());
@@ -98,17 +96,21 @@ public class TsfCartService {
 				throw new IllegalArgumentException(stockResult);
 			}
 
-			// 장바구니에 있는 같은 상품(옵션이 상이해도 같은 상품이므로 상품 전체 조회)
-			int goodsCartCnt = cartDao.getHasGoodsCartCnt(param);
-			if (param.getGoodsQty() + goodsCartCnt > goods.getDayMaxOrdQty()) {
-				throw new IllegalArgumentException("1일 구매한도 수량이 초과되었습니다.");
-			}
+			// 금일 주문 수량 체크
+			if (!StringUtils.isEmpty(param.getCartGb()) && "O".equals(param.getCartGb())) {
+				int goodsCartCnt = 0;
+				if(param.getCustNo() != 0) {
+					goodsCartCnt = cartDao.getGoodsTodayOrderCnt(param);
+				}
 
-			goodsType = param.getGoodsType();
+				if (param.getGoodsQty() + goodsCartCnt > goods.getDayMaxOrdQty()) {
+					throw new IllegalArgumentException("1일 구매한도 수량이 초과되었습니다.");
+				}
+			}
 		}
 
 		// 장바구니 정보 수정
-		if (goodsType.equals(TscConstants.GoodsType.SET.value())) {
+		if (TscConstants.GoodsType.SET.value().equals(params.iterator().next().getCartGb())) {
 			// 세트상품일 경우
 			saveSetTypeCartInfo(params);
 		} else {
@@ -801,11 +803,11 @@ public class TsfCartService {
 		}
 		
 		// 현재 장바구니 수량
-		int goodsCartCnt = cartDao.getHasGoodsCartCnt(param);
+		/*int goodsCartCnt = cartDao.getHasGoodsCartCnt(param);
 
 		if (param.getGoodsQty() + goodsCartCnt > goods.getDayMaxOrdQty()) {
 			throw new IllegalArgumentException("1일 구매한도 수량이 초과되었습니다.");
-		}
+		}*/
 
 		// 구성 상품 재고 확인
 		for(int i = 0 ; i < param.getCartDtlSqArr().length ; i++) {

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

@@ -881,6 +881,7 @@ public class TsfOrderController extends TsfBaseController {
 		Payment payment = orderService.setPgDataInfo(order);
 
 		mav.addObject("payment", payment);
+		mav.addObject("orderDetailList", order.getOrderDetailList());
 		//model.addAttribute("payment", payment);
 
 		mav.setViewName(super.getDeviceViewName("pg/kcpOrder"));

+ 13 - 21
src/main/java/com/style24/persistence/mybatis/shop/TsfCart.xml

@@ -15,25 +15,19 @@
 	</sql>
 	
 
-	<!-- 등록 상품 장바구니 수량 조회 -->
-	<select id="getHasGoodsCartCnt" parameterType="Cart" resultType="int">
-		/* TsfCart.getHasGoodsCartCnt : 등록 상품 장바구니 수량 조회 */
-		SELECT IFNULL(SUM(C.GOODS_QTY), 0) AS CNT
-		  FROM TB_CART C
-		 WHERE 1=1
-		   AND GOODS_CD = #{goodsCd}
-		<choose>
-			<when test="custNo == 0">
-		   AND C.JSESSION_ID = #{jsessionId}
-		   AND C.CUST_NO = 0
-			</when>
-			<otherwise>
-		   AND C.CUST_NO = #{custNo}
-			</otherwise>
-		</choose>
-		<if test="cartSq != null and cartSq != 0">
-			AND C.CART_SQ <![CDATA[ <> ]]> #{cartSq}
-		</if>
+	<!-- 금일 상품 주문 수량 조회 -->
+	<select id="getGoodsTodayOrderCnt" parameterType="Cart" resultType="int">
+		/* TsfCart.getGoodsTodayOrderCnt : 금일 상품 주문 수량 조회 */
+		SELECT IFNULL(SUM(OD.ORD_QTY), 0) AS CNT
+		FROM   TB_ORDER O
+		INNER  JOIN TB_ORDER_DETAIL OD
+		ON     O.ORD_NO = OD.ORD_NO
+		WHERE  1=1
+		AND    OD.ORD_EXCH_GB = 'O'
+		AND    DATE(ORD_DT) = CURRENT_DATE
+		AND    OD.ORD_DTL_STAT <![CDATA[ <> ]]> 'G013_00'
+		AND    OD.GOODS_CD = #{goodsCd}
+		AND    O.CUST_NO = #{custNo}
 	</select>
 
 	<!-- 장바구니 등록 세트 상품 확인 -->
@@ -131,7 +125,6 @@
 				, PRODUCT_NO
 				, PRODUCT_CODE
 				, ITEM_QTY
-				, ITEM_PRICE
 				, DISP_ORD
 				, REG_NO
 				, REG_DT
@@ -147,7 +140,6 @@
 			 , O.PRODUCT_NO
 			 , O.PRODUCT_CODE
 			 , IFNULL(GC.QTY, 1)
-			 , IFNULL(GC.COMPS_CURR_PRICE, G.CURR_PRICE)
 			 , IFNULL(GC.DISP_ORD, 1)						<!-- TB_GOODS_COMPOSE DISP_ORD 따라 CART_DETAIL도 동일하게 진행 -->
 			 , #{regNo}
 			 , CURRENT_TIMESTAMP

+ 4 - 4
src/main/webapp/WEB-INF/views/web/cart/cartListAjaxFormWeb.html

@@ -466,14 +466,14 @@
 
 		cfnAddCart(compsList);*/
 
-		/*let compsList = [];
+		let compsList = [];
 		let temp = new Object;
 		temp.goodsCd = "14373686";
 		temp.optCd = "챠콜그레이150";
 		temp.goodsQty = 2;
 		temp.goodsType = "G056_D";
 		temp.dealGoodsCd = "STYD000000025"
-		temp.cartGb = "C";
+		temp.cartGb = "O";
 		temp.afLinkCd = "afLinkCd";
 		temp.ithrCd = "G027_ZZZ";
 		temp.contentsLoc = "G028_YYY";
@@ -486,14 +486,14 @@
 		temp.goodsQty = 3;
 		temp.goodsType = "G056_D";
 		temp.dealGoodsCd = "STYD000000025"
-		temp.cartGb = "C";
+		temp.cartGb = "O";
 		temp.afLinkCd = "afLinkCd";
 		temp.ithrCd = "G027_ZZZ";
 		temp.contentsLoc = "G028_YYY";
 		temp.planDtlSq = "123";
 		compsList.push(temp);
 
-		cfnAddCart(compsList);*/
+		cfnAddCart(compsList);
 	});
 
 	function notApplyTmtbAreaList() {

+ 4 - 0
src/main/webapp/WEB-INF/views/web/pg/kcpOrderWeb.html

@@ -3,6 +3,10 @@
 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
 <meta http-equiv="Pragma" content="no-cache">
 <meta http-equiv="Expires" content="-1">
+	<!-- 장바구니 시퀀스 목록 -->
+	<th:block th:each="detail, status : ${orderDetailList}">
+		<input type="hidden" name="cartSqArr"		th:value="${detail.cartSq}" />
+	</th:block>
 	<!-- 주문 데이터 -->
 	<input type="hidden" name="pgGb"		th:value="${payment.pgGb}" />
 	<input type="hidden" name="payMeans"	th:value="${payment.payMeans}" />