xyzp1539 vor 5 Jahren
Ursprung
Commit
ec8371ea52

+ 1 - 0
src/main/java/com/style24/admin/biz/dao/TsaCouponDao.java

@@ -13,6 +13,7 @@ import java.util.Collection;
  * @since  2021-01-11
  */
 @ShopDs
+@Component
 public interface TsaCouponDao {
 	/**
 	 * 쿠폰 리스트 조회

+ 17 - 52
src/main/java/com/style24/admin/biz/service/TsaCouponService.java

@@ -1,11 +1,15 @@
 package com.style24.admin.biz.service;
 
+import java.lang.reflect.Type;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
 
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -34,9 +38,6 @@ public class TsaCouponService {
 	@Autowired
 	private TsaCommonService commonService;
 
-
-
-
 	/**
 	 * 쿠폰 저장
 	 * @param params
@@ -47,70 +48,34 @@ public class TsaCouponService {
 	public void couponSave(Coupon params) {
 		String cpnId = "";		// 쿠폰ID
 
-		params = applyTargetSetting(params);
-
 		params.setRegNo(TsaSession.getInfo().getUserNo());
 		params.setUpdNo(TsaSession.getInfo().getUserNo());
 
 		// 자동생성이면 시퀀스 가져오기
-		if(params.getCpnId() == null || params.getCpnId().equals("")) {
-			int sequence = commonService.getNextSequence("SEQ_COUPON");
+		/*if(StringUtils.isBlank(params.getCpnId())) {
+			Integer sequence = commonService.getNextSequence("SEQ_COUPON");
 			cpnId = "CPN"+sequence;
 		} else {
 			cpnId = params.getCpnId();
 		}
-
-		log.info(">>>> CPNID : {}" , cpnId );
 		params.setCpnId(cpnId);
 
 		couponDao.couponInsert(params);
+		*/
+		Gson gson = new Gson();
 
-
-		//checkCpnValidation(params);
-
-	}
-
-	// 쿠폰 적용대상 세팅
-	public Coupon applyTargetSetting(Coupon params) {
-		Collection<Coupon> cpnSupplyCompList = null;
-		Collection<Coupon> cpnBrandList = null;
-		Collection<Coupon> cpnApplyGoodsList = null;
-		Collection<Coupon> cpnCateList = null;
-		Collection<Coupon> cpnBurdenList = null;
-		Collection<Coupon> cpnExcepGoodsList = null;
-		ObjectMapper mapper = new ObjectMapper();
-
-		try {
-			if(params.getSupplyCompList() != null) {
-				cpnSupplyCompList = mapper.readValue(params.getSupplyCompList(), new TypeReference<Collection<Coupon>>() {
-				});
-			}
-			if(params.getBrandList() != null) {
-				cpnBrandList = mapper.readValue(params.getBrandList(), new TypeReference<Collection<Coupon>>() {
-				});
-			}
-			if(params.getApplyGoodsList() != null) {
-				cpnApplyGoodsList = mapper.readValue(params.getApplyGoodsList(), new TypeReference<Collection<Coupon>>() {
-				});
-			}
-			if(params.getCateList() != null) {
-				cpnCateList = mapper.readValue(params.getCateList(), new TypeReference<Collection<Coupon>>() {
-				});
-			}
-			if(params.getBurdenList() != null) {
-				cpnBurdenList = mapper.readValue(params.getBurdenList(), new TypeReference<Collection<Coupon>>() {
-				});
-			}
-			if(params.getCateList() != null) {
-				cpnExcepGoodsList = mapper.readValue(params.getExceptGoodsList(), new TypeReference<Collection<Coupon>>() {
-				});
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
+		Collection<Coupon>	supplyCompList = gson.fromJson(params.getSupplyCompList() , new TypeToken<Collection<Coupon>>(){}.getType());
+		for(Coupon supplyComp : supplyCompList) {
+		//	couponDao.couponRefValInsert(supplyComp);
 		}
+		Collection<Coupon> brandList = gson.fromJson(params.getBrandList() , new TypeToken<Collection<Coupon>>(){}.getType());
+		Collection<Coupon> applyGoodsList = gson.fromJson(params.getApplyGoodsList() , new TypeToken<Collection<Coupon>>(){}.getType());
+		Collection<Coupon> cateList = gson.fromJson(params.getCateList() , new TypeToken<Collection<Coupon>>(){}.getType());
+		Collection<Coupon> exceptGoodsList = gson.fromJson(params.getExceptGoodsList() , new TypeToken<Collection<Coupon>>(){}.getType());
+		Collection<Coupon> burdenList = gson.fromJson(params.getBurdenList() , new TypeToken<Collection<Coupon>>(){}.getType());
 
+		//checkCpnValidation(params);
 
-		return params;
 	}
 
 	/**

+ 1 - 12
src/main/java/com/style24/persistence/domain/Coupon.java

@@ -4,6 +4,7 @@ import com.style24.persistence.TsaPageRequest;
 import com.style24.persistence.TscBaseDomain;
 import lombok.Data;
 
+import java.util.ArrayList;
 import java.util.Collection;
 
 /**
@@ -43,10 +44,6 @@ public class Coupon extends TscBaseDomain {
     private String  reissuance;				// 쿠폰재발급여부(공통코드G231)
     private String  cpnStat;				// 쿠폰상태(공통코드G232)
     private String  endAlimYn;				// 만료알림여부
-    private Integer regNo;					// 등록자번호
-    private String  regDt;					// 등록일시
-    private Integer updNo;					// 수정자번호
-    private String  updDt;					// 수정일시
     private String  firstYn;				// 첫구매여부 (Y:구매이력이없음 | N:구매이력있음)
     private String  downYn;					// 다운로드가능여부(마이페이지, 상품상세) --> EP쿠폰, 난수쿠폰
     private String  custJoinStdt;			// 회원가입일자(FROM) 20200101 (신규회원여부의 판단을 가입일자로 설정함)
@@ -57,7 +54,6 @@ public class Coupon extends TscBaseDomain {
     private Integer useCnt;					// 쿠폰사용개수
     private String  payType;                 // 결제수단
     private String  custJoinYn;             // 신규회원여부
-    private String  regNm;                  // 사용자명
 
     private String  supplyCompCd;            // 공급업체코드
     private int     burdenRate;                 // 업체분담율
@@ -81,13 +77,6 @@ public class Coupon extends TscBaseDomain {
     private String  burdenList;              // 업체 분담율 리스트
     private String  cateList;                // 카테고리 리스트
 
-    private Collection<Coupon> supplyCompListNew;          // 공급업체 리스트
-    private Collection<Coupon>  brandListNew;               // 브랜드 리스트
-    private Collection<Coupon>  applyGoodsListNew;          // 적용상품 리스트
-    private Collection<Coupon>  exceptGoodsListNew;         // 제외상품 리스트
-    private Collection<Coupon>  burdenListNew;              // 업체 분담율 리스트
-    private Collection<Coupon>  cateListNew;                // 카테고리 리스트
-
     // Pagination
     private TsaPageRequest pageable;
     private int pageNo = 1;

+ 9 - 5
src/main/webapp/WEB-INF/views/marketing/CouponCreatePopupForm.html

@@ -662,7 +662,7 @@
 
 			// 중복되지 않은 데이터 리스트에 추가
 			if(addChk) {
-				gagaAgGrid.addRowData(brandGridOptions, {"brandCd" : result[i].brandCd, "brandEnm" : result[i].brandEnm, "supplyCompNm" : result[i].supplyCompNm, "targetGb" : "G260_12"});
+				gagaAgGrid.addRowData(brandGridOptions, {"brandCd" : result[i].brandCd, "brandEnm" : result[i].brandEnm, "supplyCompNm" : result[i].supplyCompNm});
 			}
 		}
 	};
@@ -691,7 +691,7 @@
 
 			// 중복되지 않은 데이터 리스트에 추가
 			if(addChk) {
-				gagaAgGrid.addRowData(supplyGridOptions, {"supplyCompCd" : result[i].supplyCompCd, "supplyCompNm" : result[i].supplyCompNm, "targetGb" : "G260_13"});
+				gagaAgGrid.addRowData(supplyGridOptions, {"supplyCompCd" : result[i].supplyCompCd, "supplyCompNm" : result[i].supplyCompNm});
 			}
 		}
 	};
@@ -720,7 +720,7 @@
 
 			// 중복되지 않은 데이터 리스트에 추가
 			if(addChk) {
-				gagaAgGrid.addRowData(cateGridOptions, {"supplyCompCd" : result[i].supplyCompCd, "supplyCompNm" : result[i].supplyCompNm, "targetGb" : "G260_13"});
+				gagaAgGrid.addRowData(cateGridOptions, {"supplyCompCd" : result[i].supplyCompCd, "supplyCompNm" : result[i].supplyCompNm});
 			}
 		}
 	}
@@ -772,7 +772,7 @@
 			// 중복되지 않은 데이터 리스트에 추가
 			if(addChk) {
 				//gagaAgGrid.addRowData(OriginGridListOption, result[i], "goodsCd");
-				gagaAgGrid.addRowData(OriginGridListOption, {"goodsGb": goodsGbVal, "goodsCd" : result[i].goodsCd, "goodsNm" : result[i].goodsNm, "targetGb" : "G260_10"});
+				gagaAgGrid.addRowData(OriginGridListOption, {"goodsGb": goodsGbVal, "goodsCd" : result[i].goodsCd, "goodsNm" : result[i].goodsNm});
 			}
 		}
 	}
@@ -892,7 +892,7 @@
 		// 적용대상 - 브랜드 그리드 전체값 세팅
 		var brandAllData = gagaAgGrid.getAllRowData(brandGridOptions);
 		var jsonBrandData = JSON.stringify(brandAllData);
-		$('#couponCreateForm #brandlist').val(jsonBrandData);
+		$('#couponCreateForm #brandList').val(jsonBrandData);
 		// // 적용대상 - 카테고리 그리드 전체값 세팅
 		var cateAllData = gagaAgGrid.getAllRowData(cateGridOptions);
 		var jsonCateData = JSON.stringify(cateAllData);
@@ -905,6 +905,10 @@
 		var exceptGoodsAllData = gagaAgGrid.getAllRowData(excepGoodsGridOptions);
 		var jsonExceptGoodsData = JSON.stringify(exceptGoodsAllData);
 		$('#couponCreateForm #excepGoodsList').val(jsonExceptGoodsData);
+		// 입점업체분담율 그리드 전체값 세팅
+		var inCompBurdenAllData = gagaAgGrid.getAllRowData(inComGridOptions);
+		var jsonInCompBurdenData = JSON.stringify(inCompBurdenAllData);
+		$('#couponCreateForm #burdenList').val(jsonInCompBurdenData);
 
 	}