ソースを参照

카드무이자 할부

eskim 5 年 前
コミット
ba0fd682f4

+ 21 - 0
src/main/java/com/style24/admin/biz/dao/TsaCardPromotionDao.java

@@ -98,4 +98,25 @@ public interface TsaCardPromotionDao {
 	 */
 	void createCardPromotionTarget(CardPromotionTarget cardPromotionTarget);
 
+	/**
+	 * 카드프로모션 비노출처리
+	 * @param cardPrmtSq
+	 * @return
+	 * @author eskim
+	 * @since 2021. 2. 2
+	 */
+	void updateCardPromotionDsipYn(CardPromotion cardPromotion);
+
+
+	/**
+	 * 카드프로모션 삭제
+	 * @param cardPrmtSq
+	 * @return
+	 * @author eskim
+	 * @since 2021. 2. 2
+	 */
+	void deleteCardPromotion(int cardPrmtSq);
+
+
+
 }

+ 38 - 0
src/main/java/com/style24/admin/biz/service/TsaCardPromotionService.java

@@ -170,4 +170,42 @@ public class TsaCardPromotionService {
 		return cardPromotion;
 	}
 
+	/**
+	 * 카드프로모션 비노출처리
+	 * @param cardPromotion
+	 * @return
+	 * @author eskim
+	 * @since 2021. 02. 2
+	 */
+	@Transactional("shopTxnManager")
+	public void updateCardPromotionDsipYn(CardPromotion cardPromotion) {
+		cardPromotion.setUpdNo(TsaSession.getInfo().getUserNo());
+		cardPromotionDao.updateCardPromotionDsipYn(cardPromotion);
+	}
+
+	/**
+	 * 카드프로모션 삭제
+	 * @param cardPromotion
+	 * @return
+	 * @author eskim
+	 * @since 2021. 02. 2
+	 */
+	@Transactional("shopTxnManager")
+	public void deleteCardPromotion(CardPromotion cardPromotion) {
+
+		for(String tmpCardPrmtSq: cardPromotion.getArrCardPrmtSq()) {
+			int cardPrmtSq = Integer.parseInt(tmpCardPrmtSq);
+			//카드프로모션 조건 조회
+			Collection<CardPromotionCondition> cardPrmtCdtList = cardPromotionDao.getCardPromotionConditionList(cardPrmtSq);
+			for (CardPromotionCondition cardPromotionCondition : cardPrmtCdtList){
+				//카드프로모션 대상 삭제
+				cardPromotionDao.deleteCardPromotionTarget(cardPromotionCondition.getCardPrmtCdtSq());
+				//카드프로모션 조건 삭제
+				cardPromotionDao.deleteCardPromotionCondition(cardPromotionCondition.getCardPrmtCdtSq());
+			}
+			//카드프로모션삭제
+			cardPromotionDao.deleteCardPromotion(cardPrmtSq);
+		}
+	}
+
 }

+ 31 - 3
src/main/java/com/style24/admin/biz/web/TsaMarketingController.java

@@ -1099,10 +1099,10 @@ public class TsaMarketingController extends TsaBaseController {
 
 	/**
 	 * 카드무이자할부 저장
-	 * @param cardPromotion - 포인트 정보
-	 * @return ModelAndView
+	 * @param cardPromotion
+	 * @return
 	 * @author eskim
-	 * @since 2021. 2. 1
+	 * @since 2021. 2. 2
 	 */
 	@PostMapping("/card/interest/save")
 	@ResponseBody
@@ -1111,6 +1111,34 @@ public class TsaMarketingController extends TsaBaseController {
 		return super.ok(message.getMessage("SUCC_0001"));
 	}
 
+	/**
+	 * 카드프로모션 비노출 처리
+	 * @param cardPromotion
+	 * @return
+	 * @author eskim
+	 * @since 2021. 2. 3
+	 */
+	@PostMapping("/card/promotion/dispYn/update")
+	@ResponseBody
+	public GagaResponse updateCardPromotionDsipYn(@RequestBody CardPromotion cardPromotion) {
+		cardPromotionService.updateCardPromotionDsipYn(cardPromotion);
+		return super.ok(message.getMessage("SUCC_0009"));	//성공적 변경
+	}
+
+	/**
+	 * 카드프로모션 삭제 처리
+	 * @param cardPromotion
+	 * @return
+	 * @author eskim
+	 * @since 2021. 2. 3
+	 */
+	@PostMapping("/card/promotion/delete")
+	@ResponseBody
+	public GagaResponse deleteCardPromotion(@RequestBody CardPromotion cardPromotion) {
+		cardPromotionService.deleteCardPromotion(cardPromotion);
+		return super.ok(message.getMessage("SUCC_0003"));	//성공적 변경
+	}
+
 	/**
 	 *   카드관련 작업 종료 - eskim
 	 */

+ 4 - 1
src/main/java/com/style24/persistence/domain/CardPromotion.java

@@ -55,10 +55,13 @@ public class CardPromotion extends TscBaseDomain {
 	// 삭제할 프로모션조건
 	private String delCardPrmtCdtSq;	// 형식 /8/9
 
+	// 삭제(비노출)할 프로모션
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private String[] arrCardPrmtSq;
+
 	// 화면 조회용
 	Collection<CardPromotionCondition> cardPrmtCdtList;
 
-
 	// Pagination
 	private TscPageRequest pageable;
 	private int pageNo = 1;

+ 28 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsaCardPromotion.xml

@@ -241,4 +241,32 @@
 		)
 	</insert>
 	
+	<!-- 카드프로모션 비노출처리 -->
+	<delete id="updateCardPromotionDsipYn"  parameterType="CardPromotion" >
+		/* TsaGoods.updateCardPromotionDsipYn */
+		UPDATE TB_CARD_PROMOTION 
+		SET DISP_YN = 'N'
+		  , UPD_NO = #{updNo} 
+		  , UPD_DT = NOW()
+		WHERE 1 = 1
+		<choose>
+		    <when test="arrCardPrmtSq != null and arrCardPrmtSq != ''">
+		AND CARD_PRMT_SQ IN
+		        <foreach collection="arrCardPrmtSq" item="item" index="index"  open="(" close=")" separator=",">
+		        #{item}
+		        </foreach>
+		    </when>
+		<otherwise>
+		AND CARD_PRMT_SQ = #{cardPrmtSq}
+		</otherwise>
+		</choose>
+	</delete>
+	
+	<!-- 카드프로모션 삭제 -->
+	<delete id="deleteCardPromotion"  parameterType="int" >
+		/* TsaGoods.deleteCardPromotion */
+		DELETE FROM TB_CARD_PROMOTION
+		WHERE CARD_PRMT_SQ = #{cardPrmtSq}
+	</delete>
+	
 </mapper>

+ 56 - 32
src/main/webapp/WEB-INF/views/marketing/CardInterestForm.html

@@ -107,16 +107,8 @@
 			}
 		},
 		{headerName: "노출여부", field: "dispYn", width: 100, cellClass: 'text-center'},
