Просмотр исходного кода

Merge branch 'eskim' into develop

eskim 5 лет назад
Родитель
Сommit
d6edb4109b

+ 12 - 2
style24.admin/src/main/java/com/style24/admin/biz/dao/TsaGoodsDao.java

@@ -981,7 +981,7 @@ public interface TsaGoodsDao {
 	 * @author daehyoung
 	 * @since 2020. 12. 16
 	 */
-	int getInStockAlarmCount(GoodsSearch goodsSearch);
+	int getReinboundInformCount(GoodsSearch goodsSearch);
 
 	/**
 	 * 재입고알림 목록
@@ -991,6 +991,16 @@ public interface TsaGoodsDao {
 	 * @author daehyoung
 	 * @since 2020. 12. 16
 	 */
-	Collection<ReinboundInform> getInStockAlarmList(GoodsSearch goodsSearch);
+	Collection<ReinboundInform> getReinboundInformList(GoodsSearch goodsSearch);
+
+	/**
+	 * 재입고 알림톡 발송처리
+	 *
+	 * @param params
+	 * @return void
+	 * @author eskim
+	 * @since 2020. 12. 17
+	 */
+	void updateReinboundInform(ReinboundInform reinboundInform);
 
 }

+ 60 - 4
style24.admin/src/main/java/com/style24/admin/biz/service/TsaGoodsService.java

