Przeglądaj źródła

[ST24PRJ-596] [결함] 재고 수정 비지니스 적용 누락

jmh 4 lat temu
rodzic
commit
32573607fb

+ 6 - 116
src/main/java/com/style24/admin/biz/service/TsaShoplinkerService.java

@@ -118,14 +118,9 @@ public class TsaShoplinkerService {
 
 				StringBuilder sbRequest;
 				int opCnt = 0;
-				int qty = 0;
 				for (ShoplinkerGoods map : list) {
 					opCnt ++;
 					
-					// 21.10.18 재고비율 추가 - 샵링커에 전송 및 전송이력에는 재고비율 수량으로 저장함
-					// 참고)재고 마스터 테이블에는 원 수량임(동기화 처리시에도 원 수량으로 됨)
-					qty = GetStockQtyForBrand(map, true);
-
 					// xml 데이터 세팅
 					sbRequest = new StringBuilder();
 					sbRequest.append("<?xml version=\"1.0\" encoding=\"euc-kr\"?>\n");
@@ -137,7 +132,12 @@ public class TsaShoplinkerService {
 					sbRequest.append("			<partner_product_id><![CDATA[").append(map.getPartnerProductId()).append("]]></partner_product_id>\n");
 					sbRequest.append("			<attribute_code><![CDATA[").append("999999999").append("]]></attribute_code>\n");
 					sbRequest.append("			<product_name><![CDATA[").append(map.getOptCd1()+"_"+map.getOptCd2()).append("]]></product_name>\n");
-					sbRequest.append("			<quantity>").append(qty).append("</quantity>\n");
+					// 재고가 0일경우 1로전송
+					if( 0 < map.getQuantity()) {
+						sbRequest.append("			<quantity>").append(map.getQuantity()).append("</quantity>\n");
+					}else {
+						sbRequest.append("			<quantity>").append("1").append("</quantity>\n");
+					}
 
 					sbRequest.append("		</product>\n");
 					sbRequest.append("	</productInfo>\n");
@@ -1356,116 +1356,6 @@ public class TsaShoplinkerService {
 		}
 	}
 	
-
-	/**
-	 * 샵링커 브랜드별 재고비율
-	 *
-	 * @return
-	 * @author jmh
-	 * @since  2021. 10. 18
-	 */
-	private int GetStockQtyForBrand(ShoplinkerGoods map, boolean isFirst)
-    {
-        int resultQty = 0;
-        String brandCd = map.getBrandCd();
-        int qty = map.getQuantity();
-
-        if (brandCd.equals("S0016") || brandCd.equals("S0018") || brandCd.equals("S0012"))
-        {
-            if (qty >= 0 && qty <= 5)
-            {
-                resultQty = isFirst ? 1 : 0;
-            }
-            else if (qty >= 6 && qty <= 29)
-            {
-                resultQty = (int)Math.floor(qty * 0.25);
-            }
-            else if (qty >= 30)
-            {
-                resultQty = (int)Math.floor(qty * 0.4);
-            }
-        }
-        else if (brandCd.equals("S0005"))
-        {
-            if (qty >= 0 && qty <= 3)
-            {
-                resultQty = isFirst ? 1 : 0;
-            }
-            else if (qty >= 4 && qty <= 29)
-            {
-                resultQty = (int)Math.floor(qty * 0.25);
-            }
-            else if (qty >= 30)
-            {
-                resultQty = (int)Math.floor(qty * 0.4);
-            }
-        }
-        else if (brandCd.equals("S0003") || brandCd.equals("S0004") || brandCd.equals("S0007") || brandCd.equals("S0001") || brandCd.equals("S0006"))
-        {
-            if (qty >= 0 && qty <= 3)
-            {
-                resultQty = isFirst ? 1 : 0;
-            }
-            else if (qty >= 4 && qty <= 29)
-            {
-                resultQty = (int)Math.ceil(qty * 0.25);
-            }
-            else if (qty >= 30)
-            {
-                resultQty = (int)Math.floor(qty * 0.4);
-            }
-        }
-        else if (brandCd.equals("S0013"))
-        {
-            if (qty >= 0 && qty <= 2)
-            {
-                resultQty = isFirst ? 1 : 0;
-            }
-            else if (qty >= 3 && qty <= 29)
-            {
-                resultQty = (int)Math.ceil(qty * 0.25);
-            }
-            else if (qty >= 30)
-            {
-                resultQty = (int)Math.floor(qty * 0.4);
-            }
-        }
-
-        else if (brandCd.equals("S0015"))
-        {
-            if (qty >= 0 && qty <= 2)
-            {
-                resultQty = isFirst ? 1 : 0;
-            }
-            else if (qty >= 3 && qty <= 29)
-            {
-                resultQty = (int)Math.ceil(qty * 0.25);
-            }
-            else if (qty >= 30)
-            {
-                resultQty = (int)Math.floor(qty * 0.4);
-            }
-        }
-        
-        else 
-        {
-        	if (qty >= 0 && qty <= 2)
-            {
-                resultQty = isFirst ? 1 : 0;
-            }
-            else if (qty >= 3 && qty <= 29)
-            {
-                resultQty = (int)Math.ceil(qty * 0.25);
-            }
-            else if (qty >= 30)
-            {
-                resultQty = (int)Math.floor(qty * 0.4);
-            }
-        }
-
-        return resultQty;
-    }
-	
 	/**
 	 * 샵링커 주문수집 목록 - 제휴몰업로드 메모 저장 
 	 *

+ 5 - 10
src/main/java/com/style24/persistence/mybatis/shop/TsaShoplinker.xml

@@ -11,18 +11,13 @@
 			, B.OPT_CD
 			, B.OPT_CD1
 			, B.OPT_CD2
-		   /*, IF(B.CURR_STOCK_QTY - B.BASE_STOCK_QTY <![CDATA[<]]> 1, 1 , B.CURR_STOCK_QTY - B.BASE_STOCK_QTY) AS QUANTITY -- 기준재고(안전재고)수량
-		   , B.STORE_STOCK_QTY -- 매장재고수량
-		   , B.CURR_STOCK_QTY -- 현재고수량
-		   */
 			, A.SELF_GOODS_YN
-			, VS.CURR_STOCK_QTY AS QUANTITY   	-- 현재고
-			, VS.BASE_STOCK_QTY 				-- 안전재고
 			, A.BRAND_CD
-		FROM VW_STOCK VS INNER JOIN TB_GOODS A ON VS.GOODS_CD = A.GOODS_CD
-		INNER JOIN TB_OPTION B ON VS.GOODS_CD = B.GOODS_CD AND A.GOODS_CD = B.GOODS_CD AND VS.OPT_CD = B.OPT_CD
-		WHERE VS.GOODS_CD = #{goodsCd}
-		AND A.SELF_GOODS_YN = 'Y'
+			, FN_GET_SHOPLINKER_STOCK_CNT(B.GOODS_CD, B.OPT_CD) AS QUANTITY   	-- 현재고
+		FROM TB_GOODS A
+		INNER JOIN TB_OPTION B ON A.GOODS_CD = B.GOODS_CD
+		WHERE 	A.GOODS_CD = #{goodsCd}
+		AND 	A.SELF_GOODS_YN = 'Y'
 		ORDER BY cast(REPLACE(B.OPT_CD, '-', '') as unsigned)
 	</select>