Explorar o código

Merge remote-tracking branch 'origin/develop' into card007

card007 %!s(int64=4) %!d(string=hai) anos
pai
achega
8752e6fd97

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

@@ -117,8 +117,13 @@ 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();
@@ -131,19 +136,14 @@ 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");
-					// 재고가 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("			<quantity>").append(qty).append("</quantity>\n");
 
 					sbRequest.append("		</product>\n");
 					sbRequest.append("	</productInfo>\n");
 					sbRequest.append("</shoplinker>\n");
 
 					regMap.setOptCd(map.getPartnerProductId());
-					regMap.setQuantity(map.getQuantity());		// 재고 기록은 실재고 기록 0일경우 샵링커에 전송하지 않기위함.(md가 샵링커에서 몰로 수동전송시 재고가 0일경우 몰에 등록안된다 함)
+					regMap.setQuantity(map.getQuantity());		// 중요!! 재고 기록은 실 재고 기록한다. 0일경우 샵링커에 전송하지 않기위함.(md가 샵링커에서 몰로 수동전송시 재고가 0일경우 몰에 등록안된다 함)
 
 					// api 호출 및 결과 history 저장
 					callGoodsRegApi(regMap , sbRequest, "option_"+opCnt);
@@ -1309,6 +1309,114 @@ public class TsaShoplinkerService {
 			throw new IllegalStateException(e);
 		}
 	}
+	
 
