Преглед изворни кода

이태영 - 20210406 세트상품 다수개 등록 테스트 중

xodud1202 пре 5 година
родитељ
комит
cc14d24375

+ 201 - 109
src/main/java/com/style24/front/biz/service/TsfCartService.java

@@ -60,7 +60,10 @@ public class TsfCartService {
 	 * 세트 : goodsCd,
 	 * 세트 : goodsCd,
 	 * @param params
 	 * @param params
 	 */
 	 */
-	public void saveCartInfo(Collection<Cart> params) {
+	public GagaMap saveCartInfo(Collection<Cart> params) {
+		GagaMap result = new GagaMap();
+		List<Integer> cartSqList = new ArrayList<>();
+
 		// 로그인 유무 확인 (로그인이 되어 있지 않으면 regNo 를 0으로 장바구니에 저장한다.)
 		// 로그인 유무 확인 (로그인이 되어 있지 않으면 regNo 를 0으로 장바구니에 저장한다.)
 		Login login = new Login();
 		Login login = new Login();
 		if(TsfSession.isLogin()) {
 		if(TsfSession.isLogin()) {
@@ -69,68 +72,153 @@ public class TsfCartService {
 			login.setCustNo(0);
 			login.setCustNo(0);
 		}
 		}
 
 
+		String goodsType = params.iterator().next().getGoodsType();
+		String cartGb = params.iterator().next().getCartGb();
+		if(StringUtils.isEmpty(goodsType)) {
+			goodsType = params.iterator().next().getCartCompsList().iterator().next().getGoodsType();
+			cartGb    = params.iterator().next().getCartCompsList().iterator().next().getCartGb();
+		}
+
+		log.info("CHECK GOODS_TYPE ::::: {}", goodsType);
+
 		// 장바구니 상품 및 재고 가능 여부 체크
 		// 장바구니 상품 및 재고 가능 여부 체크
-		for (Cart param : params) {
-			param.setCustNo(login.getCustNo());
-			// 상품 마스터 정보 확인
-			Goods goods = new Goods();
-			goods.setGoodsCd(param.getGoodsCd());
-			goods.setFrontGb(TsfSession.getFrontGb());
-			goods.setSiteCd(TscConstants.Site.STYLE24.value());
-
-			goods = goodsService.getGoodsInfo(goods);
-
-			if (goods == null) {
-				throw new IllegalArgumentException("상품 정보가 존재하지 않습니다.");
-			}
-			if (TscConstants.GoodsStat.SOLDOUT.value().equals(goods.getGoodsStat())) {
-				throw new IllegalArgumentException("품절입니다.");
-			} else if (!TscConstants.GoodsStat.SOLDOUT.value().equals(goods.getGoodsStat()) && !TscConstants.GoodsStat.APPR.value().equals(goods.getGoodsStat())) {
-				throw new IllegalArgumentException("판매중인 상품이 아닙니다.");
-			} else if (param.getGoodsQty() > goods.getMaxOrdQty()) {
-				throw new IllegalArgumentException(goods.getGoodsNm() + " 상품의 최대 구매 수량은 " + goods.getMaxOrdQty() + " 입니다.");
-			} else if (param.getGoodsQty() < goods.getMinOrdQty()) {
-				throw new IllegalArgumentException(goods.getGoodsNm() + " 상품의 최소 구매 수량은 " + goods.getMinOrdQty() + " 입니다.");
-			}
+		if(TscConstants.GoodsType.SET.value().equals(goodsType)) {
+			for (Cart goodsParams : params) {
+				for (Cart param : goodsParams.getCartCompsList()) {
+					param.setCustNo(login.getCustNo());
+					// 상품 마스터 정보 확인
+					Goods goods = new Goods();
+					goods.setGoodsCd(param.getGoodsCd());
+					goods.setFrontGb(TsfSession.getFrontGb());
+					goods.setSiteCd(TscConstants.Site.STYLE24.value());
+
+					goods = goodsService.getGoodsInfo(goods);
+
+					if (goods == null) {
+						result.put("message", "상품 정보가 존재하지 않습니다.");
+						return result;
+					} else if (TscConstants.GoodsStat.SOLDOUT.value().equals(goods.getGoodsStat())) {
+						result.put("message", "품절입니다.");
+						return result;
+					} else if (!TscConstants.GoodsStat.SOLDOUT.value().equals(goods.getGoodsStat()) && !TscConstants.GoodsStat.APPR.value().equals(goods.getGoodsStat())) {
+						result.put("message", "판매중인 상품이 아닙니다.");
+						return result;
+					} else if (param.getGoodsQty() > goods.getMaxOrdQty()) {
+						result.put("message", goods.getGoodsNm() + " 상품의 최대 구매 수량은 " + goods.getMaxOrdQty() + " 입니다.");
+						return result;
+					} else if (param.getGoodsQty() < goods.getMinOrdQty()) {
+						result.put("message", goods.getGoodsNm() + " 상품의 최소 구매 수량은 " + goods.getMinOrdQty() + " 입니다.");
+						return result;
+					}
 
 
-			// 상품 재고 확인
-			GoodsStock checkParam = new GoodsStock();
-			checkParam.setGoodsCd(param.getGoodsCd());
-			checkParam.setItemCd(param.getItemCd());
-			checkParam.setOptCd(param.getOptCd());
-			checkParam.setGoodsQty(param.getGoodsQty());
-			checkParam.setGoodsType(param.getGoodsType());
-			String stockResult = goodsService.getCheckStock(checkParam);
+					// 상품 재고 확인
+					GoodsStock checkParam = new GoodsStock();
+					checkParam.setGoodsCd(param.getGoodsCd());
+					checkParam.setItemCd(param.getItemCd());
+					checkParam.setOptCd(param.getOptCd());
+					checkParam.setGoodsQty(param.getGoodsQty());
+					checkParam.setGoodsType(param.getGoodsType());
+					String stockResult = goodsService.getCheckStock(checkParam);
+
+					if (!"SUCCESS".equals(stockResult)) {
+						result.put("message", stockResult);
+						return result;
+					}
 
 
-			if (!"SUCCESS".equals(stockResult)) {
-				throw new IllegalArgumentException(stockResult);
+					// 금일 주문 수량 체크
+					if (!StringUtils.isEmpty(param.getCartGb()) && "O".equals(param.getCartGb())) {
+						int goodsCartCnt = 0;
+						if(param.getCustNo() != 0) {
+							goodsCartCnt = cartDao.getGoodsTodayOrderCnt(param);
+						}
+
+						if (param.getGoodsQty() + goodsCartCnt > goods.getDayMaxOrdQty()) {
+							result.put("message", "1일 구매한도 수량이 초과되었습니다.");
+							return result;
+						}
+					}
+				}
+
+				saveSetTypeCartInfo(params, cartSqList);
 			}
 			}
+		} else {
+			for (Cart param : params) {
+				param.setCustNo(login.getCustNo());
+				// 상품 마스터 정보 확인
+				Goods goods = new Goods();
+				goods.setGoodsCd(param.getGoodsCd());
+				goods.setFrontGb(TsfSession.getFrontGb());
+				goods.setSiteCd(TscConstants.Site.STYLE24.value());
+
+				goods = goodsService.getGoodsInfo(goods);
 
 
-			// 금일 주문 수량 체크
-			if (!StringUtils.isEmpty(param.getCartGb()) && "O".equals(param.getCartGb())) {
-				int goodsCartCnt = 0;
-				if(param.getCustNo() != 0) {
-					goodsCartCnt = cartDao.getGoodsTodayOrderCnt(param);
+				log.info("CHECK :::::::::::::::: 0 ::::::::::::::::::::::");
+
+				if (goods == null) {
+					log.info("CHECK :::::::::::::::: 1 ::::::::::::::::::::::");
+					result.put("message", "상품 정보가 존재하지 않습니다.");
+					return result;
+				} else if (TscConstants.GoodsStat.SOLDOUT.value().equals(goods.getGoodsStat())) {
+					log.info("CHECK :::::::::::::::: 2 ::::::::::::::::::::::");
+					result.put("message", "품절입니다");
+					return result;
+				} else if (!TscConstants.GoodsStat.SOLDOUT.value().equals(goods.getGoodsStat()) && !TscConstants.GoodsStat.APPR.value().equals(goods.getGoodsStat())) {
+					log.info("CHECK :::::::::::::::: 3 ::::::::::::::::::::::");
+					result.put("message", "판매중인 상품이 아닙니다.");
+					return result;
+				} else if (param.getGoodsQty() > goods.getMaxOrdQty()) {
+					log.info("CHECK :::::::::::::::: 4 ::::::::::::::::::::::");
+					result.put("message", goods.getGoodsNm() + " 상품의 최대 구매 수량은 " + goods.getMaxOrdQty() + " 입니다.");
+					return result;
+				} else if (param.getGoodsQty() < goods.getMinOrdQty()) {
+					log.info("CHECK :::::::::::::::: 5 ::::::::::::::::::::::");
+					result.put("message", goods.getGoodsNm() + " 상품의 최소 구매 수량은 " + goods.getMinOrdQty() + " 입니다.");
+					return result;
 				}
 				}
 
 
-				if (param.getGoodsQty() + goodsCartCnt > goods.getDayMaxOrdQty()) {
-					throw new IllegalArgumentException("1일 구매한도 수량이 초과되었습니다.");
+				log.info("CHECK :::::::::::::::: 6 ::::::::::::::::::::::");
+
+				// 상품 재고 확인
+				GoodsStock checkParam = new GoodsStock();
+				checkParam.setGoodsCd(param.getGoodsCd());
+				checkParam.setItemCd(param.getItemCd());
+				checkParam.setOptCd(param.getOptCd());
+				checkParam.setGoodsQty(param.getGoodsQty());
+				checkParam.setGoodsType(param.getGoodsType());
+				String stockResult = goodsService.getCheckStock(checkParam);
+
+				if (!"SUCCESS".equals(stockResult)) {
+					result.put("message", stockResult);
+					return result;
+				}
+
+				// 금일 주문 수량 체크
+				if (!StringUtils.isEmpty(param.getCartGb()) && "O".equals(param.getCartGb())) {
+					int goodsCartCnt = 0;
+					if(param.getCustNo() != 0) {
+						goodsCartCnt = cartDao.getGoodsTodayOrderCnt(param);
+					}
+
+					if (param.getGoodsQty() + goodsCartCnt > goods.getDayMaxOrdQty()) {
+						result.put("message", "1일 구매한도 수량이 초과되었습니다.");
+						return result;
+					}
 				}
 				}
 			}
 			}
-		}
 
 
-		// 장바구니 정보 수정
-		if (TscConstants.GoodsType.SET.value().equals(params.iterator().next().getGoodsType())) {
-			// 세트상품일 경우
-			saveSetTypeCartInfo(params);
-		} else {
-			// 세트 상품이 아닐 경우
-			saveNormalDealCartInfo(params);
+			saveNormalDealCartInfo(params, cartSqList);
 		}
 		}
+
+		result.put("cartSqList", cartSqList);
+		result.put("goodsType", goodsType);
+		result.put("cartGb", cartGb);
+		result.put("message", "SUCCESS");
+
+		return result;
 	}
 	}
 
 
 	@Transactional("shopTxnManager")
 	@Transactional("shopTxnManager")
-	public void saveSetTypeCartInfo(Collection<Cart> params) {
+	public void saveSetTypeCartInfo(Collection<Cart> params, List<Integer> cartSqs) {
 		Cart cart = new Cart();
 		Cart cart = new Cart();
 		StringBuilder sb = new StringBuilder();
 		StringBuilder sb = new StringBuilder();
 
 
@@ -149,80 +237,82 @@ public class TsfCartService {
 		cart.setJsessionId(TscSession.getSessionId());
 		cart.setJsessionId(TscSession.getSessionId());
 
 
 		// 장바구니 보유 CART_SQ 쿼리
 		// 장바구니 보유 CART_SQ 쿼리
-		int i = 1;
-		for (Cart param : params) {
-			sb.append("SELECT CD.CART_SQ \n FROM TB_CART_DETAIL CD \n INNER JOIN TB_CART C \n ON CD.CART_SQ = C.CART_SQ \n WHERE C.CUST_NO = ");
-
-			if (cart.getCustNo() == 0) {
-				sb.append(cart.getCustNo()).append("\n AND JSESSION_ID = '").append(cart.getJsessionId()).append("'");
-			} else {
-				sb.append(cart.getCustNo());
-			}
-			sb.append("\n AND CD.ITEM_CD = '").append(param.getItemCd()).append("' \n AND CD.OPT_CD = '").append(param.getOptCd()).append("'");
-			if (i < params.size()) {
-				i++;
-				sb.append("\n UNION ALL \n");
+		for (Cart carts : params) {
+			int i = 1;
+			Collection<Cart> cartInfos = carts.getCartCompsList();
+			sb = new StringBuilder();
+			for(Cart param : cartInfos) {
+				sb.append("SELECT CD.CART_SQ \n FROM TB_CART_DETAIL CD \n INNER JOIN TB_CART C \n ON CD.CART_SQ = C.CART_SQ \n WHERE C.CUST_NO = ");
+
+				if (cart.getCustNo() == 0) {
+					sb.append(cart.getCustNo()).append("\n AND JSESSION_ID = '").append(cart.getJsessionId()).append("'");
+				} else {
+					sb.append(cart.getCustNo());
+				}
+				sb.append("\n AND CD.ITEM_CD = '").append(param.getItemCd()).append("' \n AND CD.OPT_CD = '").append(param.getOptCd()).append("'");
+				if (i < cartInfos.size()) {
+					i++;
+					sb.append("\n UNION ALL \n");
+				}
 			}
 			}
-		}
-
-		// cart 정보 세팅
-		cart.setContentsLoc(params.iterator().next().getContentsLoc());
-		cart.setAfLinkCd(params.iterator().next().getAfLinkCd());
-		cart.setIthrCd(params.iterator().next().getIthrCd());
-		cart.setPlanDtlSq(params.iterator().next().getPlanDtlSq());
-		cart.setGoodsCd(params.iterator().next().getGoodsCd());
-		cart.setGoodsQty(params.iterator().next().getGoodsQty());
-		cart.setGoodsType(params.iterator().next().getGoodsType());
-		cart.setItemCdSql(sb.toString());
 
 
-		Collection<Cart> cartSqList = null;
-
-		if (!StringUtils.isEmpty(params.iterator().next().getCartGb()) && "C".equals(params.iterator().next().getCartGb())) {
-			cart.setCartGb(TscConstants.CartGb.CART.value());
-			// 같은 장바구니 상품 확인
-			cartSqList = cartDao.selectHasSetItemCartList(cart);
-		} else if (!StringUtils.isEmpty(params.iterator().next().getCartGb()) && "O".equals(params.iterator().next().getCartGb())) {
-			if ("P".equals(TsfSession.getFrontGb())) {
-				cart.setCartGb(TscConstants.CartGb.PC_ORDER.value());
+			// cart 정보 세팅
+			cart.setContentsLoc(cartInfos.iterator().next().getContentsLoc());
+			cart.setAfLinkCd(cartInfos.iterator().next().getAfLinkCd());
+			cart.setIthrCd(cartInfos.iterator().next().getIthrCd());
+			cart.setPlanDtlSq(cartInfos.iterator().next().getPlanDtlSq());
+			cart.setGoodsCd(cartInfos.iterator().next().getGoodsCd());
+			cart.setGoodsQty(cartInfos.iterator().next().getGoodsQty());
+			cart.setGoodsType(cartInfos.iterator().next().getGoodsType());
+			cart.setItemCdSql(sb.toString());
+
+			Collection<Cart> cartSqList = null;
+
+			if (!StringUtils.isEmpty(cartInfos.iterator().next().getCartGb()) && "C".equals(cartInfos.iterator().next().getCartGb())) {
+				cart.setCartGb(TscConstants.CartGb.CART.value());
+				// 같은 장바구니 상품 확인
+				cartSqList = cartDao.selectHasSetItemCartList(cart);
+			} else if (!StringUtils.isEmpty(cartInfos.iterator().next().getCartGb()) && "O".equals(cartInfos.iterator().next().getCartGb())) {
+				if ("P".equals(TsfSession.getFrontGb())) {
+					cart.setCartGb(TscConstants.CartGb.PC_ORDER.value());
+				} else {
+					cart.setCartGb(TscConstants.CartGb.MOB_ORDER.value());
+				}
 			} else {
 			} else {
-				cart.setCartGb(TscConstants.CartGb.MOB_ORDER.value());
+				cart.setCartGb(TscConstants.CartGb.CREATE_ORDER.value());
 			}
 			}
-		} else {
-			cart.setCartGb(TscConstants.CartGb.CREATE_ORDER.value());
-		}
 
 
-		if (cartSqList != null && cartSqList.size() > 0) {		// 장바구니 기존재
-			if (cartSqList.size() > 1) {						// 장바구니 조회 결과 이상시 insert or select 수정 필요
-				throw new IllegalArgumentException("장바구니 조회에 실패하였습니다. 관리자에게 문의해주세요.");
+			if (cartSqList != null && cartSqList.size() > 0) {		// 장바구니 기존재
+				if (cartSqList.size() > 1) {						// 장바구니 조회 결과 이상시 insert or select 수정 필요
+					throw new IllegalArgumentException("장바구니 조회에 실패하였습니다. 관리자에게 문의해주세요.");
+				} else {
+					cart.setCartSq(cartSqList.iterator().next().getCartSq());
+					cartSqs.add(cart.getCartSq());
+					cartDao.updateCartInfo(cart);               // 장바구니 정보 수정
+					cartDao.insertCartHst(cart);                // 장바구니 수정 이력 저장
+				}
 			} else {
 			} else {
-				cart.setCartSq(cartSqList.iterator().next().getCartSq());
-				cartDao.updateCartInfo(cart);               // 장바구니 정보 수정
-				cartDao.insertCartHst(cart);                // 장바구니 수정 이력 저장
-			}
+				cartDao.insertCartInfo(cart);					// 장바구니 마스터 정보 저장
+				cartDao.insertCartHst(cart);                    // 장바구니 이력 정보 저장
 
 
-			for (Cart param : params) {
-				param.setCartSq(cart.getCartSq());
-			}
-		} else {
-			cartDao.insertCartInfo(cart);					// 장바구니 마스터 정보 저장
-			cartDao.insertCartHst(cart);                    // 장바구니 이력 정보 저장
-
-			TsfSession.setAttribute("cartSqArr", cart.getCartSq()+"");
+				cartSqs.add(cart.getCartSq());
+				TsfSession.setAttribute("cartSqArr", cart.getCartSq()+"");
 
 
-			for (Cart param : params) {
-				param.setCartSq(cart.getCartSq());
-				param.setRegNo(cart.getRegNo());
-				param.setCustNo(cart.getCustNo());
-				param.setUpdNo(cart.getUpdNo());
+				for (Cart param : cartInfos) {
+					param.setCartSq(cart.getCartSq());
+					param.setRegNo(cart.getRegNo());
+					param.setCustNo(cart.getCustNo());
+					param.setUpdNo(cart.getUpdNo());
 
 
-				cartDao.insertCartDetailInfo(param);		// 장바구니 상세 저장
-				cartDao.insertCartDetailHst(param);         // 장바구니 상세 이력 저장
+					cartDao.insertCartDetailInfo(param);		// 장바구니 상세 저장
+					cartDao.insertCartDetailHst(param);         // 장바구니 상세 이력 저장
+				}
 			}
 			}
 		}
 		}
 	}
 	}
 
 
 	@Transactional("shopTxnManager")
 	@Transactional("shopTxnManager")
-	public void saveNormalDealCartInfo(Collection<Cart> params) {
+	public void saveNormalDealCartInfo(Collection<Cart> params, List<Integer> cartSqs) {
 		Cart cart = new Cart();
 		Cart cart = new Cart();
 		// 로그인 정보
 		// 로그인 정보
 		if(TsfSession.isLogin()) {
 		if(TsfSession.isLogin()) {
@@ -265,6 +355,7 @@ public class TsfCartService {
 					throw new IllegalArgumentException("장바구니 조회에 실패하였습니다. 관리자에게 문의해주세요.");
 					throw new IllegalArgumentException("장바구니 조회에 실패하였습니다. 관리자에게 문의해주세요.");
 				} else {
 				} else {
 					item.setCartSq(cartSqList.iterator().next());
 					item.setCartSq(cartSqList.iterator().next());
+					cartSqs.add(item.getCartSq());
 					cartDao.updateCartInfo(item);
 					cartDao.updateCartInfo(item);
 					cartDao.insertCartHst(item);                // 장바구니 수정 이력 저장
 					cartDao.insertCartHst(item);                // 장바구니 수정 이력 저장
 				}
 				}
@@ -274,6 +365,7 @@ public class TsfCartService {
 				cartDao.insertCartDetailInfo(item);				// 장바구니 상세 저장
 				cartDao.insertCartDetailInfo(item);				// 장바구니 상세 저장
 				cartDao.insertCartDetailHst(item);				// 장바구니 수정 이력 저장
 				cartDao.insertCartDetailHst(item);				// 장바구니 수정 이력 저장
 
 
+				cartSqs.add(item.getCartSq());
 				sendCartSqList.add(item.getCartSq() + "");
 				sendCartSqList.add(item.getCartSq() + "");
 			}
 			}
 		}
 		}

+ 4 - 3
src/main/java/com/style24/front/biz/web/TsfCartController.java

@@ -100,15 +100,16 @@ public class TsfCartController extends TsfBaseController {
 	 */
 	 */
 	@ResponseBody
 	@ResponseBody
 	@PostMapping("/save")
 	@PostMapping("/save")
-	public Collection<Cart> createCart(@RequestBody Collection<Cart> params) {
+	public GagaMap createCart(@RequestBody Collection<Cart> params) {
+		GagaMap result = new GagaMap();
 		try {
 		try {
-			cartService.saveCartInfo(params);
+			result = cartService.saveCartInfo(params);
 		} catch (Exception e) {
 		} catch (Exception e) {
 			e.printStackTrace();
 			e.printStackTrace();
 			throw new IllegalArgumentException();
 			throw new IllegalArgumentException();
 		}
 		}
 
 
-		return params;
+		return result;
 	}
 	}
 
 
 	// @ResponseBody
 	// @ResponseBody

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

@@ -84,9 +84,9 @@ public class TsfOrderController extends TsfBaseController {
 		
 		
 		// TODO 임시 장바구니
 		// TODO 임시 장바구니
 		// 2. 장바구니시퀀스 배열 등록 (장바구니 상품 정보 조회)
 		// 2. 장바구니시퀀스 배열 등록 (장바구니 상품 정보 조회)
-		int[] arr = {11,77,8};
-		order.setCartSqArr(arr);		// 장바구니시퀀스
-		order.setShotDelvUseYn("Y");	// 장바구니총알배송사용여부
+		//int[] arr = {11,77,8};
+		//order.setCartSqArr(arr);		// 장바구니시퀀스
+		//order.setShotDelvUseYn("Y");	// 장바구니총알배송사용여부
 		
 		
 		// 1.1 카트시퀀스가 정보가 없을때 처리 장바구니로 이동 
 		// 1.1 카트시퀀스가 정보가 없을때 처리 장바구니로 이동 
 		if (order.getCartSqArr() == null) {
 		if (order.getCartSqArr() == null) {

+ 2 - 0
src/main/java/com/style24/persistence/domain/Cart.java

@@ -88,4 +88,6 @@ public class Cart extends TscBaseDomain {
 	private Integer updCartSq;	// 업데이트할 장바구니번호
 	private Integer updCartSq;	// 업데이트할 장바구니번호
 	private Integer delCartSq;	// 삭제할 장바구니번호(0이면 삭제할 장바구니번호 없음)
 	private Integer delCartSq;	// 삭제할 장바구니번호(0이면 삭제할 장바구니번호 없음)
 
 
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private Cart[] cartGoodsList;		// 장바구니 단품코드
 }
 }

+ 57 - 34
src/main/webapp/WEB-INF/views/web/cart/CartListAjaxFormWeb.html

@@ -571,10 +571,22 @@
 			/*let compsList = [];
 			/*let compsList = [];
 			let temp 			= new Object;
 			let temp 			= new Object;
 			temp.goodsCd 		= "AOW13QDM76";
 			temp.goodsCd 		= "AOW13QDM76";
-			temp.optCd 			= "13256848-4";
-			temp.goodsQty 		= 1;
+			temp.optCd 			= "13256848-2";
+			temp.goodsQty 		= 3;
 			temp.goodsType 		= "G056_N";
 			temp.goodsType 		= "G056_N";
-			temp.cartGb 		= "C";
+			temp.cartGb 		= "O";
+			temp.afLinkCd 		= "afLinkCd";
+			temp.ithrCd 		= "G027_ZZZ";
+			temp.contentsLoc 	= "G028_YYY";
+			temp.planDtlSq 		= "123";
+			compsList.push(temp);
+
+			temp 			= new Object;
+			temp.goodsCd 		= "AOW13QDM76";
+			temp.optCd 			= "13256848-6";
+			temp.goodsQty 		= 3;
+			temp.goodsType 		= "G056_N";
+			temp.cartGb 		= "O";
 			temp.afLinkCd 		= "afLinkCd";
 			temp.afLinkCd 		= "afLinkCd";
 			temp.ithrCd 		= "G027_ZZZ";
 			temp.ithrCd 		= "G027_ZZZ";
 			temp.contentsLoc 	= "G028_YYY";
 			temp.contentsLoc 	= "G028_YYY";
@@ -593,12 +605,17 @@
 			}
 			}
 
 
 			/* 세트상품 장바구니 */
 			/* 세트상품 장바구니 */
-			/*let compsList = [];
+			/*let goodsList = {
+				cartCompsList : new Array()
+			}
+			let cartGoodsList = [];
+
+			let compsList = [];
 			let temp = new Object;
 			let temp = new Object;
 			temp.goodsCd = "STYS00000005";
 			temp.goodsCd = "STYS00000005";
 			temp.itemCd = "A83F-DP568S";
 			temp.itemCd = "A83F-DP568S";
-			temp.optCd = "14019445-2";
-			temp.goodsQty = 1;
+			temp.optCd = "14019445-1";
+			temp.goodsQty = 3;
 			temp.goodsType = "G056_S";
 			temp.goodsType = "G056_S";
 			temp.cartGb = "C";
 			temp.cartGb = "C";
 			temp.afLinkCd = "aaaa";
 			temp.afLinkCd = "aaaa";
@@ -609,8 +626,8 @@
 			temp = new Object;
 			temp = new Object;
 			temp.goodsCd = "STYS00000005";
 			temp.goodsCd = "STYS00000005";
 			temp.itemCd = "A83F-TS517S";
 			temp.itemCd = "A83F-TS517S";
-			temp.optCd = "11867579-2";
-			temp.goodsQty = 1;
+			temp.optCd = "11867579-1";
+			temp.goodsQty = 3;
 			temp.goodsType = "G056_S";
 			temp.goodsType = "G056_S";
 			temp.cartGb = "C";
 			temp.cartGb = "C";
 			temp.afLinkCd = "aaaa";
 			temp.afLinkCd = "aaaa";
@@ -619,36 +636,42 @@
 			temp.planDtlSq = "44";
 			temp.planDtlSq = "44";
 			compsList.push(temp);
 			compsList.push(temp);
 
 
-			cfnAddCart(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 = "O";
-			temp.afLinkCd = "afLinkCd";
-			temp.ithrCd = "G027_ZZZ";
-			temp.contentsLoc = "G028_YYY";
-			temp.planDtlSq = "123";
-			compsList.push(temp);
+			goodsList.cartCompsList = compsList;
+			cartGoodsList.push(goodsList);
 
 
+			let compsList2 = [];
+			let goodsList2 = {
+				cartCompsList : new Array()
+			}
+			temp = new Object;
+			temp.goodsCd = "STYS00000005";
+			temp.itemCd = "A83F-DP568S";
+			temp.optCd = "14019445-3";
+			temp.goodsQty = 3;
+			temp.goodsType = "G056_S";
+			temp.cartGb = "C";
+			temp.afLinkCd = "aaaa";
+			temp.ithrCd = "12311";
+			temp.contentsLoc = "afasd";
+			temp.planDtlSq = "44";
+			compsList2.push(temp);
 			temp = new Object;
 			temp = new Object;
-			temp.goodsCd = "14373710";
-			temp.optCd = "L핑크130";
+			temp.goodsCd = "STYS00000005";
+			temp.itemCd = "A83F-TS517S";
+			temp.optCd = "14024048-1";
 			temp.goodsQty = 3;
 			temp.goodsQty = 3;
-			temp.goodsType = "G056_D";
-			temp.dealGoodsCd = "STYD000000025"
-			temp.cartGb = "O";
-			temp.afLinkCd = "afLinkCd";
-			temp.ithrCd = "G027_ZZZ";
-			temp.contentsLoc = "G028_YYY";
-			temp.planDtlSq = "123";
-			compsList.push(temp);
+			temp.goodsType = "G056_S";
+			temp.cartGb = "C";
+			temp.afLinkCd = "aaaa";
+			temp.ithrCd = "12311";
+			temp.contentsLoc = "afasd";
+			temp.planDtlSq = "44";
+			compsList2.push(temp);
 
 
-			cfnAddCart(compsList);*/
+			goodsList2.cartCompsList = compsList2;
+			cartGoodsList.push(goodsList2);
+
+			cfnAddCart(cartGoodsList);*/
 		});
 		});
 
 
 		function cancelCartCpn() {
 		function cancelCartCpn() {

+ 4 - 2
src/main/webapp/WEB-INF/views/web/goods/GoodsDealDetailFormWeb.html

@@ -274,8 +274,10 @@
 	<!-- //상품썸네일 크게보기 팝업 -->
 	<!-- //상품썸네일 크게보기 팝업 -->
 	
 	
 	<!-- **************** 개별상품 상세정보 팝업 **************** -->
 	<!-- **************** 개별상품 상세정보 팝업 **************** -->
-	
- 
+
+
+	<!-- 바로구매 장바구니 등록 정보 저장을 위한 form -->
+	<form id="directOrderForm" method="POST" action="/order/noMember"></form>
 </div>
 </div>
  
  
 <script th:inline="javascript">
 <script th:inline="javascript">

+ 25 - 16
src/main/webapp/ux/style24_link.js

@@ -222,6 +222,7 @@ var cfnOpenIpinCertify = function (redirectUrl) {
  *				compsList.push(temp);
  *				compsList.push(temp);
  *			}
  *			}
  *			cfnAddCart(compsList);
  *			cfnAddCart(compsList);
+ *
  * </pre>
  * </pre>
  * @since  : 2021/02/24
  * @since  : 2021/02/24
  * @author : xodud1202
  * @author : xodud1202
@@ -236,25 +237,33 @@ function cfnAddCart(cartList) {
 		contentType: 'application/json',
 		contentType: 'application/json',
 		dataType : 'json',
 		dataType : 'json',
 		success : function(result) {
 		success : function(result) {
-			if(cartList[0].cartGb == "C") {
-				mcxDialog.confirm("<div class="+"dialog-title"+">"+"상품이 쇼핑백에 추가되었습니다.</div><p>쇼핑백으로 이동하시겠습니까?</p>", {
-					cancelBtnText: "계속 쇼핑하기",
-					sureBtnText: "쇼핑백 가기",
-					sureBtnClick: function(){
-						location.href='/cart/list/form'; 	//내 쇼핑백 이동url
+			alert(result.cartGb + " / " + result.message)
+			if(result.message == "SUCCESS") {
+				if(result.cartGb == "C") {
+					mcxDialog.confirm("<div class="+"dialog-title"+">"+"상품이 쇼핑백에 추가되었습니다.</div><p>쇼핑백으로 이동하시겠습니까?</p>", {
+						cancelBtnText: "계속 쇼핑하기",
+						sureBtnText: "쇼핑백 가기",
+						sureBtnClick: function(){
+							location.href='/cart/list/form'; 	//내 쇼핑백 이동url
+						}
+					});
+				} else if (result.cartGb == "O"){
+					let orderHtml = "";
+					for(let i = 0 ; i < result.cartSqList.length ; i++) {
+						orderHtml += '<input type="hidden" name="cartSqArr" value="' + result.cartSqList[i] + '" />';
 					}
 					}
-				});
-			} else if (cartList[0].cartGb == "O"){
-				let orderHtml = "";
-				for(let i = 0 ; i < result.length ; i++) {
-					orderHtml += '<input type="hidden" name="cartSqArr" value="' + result[i].cartSq + '" />';
+					$("#directOrderForm").html(orderHtml);
+					
+					alert("cartGb = O 영역 ::: " + orderHtml);
+					
+					$("#directOrderForm").submit();
+					
+					//location.href='/cart/list/form';
+				} else {
+					mcxDialog.alert("쇼핑백담기, 바로구매가 아닌 상태입니다. 해당 요청이 맞다면 새로고침 후 다시시도해주세요.");
 				}
 				}
-				$("#directOrderForm").html(orderHtml);
-				$("#directOrderForm").submit();
-				
-				//location.href='/cart/list/form';
 			} else {
 			} else {
-				mcxDialog.alert("쇼핑백담기, 바로구매가 아닌 상태입니다. 해당 요청이 맞다면 새로고침 후 다시시도해주세요.");
+				mcxDialog.alert(result.message);
 			}
 			}
 		}
 		}
 	});
 	});