@@ -2497,8 +2497,8 @@ public class TsaGoodsService {
 	 * @author eskim
 	 * @since 2020. 12. 16
 	 */
-	public int getInStockAlarmCount(GoodsSearch goodsSearch) {
-		return goodsDao.getInStockAlarmCount(goodsSearch);
+	public int getReinboundInformCount(GoodsSearch goodsSearch) {
+		return goodsDao.getReinboundInformCount(goodsSearch);
 	}
 
 	/**
@@ -2509,8 +2509,64 @@ public class TsaGoodsService {
 	 * @author eskim
 	 * @since 2020. 12. 16
 	 */
-	public Collection<ReinboundInform> getInStockAlarmList(GoodsSearch goodsSearch) {
-		return goodsDao.getInStockAlarmList(goodsSearch);
+	public Collection<ReinboundInform> getReinboundInformList(GoodsSearch goodsSearch) {
+		return goodsDao.getReinboundInformList(goodsSearch);
+	}
+
+
+	/**
+	 * 재입고알림 발송 처리
+	 *
+	 * @param params
+	 * @return void
+	 * @author daehyoung
+	 * @since 2020. 07 .21
+	 */
+	@Transactional("shopTxnManager")
+	public void sendReinboundInform(ReinboundInform reinboundInform) {
+
+		if (reinboundInform.getArrRinbdInfoSq().length <= 0) {
+			throw new IllegalStateException(message.getMessage("FAIL_1001"));
+		}
+
+		int idx = 0;
+		for (String rinbdInfoSq : reinboundInform.getArrRinbdInfoSq()) {
+
+			GoodsSearch goodsSearch = new GoodsSearch();
+			goodsSearch.setRinbdInfoSq(Integer.parseInt(rinbdInfoSq));
+
+			Collection<ReinboundInform> list = goodsDao.getReinboundInformList(goodsSearch);
+			ReinboundInform oneParam = null;
+			if (list.size() == 1) {
+				oneParam = list.iterator().next();
+			} else {
+				continue;
+			}
+
+			// 재고체크
+			if (oneParam.getCurrStockQty() < 1 || "Y".equals(oneParam.getSoldoutYn())) {
+				throw new IllegalStateException(oneParam.getGoodsCd() + "상품( 사이즈 : " + oneParam.getOptCd1() + " )은 가용재고가 없습니다.");
+			}
+
+			oneParam.setRegNo(TsaSession.getInfo().getUserNo());
+			oneParam.setUpdNo(TsaSession.getInfo().getUserNo());
+
+			// **** 알림톡 발송 start ****
+			try {
+				log.info("[카카오 알림톡 발송 정보] - 재입고알림 발송: " + oneParam.toString());
+				/////////////////////////////////////////////////////
+				//kakaoService.sendGoodsRestock(oneParam);	//나중에 수정해요 eskim
+				/////////////////////////////////////////////////////
+			} catch (Exception e) {
+				e.getStackTrace();
+				throw new IllegalStateException("재입고알림 알림톡 발송을 실패하였습니다.");
+			}
+			// **** 알림톡 발송 end ****
+
+			// 재입고알림 발송처리
+			goodsDao.updateReinboundInform(oneParam);
+			idx++;
+		}
 	}
 
 }

+ 23 - 7
style24.admin/src/main/java/com/style24/admin/biz/web/TsaGoodsController.java

@@ -48,6 +48,7 @@ import com.style24.persistence.domain.NotiInfo;
 import com.style24.persistence.domain.Notice;
 import com.style24.persistence.domain.NoticeGoods;
 import com.style24.persistence.domain.Option;
+import com.style24.persistence.domain.ReinboundInform;
 import com.style24.persistence.domain.User;
 import com.style24.persistence.domain.Video;
 import com.style24.persistence.domain.WmsColorMapping;
@@ -1586,8 +1587,8 @@ public class TsaGoodsController extends TsaBaseController {
 	 * @author eskim
 	 * @since 2020. 10. 16
 	 */
-	@GetMapping("/instock/alarm/form")
-	public ModelAndView instockAlarmForm() {
+	@GetMapping("/reinbound/inform/form")
+	public ModelAndView reinboundInformForm() {
 		ModelAndView mav = new ModelAndView();
 
 		// 공급업체
@@ -1598,7 +1599,7 @@ public class TsaGoodsController extends TsaBaseController {
 		// 상품상태
 		mav.addObject("goodsStatList", rendererService.getAvailCommonCodeList("G008"));
 
-		mav.setViewName("goods/GoodsInstockAlarmForm");
+		mav.setViewName("goods/GoodsReinboundInformForm");
 
 		return mav;
 	}
@@ -1611,21 +1612,36 @@ public class TsaGoodsController extends TsaBaseController {
 	 * @author daehyoung
 	 * @since 2020. 07. 16
 	 */
-	@PostMapping("/inStockAlarm/list")
+	@PostMapping("/reinbound/inform/list")
 	@ResponseBody
-	public GagaMap getInStockAlarmList(@RequestBody GoodsSearch goodsSearch) {
+	public GagaMap getReinboundInformList(@RequestBody GoodsSearch goodsSearch) {
 
 		GagaMap result = new GagaMap();
 
 		goodsSearch.setPageable(new TsaPageRequest(goodsSearch.getPageNo() - 1, goodsSearch.getPageSize()));
-		goodsSearch.getPageable().setTotalCount(goodsService.getInStockAlarmCount(goodsSearch));
+		goodsSearch.getPageable().setTotalCount(goodsService.getReinboundInformCount(goodsSearch));
 
 		result.set("pageing", goodsSearch);
-		result.set("inStockAlarmList", goodsService.getInStockAlarmList(goodsSearch));
+		result.set("reinboundInformList", goodsService.getReinboundInformList(goodsSearch));
 
 		return result;
 	}
 
+	/**
+	 * 재입고알림 발송 처리
+	 *
+	 * @param params
+	 * @return GagaResponse
+	 * @author eskim
+	 * @since 2020. 12. 17
+	 */
+	@PostMapping("/reinbound/inform/send")
+	@ResponseBody
+	public GagaResponse sendReinboundInform(@RequestBody ReinboundInform reinboundInform) {
+		goodsService.sendReinboundInform(reinboundInform);
+		return super.ok(message.getMessage("SUCC_0001"));
+	}
+
 	/**
 	 * 상품 예약판매관리 화면
 	 *

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

@@ -81,6 +81,8 @@ public class GoodsSearch extends TscBaseDomain {
 	private String useYn;
 	private String noticeTitle;
 
+	private Integer rinbdInfoSq;
+
 	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 	private String[] siteCd;
 

+ 4 - 0
style24.admin/src/main/java/com/style24/persistence/domain/ReinboundInform.java

@@ -1,5 +1,6 @@
 package com.style24.persistence.domain;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.style24.persistence.TscBaseDomain;
 
 import lombok.Data;
@@ -28,6 +29,7 @@ public class ReinboundInform extends TscBaseDomain {
 	private String brandEnm;
 	private String GoodsNm;
 	private String custNm;
+	private String cellPhnno;
 	private String goodsStat;
 	private String imgType;
 	private String imgPath1;
@@ -35,5 +37,7 @@ public class ReinboundInform extends TscBaseDomain {
 	private int currStockQty;
 	private String soldoutYn;
 
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private String[] arrRinbdInfoSq;
 
 }

+ 22 - 5
style24.admin/src/main/java/com/style24/persistence/mybatis/shop/TsaGoods.xml

@@ -3354,8 +3354,8 @@
 	</delete>
 	
 	<!-- 재입고알림 목록 건수 -->
-	<select id="getInStockAlarmCount" parameterType="GoodsSearch" resultType="int">
-	/* TsaGoods.getInStockAlarmCount */
+	<select id="getReinboundInformCount" parameterType="GoodsSearch" resultType="int">
+	/* TsaGoods.getReinboundInformCount */
 		SELECT COUNT(*) AS TOTCNT
 		FROM TB_REINBOUND_INFORM IA
 		INNER JOIN TB_GOODS G ON IA.GOODS_CD = G.GOODS_CD
@@ -3409,8 +3409,8 @@
 	</select>
 
 	<!-- 재입고알림 목록 -->
-	<select id="getInStockAlarmList" parameterType="GoodsSearch" resultType="ReinboundInform">
-		/* TsaGoods.getInStockAlarmList */
+	<select id="getReinboundInformList" parameterType="GoodsSearch" resultType="ReinboundInform">
+		/* TsaGoods.getReinboundInformList */
 		SELECT Z.*
 		FROM (
 		       SELECT A.*, @rownum := @rownum + 1 AS RNUM 
@@ -3420,7 +3420,7 @@
 		                   , IA.OPT_CD
 		                   , IA.OPT_CD1
 		                   , IA.OPT_CD2
-		                   , DATE_FORMAT(IA.REQ_DT,'%Y%m%d%H%i%S')  AS REQ_DT
+		                   , DATE_FORMAT(IA.REQ_DT,'%Y%m%d')  AS REQ_DT
 		                   , DATE_FORMAT(IA.INFORM_DT,'%Y%m%d%H%i%S')  AS INFORM_DT
 		                   , FN_GET_USER_NM(IA.REG_NO)             AS REG_NM
 		                   , DATE_FORMAT(IA.REG_DT,'%Y%m%d%H%i%S') AS REG_DT
@@ -3429,6 +3429,7 @@
 		                   , IA.CUST_NO
 		                   , C.CUST_ID
 		                   , C.CUST_NM
+		                   , C.CELL_PHNNO
 		                   , G.GOODS_NM
 		                   , G.GOODS_STAT
 		                   , B.BRAND_ENM
@@ -3450,6 +3451,10 @@
 		              LEFT OUTER JOIN TB_GOODS_IMG GI ON IA.GOODS_CD = GI.GOODS_CD
 		                                              AND IA.OPT_CD1 = GI.COLOR_CD 
 		              WHERE 1=1
+		              AND IA.DEL_YN = 'N'
+		              <if test="rinbdInfoSq != null and rinbdInfoSq != ''">
+		              AND IA.RINBD_INFO_SQ = #{rinbdInfoSq}
+		              </if>
 		              <if test='alarmYn != null and alarmYn == "Y"'>
 		              AND IA.INFORM_DT IS NOT NULL
 		              </if>
@@ -3490,5 +3495,17 @@
 		              ORDER BY IA.REG_DT DESC
 		<include refid="getListPagingCondition_sql"/>
 	</select>
+	
+	<!-- 재입고 알림톡 발송처리 -->
+	<update id="updateReinboundInform" parameterType="ReinboundInform">
+		/* TsaGoods.updateReinboundInform */
+		UPDATE TB_REINBOUND_INFORM
+		SET INFORM_DT = NOW()
+		  , UPD_NO = #{updNo}
+		  , UPD_DT = NOW()
+		WHERE 1=1
+		AND DEL_YN = 'N'
+		AND RINBD_INFO_SQ = #{rinbdInfoSq}
+	</update>
 	
 </mapper>

+ 33 - 24
style24.admin/src/main/webapp/WEB-INF/views/goods/GoodsInstockAlarmForm.html → style24.admin/src/main/webapp/WEB-INF/views/goods/GoodsReinboundInformForm.html

@@ -3,7 +3,7 @@
 	xmlns:th="http://www.thymeleaf.org">
 <!--
  *******************************************************************************
- * @source  : GoodsInstockAlarmForm.html
+ * @source  : GoodsReinboundInformForm.html
  * @desc    : 재입고알림관리
  *============================================================================
  * PASTEL
@@ -22,7 +22,7 @@
 		<!-- 메뉴 설명 -->
 		<div class="infoBox menu-desc">
 		</div>
-		<form id="searchForm" name="searchForm" action="#" th:action="@{'/goods/inStockAlarm/list'}">
+		<form id="searchForm" name="searchForm" action="#" th:action="@{'/goods/reinbound/inform/list'}">
 		<input type="hidden" id="searchGb" name="searchGb" />
  		<!-- 패널 영역1 -->
 		<div class="panelStyle" >
@@ -116,7 +116,7 @@
 			<!-- 상단버튼 영역  -->
 			<ul class="panelBar">
 				<li class="right">
-					<button type="button" class="btn btn-primary btn-lg" id="inStockAlarmSend">재입고알림 발송</button>
+					<button type="button" class="btn btn-primary btn-lg" id="reinboundInformSend">재입고알림 발송</button>
 					검색결과 : <strong><span id="gridRowTotalCount">0</span> 건</strong>&nbsp;
 					쪽번호 <span id="pgNo">0</span>/ <strong id="endPgNo">0</strong>&nbsp;&nbsp;
 					<select id="pageSize" name="pageSize">
@@ -172,7 +172,7 @@
 				}
 			}
 		},
-		{headerName: "상품코드", field: "goodsCd", width: 140, cellClass: 'text-center'},
+		{headerName: "상품코드", field: "goodsCd", width: 130, cellClass: 'text-center'},
 		{headerName: "상품명", field: "goodsNm", width: 200, cellClass: 'text-left'
 			,cellRenderer: function(params) {
 				return '<a href="javascript:void(0);">' + params.value + '</a>';
@@ -183,14 +183,14 @@
 			valueFormatter: function (params) { return gagaAgGrid.lookupValue(goodsStatList, params.value); },
 			valueParser: function (params) { return gagaAgGrid.lookupKey(goodsStatList, params.newValue); }
 		},
-		{headerName: "색상명", field: "optCd1", width: 130, cellClass: 'text-center'},
-		{headerName: "사이즈", field: "optCd2" , width: 130, cellClass: 'text-center'},
-		{headerName: "가용재고", field: "currStockQty" , width: 100, cellClass: 'text-center'},
+		{headerName: "색상명", field: "optCd1", width: 100, cellClass: 'text-center'},
+		{headerName: "사이즈", field: "optCd2" , width: 100, cellClass: 'text-center'},
+		{headerName: "가용재고", field: "currStockQty" , width: 80, cellClass: 'text-center'},
 		{headerName: "고객ID", field: "custId" , width: 100, cellClass: 'text-center'},
 		{headerName: "고객명", field: "custNm" , width: 100, cellClass: 'text-center'},
-		{headerName: "알림요청일시", field: "regDt", width: 120, cellClass: 'text-center',
+		{headerName: "알림요청일시", field: "reqDt", width: 120, cellClass: 'text-center',
 			cellRenderer: function(params) {
-				return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD") : '';
+				return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDD").format("YYYY-MM-DD") : '';
 			}
 		},
 		{headerName: "알림 발송일시", field: "informDt", width: 120, cellClass: 'text-center',
@@ -243,11 +243,11 @@
 	// 조회클릭시
 	$('#btnSearch').on('click', function() {
 		$("#searchForm input[name=pageNo]").val('1');
-		fnInStockAlarmListSearch();
+		fnReinboundInformListSearch();
 	});
 
 	// 조회
-	var fnInStockAlarmListSearch = function(gbn) {
+	var fnReinboundInformListSearch = function(gbn) {
 
 		$("#searchForm input[name=searchGb]").val("BASIC");
 		
@@ -330,7 +330,7 @@
 				$("#cateNo").val(val);
 			}
 		}
-		debugger;
+		
 		$("#searchForm input[name=selLvl]").val(selLvl);
 		$("#searchForm input[name=searchGb]").val("BASIC");
 		gagajf.ajaxFormSubmit('/display/category/list', "#searchForm", fnChangeCategory);
@@ -368,14 +368,14 @@
 		$('#searchForm').find('#pageNo').val(result.pageing.pageable.pageNo.addComma());
 		$('#searchForm').find('#pgNo').html(result.pageing.pageable.pageNo.addComma());
 		$('#searchForm').find('#endPgNo').html(result.pageing.pageable.totalPage.addComma());
-		gridOptions.api.setRowData(result.inStockAlarmList);
+		gridOptions.api.setRowData(result.reinboundInformList);
 		gagaPaging.createPagination(result.pageing.pageable);
 	}
 
 	//페이징 
 	$('#searchForm select[name=pageSize]').on('change', function() {
 		$("#searchForm input[name=pageNo]").val('1');
-		fnInStockAlarmListSearch($("#searchForm input[name=searchGb]").val());
+		fnReinboundInformListSearch($("#searchForm input[name=searchGb]").val());
 	});
 	
 	//업체변경시
@@ -391,8 +391,7 @@
 	});
 
 	// 재입고알림 발송
-	$('#inStockAlarmSend').click(function(e) {
-		//상품선택여부 확인처리 추가
+	$('#reinboundInformSend').click(function(e) {
 		var selectedData = gridOptions.api.getSelectedRows();
 
 		if (selectedData.length == 0) {
@@ -400,13 +399,17 @@
 			return false;
 		}
 
-		var arrInstockAlarmSq = [];
+		//var toDateStr = new Date().format("YYYYMMDD");
+		var date = new Date();
+		var beforeDay = date.before(0, 0, 15).format("YYYYMMDD");
+		
+		var arrRinbdInfoSq = [];
 		var chkFlag = false;
 		$.each(selectedData, function(idx, item) {
 
-			if (item.alarmYn == "Y"){
+			if (!gagajf.isNull(item.informDt)){
 				chkFlag = true;
-				mcxDialog.alert(item.goodsCd +"상품은 이미 재입고알림 발송되었습니다.");
+				mcxDialog.alert(item.custId+'('+ item.custNm+ ') 의 '  + item.goodsCd +"상품은 이미 재입고알림 발송되었습니다.");
 				return false;
 			}
 
@@ -415,8 +418,14 @@
 				mcxDialog.alert(item.goodsCd +"상품( 사이즈 : " + item.sizeNm + " )은 가용재고가 없습니다.");
 				return false;
 			}
-
-			arrInstockAlarmSq.push(item.instockAlarmSq);
+			
+			if (beforeDay > item.reqDt){
+				chkFlag = true;
+				mcxDialog.alert("요청일이 15일경과한 재입고알림은 발송할 수 없습니다.");
+				return false;
+			}
+			
+			arrRinbdInfoSq.push(item.rinbdInfoSq);
 		});
 
 		if (chkFlag){
@@ -427,18 +436,18 @@
 			cancelBtnText: "취소",
 			sureBtnText: "확인",
 			sureBtnClick: function(){
-				var data = {arrInstockAlarmSq : arrInstockAlarmSq
+				var data = {arrRinbdInfoSq : arrRinbdInfoSq
 				};
 
 				var jsonData = JSON.stringify(data);
-				gagajf.ajaxJsonSubmit('/goods/inStockAlarm/send', jsonData, fnSendInstockCallBack);
+				gagajf.ajaxJsonSubmit('/goods/reinbound/inform/send', jsonData, fnSendInstockCallBack);
 			}
 		});
 	});
 
 	// 재입고알림 발송 콜백
 	var fnSendInstockCallBack = function(){
-		fnInStockAlarmListSearch();
+		fnReinboundInformListSearch();
 	}
 	
 	$(document).ready(function() {