-
+	/**
+	 * 샵링커 브랜드별 재고비율
+	 *
+	 * @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;
+    }
 }

+ 6 - 0
src/main/webapp/WEB-INF/views/business/BrandForm.html

@@ -329,6 +329,12 @@
 	
 	gridOptions2.rowSelection = "multiple";
 
+	var changeTag = function(option, type, val) {
+		var changeVal = val.replaceAll('&amp;', '&').replaceAll('&gt;', '>').replaceAll('&lt', '<').replaceAll('&nbsp;', ' ');
+		rowNode.setDataValue(rowNode, val);
+		gridOptions.setData()
+	}
+
 	// Cell click
 	gridOptions.onCellClicked = function(event) {
 		if (event.colDef.field != 'brandCd')

+ 8 - 0
src/main/webapp/WEB-INF/views/goods/GoodsPopupListForm.html

@@ -486,6 +486,14 @@
 		$('#goodsPopupForm').find('#pageNo').val(result.pageing.pageable.pageNo.addComma());
 		$('#goodsPopupForm').find('#pgNo').html(result.pageing.pageable.pageNo.addComma());
 		$('#goodsPopupForm').find('#endPgNo').html(result.pageing.pageable.totalPage.addComma());
+
+		// 태그 치환
+		$(result.goodsList).each(function(idx, item) {
+			if (typeof item.brandEnm != "undefined" && !gagajf.isNull(item.brandEnm)) item.brandEnm = item.brandEnm.replaceAll('&amp;', '&').replaceAll('&gt;', '>').replaceAll('&lt', '<').replaceAll('&nbsp;', ' ');
+			if (typeof item.brandKnm != "undefined" && !gagajf.isNull(item.brandKnm)) item.brandKnm = item.brandKnm.replaceAll('&amp;', '&').replaceAll('&gt;', '>').replaceAll('&lt', '<').replaceAll('&nbsp;', ' ');
+			if (typeof item.brandGroupNm != "undefined" && !gagajf.isNull(item.brandGroupNm)) item.brandGroupNm = item.brandGroupNm.replaceAll('&amp;', '&').replaceAll('&gt;', '>').replaceAll('&lt', '<').replaceAll('&nbsp;', ' ');
+		});
+
 		popupGoodsGridOptions.api.setRowData(result.goodsList);
 		gagaPaging.createPagination(result.pageing.pageable);
 

+ 1 - 1
src/main/webapp/WEB-INF/views/shoplinker/ShoplinkerStockForm.html

@@ -33,7 +33,7 @@
 				<div class="panelTitle">
 					<h3>
 						<i class="fa fa-info-circle"></i>아래 검색조건 중 상품코드나 전송일자을 꼭 입력해 주세요.
-						<br><i class="fa fa-info-circle"></i>[배치주기] 매일 10시, 15시
+						<br><i class="fa fa-info-circle"></i>[배치주기] 매일 15시 20분
 					</h3>
 					<span class="panelControl">
 						<i class="fa fa-chevron-up"></i>

+ 20 - 0
src/main/webapp/ux/plugins/gaga/gaga.agGrid.js

@@ -1006,6 +1006,16 @@ var gagaAgGrid = {
 				},
 				success : function(data) {
 					try {
+						// 태그 치환
+						$(data).each(function(idx, item) {
+							if (typeof item.brandEnm != "undefined" && !gagajf.isNull(item.brandEnm)) item.brandEnm = item.brandEnm.replaceAll('&amp;', '&').replaceAll('&gt;', '>').replaceAll('&lt', '<').replaceAll('&nbsp;', ' ');
+							if (typeof item.brandKnm != "undefined" && !gagajf.isNull(item.brandKnm)) item.brandKnm = item.brandKnm.replaceAll('&amp;', '&').replaceAll('&gt;', '>').replaceAll('&lt', '<').replaceAll('&nbsp;', ' ');
+							if (typeof item.brandGroupNm != "undefined" && !gagajf.isNull(item.brandGroupNm)) item.brandGroupNm = item.brandGroupNm.replaceAll('&amp;', '&').replaceAll('&gt;', '>').replaceAll('&lt', '<').replaceAll('&nbsp;', ' ');
+							if (typeof item.brandGroupKnm != "undefined" && !gagajf.isNull(item.brandGroupKnm)) item.brandGroupKnm = item.brandGroupKnm.replaceAll('&amp;', '&').replaceAll('&gt;', '>').replaceAll('&lt', '<').replaceAll('&nbsp;', ' ');
+							if (typeof item.brandGroupEnm != "undefined" && !gagajf.isNull(item.brandGroupEnm)) item.brandGroupEnm = item.brandGroupEnm.replaceAll('&amp;', '&').replaceAll('&gt;', '>').replaceAll('&lt', '<').replaceAll('&nbsp;', ' ');
+							if (typeof item.goodsNm != "undefined" && !gagajf.isNull(item.goodsNm)) item.goodsNm = item.goodsNm.replaceAll('&amp;', '&').replaceAll('&gt;', '>').replaceAll('&lt', '<').replaceAll('&nbsp;', ' ');
+						});
+
 						gridOptions.api.setRowData(data);
 					} catch (e) {
 						console.log(e);
@@ -1045,6 +1055,16 @@ var gagaAgGrid = {
 				},
 				success : function(data) {
 					try {
+						// 태그 치환
+						$(data).each(function(idx, item) {
+							if (typeof item.brandEnm != "undefined" && !gagajf.isNull(item.brandEnm)) item.brandEnm = item.brandEnm.replaceAll('&amp;', '&').replaceAll('&gt;', '>').replaceAll('&lt', '<').replaceAll('&nbsp;', ' ');
+							if (typeof item.brandKnm != "undefined" && !gagajf.isNull(item.brandKnm)) item.brandKnm = item.brandKnm.replaceAll('&amp;', '&').replaceAll('&gt;', '>').replaceAll('&lt', '<').replaceAll('&nbsp;', ' ');
+							if (typeof item.brandGroupNm != "undefined" && !gagajf.isNull(item.brandGroupNm)) item.brandGroupNm = item.brandGroupNm.replaceAll('&amp;', '&').replaceAll('&gt;', '>').replaceAll('&lt', '<').replaceAll('&nbsp;', ' ');
+							if (typeof item.brandGroupKnm != "undefined" && !gagajf.isNull(item.brandGroupKnm)) item.brandGroupKnm = item.brandGroupKnm.replaceAll('&amp;', '&').replaceAll('&gt;', '>').replaceAll('&lt', '<').replaceAll('&nbsp;', ' ');
+							if (typeof item.brandGroupEnm != "undefined" && !gagajf.isNull(item.brandGroupEnm)) item.brandGroupEnm = item.brandGroupEnm.replaceAll('&amp;', '&').replaceAll('&gt;', '>').replaceAll('&lt', '<').replaceAll('&nbsp;', ' ');
+							if (typeof item.goodsNm != "undefined" && !gagajf.isNull(item.goodsNm)) item.goodsNm = item.goodsNm.replaceAll('&amp;', '&').replaceAll('&gt;', '>').replaceAll('&lt', '<').replaceAll('&nbsp;', ' ');
+						});
+
 						gridOptions.api.setRowData(data);
 					} catch (e) {
 						console.log(e);