-		{headerName: "시작일", field: "prmtStd", width: 120, cellClass: 'text-center',
-			cellRenderer: function(params) {
-				return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDD").format("YYYY-MM-DD") : '';
-			}
-		},
-		{headerName: "종료일", field: "prmtEdd", width: 120, cellClass: 'text-center',
-			cellRenderer: function(params) {
-				return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDD").format("YYYY-MM-DD") : '';
-			}
-		},
+		{headerName: "시작일", field: "prmtStd", width: 120, cellClass: 'text-center'},
+		{headerName: "종료일", field: "prmtEdd", width: 120, cellClass: 'text-center'},
 		{headerName: "수정자", field: "updNm" , width: 150, cellClass: 'text-center'},
 		{headerName: "수정일시", field: "updDt", width: 150, cellClass: 'text-center',
 			cellRenderer: function(params) {
@@ -254,10 +246,9 @@
 		
 		cfnOpenModalPopup(actionUrl, 'popupCardInterest'); 
 	}
-	
-	
-	//카드 프로모션 삭제
-	$('#btnCardPromotionDelete').click(function(e) {
+
+	//카드 프로모션 비노출
+	$('#btnCardPromotionDispUpdate').click(function(e) {
 		//상품선택여부 확인처리 추가
 		var selectedData = gridOptions.api.getSelectedRows();
 
@@ -266,32 +257,68 @@
 			return false;
 		}
 		
-		var arrGoodsCd = [];
-		var arrGoodsTnmResSq = [];
+		var arrCardPrmtSq = [];
 		var chkFlag = false;
-		//selectedData = gagaAgGrid.getAllRowData(gridOptions);
 		$.each(selectedData, function(idx, item) {
 			
-			if (gagajf.isNull(item.goodsTnmResSq) || item.goodsTnmResSq == "0"){
+			var toDateStr = new Date().format("YYYYMMDD");
+			if (toDateStr > item.prmtEdd.replace(/-/gi,'') ){
 				chkFlag = true;
-				mcxDialog.alert(item.goodsCd +"상품은 상품타이틀이 예약된 상품이 아닙니다.");
+				mcxDialog.alertC("종료된 무이자할부정보는 삭제할 수 없습니다.", {
+					sureBtnText: "확인",
+					sureBtnClick: function() {
+						gridOptions.api.setFocusedCell(idx, "prmtEdd", null);
+					}
+				});
 				return false;
 			}
+		
+			arrCardPrmtSq.push(item.cardPrmtSq);
+		});
+
+		if (chkFlag){
+			return;
+		}
+		
+		mcxDialog.confirm('비노출 처리 하시겠습니까? ',  {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function(){
+				var data = {arrCardPrmtSq : arrCardPrmtSq};
+				var jsonData = JSON.stringify(data);
+				gagajf.ajaxJsonSubmit('/marketing/card/promotion/dispYn/update', jsonData, fnCardPromotionDeleteCollBack);
+			}
+		});
+		
+	});
+	
+	//카드 프로모션 삭제
+	$('#btnCardPromotionDelete').click(function(e) {
+		//상품선택여부 확인처리 추가
+		var selectedData = gridOptions.api.getSelectedRows();
+
+		if (selectedData.length == 0) {
+			mcxDialog.alert('선택된 행이 없습니다.');
+			return false;
+		}
+		
+		var arrCardPrmtSq = [];
+		var chkFlag = false;
+		$.each(selectedData, function(idx, item) {
 			
-			var toDateStr = new Date().format("YYYYMMDDHHmmss");
-			if (toDateStr > item.applyEddt){
+			var toDateStr = new Date().format("YYYYMMDD");
+			if (toDateStr > item.prmtEdd.replace(/-/gi,'') ){
 				chkFlag = true;
-				mcxDialog.alertC("종료된 예약 상품은 삭제할 수 없습니다.", {
+				mcxDialog.alertC("종료된 무이자할부정보는 삭제할 수 없습니다.", {
 					sureBtnText: "확인",
 					sureBtnClick: function() {
-						$('#goodsRsvtTnmForm input[name=applyEdYMD]').focus();
+						gridOptions.api.setFocusedCell(idx, "prmtEdd", null);
 					}
 				});
 				return false;
 			}
 		
-			arrGoodsCd.push(item.goodsCd);
-			arrGoodsTnmResSq.push(item.goodsTnmResSq);
+			arrCardPrmtSq.push(item.cardPrmtSq);
 		});
 
 		if (chkFlag){
@@ -302,18 +329,15 @@
 			cancelBtnText: "취소",
 			sureBtnText: "확인",
 			sureBtnClick: function(){
-				var data = {arrGoodsCd : arrGoodsCd
-						,arrGoodsTnmResSq : arrGoodsTnmResSq
-			};
-			
-			var jsonData = JSON.stringify(data);
-			gagajf.ajaxJsonSubmit('/goods/title/reserve/delete', jsonData, fnCardPromotionDeleteCollBack);
+				var data = {arrCardPrmtSq : arrCardPrmtSq};
+				var jsonData = JSON.stringify(data);
+				gagajf.ajaxJsonSubmit('/marketing/card/promotion/delete', jsonData, fnCardPromotionDeleteCollBack);
 			}
 		});
 	});
 	
 	var fnCardPromotionDeleteCollBack = function(){
-		//fnCardPromotionListSearch($();
+		fnCardPromotionListSearch();
 	}
 	
 	$(document).ready(function() {

+ 36 - 5
src/main/webapp/WEB-INF/views/marketing/CardInterestPopupForm.html

@@ -107,10 +107,10 @@
 			</div>
 			<ul class="panelBar">
 				<li class="left">
-					<button type="button" class="btn btn-danger btn-lg" id="btnDeleteGoodsRsvtTnm">상품삭제</button>
+					<button type="button" class="btn btn-danger btn-lg" id="btnCardInterestDelete" th:if="${cardPrmtSq}">삭제</button>
 				</li>	
 				<li class="right">
-					<button type="button" class="btnRight btn btn-success btn-lg" id="btnSaveCardInterest">적용</button>
+					<button type="button" class="btnRight btn btn-success btn-lg" id="btnCardInterestSave">적용</button>
 				</li>
 			</ul>
 			</form>	
@@ -167,8 +167,39 @@
 		$('#cardInterestForm input[name=delCardPrmtCdtSq]').val(delCardPrmtCdtSq);
 	}
 	
+	//카드 프로모션 삭제
+	$('#btnCardInterestDelete').click(function(e) {
+		var arrCardPrmtSq = [];
+		
+		var toDateStr = new Date().format("YYYYMMDD");
+		var prmtEdd = $('#cardInterestForm input[name=prmtEdd]').val();
+		if (toDateStr > prmtEdd.replace(/-/gi,'') ){
+			chkFlag = true;
+			mcxDialog.alertC("종료된 무이자할부정보는 삭제할 수 없습니다.", {
+				sureBtnText: "확인",
+				sureBtnClick: function() {
+					$('#cardInterestForm input[name=prmtEdd]').focus();
+				}
+			});
+			return false;
+		}
+	
+		arrCardPrmtSq.push($('#cardInterestForm input[name=cardPrmtSq]').val());
+		
+		mcxDialog.confirm('삭제하시겠습니까? <br/> 삭제한 프로모션은 복구할수 없습니다.',  {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function(){
+				var data = {arrCardPrmtSq : arrCardPrmtSq};
+				var jsonData = JSON.stringify(data);
+				gagajf.ajaxJsonSubmit('/marketing/card/promotion/delete', jsonData, fnSaveCardInterestCallBack);
+			}
+		});
+	});
+	
+	
 	// 저장 클릭 시
-	$('#btnSaveCardInterest').on('click', function() {
+	$('#btnCardInterestSave').on('click', function() {
 		
 		var optCheck = false;
 		// 입력 값 체크
@@ -231,8 +262,8 @@
 	
 	//창종료
 	var fnSaveCardInterestCallBack = function(){
-		//fnCardPromotionListSearch(); 	//본창 호출
-		//uifnPopupClose('popupCardInterest');
+		fnCardPromotionListSearch(); 	//본창 호출
+		uifnPopupClose('popupCardInterest');
 		
 	}