|
@@ -1,11 +1,15 @@
|
|
|
package com.style24.admin.biz.service;
|
|
package com.style24.admin.biz.service;
|
|
|
|
|
|
|
|
|
|
+import java.lang.reflect.Type;
|
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collection;
|
|
import java.util.Collection;
|
|
|
import java.util.Date;
|
|
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.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -34,9 +38,6 @@ public class TsaCouponService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private TsaCommonService commonService;
|
|
private TsaCommonService commonService;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 쿠폰 저장
|
|
* 쿠폰 저장
|
|
|
* @param params
|
|
* @param params
|
|
@@ -47,70 +48,34 @@ public class TsaCouponService {
|
|
|
public void couponSave(Coupon params) {
|
|
public void couponSave(Coupon params) {
|
|
|
String cpnId = ""; // 쿠폰ID
|
|
String cpnId = ""; // 쿠폰ID
|
|
|
|
|
|
|
|
- params = applyTargetSetting(params);
|
|
|
|
|
-
|
|
|
|
|
params.setRegNo(TsaSession.getInfo().getUserNo());
|
|
params.setRegNo(TsaSession.getInfo().getUserNo());
|
|
|
params.setUpdNo(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;
|
|
cpnId = "CPN"+sequence;
|
|
|
} else {
|
|
} else {
|
|
|
cpnId = params.getCpnId();
|
|
cpnId = params.getCpnId();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- log.info(">>>> CPNID : {}" , cpnId );
|
|
|
|
|
params.setCpnId(cpnId);
|
|
params.setCpnId(cpnId);
|
|
|
|
|
|
|
|
couponDao.couponInsert(params);
|
|
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;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|