Bläddra i källkod

Merge remote-tracking branch '112.172.147.34/style' into ST24PRJ-4(회수상품정보,금액정보노출)

jsh77b 4 år sedan
förälder
incheckning
449a71c45b

+ 9 - 0
src/main/java/com/style24/admin/biz/dao/TsaPlanDao.java

@@ -319,6 +319,15 @@ public interface TsaPlanDao {
 	 */
 	void deletePlanCornerGoods(Plan param);
 	
+	/**
+	 * 기획전 코너 상품 수정
+	 *
+	 * @param 
+	 * @author jmh
+	 * @since 2021. 12. 02
+	 */
+	void updatePlanCornerGoods(Plan param);
+	
 	/**
 	 * 기획전 코너 복사
 	 *

+ 16 - 0
src/main/java/com/style24/admin/biz/service/TsaPlanService.java

@@ -579,6 +579,22 @@ public class TsaPlanService {
 		}
 	}
 	
+	/**
+	 * 기획전 코너 상품 수정
+	 *
+	 * @param
+	 * @return
+	 * @author jmh
+	 * @since 2021. 12. 02
+	 */
+	@Transactional("shopTxnManager")
+	public void updatePlanCornerGoods(Collection<Plan> paramList) {
+		for (Plan cornerInfo : paramList) {
+			cornerInfo.setUpdNo(TsaSession.getInfo().getUserNo());
+			planDao.updatePlanCornerGoods(cornerInfo);
+		}
+	}
+	
 	/**
 	 * 기획전 코너 저장
 	 *

+ 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;
-    }
-	
 	/**
 	 * 샵링커 주문수집 목록 - 제휴몰업로드 메모 저장 
 	 *

+ 14 - 0
src/main/java/com/style24/admin/biz/web/TsaMarketingController.java

@@ -2591,6 +2591,20 @@ public class TsaMarketingController extends TsaBaseController {
 		planService.deletePlanCornerGoods(paramList);
 		return super.ok(message.getMessage("SUCC_0003"));
 	}
+	
+	/**
+	 * 기획전 코너 상품 정렬순서변경
+	 *
+	 * @return
+	 * @author jmh
+	 * @since 2021. 12. 02
+	 */
+	@PostMapping("/planning/corner/goods/modify")
+	@ResponseBody
+	public GagaResponse modifyPlanCornerGoods(@RequestBody Collection<Plan> paramList) {
+		planService.updatePlanCornerGoods(paramList);
+		return super.ok(message.getMessage("SUCC_0002"));
+	}
 
 	/**
 	 * 기획전 코너 복사

+ 11 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsaPlan.xml

@@ -747,6 +747,17 @@
 		</if>
 	</update>
 	
+	<!-- 기획전 코너 상품 순서변경 -->
+	<update id="updatePlanCornerGoods" parameterType="Plan">
+		/* TsaPlan.updatePlanCornerGoods */
+		UPDATE TB_PLAN_GOODS
+		SET  UPD_DT = now()
+			 , UPD_NO  = #{updNo}
+		     , DISP_ORD = #{dispOrd}
+		WHERE  PLAN_DTL_SQ = #{planDtlSq}
+		AND    GOODS_CD = #{goodsCd}
+	</update>
+	
 	<!-- 기획전 코너 저장 -->
 	<insert id="savePlanCornerInfo" parameterType="Plan">
 		/* TsaPlan.savePlanCornerInfo */

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

+ 42 - 16
src/main/webapp/WEB-INF/views/marketing/PlanCornerListForm.html

@@ -82,6 +82,7 @@
 					<button type="button" class="btn btn-Right btn-default btn-lg"onclick="fnGoodsExcelUpload();">엑셀상품추가/수정</button>
 					<button type="button" class="btn btn-default btn-lg" onclick="cfnDownloadSampleFile('SF012');">엑셀상품추가 양식 다운로드</button>
 					<button type="button" class="btn btn-default btn-lg" onclick="fnOpenGoodsPopup();">상품추가</button>
+					<button type="button" class="btn btn-info btn-lg" onclick="fnModifyGoods();">정렬수정</button>
 					<button type="button" class="btn btn-danger btn-lg"	onclick="fnDeleteGoods();">선택삭제</button>
 				</div>
 			</div>
@@ -307,7 +308,8 @@
 				mcxDialog.alert('진행기간 시작일자는 종료일자보다 클 수 없습니다.');
 				result = false;
 			}
-
+			
+			/* 21.12.03 제외요청 처리
 			if (Number(data.startSearchDate.replaceAll("-", "")) < Number(_today.replaceAll("-", "")) && data.crud == 'C') {
 				mcxDialog.alert('시작일자는 오늘포함 이후로 등록해주세요.');
 				result = false;
@@ -327,7 +329,7 @@
 			if (eddt[0].replaceAll("-", "") < data.endSearchDate.replaceAll("-", "")) {
 				mcxDialog.alert("기획전 종료일보다 코너종료일이 클 수 없습니다.");
 				result = false;
-			}
+			}*/
 
 			if (result) {
 				data.dispStdt = data.startSearchDate + ' ' + data.startSearchTime;
@@ -357,14 +359,15 @@
 	var uploadGoodsUrl = [[${@environment.getProperty('upload.goods.view')}]];
 	var columnDefsGoods = [
 		{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
-		{headerName: "정렬"		, field:'dispOrd'		, width:50, cellClass: 'text-center'
-			, valueFormatter: function(params) { return params.value.addComma(); }
+		{headerName: "정렬"		, field:'dispOrd'				, width:50, cellClass: 'text-right',
+			cellEditor: 'textCellEditor',
+			cellEditorParams: { maxlength: 3, required: true }
 		},
-		{headerName: "상품코드"	, field:'goodsCd'		, width:150, cellClass: 'text-left'
+		{headerName: "상품코드"	, field:'goodsCd'		, width:150, cellClass: 'text-left', editable: false
 			, cellRenderer: function(params) {return '<a href="javascript:void(0);">' + params.value + '</a>'; }
 		},
-		{headerName: "상품명"		, field:'goodsNm'		, width:300, cellClass: 'text-left'},
-		{headerName: "이미지"		, field:'sysImgNm'		, width:100 , height:60, cellClass: 'text-right'
+		{headerName: "상품명"		, field:'goodsNm'		, width:300, cellClass: 'text-left', editable: false},
+		{headerName: "이미지"		, field:'sysImgNm'		, width:100 , height:60, cellClass: 'text-right', editable: false
 			,cellRenderer: function(params) {
 				return '<img width="60" src="'+ _goodsUrl+ "/" + params.value + '?RS=60" alt="" onclick="cfnOpenImagePreViewPopup(\'goodsImgView\', \''+ _goodsUrl+ "/" + params.value +'\')" onerror="this.src=\'/image/no.png\';"/>';
 			}
@@ -373,23 +376,23 @@
 			, editable : true, cellEditor: 'numericCellEditor'
 			, valueFormatter: function(params) { return params.value.addComma(); }
 		}, */
-		{headerName: "재고"		, field:'stockQtySum'			, width:80 , cellClass: 'text-center'
+		{headerName: "재고"		, field:'stockQtySum'			, width:80 , cellClass: 'text-center', editable: false
 			, cellRenderer: function(params) {return !gagajf.isNull(params.value) ? params.value : '0'; }
 		},
-		{headerName: "할인율(%)"		, field:'dcRate'		, width:80 , cellClass: 'text-center'},
+		{headerName: "할인율(%)"		, field:'dcRate'		, width:80 , cellClass: 'text-center', editable: false},
 		{headerName: "정상가"		, field:'listPrice'		, width:100, cellClass: 'text-right' , hide : true
 			, valueFormatter: function(params) { return params.value.addComma(); }
 		},
-		{headerName: "판매가"		, field:'currPrice'		, width:100, cellClass: 'text-right'
+		{headerName: "판매가"		, field:'currPrice'		, width:100, cellClass: 'text-right', editable: false
 			, valueFormatter: function(params) { return params.value.addComma(); }
 		},
-		{headerName: "정상/이월여부", field:'formalGb'		, width:120, cellClass: 'text-center'},
-		{headerName: "상품상태"	, field:'goodsStat'		, width:100, cellClass: 'text-center'
+		{headerName: "정상/이월여부", field:'formalGb'		, width:120, cellClass: 'text-center', editable: false},
+		{headerName: "상품상태"	, field:'goodsStat'		, width:100, cellClass: 'text-center', editable: false
 			, valueFormatter: function(params) { return gagaAgGrid.lookupValue(goodsStatList, params.value); }
 		},
-		{headerName: "업체"		, field:'supplyCompNm'	, width:150, cellClass: 'text-left'},
+		{headerName: "업체"		, field:'supplyCompNm'	, width:150, cellClass: 'text-left', editable: false},
 		{headerName: "기획전상세"	, field:'planDtlSq'		, width:200, cellClass: 'text-left', hide: true},
-		{headerName: "등록일"		, field:'regDt'			, width:100,  cellClass: 'text-left'
+		{headerName: "등록일"		, field:'regDt'			, width:100,  cellClass: 'text-left', editable: false
 			, cellRenderer: function(params) { return !gagajf.isNull(params.value) ? params.value.toDate("YYYY-MM-DD HH:MM:SS").format("YYYY-MM-DD") : ''; }
 		},
 	];
@@ -398,7 +401,9 @@
 	gridOptionsGoods.rowSelection = 'multiple';
 	gridOptionsGoods.rowHeight = 60; //이미지가 있을경우 높이 지정해야함.
 	gridOptionsGoods.suppressRowClickSelection = true;
-
+	gridOptionsGoods.stopEditingWhenGridLosesFocus = true;
+	gridOptionsGoods.defaultColDef.editable = true;
+	
 	gridOptionsGoods.onCellClicked = function(event) {
 		if (event.colDef.field == 'goodsCd') {
 			// 상품 상세 팝업
@@ -432,7 +437,28 @@
 			}
 		});
 	}
-
+	
+	// 상품 정렬(순서) 전체 변경
+	var fnModifyGoods = function() {
+		var changeData = gagaAgGrid.getChangedData(gridOptionsGoods);
+		
+		if( changeData.length < 1 ){
+			mcxDialog.alert('변경할 데이터가 없습니다.');
+		}else{
+			mcxDialog.confirm('정렬된 순서를 변경하시겠습니까?', {
+				cancelBtnText: "취소",
+				sureBtnText: "확인",
+				sureBtnClick: function() {
+					var jsonData = JSON.stringify(changeData);
+	
+					gagajf.ajaxJsonSubmit('/marketing/planning/corner/goods/modify', jsonData, function() {
+						fnConnerGoodsSearch();
+					});
+				}
+			});
+		}
+	}
+	
 	// 기획전 상세일련번호 전역 변수
 	var _planDtlSq = '';