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

Merge remote-tracking branch 'origin/develop' into xodud1202

xodud1202 5 лет назад
Родитель
Сommit
1423e6237a
21 измененных файлов с 1073 добавлено и 271 удалено
  1. 35 0
      README.md
  2. 19 11
      src/main/java/com/style24/admin/biz/dao/TsaCouponDao.java
  3. 60 39
      src/main/java/com/style24/admin/biz/service/TsaCouponService.java
  4. 28 28
      src/main/java/com/style24/admin/biz/service/TsaGoodsService.java
  5. 12 12
      src/main/java/com/style24/admin/biz/web/TsaGoodsController.java
  6. 88 13
      src/main/java/com/style24/admin/biz/web/TsaMarketingController.java
  7. 10 30
      src/main/java/com/style24/persistence/domain/Coupon.java
  8. 22 0
      src/main/java/com/style24/persistence/domain/CouponBurden.java
  9. 43 0
      src/main/java/com/style24/persistence/domain/CouponRefval.java
  10. 28 0
      src/main/java/com/style24/persistence/domain/CustCoupon.java
  11. 3 0
      src/main/java/com/style24/persistence/domain/CustomerSearch.java
  12. 55 15
      src/main/java/com/style24/persistence/mybatis/shop/TsaCoupon.xml
  13. 9 0
      src/main/java/com/style24/persistence/mybatis/shop/TsaCustomer.xml
  14. 44 34
      src/main/java/com/style24/persistence/mybatis/shop/TsaMorebetter.xml
  15. 89 0
      src/main/resources/config/application-tsit.yml
  16. 25 0
      src/main/resources/log/logback-tsit.xml
  17. 1 1
      src/main/webapp/WEB-INF/views/goods/GoodsDetailForm.html
  18. 17 4
      src/main/webapp/WEB-INF/views/marketing/CouponListForm.html
  19. 212 56
      src/main/webapp/WEB-INF/views/marketing/CouponPopupForm.html
  20. 243 0
      src/main/webapp/WEB-INF/views/marketing/CouponPubForCustPopupForm.html
  21. 30 28
      src/main/webapp/WEB-INF/views/marketing/MorebetterPopupForm.html

+ 35 - 0
README.md

@@ -0,0 +1,35 @@
+# style24 
+
+## locd
+
+```
+-Dspring.profiles.active=locd
+```
+
+## locp
+
+```
+-Dspring.profiles.active=locp
+```
+
+## dev
+
+```
+-Dspring.profiles.active=dev
+```
+
+### 프로그래밍 규칙
+```
+1. Java Domain 생성시 DB의 Key가 되는 번호인 경우 Integer 타입으로 만들어줘야 한다.
+   > PK가 번호로 되어 있는 것은 db는 int unsigned 형식이고 자바에서는 Integer 형식
+
+2. Java Method 에 대한 네이밍 규칙은 Fullname으로 해야한다.
+   2.1 목록은 ~List
+   2.2 등록은 save~, create~
+   2.3 업데이트는 update~
+   2.4 삭제는 delete~
+
+3. Java Service 영역에서 CUD가 있으면 반드시 @Transactional("shopTxnManager") 명시해 줘야 한다.
+
+4. 팝업 화면에 대한 네이밍 규칙은 ~PopupForm.html 해야한다.
+```

+ 19 - 11
src/main/java/com/style24/admin/biz/dao/TsaCouponDao.java

@@ -3,11 +3,10 @@ package com.style24.admin.biz.dao;
 import java.util.ArrayList;
 import java.util.Collection;
 
+import com.style24.persistence.domain.*;
 import org.springframework.stereotype.Component;
 
 import com.style24.core.support.annotation.ShopDs;
-import com.style24.persistence.domain.CommonCode;
-import com.style24.persistence.domain.Coupon;
 import org.springframework.stereotype.Component;
 
 /**
@@ -60,7 +59,7 @@ public interface TsaCouponDao {
 	 * @author xyzp1539
 	 * @since  2021-01-14
 	 */
-	void saveCouponRefVal(Coupon supplyComp);
+	void saveCouponRefVal(CouponRefval supplyComp);
 
 	/**
 	 * 쿠폰 입점업체 분담 등록
@@ -68,7 +67,7 @@ public interface TsaCouponDao {
 	 * @author xyzp1539
 	 * @since  2021-01-14
 	 */
-	void saveCouponBurden(Coupon burden);
+	void saveCouponBurden(CouponBurden burden);
 
 	/**
 	 * 자사브랜드 조회
@@ -103,7 +102,7 @@ public interface TsaCouponDao {
 	 * @author xyzp1539
 	 * @since 2021-01-18
 	 */
-	ArrayList<Coupon> getCouponRefvalExceptGoodsList(Coupon cpnRefval);
+	ArrayList<CouponRefval> getCouponRefvalExceptGoodsList(CouponRefval cpnRefval);
 
 	/**
 	 * 쿠폰 적용 대상 - 브랜드
@@ -112,7 +111,7 @@ public interface TsaCouponDao {
 	 * @author xyzp1539
 	 * @since 2021-01-18
 	 */
-	ArrayList<Coupon> getCouponRefvalBrandList(Coupon cpnRefval);
+	ArrayList<CouponRefval> getCouponRefvalBrandList(CouponRefval cpnRefval);
 
 	/**
 	 * 쿠폰 적용 대상 - 카테고리
@@ -121,7 +120,7 @@ public interface TsaCouponDao {
 	 * @author xyzp1539
 	 * @since 2021-01-18
 	 */
-	ArrayList<Coupon> getCouponRefvalCategoryList(Coupon cpnRefval);
+	ArrayList<CouponRefval> getCouponRefvalCategoryList(CouponRefval cpnRefval);
 
 	/**
 	 * 쿠폰 적용 대상 - 적용/제외상품
@@ -130,7 +129,7 @@ public interface TsaCouponDao {
 	 * @author xyzp1539
 	 * @since 2021-01-18
 	 */
-	ArrayList<Coupon> getCouponRefvalGoodsList(Coupon cpnRefval);
+	ArrayList<CouponRefval> getCouponRefvalGoodsList(CouponRefval cpnRefval);
 
 	/**
 	 * 쿠폰 적용 대상 - 공급처
@@ -139,7 +138,7 @@ public interface TsaCouponDao {
 	 * @author xyzp1539
 	 * @since 2021-01-18
 	 */
-	ArrayList<Coupon> getCouponRefvalSupplyCompList(Coupon cpnRefval);
+	ArrayList<CouponRefval> getCouponRefvalSupplyCompList(CouponRefval cpnRefval);
 
 	/**
 	 * 쿠폰 입점업쳅 분담율 조회
@@ -152,10 +151,19 @@ public interface TsaCouponDao {
 
 	/**
 	 * 쿠폰 적용대상 삭제
-	 * @param  coupon
+	 * @param  couponRefval
 	 * @return
 	 * @author xyzp1539
 	 * @since 2021-01-19
 	 */
-    void updateCouponRefval(Coupon coupon);
+    void updateCouponRefval(CouponRefval couponRefval);
+
+    /**
+     * 고객 쿠폰 발행
+     * @param  custPub
+     * @return
+     * @author xyzp1539
+     * @since 2021-01-21
+     */
+	void saveCouponCustPub(CustCoupon custPub);
 }

+ 60 - 39
src/main/java/com/style24/admin/biz/service/TsaCouponService.java

@@ -8,7 +8,7 @@ import java.util.Date;
 
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
-import com.style24.persistence.domain.CommonCode;
+import com.style24.persistence.domain.*;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -18,7 +18,6 @@ import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.style24.admin.biz.dao.TsaCouponDao;
 import com.style24.admin.support.security.session.TsaSession;
-import com.style24.persistence.domain.Coupon;
 
 import lombok.extern.slf4j.Slf4j;
 
@@ -65,13 +64,12 @@ public class TsaCouponService {
 		Gson gson = new Gson();
 		Integer sequence;
 		// 적용대상 - 공급업체
-		Collection<Coupon>	supplyCompList = gson.fromJson(params.getSupplyCompList() , new TypeToken<Collection<Coupon>>(){}.getType());
-		for(Coupon supplyComp : supplyCompList) {
+		Collection<CouponRefval> supplyCompList = gson.fromJson(params.getSupplyCompList() , new TypeToken<Collection<CouponRefval>>(){}.getType());
+		for(CouponRefval supplyComp : supplyCompList) {
 			sequence = null;
+
 			if(supplyComp.getCpnRefvalSq() != null && supplyComp.getCpnRefvalSq() > 0){
 				sequence = supplyComp.getCpnRefvalSq();
-			} else {
-				sequence = commonService.getNextSequence("SEQ_COUPON_REFVAL");
 			}
 
 			supplyComp.setCpnId(cpnId);
@@ -83,13 +81,12 @@ public class TsaCouponService {
 			couponDao.saveCouponRefVal(supplyComp);
 		}
 		// 적용대상 - 브랜드
-		Collection<Coupon> brandList = gson.fromJson(params.getBrandList() , new TypeToken<Collection<Coupon>>(){}.getType());
-		for(Coupon brand : brandList) {
+		Collection<CouponRefval> brandList = gson.fromJson(params.getBrandList() , new TypeToken<Collection<CouponRefval>>(){}.getType());
+		for(CouponRefval brand : brandList) {
 			sequence = null;
+
 			if(brand.getCpnRefvalSq() != null && brand.getCpnRefvalSq() > 0){
 				sequence = brand.getCpnRefvalSq();
-			} else {
-				sequence = commonService.getNextSequence("SEQ_COUPON_REFVAL");
 			}
 
 			brand.setCpnId(cpnId);
@@ -102,13 +99,12 @@ public class TsaCouponService {
 			couponDao.saveCouponRefVal(brand);
 		}
 		// 적용대상 - 적용상품
-		Collection<Coupon> applyGoodsList = gson.fromJson(params.getApplyGoodsList() , new TypeToken<Collection<Coupon>>(){}.getType());
-		for(Coupon applyGoods : applyGoodsList ) {
+		Collection<CouponRefval> applyGoodsList = gson.fromJson(params.getApplyGoodsList() , new TypeToken<Collection<CouponRefval>>(){}.getType());
+		for(CouponRefval applyGoods : applyGoodsList ) {
 			sequence = null;
+
 			if(applyGoods.getCpnRefvalSq() != null && applyGoods.getCpnRefvalSq() > 0){
 				sequence = applyGoods.getCpnRefvalSq();
-			} else {
-				sequence = commonService.getNextSequence("SEQ_COUPON_REFVAL");
 			}
 			applyGoods.setCpnId(cpnId);
 			applyGoods.setCpnRefvalSq(sequence);
@@ -120,13 +116,12 @@ public class TsaCouponService {
 			couponDao.saveCouponRefVal(applyGoods);
 		}
 		// 적용대상 - 카테고리
-		Collection<Coupon> cateList = gson.fromJson(params.getCateList() , new TypeToken<Collection<Coupon>>(){}.getType());
-		for(Coupon cate : cateList ) {
+		Collection<CouponRefval> cateList = gson.fromJson(params.getCateList() , new TypeToken<Collection<CouponRefval>>(){}.getType());
+		for(CouponRefval cate : cateList ) {
 			sequence = null;
+
 			if(cate.getCpnRefvalSq() != null && cate.getCpnRefvalSq() > 0){
 				sequence = cate.getCpnRefvalSq();
-			} else {
-				sequence = commonService.getNextSequence("SEQ_COUPON_REFVAL");
 			}
 			cate.setCpnId(cpnId);
 			cate.setCpnRefvalSq(sequence);
@@ -140,14 +135,14 @@ public class TsaCouponService {
 			couponDao.saveCouponRefVal(cate);
 		}
 		// 적용대상 - 제외상품
-		Collection<Coupon> exceptGoodsList = gson.fromJson(params.getExceptGoodsList() , new TypeToken<Collection<Coupon>>(){}.getType());
-		for(Coupon exceptGoods: exceptGoodsList ) {
+		Collection<CouponRefval> exceptGoodsList = gson.fromJson(params.getExceptGoodsList() , new TypeToken<Collection<CouponRefval>>(){}.getType());
+		for(CouponRefval exceptGoods: exceptGoodsList ) {
 			sequence = null;
+
 			if(exceptGoods.getCpnRefvalSq() != null && exceptGoods.getCpnRefvalSq() > 0){
 				sequence = exceptGoods.getCpnRefvalSq();
-			} else {
-				sequence = commonService.getNextSequence("SEQ_COUPON_REFVAL");
 			}
+
 			exceptGoods.setCpnId(cpnId);
 			exceptGoods.setCpnRefvalSq(sequence);
 			exceptGoods.setCpnTarget("G260_14");
@@ -158,8 +153,8 @@ public class TsaCouponService {
 			couponDao.saveCouponRefVal(exceptGoods);
 		}
 		// 입점업체분담율
-		Collection<Coupon> burdenList = gson.fromJson(params.getBurdenList() , new TypeToken<Collection<Coupon>>(){}.getType());
-		for(Coupon burden: burdenList ) {
+		Collection<CouponBurden> burdenList = gson.fromJson(params.getBurdenList() , new TypeToken<Collection<CouponBurden>>(){}.getType());
+		for(CouponBurden burden: burdenList ) {
 			burden.setCpnId(cpnId);
 			burden.setRegNo(TsaSession.getInfo().getUserNo());
 			burden.setUpdNo(TsaSession.getInfo().getUserNo());
@@ -239,8 +234,8 @@ public class TsaCouponService {
 	 * @author xyzp1539
 	 * @since 2021-01-18
 	 */
-	public ArrayList<Coupon> getCouponRefvalExceptGoodsList(String cpnId ) {
-		Coupon cpnRefval = new Coupon();
+	public ArrayList<CouponRefval> getCouponRefvalExceptGoodsList(String cpnId ) {
+		CouponRefval cpnRefval = new CouponRefval();
 		cpnRefval.setCpnId(cpnId);
 		cpnRefval.setCpnTarget("G260_14");
 		return couponDao.getCouponRefvalExceptGoodsList(cpnRefval);
@@ -253,8 +248,8 @@ public class TsaCouponService {
 	 * @author xyzp1539
 	 * @since 2021-01-18
 	 */
-	public ArrayList<Coupon> getCouponRefvalBrandList(String cpnId ) {
-		Coupon cpnRefval = new Coupon();
+	public ArrayList<CouponRefval> getCouponRefvalBrandList(String cpnId ) {
+		CouponRefval cpnRefval = new CouponRefval();
 		cpnRefval.setCpnId(cpnId);
 		cpnRefval.setCpnTarget("G260_12");
 		return couponDao.getCouponRefvalBrandList(cpnRefval);
@@ -267,8 +262,8 @@ public class TsaCouponService {
 	 * @author xyzp1539
 	 * @since 2021-01-18
 	 */
-	public ArrayList<Coupon> getCouponRefvalCategoryList(String cpnId) {
-		Coupon cpnRefval = new Coupon();
+	public ArrayList<CouponRefval> getCouponRefvalCategoryList(String cpnId) {
+		CouponRefval cpnRefval = new CouponRefval();
 		cpnRefval.setCpnId(cpnId);
 		cpnRefval.setCpnTarget("G260_11");
 		return couponDao.getCouponRefvalCategoryList(cpnRefval);
@@ -281,8 +276,8 @@ public class TsaCouponService {
 	 * @author xyzp1539
 	 * @since 2021-01-18
 	 */
-	public ArrayList<Coupon> getCouponRefvalGoodsList(String cpnId , String cpnTarget) {
-		Coupon cpnRefval = new Coupon();
+	public ArrayList<CouponRefval> getCouponRefvalGoodsList(String cpnId , String cpnTarget) {
+		CouponRefval cpnRefval = new CouponRefval();
 		cpnRefval.setCpnId(cpnId);
 		cpnRefval.setCpnTarget(cpnTarget);
 		return couponDao.getCouponRefvalGoodsList(cpnRefval);
@@ -295,10 +290,10 @@ public class TsaCouponService {
 	 * @author xyzp1539
 	 * @since 2021-01-18
 	 */
-	public ArrayList<Coupon> getCouponRefvalSupplyCompList(String cpnId) {
-		Coupon cpnRefval = new Coupon();
+	public ArrayList<CouponRefval> getCouponRefvalSupplyCompList(String cpnId) {
+		CouponRefval cpnRefval = new CouponRefval();
 		cpnRefval.setCpnId(cpnId);
-		cpnRefval.setCpnTarget("G260_30");
+		cpnRefval.setCpnTarget("G260_13");
 		return couponDao.getCouponRefvalSupplyCompList(cpnRefval);
 	}
 
@@ -315,14 +310,40 @@ public class TsaCouponService {
 
 	/**
 	 * 쿠폰 적용대상 삭제
-	 * @param   coupon
+	 * @param   couponRefval
 	 * @return
 	 * @author xyzp1539
 	 * @since 2021-01-19
 	 */
 	@Transactional("shopTxnManager")
-	public void updateCouponRefval(Coupon coupon) {
-		coupon.setUpdNo(TsaSession.getInfo().getUserNo());
-		couponDao.updateCouponRefval(coupon);
+	public void updateCouponRefval(CouponRefval couponRefval) {
+		couponRefval.setUpdNo(TsaSession.getInfo().getUserNo());
+		couponDao.updateCouponRefval(couponRefval);
+	}
+
+	/**
+	 * 고객 쿠폰
+	 * @param
+	 * @return
+	 * @author xyzp1539
+	 * @since 2021-01-21
+	 */
+	@Transactional("shopTxnManager")
+	public void saveCouponCustPub(CustCoupon custCoupon) {
+		Gson gson = new Gson();
+
+		Collection<CustCoupon> custPubList = gson.fromJson(custCoupon.getCustList() , new TypeToken<Collection<CustCoupon>>(){}.getType());
+		for(CustCoupon custPub : custPubList ) {
+			custPub.setCpnId(custCoupon.getCpnId());
+			custPub.setAvailStdt(custCoupon.getAvailStdt());
+			custPub.setAvailEddt(custCoupon.getAvailEddt());
+			custPub.setPubReason(custCoupon.getPubReason());
+			custPub.setPubReasonDtl(custCoupon.getPubReasonDtl());
+			custPub.setEndAlimSendYn(custCoupon.getEndAlimSendYn());
+			custPub.setRegNo(TsaSession.getInfo().getUserNo());
+			custPub.setUpdNo(TsaSession.getInfo().getUserNo());
+
+			couponDao.saveCouponCustPub(custPub);
+		}
 	}
 }

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

@@ -4,11 +4,11 @@ import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.Collection;
 
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.StringUtils;
 
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -233,7 +233,7 @@ public class TsaGoodsService {
 			throw new IllegalStateException(message.getMessage("FAIL_1001"));
 
 		for (NotiInfo notiInfo : notiInfoList) {
-			if (!StringUtils.isEmpty(notiInfo.getNiContent())) {
+			if (!StringUtils.isBlank(notiInfo.getNiContent())) {
 				notiInfo.setNiContent(GagaStringUtil.replace(GagaStringUtil.replace(notiInfo.getNiContent(),"&lt;", "<"),"&gt;", ">"));
 			}
 			notiInfo.setRegNo(TsaSession.getInfo().getUserNo());
@@ -398,7 +398,7 @@ public class TsaGoodsService {
 			Collection<GagaMap> dataList = goodsDao.getGoodsInfoExcelList(goodsSearch); // map형식으로 조회
 			if (dataList != null && !dataList.isEmpty()) {
 				for (GagaMap gagaMap : dataList) {
-					if (!StringUtils.isEmpty(gagaMap.get("SYS_IMG_NM").toString()) ) {
+					if (!StringUtils.isBlank(gagaMap.get("SYS_IMG_NM").toString()) ) {
 						gagaMap.set("SYS_IMG_NM", targetPath + '/' +  gagaMap.get("SYS_IMG_NM").toString());
 					}
 				}
@@ -704,8 +704,8 @@ public class TsaGoodsService {
 					brand.setBrandCd(originGoods.getBrandCd());
 					Collection<Brand> brandList = businessService.getBrandList(brand);
 					if (brandList != null && !brandList.isEmpty()) {
-						float pntPrate = 0;
-						float pntMrate = 0;
+						float pntPrate = 0f;
+						float pntMrate = 0f;
 						for (Brand tmpBrand : brandList) {
 							if ("G009_10".equals(goods.getFormalGb())) {
 								pntPrate = tmpBrand.getPntPrate10();
@@ -745,8 +745,8 @@ public class TsaGoodsService {
 				brand.setBrandCd(originGoods.getBrandCd());
 				Collection<Brand> brandList = businessService.getBrandList(brand);
 				if (brandList != null && !brandList.isEmpty()) {
-					float pntPrate = 0;
-					float pntMrate = 0;
+					float pntPrate = 0f;
+					float pntMrate = 0f;
 					for (Brand tmpBrand : brandList) {
 						if ("G009_10".equals(goods.getFormalGb())) {
 							pntPrate = tmpBrand.getPntPrate10();
@@ -788,11 +788,11 @@ public class TsaGoodsService {
 		String goodsNumFlag = "";
 		for (Goods goods : goodsList) {
 
-			if (!StringUtils.isEmpty(goodsCdFlag) && !StringUtils.isEmpty(goodsNumFlag)) {
+			if (!StringUtils.isBlank(goodsCdFlag) && !StringUtils.isBlank(goodsNumFlag)) {
 				throw new IllegalStateException("상품코드와 원코드 중 한 개의 셀에만 값을 입력해서 조회하세요.");
 			}
 
-			if (!StringUtils.isEmpty(goods.getSupplyCompCd())) {
+			if (!StringUtils.isBlank(goods.getSupplyCompCd())) {
 				goods.setGoodsCd(goods.getSupplyCompCd());
 			}
 
@@ -857,7 +857,7 @@ public class TsaGoodsService {
 			// 검색어 변경
 			String goodsSnm = goodsDao.getGoodsSnm(goods.getGoodsCd());
 			Goods tmpGoods = goodsDao.getGoods(goods);
-			if (tmpGoods != null && !StringUtils.isEmpty(tmpGoods.getGoodsSnm1())) {
+			if (tmpGoods != null && !StringUtils.isBlank(tmpGoods.getGoodsSnm1())) {
 				String[] arrGoodsSnm = tmpGoods.getGoodsSnm1().split(";");
 				StringBuilder tempGoodsSnm = new StringBuilder();
 				for (String loopGoodsSnm : arrGoodsSnm) {
@@ -1007,7 +1007,7 @@ public class TsaGoodsService {
 		}
 		// 사용자 검색어를 검색어에 적용
 		String goodsSnm = goodsDao.getGoodsSnm(goods.getGoodsCd());
-		if (!StringUtils.isEmpty(goods.getGoodsSnm1())) {
+		if (!StringUtils.isBlank(goods.getGoodsSnm1())) {
 			goods.setGoodsSnm1(GagaStringUtil.replace(goods.getGoodsSnm1(), " ", "")); // 빈값 삭제
 			String[] arrGoodsSnm = goods.getGoodsSnm1().split(";");
 			StringBuilder tempGoodsSnm = new StringBuilder();
@@ -1030,8 +1030,8 @@ public class TsaGoodsService {
 				brand.setBrandCd(goods.getBrandCd());
 				Collection<Brand> brandList = businessService.getBrandList(brand);
 				if (brandList != null && !brandList.isEmpty()) {
-					float pntPrate = 0.0f;
-					float pntMrate = 0.0f;
+					float pntPrate = 0f;
+					float pntMrate = 0f;
 					for (Brand tmpBrand : brandList) {
 						if ("G009_10".equals(goods.getFormalGb())) {
 							pntPrate = tmpBrand.getPntPrate10();
@@ -1386,7 +1386,7 @@ public class TsaGoodsService {
 			Goods extendGoods = new Goods();
 			extendGoods.setGoodsCd(goodsCompose.getCompsGoodsCd());
 			extendGoods = goodsDao.getGoods(extendGoods);
-			if (StringUtils.isEmpty(extendGoods.getBrandCd())) {
+			if (StringUtils.isBlank(extendGoods.getBrandCd())) {
 				throw new IllegalStateException(message.getMessage("구성상품 중 " + goodsCompose.getCompsGoodsCd() + " 상품 정보를 확인해 주세요."));
 			}
 
@@ -1459,7 +1459,7 @@ public class TsaGoodsService {
 			Goods extendGoods = new Goods();
 			extendGoods.setGoodsCd(goodsCompose.getCompsGoodsCd());
 			extendGoods = goodsDao.getGoods(extendGoods);
-			if (StringUtils.isEmpty(extendGoods.getBrandCd())) {
+			if (StringUtils.isBlank(extendGoods.getBrandCd())) {
 				throw new IllegalStateException(message.getMessage("구성상품 중 " + goodsCompose.getCompsGoodsCd() + " 상품 정보를 확인해 주세요."));
 			}
 			listPriceSum += extendGoods.getListPrice() * goodsCompose.getQty() ;
@@ -1500,9 +1500,9 @@ public class TsaGoodsService {
 			throw new IllegalStateException(message.getMessage("구성상품 중 기준 상품의 브랜드를 확인해 주세요."));
 		}
 
-		float pntPrate = 0.0f;
-		float pntMrate = 0.0f;
-		float sellFeeRate = 0.0f;
+		float pntPrate = 0f;
+		float pntMrate = 0f;
+		float sellFeeRate = 0f;
 		String delvFeeCd = "";
 		for (Brand tmpBrand : brandList) {
 
@@ -1682,7 +1682,7 @@ public class TsaGoodsService {
 			goods.setRegNo(TsaSession.getInfo().getUserNo());
 			goods.setUpdNo(TsaSession.getInfo().getUserNo());
 
-			if (!StringUtils.isEmpty(goods.getGoodsTnm()) && !goods.getGoodsTnm().equals(goods.getGoodTnmInit())) {
+			if (!StringUtils.isBlank(goods.getGoodsTnm()) && !goods.getGoodsTnm().equals(goods.getGoodTnmInit())) {
 
 				// 상품이력 먼저 쌓기
 				goodsDao.createGoodsHst(goods);
@@ -1901,7 +1901,7 @@ public class TsaGoodsService {
 			noticeService.updateNotice(notice);
 		}
 
-		if (!StringUtils.isEmpty(notice.getGoodsList())) {
+		if (!StringUtils.isBlank(notice.getGoodsList())) {
 			Collection<NoticeGoods> noticeGoodsList = null;
 			try {
 				noticeGoodsList = mapper.readValue(notice.getGoodsList(), new TypeReference<Collection<NoticeGoods>>() {
@@ -2086,10 +2086,10 @@ public class TsaGoodsService {
 		int cnt = 0;
 		for (GoodsPriceRes goodsPriceRes : goodsPriceList) {
 
-			if (StringUtils.isEmpty(goodsPriceRes.getGoodsCd())) {
+			if (StringUtils.isBlank(goodsPriceRes.getGoodsCd())) {
 				return (cnt + 2) + "행의 상품코드를 확인해주세요";
 			}
-			if (StringUtils.isEmpty(goodsPriceRes.getResGoodsPrice())) {
+			if (StringUtils.isBlank(Integer.toString(goodsPriceRes.getResGoodsPrice()))) {
 				return (cnt + 2) + "행의 예약가격을 확인해주세요.";
 			}
 			if (goodsPriceRes.getResGoodsPrice() <= 0) {
@@ -2189,7 +2189,7 @@ public class TsaGoodsService {
 		if (video.getVideoSq() == null ||  video.getVideoSq() == 0) {
 
 			String videoSeq = goodsDao.getVideoSeq(video);
-			if (StringUtils.isEmpty(videoSeq)) {
+			if (StringUtils.isBlank(videoSeq)) {
 				goodsDao.createVideo(video);
 			}else {
 				//video.setVideoSq(Integer.parseInt(videoSeq));  //why?
@@ -2200,7 +2200,7 @@ public class TsaGoodsService {
 		if (video.getVideoSq() == null ||  video.getVideoSq() == 0) {
 			String videoSeq = goodsDao.getVideoSeq(video);
 
-			if (!StringUtils.isEmpty(videoSeq)) {
+			if (!StringUtils.isBlank(videoSeq)) {
 				video.setVideoSq(Integer.parseInt(videoSeq));
 			}
 		}
@@ -2240,12 +2240,12 @@ public class TsaGoodsService {
 			}
 			String videoSeq = goodsDao.getVideoSeq(video);
 
-			if (StringUtils.isEmpty(videoSeq)) {
+			if (StringUtils.isBlank(videoSeq)) {
 				goodsDao.createVideo(video);
 			}
 
 			videoSeq = goodsDao.getVideoSeq(video);
-			if (!StringUtils.isEmpty(videoSeq)) {
+			if (!StringUtils.isBlank(videoSeq)) {
 				video.setVideoSq(Integer.parseInt(videoSeq));
 			}
 			goodsDao.saveVideoDispLoc(video);
@@ -2363,7 +2363,7 @@ public class TsaGoodsService {
 
 		// 2. 일 최초 조회이면 테이블 삭제
 		String regYmd  = goodsDao.getGoodsNaverLowestPriceReqYmd();
-		if (!StringUtils.isEmpty(regYmd) && !regYmd.equals(GagaDateUtil.getToday())) {
+		if (!StringUtils.isBlank(regYmd) && !regYmd.equals(GagaDateUtil.getToday())) {
 			goodsDao.deleteGoodsNaverLowestPrice();
 		}
 
@@ -2483,7 +2483,7 @@ public class TsaGoodsService {
 			goodsDao.saveAdKeyword(adKeyword);
 		}
 
-		if (!StringUtils.isEmpty(adKeyword.getGoodsList())) {
+		if (!StringUtils.isBlank(adKeyword.getGoodsList())) {
 			Collection<AdKeywordGoods> adKeywordGoodsList = null;
 			try {
 				adKeywordGoodsList = mapper.readValue(adKeyword.getGoodsList(), new TypeReference<Collection<AdKeywordGoods>>() {

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

@@ -7,12 +7,12 @@ import java.util.Collection;
 
 import javax.servlet.http.HttpServletRequest;
 
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
 import org.springframework.core.io.InputStreamResource;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Controller;
-import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -498,7 +498,7 @@ public class TsaGoodsController extends TsaBaseController {
 		}
 
 		// multi row 검색관련 처리
-		if (!StringUtils.isEmpty(goodsSearch.getCondition())) {
+		if (!StringUtils.isBlank(goodsSearch.getCondition())) {
 			goodsSearch.setConditionList(goodsSearch.getCondition().replaceAll("\r", "").split("\n"));
 
 			if ("searchExtendGoodsCd".equals(goodsSearch.getSearch())) {
@@ -544,7 +544,7 @@ public class TsaGoodsController extends TsaBaseController {
 		goodsSearch.setRegNo(TsaSession.getInfo().getUserNo()); // 엑셀조회시 로그인 사용자의 엑셀 상품조회시 사용
 
 		// multi row 검색관련 처리
-		if (!StringUtils.isEmpty(goodsSearch.getCondition())) {
+		if (!StringUtils.isBlank(goodsSearch.getCondition())) {
 			goodsSearch.setConditionList(goodsSearch.getCondition().replaceAll("\r", "").split("\n"));
 
 			if ("searchExtendGoodsCd".equals(goodsSearch.getSearch())) {
@@ -629,7 +629,7 @@ public class TsaGoodsController extends TsaBaseController {
 					} else {
 						for (GoodsNotiInfo tmpGoodsNotiInfo : goodsNotiInfoList) {
 							if ("Y".equals(tmpGoodsNotiInfo.getReqYn()) || "Y".equals(tmpGoodsNotiInfo.getDispYn())) {
-								if (StringUtils.isEmpty(tmpGoodsNotiInfo.getNiContent())) {
+								if (StringUtils.isBlank(tmpGoodsNotiInfo.getNiContent())) {
 									returnGoods += tmpGoods.getGoodsCd() + ",";
 									break;
 								}
@@ -1480,7 +1480,7 @@ public class TsaGoodsController extends TsaBaseController {
 		}
 
 		// multi row 검색관련 처리
-		if (!StringUtils.isEmpty(goodsSearch.getCondition())) {
+		if (!StringUtils.isBlank(goodsSearch.getCondition())) {
 			goodsSearch.setConditionList(goodsSearch.getCondition().replaceAll("\r", "").split("\n"));
 		}
 
@@ -1681,7 +1681,7 @@ public class TsaGoodsController extends TsaBaseController {
 		}
 
 		// multi row 검색관련 처리
-		if (!StringUtils.isEmpty(goodsSearch.getCondition())) {
+		if (!StringUtils.isBlank(goodsSearch.getCondition())) {
 			goodsSearch.setConditionList(goodsSearch.getCondition().replaceAll("\r", "").split("\n"));
 		}
 
@@ -1953,7 +1953,7 @@ public class TsaGoodsController extends TsaBaseController {
 		}
 
 		// multi row 검색관련 처리
-		if (!StringUtils.isEmpty(goodsSearch.getCondition())) {
+		if (!StringUtils.isBlank(goodsSearch.getCondition())) {
 			goodsSearch.setConditionList(goodsSearch.getCondition().replaceAll("\r", "").split("\n"));
 		}
 
@@ -2076,7 +2076,7 @@ public class TsaGoodsController extends TsaBaseController {
 		}
 
 		// multi row 검색관련 처리
-		if (!StringUtils.isEmpty(goodsSearch.getCondition())) {
+		if (!StringUtils.isBlank(goodsSearch.getCondition())) {
 			goodsSearch.setConditionList(goodsSearch.getCondition().replaceAll("\r", "").split("\n"));
 
 			if ("searchExtendGoodsCd".equals(goodsSearch.getSearch())) {
@@ -2287,7 +2287,7 @@ public class TsaGoodsController extends TsaBaseController {
 		}
 
 		// multi row 검색관련 처리
-		if (!StringUtils.isEmpty(goodsSearch.getCondition())) {
+		if (!StringUtils.isBlank(goodsSearch.getCondition())) {
 			goodsSearch.setConditionList(goodsSearch.getCondition().replaceAll("\r", "").split("\n"));
 
 			if ("searchExtendGoodsCd".equals(goodsSearch.getSearch())) {
@@ -2312,7 +2312,7 @@ public class TsaGoodsController extends TsaBaseController {
 	public Collection<GoodsNaverLowestPrice> saveGoodsNaverPrice(@RequestBody GoodsSearch goodsSearch) {
 
 		// multi row 검색관련 처리
-		if (!StringUtils.isEmpty(goodsSearch.getCondition())) {
+		if (!StringUtils.isBlank(goodsSearch.getCondition())) {
 			goodsSearch.setConditionList(goodsSearch.getCondition().replaceAll("\r", "").split("\n"));
 		}
 
@@ -2463,7 +2463,7 @@ public class TsaGoodsController extends TsaBaseController {
 	public Collection<FreeGoods> getFreeGoodsList(@RequestBody GoodsSearch goodsSearch) {
 
 		// multi row 검색관련 처리
-		if (!StringUtils.isEmpty(goodsSearch.getCondition())) {
+		if (!StringUtils.isBlank(goodsSearch.getCondition())) {
 			goodsSearch.setConditionList(goodsSearch.getCondition().replaceAll("\r", "").split("\n"));
 		}
 		log.info("[getFreeGoodsList] goodsSearch={}", goodsSearch);
@@ -2483,7 +2483,7 @@ public class TsaGoodsController extends TsaBaseController {
 	public GagaResponse updateFreeGoods(@RequestBody FreeGoods freeGoods) {
 
 		if (freeGoods.getNewSysImgNm() != null && !"".equals(freeGoods.getNewSysImgNm())) {
-			String sysImgNm =  freeGoods.getProductNo() + "_" + GagaDateUtil.getTodayDateTime() + "." + StringUtils.getFilenameExtension(freeGoods.getNewSysImgNm());
+			String sysImgNm =  freeGoods.getProductNo() + "_" + GagaDateUtil.getTodayDateTime() + "." + org.springframework.util.StringUtils.getFilenameExtension(freeGoods.getNewSysImgNm());
 
 			String imgUploadPath = env.getProperty("upload.default.target.path");
 			imgUploadPath = GagaFileUtil.getConcatenationPath(imgUploadPath, "display", "freegoods");

+ 88 - 13
src/main/java/com/style24/admin/biz/web/TsaMarketingController.java

@@ -5,10 +5,12 @@ import java.util.Collection;
 import java.util.List;
 
 import com.style24.persistence.TscPageRequest;
+import com.style24.persistence.domain.*;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -27,13 +29,6 @@ import com.style24.admin.biz.service.TsaSystemService;
 import com.style24.admin.support.controller.TsaBaseController;
 import com.style24.admin.support.security.session.TsaSession;
 import com.style24.core.support.message.TscMessageByLocale;
-import com.style24.persistence.domain.CommonCode;
-import com.style24.persistence.domain.Coupon;
-import com.style24.persistence.domain.FreeGoodsPromotion;
-import com.style24.persistence.domain.MoreBetter;
-import com.style24.persistence.domain.MoreBetterBurden;
-import com.style24.persistence.domain.MoreBetterGoods;
-import com.style24.persistence.domain.MoreBetterSection;
 
 import lombok.extern.slf4j.Slf4j;
 
@@ -304,11 +299,11 @@ public class TsaMarketingController extends TsaBaseController {
 		// 쿠폰상태 조회
 		mav.addObject("cpnStatList", rendererService.getCommonCodeList("G232"));
 		// 쿠폰 유형 조회
-		mav.addObject("cpnTypeList", rendererService.getCommonCodeList("G230"));
+		mav.addObject("cpnTypeList", rendererService.getCommonCodeList("G230" , "Y"));
 		// 사용가능 고객구분 조회
 		mav.addObject("usableCustGbList", rendererService.getCommonCodeList("G100"));
 		// 사용가능 고객등급 조회
-		mav.addObject("usableCustGradeList", rendererService.getCommonCodeList("G101"));
+		mav.addObject("usableCustGradeList", rendererService.getCommonCodeList("G110"));
 		// 재발급 여부 조회
 		mav.addObject("reissuanceList", rendererService.getCommonCodeList("G231"));
 		// 할인방식 조회
@@ -368,22 +363,102 @@ public class TsaMarketingController extends TsaBaseController {
 
 	/**
 	 * 쿠폰 적용대상 삭제수정
-	 * @param coupon
+	 * @param CouponRefval
 	 * @return
 	 * @author xyzp1539
 	 * @since 2021-01-19
 	 */
 	@PostMapping("/coupon/refval/update")
 	@ResponseBody
-	public GagaResponse updateCouponRefval(@RequestBody Coupon coupon) {
-		log.info("couponSave : {}", coupon);
+	public GagaResponse updateCouponRefval(@RequestBody CouponRefval CouponRefval) {
+		log.info("couponSave : {}", CouponRefval);
 
-		couponService.updateCouponRefval(coupon);
+		couponService.updateCouponRefval(CouponRefval);
 
 		return super.ok(message.getMessage("SUCC_0001"));
 	}
 
 
+	/**
+	 * 쿠폰발행팝업
+	 * @param
+	 * @return
+	 * @author xyzp1539
+	 * @since 2021-01-21
+	 */
+	@GetMapping("/coupon/cpnPubForCust/popup/form")
+	@ResponseBody
+	public ModelAndView couponPubForCustPopup() {
+		ModelAndView mav = new ModelAndView();
+		String num = "";
+		// 일시 시 리스트 세팅
+		Collection<CommonCode> hhList = new ArrayList<CommonCode>();
+		for (int i = 0; i < 24; i++) {
+			num = "";
+			CommonCode temp = new CommonCode();
+			if (i < 10) {
+				num = "0" + i;
+			} else {
+				num = String.valueOf(i);
+			}
+
+			// 상품상태
+			String[] exceptCds = {"G008_00"};
+			mav.addObject("goodsStatList", rendererService.getCommonCodeList("G008", "Y", exceptCds));
+
+			temp.setCd(num);
+			temp.setCdNm(num + "시");
+
+			hhList.add(temp);
+		}
+		// 일시 분 리스트 세팅
+		Collection<CommonCode> mmList = new ArrayList<CommonCode>();
+		for (int i = 0; i < 60; i++) {
+			num = "";
+			CommonCode temp = new CommonCode();
+			if (i < 10) {
+				num = "0" + i;
+			} else {
+				num = String.valueOf(i);
+			}
+			temp.setCd(num);
+			temp.setCdNm(num + "분");
+
+			mmList.add(temp);
+		}
+		// 시간 분 리스트 세팅
+		mav.addObject("mmList", mmList);
+		// 시간 시 리스트 세팅
+		mav.addObject("hhList", hhList);
+		// 사이트조회
+		mav.addObject("siteCdList" , rendererService.getCommonCodeList("G000"));
+		// 사용가능 고객구분 조회
+		mav.addObject("usableCustGbList", rendererService.getCommonCodeList("G100"));
+		// 사용가능 고객등급 조회
+		mav.addObject("usableCustGradeList", rendererService.getCommonCodeList("G110"));
+		// 쿠폰발행사유 조회
+		mav.addObject("cpnPubReasonList", rendererService.getCommonCodeList("G068"));
+		
+		mav.setViewName("marketing/CouponPubForCustPopupForm");
+
+		return mav;
+	}
+
+	/**
+	 * 고객 쿠폰 발행
+	 * @param  custCoupon
+	 * @return
+	 * @author xyzp1539
+	 * @since 2021-01-21
+	 */
+	@PostMapping("/coupon/insertCustPub")
+	@ResponseBody
+	public GagaResponse saveCouponCustPub(@RequestBody CustCoupon custCoupon ){
+		couponService.saveCouponCustPub(custCoupon);
+
+		return super.ok(message.getMessage("SUCC_0006"));
+
+	}
 	/* // JSM 진행 */
 
 	/* CSB 진행 */

+ 10 - 30
src/main/java/com/style24/persistence/domain/Coupon.java

@@ -53,40 +53,20 @@ public class Coupon extends TscBaseDomain {
     private String  buyEddt;				// 구매기간일자(TO)
     private Integer issueCnt;				// 쿠폰발급개수
     private Integer useCnt;					// 쿠폰사용개수
-    private String  payType;                 // 결제수단
+    private String  payType;                // 결제수단
     private String  custJoinYn;             // 신규회원여부
+    private String  afChannel;              // 제휴링크
 
-    // 그리드 컬럼
-    private String  supplyCompCd;            // 공급업체코드
-    private Integer burdenRate;              // 업체분담율
-    private String  delYn;                   // 삭제여부
-    private String  supplyCompNm;            // 공급업체명
-    private String  brandCd;                 // 브랜드코드
-    private String  brandEnm;                // 브랜드영문명
-    private String  goodsGb;                 // 상품구분
-    private String  goodsCd;                 // 상품코드
-    private String  goodsNm;                 // 상품명
-    private String  cateNm;                  // 카테고리코드명
-    private String  cateNo;                  // 카테고리코드
-    private String  supplyCompList;          // 공급업체 리스트
-    private String  brandList;               // 브랜드 리스트
-    private String  applyGoodsList;          // 적용상품 리스트
-    private String  exceptGoodsList;         // 제외상품 리스트
-    private String  burdenList;              // 업체 분담율 리스트
-    private String  cateList;                // 카테고리 리스트
-    private String  formalGb;                // 이월정상구분
-
-    // TB_COUPON_REFVAL
-    private String  cpnTarget;               // 쿠폰대상구분(공통코드G260)
-    private String  refVal;                  // 관련값(쿠폰대상이 "10:상품"일 때는 상품코드, "20:브랜드"일 때는 브랜드코드, "30:카테고리"일 때는 카테고리코드, "40:제외상품"일 때는 상품코드)
-    private Integer cpnRefvalSq;             // 쿠폰대상일련번호
-    private String  refFormalGb;             // 정상/이월구분(G009). 쿠폰대상구분이 카테고리일 경우 사용
-    private String  refBrandCd;              // 브랜드코드. 쿠폰대상구분이 카테고리일 경우 사용
-    @JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
-    private Integer[] cpnRefvalSqArr;        // 쿠폰적용대상시퀀스배열
+    // 그리드 파라미터
+    private String  supplyCompList;         // 공급업체 리스트
+    private String  brandList;              // 브랜드 리스트
+    private String  applyGoodsList;         // 적용상품 리스트
+    private String  exceptGoodsList;        // 제외상품 리스트
+    private String  cateList;               // 카테고리 리스트
+    private String  burdenList;             // 업체 분담율 리스트
 
     // TB_COUPON_BAN_GOODS
-    private Integer  cpnBanGoodsSq;          //
+    private Integer  cpnBanGoodsSq;         //  제외상품시퀀스
 
     // Pagination
     private TscPageRequest pageable;

+ 22 - 0
src/main/java/com/style24/persistence/domain/CouponBurden.java

@@ -0,0 +1,22 @@
+package com.style24.persistence.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.style24.persistence.TscBaseDomain;
+import lombok.Data;
+
+/**
+ * 쿠폰 적용대상 도메인
+ * @author xyzp1539
+ * @since 2021-01-20
+ */
+@SuppressWarnings("serial")
+@Data
+public class CouponBurden extends TscBaseDomain {
+    // TB_COUPON_REFVAL
+    private String  cpnId;					// 쿠폰ID
+    private String  supplyCompCd;           // 공급업체코드
+    private Integer burdenRate;             // 업체분담율
+    private String  delYn;                  // 삭제여부
+    private String  supplyCompNm;           // 공급업체명
+
+}

+ 43 - 0
src/main/java/com/style24/persistence/domain/CouponRefval.java

@@ -0,0 +1,43 @@
+package com.style24.persistence.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.style24.persistence.TscBaseDomain;
+import com.style24.persistence.TscPageRequest;
+import lombok.Data;
+
+/**
+ * 쿠폰 적용대상 도메인
+ * @author xyzp1539
+ * @since 2021-01-20
+ */
+@SuppressWarnings("serial")
+@Data
+public class CouponRefval extends TscBaseDomain {
+    // TB_COUPON_REFVAL
+    private String  cpnId;					// 쿠폰ID
+    private String  cpnTarget;              // 쿠폰대상구분(공통코드G260)
+    private String  refVal;                 // 관련값(쿠폰대상이 "10:상품"일 때는 상품코드, "20:브랜드"일 때는 브랜드코드, "30:카테고리"일 때는 카테고리코드, "40:제외상품"일 때는 상품코드)
+    private Integer cpnRefvalSq;            // 쿠폰대상일련번호
+    private String  refFormalGb;            // 정상/이월구분(G009). 쿠폰대상구분이 카테고리일 경우 사용
+    private String  refBrandCd;             // 브랜드코드. 쿠폰대상구분이 카테고리일 경우 사용
+    @JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+    private Integer[] cpnRefvalSqArr;       // 쿠폰적용대상시퀀스배열
+
+    // 그리드 컬럼들
+    private String  supplyCompCd;           // 공급업체코드
+    private Integer burdenRate;             // 업체분담율
+    private String  delYn;                  // 삭제여부
+    private String  supplyCompNm;           // 공급업체명
+    private String  brandCd;                // 브랜드코드
+    private String  brandEnm;               // 브랜드영문명
+    private String  goodsGb;                // 상품구분
+    private String  goodsCd;                // 상품코드
+    private String  goodsNm;                // 상품명
+    private String  cateNm;                 // 카테고리코드명
+    private String  cateNo;                 // 카테고리코드
+    private String  cateList;               // 카테고리 리스트
+    private String  formalGb;               // 이월정상구분
+    private String  siteCd;                 // 사이트코드
+    private String  cateGb;                 // 카테고리구분
+
+}

+ 28 - 0
src/main/java/com/style24/persistence/domain/CustCoupon.java

@@ -0,0 +1,28 @@
+package com.style24.persistence.domain;
+
+import com.style24.persistence.TscBaseDomain;
+import com.style24.persistence.TscPageRequest;
+import lombok.Data;
+import org.codehaus.groovy.runtime.dgmimpl.arrays.IntegerArrayGetAtMetaMethod;
+
+/**
+ * 고객쿠폰 도메인
+ * @author xyzp1539
+ * @since 2020-12-21
+ */
+@SuppressWarnings("serial")
+@Data
+public class CustCoupon extends TscBaseDomain {
+    private Integer custCpnSq;              // 고객쿠폰일련번호
+    private Integer custNo;                 // 고객번호
+    private String  cpnId;                  // 쿠폰아이디
+    private String  availStdt;              // 유효시작일시
+    private String  availEddt;              // 유효종료일시
+    private String  pubReason;              // 발행사유(공통코드G250)
+    private String  pubReasonDtl;           // 발행사유상세
+    private String  usedDt;                 // 사용된일시
+    private String  endAlimSendYn;          // 만료알림발송여부
+
+    // 그리드 컬럼
+    private String  custList;
+}

+ 3 - 0
src/main/java/com/style24/persistence/domain/CustomerSearch.java

@@ -29,5 +29,8 @@ public class CustomerSearch extends TscBaseDomain {
 	private String emailAgreeYn;
 	private String appAgreeYn;
 	private String secedeRsn;
+	private String custNm;
+	private String email;
+	private String custId;
 
 }

+ 55 - 15
src/main/java/com/style24/persistence/mybatis/shop/TsaCoupon.xml

@@ -286,8 +286,10 @@
 	<insert id="saveCouponRefVal" parameterType="Coupon">
 		/* TsaCoupon.saveCouponRefVal */
 		INSERT INTO TB_COUPON_REFVAL (
-			CPN_REFVAL_SQ
-		  , CPN_ID
+		    CPN_ID
+		  <if test='cpnRefvalSq != null and cpnRefvalSq > 0'>
+		  , CPN_REFVAL_SQ
+		  </if>
 		  , CPN_TYPE
 		  , CPN_TARGET
 		  , REF_VAL
@@ -302,8 +304,10 @@
 		  , UPD_NO
 		  , UPD_DT
 		)
-		SELECT #{cpnRefvalSq}
-			 , CPN_ID
+		SELECT CPN_ID
+		     <if test="cpnRefvalSq != null and cpnRefvalSq > 0">
+			 , #{cpnRefvalSq}
+			 </if>
 			 , CPN_TYPE
 			 , #{cpnTarget}
 			 , #{refVal}
@@ -328,7 +332,7 @@
 	</insert>
 
 	<!-- 쿠폰 입점업체 분담율 등록 -->
-	<insert id="saveCouponBurden" parameterType="Coupon">
+	<insert id="saveCouponBurden" parameterType="CouponBurden">
 		/* TsaCoupon.saveCouponBurden */
 		INSERT INTO TB_COUPON_BURDEN(
 		    CPN_ID
@@ -349,8 +353,7 @@
 		  FROM TB_COUPON
 		 WHERE CPN_ID = #{cpnId}
 			ON DUPLICATE KEY UPDATE
-			   SUPPLY_COMP_CD = #{supplyCompCd}
-			 , BURDEN_RATE = #{burdenRate}
+			   BURDEN_RATE = #{burdenRate}
 			 , UPD_NO = #{updNo}
 			 , UPD_DT = now()
 	</insert>
@@ -406,7 +409,10 @@
 			 , BUY_EDDT
 			 , PAY_TYPE
 			 , CUST_JOIN_YN
-  		  FROM TB_COUPON
+			 , (SELECT AF_CHANNEL
+			      FROM TB_AF_LINK A
+			     WHERE A.AF_LINK_CD = B.AF_LINK_CD) AS AF_CHANNEL
+  		  FROM TB_COUPON B
     	 WHERE CPN_ID = #{value}
 	</select>
 
@@ -419,7 +425,7 @@
 	</select>
 
 	<!-- 쿠폰 적용대상 조회 - 제외/적용 상품 -->
-	<select id="getCouponRefvalGoodsList" parameterType="Coupon" resultType="Coupon">
+	<select id="getCouponRefvalGoodsList" parameterType="CouponRefval" resultType="CouponRefval">
 		/* TsaCoupon.getCouponRefvalGoodsList */
 		SELECT FN_GET_CODE_NM('G073',B.GOODS_GB) AS GOODS_GB
 			 , B.GOODS_CD
@@ -431,11 +437,12 @@
 		 INNER JOIN TB_BRAND C ON B.BRAND_CD = C.BRAND_CD
 		 WHERE A.CPN_ID = #{cpnId}
 		   AND A.CPN_TARGET = #{cpnTarget}
+		   AND A.DEL_YN = 'N'
 		 ORDER BY A.CPN_REFVAL_SQ DESC
 	</select>
 
 	<!-- 쿠폰 적용대상 조회 - 브랜드 -->
-	<select id="getCouponRefvalBrandList" parameterType="Coupon" resultType="Coupon">
+	<select id="getCouponRefvalBrandList" parameterType="CouponRefval" resultType="CouponRefval">
 		/* TsaCoupon.getCouponRefvalExceptGoodsList */
 		SELECT B.BRAND_CD
 			 , B.BRAND_ENM
@@ -446,14 +453,15 @@
 		 INNER JOIN TB_SUPPLY_COMPANY C ON B.SUPPLY_COMP_CD = C.SUPPLY_COMP_CD
 		 WHERE A.CPN_ID = #{cpnId}
 		   AND A.CPN_TARGET = #{cpnTarget}
+		   AND A.DEL_YN = 'N'
 		 ORDER BY A.CPN_REFVAL_SQ DESC
 	</select>
 
 	<!-- 쿠폰적용대상 - 카테고리 조회 -->
-	<select id="getCouponRefvalCategoryList" parameterType="Coupon" resultType="Coupon">
+	<select id="getCouponRefvalCategoryList" parameterType="CouponRefval" resultType="CouponRefval">
 		/* TsaCoupon.getCouponRefvalCategoryList */
 		SELECT B.CATE_GB
-			 , A.REF_VAL AS CATE_CD
+			 , A.REF_VAL AS CATE_NO
 			 , B.FULL_CATE_NM 					AS CATE_NM
 			 , B.SITE_CD
 			 , A.REF_FORMAL_GB					AS FORMAL_GB
@@ -463,11 +471,12 @@
 		 INNER JOIN TB_CATE_4SRCH B ON A.REF_VAL = B.LEAF_CATE_NO
 		 WHERE A.CPN_ID = #{cpnId}
 		   AND A.CPN_TARGET = #{cpnTarget}
+		   AND A.DEL_YN = 'N'
 		 ORDER BY A.CPN_REFVAL_SQ DESC
 	</select>
 
 	<!-- 쿠폰 적용대상 - 공급처 조회 -->
-	<select id="getCouponRefvalSupplyCompList" parameterType="Coupon" resultType="Coupon">
+	<select id="getCouponRefvalSupplyCompList" parameterType="CouponRefval" resultType="CouponRefval">
 		/* TsaCoupon.getCouponRefvalSupplyCompList */
 		SELECT B.SUPPLY_COMP_CD
 			 , B.SUPPLY_COMP_NM
@@ -476,11 +485,12 @@
 		 INNER JOIN TB_SUPPLY_COMPANY B ON A.REF_VAL = B.SUPPLY_COMP_CD
 		 WHERE A.CPN_ID = #{cpnId}
 		   AND A.CPN_TARGET = #{cpnTarget}
+		   AND A.DEL_YN = 'N'
 		 ORDER BY A.CPN_REFVAL_SQ DESC
 	</select>
 
 	<!-- 쿠폰 입점업체 분담율 조회-->
-	<select id="getCouponBurdenList" parameterType="String" resultType="Coupon">
+	<select id="getCouponBurdenList" parameterType="String" resultType="CouponBurden">
 		/* TsaCoupon.getCouponBurdenList */
 		SELECT SUPPLY_COMP_CD
 			 , BURDEN_RATE
@@ -491,7 +501,7 @@
 	</select>
 
 	<!-- 쿠폰 적용대상 수정-->
-	<update id="updateCouponRefval" >
+	<update id="updateCouponRefval" parameterType="CouponRefval" >
 		/* TsaCoupon.updateCouponRefval */
 		UPDATE TB_COUPON_REFVAL
 		   SET DEL_YN = 'Y'
@@ -504,4 +514,34 @@
 		  </foreach>
 	</update>
 
+	<!-- 고객 쿠폰 발행 -->
+	<insert id="saveCouponCustPub" parameterType="CustCoupon">
+		/* TsaCoupon.saveCouponCustPub */
+		INSERT INTO TB_CUST_COUPON (
+			CUST_NO
+		  , CPN_ID
+		  , AVAIL_STDT
+		  , AVAIL_EDDT
+		  , PUB_REASON
+		  , PUB_REASON_DTL
+          , END_ALIM_SEND_YN
+          , REG_NO
+          , REG_DT
+          , UPD_NO
+          , UPD_DT
+		) VALUES (
+		    #{custNo}
+		  , #{cpnId}
+		  , DATE_FORMAT(#{availStdt} , '%Y-%m-%d')
+		  , DATE_FORMAT(#{availEddt} , '%Y-%m-%d')
+		  , #{pubReason}
+		  , #{pubReasonDtl}
+		  , #{endAlimSendYn}
+		  , #{regNo}
+		  , now()
+		  , #{updNo}
+		  , now()
+		)
+	</insert>
+
 </mapper>

+ 9 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsaCustomer.xml

@@ -103,6 +103,15 @@
 		AND   LOGIN_LDT <![CDATA[<]]> DATE_FORMAT(DATE_ADD(#{edDate}, INTERVAL 1 DAY), '%Y-%m-%d %H:%i:%S')
 		     </if>
 		</if>
+		<if test="custNm != null and custNm != ''">
+		AND    LOWER(CUST_NM) LIKE CONCAT('%',LOWER(#{custNm}),'%')
+		</if>
+		<if test="email != null and email != ''">
+		AND    LOWER(EMAIL) LIKE CONCAT('%',LOWER(#{eamil}),'%')
+		</if>
+		<if test="custId != null and custId != ''">
+		AND    CUST_ID = #{custId}
+		</if>
 	</select>
 
 	<!-- 회원기본정보 -->

+ 44 - 34
src/main/java/com/style24/persistence/mybatis/shop/TsaMorebetter.xml

@@ -129,48 +129,58 @@
 
 	<select id="getMorebetterApplyGoodsList" parameterType="MoreBetterGoods" resultType="MoreBetterGoods">
 		/* TsaMarketing.getMorebetterApplyGoodsList */
-		SELECT 	 TMTB_GOODS_SQ
-				 , TMTB_SQ
-				 , GOODS_GB
-				 , TARGET_GB
-				 , TARGET_VAL
-				 , TARGET_VAL AS GOODS_CD
+		SELECT 	 A.TMTB_GOODS_SQ
+				 , A.TMTB_SQ
+				 , B.TMTB_APPLY_GOODS_SQ
+				 , A.GOODS_GB
+				 , A.TARGET_GB
+				 , A.TARGET_VAL
+				 , A.TARGET_VAL AS GOODS_CD
 				 , (SELECT  GOODS_NM
 					FROM  TB_GOODS
-					WHERE  GOODS_CD = TARGET_VAL) AS GOODS_NM
-				 , DEL_YN
-				 , REG_NO
-				 , REG_DT
-				 , UPD_NO
-				 , UPD_DT
-		FROM TB_TMTB_GOODS
+					WHERE  GOODS_CD = A.TARGET_VAL) AS GOODS_NM
+				 , A.DEL_YN
+				 , A.REG_NO
+				 , A.REG_DT
+				 , A.UPD_NO
+				 , A.UPD_DT
+		FROM 		TB_TMTB_GOODS A
+		INNER JOIN 	TB_TMTB_APPLY_GOODS B
+				ON 	A.TMTB_SQ = B.TMTB_SQ
+				AND A.GOODS_GB = B.GOODS_GB
+				AND A.TARGET_VAL = B.GOODS_CD
 		WHERE 1=1
-		  AND TMTB_SQ = #{tmtbSq}
-		  AND TARGET_GB = 'G260_10'
-		  AND GOODS_GB IN ('G800_10','G800_20')
+		  AND A.TMTB_SQ = #{tmtbSq}
+		  AND A.TARGET_GB = 'G260_10'
+		  AND A.GOODS_GB IN ('G800_10','G800_20')
 	</select>
 
 	<select id="getMorebetterExceptGoodsList" parameterType="MoreBetterGoods" resultType="MoreBetterGoods">
 		/* TsaMarketing.getMorebetterExceptGoodsList */
-		SELECT 	 TMTB_GOODS_SQ
-			 , TMTB_SQ
-			 , GOODS_GB
-			 , TARGET_GB
-			 , TARGET_VAL
-			 , TARGET_VAL AS GOODS_CD
-			 , (SELECT  GOODS_NM
-				FROM  TB_GOODS
-				WHERE  GOODS_CD = TARGET_VAL) AS GOODS_NM
-			 , DEL_YN
-			 , REG_NO
-			 , REG_DT
-			 , UPD_NO
-			 , UPD_DT
-		FROM TB_TMTB_GOODS
+		SELECT 	 A.TMTB_GOODS_SQ
+				 , A.TMTB_SQ
+				 , B.TMTB_APPLY_GOODS_SQ
+				 , A.GOODS_GB
+				 , A.TARGET_GB
+				 , A.TARGET_VAL
+				 , A.TARGET_VAL AS GOODS_CD
+				 , (SELECT  GOODS_NM
+					FROM  TB_GOODS
+					WHERE  GOODS_CD = A.TARGET_VAL) AS GOODS_NM
+				 , A.DEL_YN
+				 , A.REG_NO
+				 , A.REG_DT
+				 , A.UPD_NO
+				 , A.UPD_DT
+			FROM 	TB_TMTB_GOODS A
+		INNER JOIN 	TB_TMTB_APPLY_GOODS B
+			 ON 	A.TMTB_SQ = B.TMTB_SQ
+			AND 	A.GOODS_GB = B.GOODS_GB
+			AND 	A.TARGET_VAL = B.GOODS_CD
 		WHERE 1=1
-		  AND TMTB_SQ = #{tmtbSq}
-		  AND TARGET_GB = 'G260_10'
-		  AND GOODS_GB IN ('G800_30')
+		  AND A.TMTB_SQ = #{tmtbSq}
+		  AND A.TARGET_GB = 'G260_10'
+		  AND A.GOODS_GB IN ('G800_30')
 	</select>
 
 	<select id="getMorebetterBurdenList" parameterType="Integer" resultType="MoreBetterBurden">

+ 89 - 0
src/main/resources/config/application-tsit.yml

@@ -0,0 +1,89 @@
+spring:
+    profiles:
+        active: tsit
+    cache.type: redis
+    redis:
+        lettuce:
+            pool:
+                max-active: 10
+                max-idle: 10
+                min-idle: 2
+        host: localhost
+        port: 6379
+        password:
+
+logging:
+    config: classpath:log/logback-tsit.xml
+
+domain:
+    admin: //ts5000.ipdisk.co.kr
+    pastel: //tdfront.pastelmall.com
+    image: //image.pastelmall.com
+    cdnimage: //img.pastelmall.com/pastelmall_images
+    uximage: //pt-office.pastelmall.com
+
+upload:
+    default:
+        target.path: /TSIT/servers/files/data
+        max.size: 10
+        allow.extension: jpg|gif|jpeg|png|bmp|txt|doc|docx|ppt|pptx|xls|xlsx|hwp|pdf
+        view: //image.pastelmall.com
+    goods:
+        target.path: /TSIT/servers/files/data/goods
+        max.size: 10
+        allow.extension: jpg|gif|jpeg|png
+        view: //img.pastelmall.com/goods
+    image:
+        target.path: /TSIT/servers/files/data
+        max.size: 10
+        allow.extension: jpg|gif|jpeg|png
+        view: //image.pastelmall.com
+    excel:
+        target.path: /TSIT/servers/files/data/excel
+        max.size: 10
+        allow.extension: xls|xlsx
+        view: //tdimage.pastelmall.com/excel
+    sample:
+        target.path: /WIDE/workspace/files/data
+        max.size: 10
+        allow.extension: txt|doc|docx|ppt|pptx|xls|xlsx|hwp|pdf
+        view: //tdimage.pastelmall.com/sample
+
+download.path: /TSIT/servers/files/data
+
+# Directsend API
+#mail:
+#    pastel.url: https://tdfront.pastelmall.com
+#    admin.url: https://tdadmin.pastelmall.com
+#    image.url: https://tdfront.pastelmall.com/image/web/mail
+#    template.path: /TSIT/servers/webapps/pastelmall.admin/WEB-INF/mail
+#    send.flag: N
+#    api :
+#        url: https://directsend.co.kr/index.php/api_v2/mail_change_word
+#        username : tribons1
+#        key : UQbDUz0TNwGt1Ay
+#        from : pastelmall@tribons.co.kr
+#        sender: 파스텔몰
+
+# EC모니터 API
+#ecmonitor:
+#    url: http://222.112.8.121:8085/
+        
+# juso.go.kr
+#juso:
+#    api:
+#        key: U01TX0FVVEgyMDIwMDUxMzEzMzUwOTEwOTc1NDc=
+#        url: http://www.juso.go.kr/addrlink/addrLinkApiJsonp.do
+
+# PG
+#pg:
+#    nicepay:
+#        merchantId: nictest00m
+#        merchantKey: 33F49GnCMS1mFYlGXisbUDzVf2ATWCl9k3R++d5hDd3Frmuos/XLx8XhXpe+LDYAbpGKZYSwtlyyLOtS/8aD7A==
+#        log.path: /TSIT/servers/logs/pastelmall/admin
+#        account.cert.url: https://webapi.nicepay.co.kr/api/checkBankAccountAPI.jsp
+
+# WMS
+#wms:
+#    api:
+#        cancelurl: http://dncs.8200.co.kr:8081/Service.asmx

+ 25 - 0
src/main/resources/log/logback-tsit.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<configuration scan="true">
+	<property name="LOG_HOME" value="/TSIT/servers/logs/style24/admin"/>
+	<property name="LOG_LEVEL" value="INFO"/>
+	
+	<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
+		<encoder>
+			<charset>utf-8</charset>
+			<pattern>[%d] [%thread] %-5level %logger{32} : %msg%n</pattern>
+		</encoder>
+	</appender>
+	
+	<logger name="org.springframework" level="ERROR"/>
+
+	<!-- SQL문과 해당 SQL을 실행시키는데 수행된 시간 정보(milliseconds)를 포함한다. -->
+	<logger name="jdbc.sqltiming" level="INFO" additivity="false">
+		<appender-ref ref="CONSOLE"/>
+	</logger>
+
+	<root level="${LOG_LEVEL}">
+		<appender-ref ref="CONSOLE"/>
+	</root>
+
+</configuration>

+ 1 - 1
src/main/webapp/WEB-INF/views/goods/GoodsDetailForm.html

@@ -272,7 +272,7 @@
 											<label class="rdoBtn"><input type="radio" name="changeableYn" id="changeableYnN" value="N"/>N</label>
 											<input type="hidden" id="changeableYnOrg" name="changeableYnOrg"/>
 										</td>
-										<th>신규가입구매가여부<em class="required" title="필수"></em></th>
+										<th>신규가입구매가여부<em class="required" title="필수"></em></th>
 										<td>
 											<label class="rdoBtn"><input type="radio" name="newCustOrdYn" id="newCustOrdYnY" value="Y" />Y</label>
 											<label class="rdoBtn"><input type="radio" name="newCustOrdYn" id="newCustOrdYnN" value="N"/>N</label>

+ 17 - 4
src/main/webapp/WEB-INF/views/marketing/CouponListForm.html

@@ -175,12 +175,24 @@
 				valueFormatter: function (params) { return gagaAgGrid.lookupValue(dcWayList, params.value); },
 				valueParser: function (params) { return gagaAgGrid.lookupKey(dcWayList, params.newValue); }
 			},
-			{headerName: "할인값(PC)", field: "dcPval", width: 140, cellClass: 'text-center'},
-			{headerName: "할인값(MOBILE)", field: "dcMval", width: 140, cellClass: 'text-center'},
-			{headerName: "최고할인값", field: "maxDcAmt", width: 140, cellClass: 'text-center'},
+			{headerName: "할인값(PC)", field: "dcPval", width: 140, cellClass: 'text-center' ,
+				valueFormatter	: function(params) {
+					return params.value.addComma();
+				}
+			},
+			{headerName: "할인값(MOBILE)", field: "dcMval", width: 140, cellClass: 'text-center' ,
+				valueFormatter	: function(params) {
+					return params.value.addComma();
+				}
+			},
+			{headerName: "최고할인값", field: "maxDcAmt", width: 140, cellClass: 'text-center' ,
+				valueFormatter	: function(params) {
+					return params.value.addComma();
+				}
+			},
 			{headerName: "사용 수/발급 수 ", field: "useIssueCnt", width: 140, cellClass: 'text-center',
 				cellRenderer: function(params) {
-					return params.data.issueCnt + "/" + params.data.useCnt;
+					return params.data.issueCnt.addComma() + "/" + params.data.useCnt.addComma();
 				}
 			},
 			{headerName: "기간/일수구분", field: "pdGb", width: 140, cellClass: 'text-center' ,
@@ -199,6 +211,7 @@
 					return !gagajf.isNull(params.value) ? params.value.toDate("YYYY-MM-DD HH:mm:ss").format("YYYY-MM-DD HH:mm:ss") : '';
 				}
 			},
+			{headerName: "유효일수", field: "availDays", width: 140, cellClass: 'text-center'},
 			{headerName: "등록자", field: "regNm", width: 150, cellClass: 'text-center'},
 			{headerName: "등록일시", field: "regDt", width: 140, cellClass: 'text-center' ,
 				cellRenderer: function(params) {

+ 212 - 56
src/main/webapp/WEB-INF/views/marketing/CouponPopupForm.html

@@ -28,6 +28,7 @@
 				<input type="hidden" name="exceptGoodsList" id="excepGoodsList">
 				<input type="hidden" name="burdenList" id="burdenList">
 				<input type="hidden" name="cateList" id="cateList">
+				<input type="hidden" name="cpnId2" id="cpnId2" th:if="${cpnDetail}" th:value="${cpnDetail.cpnId}">
 
 				<div class="tabs">
 					<div class="tabsNav">
@@ -324,6 +325,7 @@
 									</tbody>
 								</table>
 								<div class="mdPopBtnB aR">
+									<button type="button" class="btn btn-info btn-lg" onclick="fnCustomerIssuePopUp();" th:if="${mode == 'U'}">쿠폰발행</button>
 									<button type="button" class="btn btn-info btn-lg" onclick="fnCouponCreate();" th:if="${mode == 'N'}">등록</button>
 									<button type="button" class="btn btn-info btn-lg" onclick="fnCouponUpdate();" th:if="${mode == 'U'}">수정</button>
 								</div>
@@ -332,11 +334,11 @@
 						<!-- 쿠폰적용대상-->
 						<li class="tab" id="coupontab2" >
 							<div class="panelStyle">
-								<div class="panelTitle">
-									<h2 style="position: relative">적용 대상 상품 등록</h2>
-								</div>
 								<div class="inner-panelContent">
 									<div class="panelContent">
+										<div class="panelBar">
+											<h4>적용 대상 상품 등록</h4>
+										</div>
 										<table class="frmStyle">
 											<colgroup>
 												<col style="width:15%;">
@@ -391,11 +393,11 @@
 										</table>
 									</div>
 								</div>
-								<div class="panelTitle">
-									<h2 style="position: relative">적용 제외 대상 상품 등록</h2>
-								</div>
 								<div class="inner-panelContent">
 									<div class="panelContent">
+										<div class="panelBar">
+											<h4>적용 대상 상품 등록</h4>
+										</div>
 										<table class="frmStyle">
 											<colgroup>
 												<col style="width:15%;">
@@ -426,7 +428,7 @@
 								<ul class="panelBar">
 									<li class="left">
 										<button type="button" class="btn btn-warning btn-lg" id="btnAddRow">행추가</button>
-										<button type="button" class="btn btn-danger btn-lg" id="btnDeleteRow">행삭제</button>
+										<button type="button" class="btn btn-danger btn-lg" id="btnDelRow">행삭제</button>
 									</li>
 								</ul>
 
@@ -504,7 +506,7 @@
 		{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
 		{ headerName: "상품구분" , field: "goodsGb" , width: 100, cellClass: 'text-center'} ,
 		{ headerName: "Product ID" , field: "goodsCd" , width: 120, cellClass: 'text-center'},
-		{ headerName: "상품명"  , field: "goodsNm" , width: 120 , cellClass: 'text-center'} ,
+		{ headerName: "상품명"  , field: "goodsNm" , width: 250 , cellClass: 'text-center'} ,
 		{ headerName: "쿠폰대상일련번호"  , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true}
 	];
 
@@ -545,7 +547,7 @@
 		{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
 		{ headerName: "상품구분" , field: "goodsGb" , width: 100, cellClass: 'text-center'} ,
 		{ headerName: "Product ID" , field: "goodsCd" , width: 120, cellClass: 'text-center'},
-		{ headerName: "상품명"  , field: "goodsNm" , width: 120 , cellClass: 'text-center'} ,
+		{ headerName: "상품명"  , field: "goodsNm" , width: 250 , cellClass: 'text-center'} ,
 		{ headerName: "쿠폰대상일련번호"  , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true}
 	];
 
@@ -567,20 +569,19 @@
 
 	// 쿠폰 등록 버튼 클릭시
 	function fnCouponCreate(){
-		// 필수값들 셋팅
-		setReqValue();
-
-		// 필수값 validation 체크
-		if (!gagajf.validation('#CouponForm')) {
-			return false;
-		}
-
-		checkValidation();
-
 		mcxDialog.confirm('저장하시겠습니까?' , {
 			cancelBtnText:"취소",
 			sureBtnText:"확인",
 			sureBtnClick: function () {
+				gagajf.removeCommaAtNumberFormattedInput('#CouponForm');
+				// 필수값들 셋팅
+				setReqValue();
+				// 필수값 validation 체크
+				if (!gagajf.validation('#CouponForm')) {
+					return false;
+				}
+				checkValidation();
+
 				gagajf.ajaxFormSubmit($('#CouponForm').prop('action'), '#CouponForm', function() {
 					uifnPopupClose('CouponRegForm');
 					$('#btnSearch').trigger('click');
@@ -591,20 +592,19 @@
 
 	// 쿠폰 수정 시
 	function fnCouponUpdate(){
-		// 필수값들 셋팅
-		setReqValue();
-		gagajf.removeCommaAtNumberFormattedInput('#CouponForm');
-		// 필수값 validation 체크
-		if (!gagajf.validation('#CouponForm')) {
-			return false;
-		}
-
-		checkValidation();
-
 		mcxDialog.confirm('수정하시겠습니까?' , {
 			cancelBtnText:"취소",
 			sureBtnText:"확인",
 			sureBtnClick: function () {
+				gagajf.removeCommaAtNumberFormattedInput('#CouponForm');
+				// 필수값들 셋팅
+				setReqValue();
+				// 필수값 validation 체크
+				if (!gagajf.validation('#CouponForm')) {
+					return false;
+				}
+				checkValidation();
+
 				$("#CouponForm input[name=cpnId]").prop("disabled", false);
 				$("#CouponForm input[name=cpnId]").attr("required", true);
 				$("#CouponForm input[name=cpnId]").attr("placeholder", "");
@@ -758,7 +758,36 @@
 
 	// 적용대상 - 브랜드 삭제 버튼시
 	$('#btnBrandDel').on('click' , function(){
-		brandGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(brandGridOptions)});
+		var selectVal = brandGridOptions.api.getSelectedRows();
+
+		if(selectVal.length == 0) {
+			mcxDialog.alert("선택된 행이 없습니다");
+			return;
+		}
+
+		if(cpnDetail != null ) {
+			mcxDialog.confirm('삭제하시겠습니까?', {
+				cancelBtnText: "취소",
+				sureBtnText: "확인",
+				sureBtnClick: function(){
+					gagaAgGrid.removeRowData(brandGridOptions , false);
+					var cpnRefvalSqArr = [];
+
+					$.each(selectVal , function(idx , item){
+						cpnRefvalSqArr.push(item.cpnRefvalSq);
+					});
+					var data = { cpnRefvalSqArr : cpnRefvalSqArr
+						,cpnId : cpnDetail.cpnId
+					};
+
+					var jsonData = JSON.stringify(data);
+					gagajf.ajaxJsonSubmit('/marketing/coupon/refval/update', jsonData);
+				}
+			});
+		} else {
+			// 신규화면이면 그리드상 삭제
+			brandGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(brandGridOptions)});
+		}
 	});
 
 	// 적용대상 - 공급처 추가 버튼시
@@ -787,7 +816,37 @@
 
 	// 적용대상 - 공급처 삭제시시
 	$('#btnSupplyDel').on('click' , function () {
-		supplyGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(supplyGridOptions)});
+		var selectVal = supplyGridOptions.api.getSelectedRows();
+
+		if(selectVal.length == 0) {
+			mcxDialog.alert("선택된 행이 없습니다");
+			return;
+		}
+
+		if(cpnDetail != null ) {
+			mcxDialog.confirm('삭제하시겠습니까?', {
+				cancelBtnText: "취소",
+				sureBtnText: "확인",
+				sureBtnClick: function(){
+					gagaAgGrid.removeRowData(supplyGridOptions , false);
+					var cpnRefvalSqArr = [];
+
+					$.each(selectVal , function(idx , item){
+						cpnRefvalSqArr.push(item.cpnRefvalSq);
+					});
+
+					var data = { cpnRefvalSqArr : cpnRefvalSqArr
+						,cpnId : $('#CouponForm #cpnId').val()
+					};
+
+					var jsonData = JSON.stringify(data);
+					gagajf.ajaxJsonSubmit('/marketing/coupon/refval/update', jsonData);
+				}
+			});
+		} else {
+			// 신규화면이면 그리드상 삭제
+			supplyGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(supplyGridOptions)});
+		}
 	});
 
 	// 적용대상 - 카테고리 추가시
@@ -816,7 +875,36 @@
 
 	// 적용대상 - 카테고리 삭제시
 	$('#btnCateDel').on('click' , function () {
-		cateGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(cateGridOptions)});
+		var selectVal = cateGridOptions.api.getSelectedRows();
+
+		if(selectVal.length == 0) {
+			mcxDialog.alert("선택된 행이 없습니다");
+			return;
+		}
+		if(cpnDetail != null) {
+			mcxDialog.confirm('삭제하시겠습니까?', {
+				cancelBtnText: "취소",
+				sureBtnText: "확인",
+				sureBtnClick: function(){
+					gagaAgGrid.removeRowData(cateGridOptions , false);
+
+					var cpnRefvalSqArr = [];
+
+					$.each(selectVal , function(idx , item){
+						cpnRefvalSqArr.push(item.cpnRefvalSq);
+					});
+
+					var data = { cpnRefvalSqArr : cpnRefvalSqArr
+						,cpnId : $('#CouponForm #cpnId').val()
+					};
+
+					var jsonData = JSON.stringify(data);
+					gagajf.ajaxJsonSubmit('/marketing/coupon/refval/update', jsonData);
+				}
+			});
+		} else {
+			cateGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(cateGridOptions)});
+		}
 	});
 
 	// 적용대상 - 상품 추가시
@@ -831,42 +919,77 @@
 
 	// 적용대상 - 상품 삭제 시
 	$('#btnGoodsDel').on('click' , function () {
-		goodsGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(goodsGridOptions)});
+		var selectVal = goodsGridOptions.api.getSelectedRows();
+
+		if(selectVal.length == 0) {
+			mcxDialog.alert("선택된 행이 없습니다");
+			return;
+		}
+		if(cpnDetail != null ) {
+			mcxDialog.confirm('삭제하시겠습니까?', {
+				cancelBtnText: "취소",
+				sureBtnText: "확인",
+				sureBtnClick: function(){
+					gagaAgGrid.removeRowData(goodsGridOptions , false);
+					var cpnRefvalSqArr = [];
+
+					$.each(selectVal , function(idx , item){
+						cpnRefvalSqArr.push(item.cpnRefvalSq);
+					});
+					var data = { cpnRefvalSqArr : cpnRefvalSqArr
+						,cpnId : $('#CouponForm #cpnId').val()
+					};
+
+					var jsonData = JSON.stringify(data);
+					gagajf.ajaxJsonSubmit('/marketing/coupon/refval/update', jsonData);
+				}
+			});
+		} else {
+			goodsGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(goodsGridOptions)});
+		}
 	});
 
 	// 적용대상 - 제외상품 추가시
-	$('#btnExcepGoodsAdd').on('click' , function(result){
-		gridAddGoodsList(excepGoodsGridOptions, result , "except");
+	$('#btnExcepGoodsAdd').on('click' , function(){
+		cfnOpenGoodsPopup("fnSetPopupExceptGoodsInfo");
 	});
+	// 적용 상품 리스트 콜백함수
+	var fnSetPopupExceptGoodsInfo = function(result) {
+		gridAddGoodsList(excepGoodsGridOptions, result , "except");
+	};
 
+	// 적용대상 - 제외상품 삭제시
 	$('#btnExcepGoodsDel').on('click' , function () {
-		var selectVal = exceptGoodsGbList.api.getSelectedRows();
+		var selectVal = excepGoodsGridOptions.api.getSelectedRows();
 
 		if(selectVal.length == 0) {
 			mcxDialog.alert("선택된 행이 없습니다");
 			return;
 		}
 
-		var removeVal = gagaAgGrid.removeRowData(exceptGoodsGbList , false);
-		var cpnRefvalSqArr = [];
-
-		$.each(selectVal , function(idx , item){
-			cpnRefvalSqArr.push(item.cpnRefvalSq);
-		});
-
-		if(removeVal.length > 0) {
+		if(cpnDetail != null ) {
 			mcxDialog.confirm('삭제하시겠습니까?', {
 				cancelBtnText: "취소",
 				sureBtnText: "확인",
 				sureBtnClick: function(){
+					gagaAgGrid.removeRowData(excepGoodsGridOptions , false);
+					var cpnRefvalSqArr = [];
+
+					$.each(selectVal , function(idx , item){
+						cpnRefvalSqArr.push(item.cpnRefvalSq);
+					});
+
 					var data = { cpnRefvalSqArr : cpnRefvalSqArr
-						,cpnId : $('#CouponForm #cpnId').val();
+						,cpnId : $('#CouponForm #cpnId').val()
 					};
 
 					var jsonData = JSON.stringify(data);
+
 					gagajf.ajaxJsonSubmit('/marketing/coupon/refval/update', jsonData);
 				}
 			});
+		} else {
+			excepGoodsGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(excepGoodsGridOptions)});
 		}
 	});
 
@@ -887,7 +1010,6 @@
 
 			// 중복되지 않은 데이터 리스트에 추가
 			if(addChk) {
-				//gagaAgGrid.addRowData(OriginGridListOption, result[i], "goodsCd");
 				gagaAgGrid.addRowData(OriginGridListOption, {"goodsGb": goodsGbVal, "goodsCd" : result[i].goodsCd, "goodsNm" : result[i].goodsNm});
 			}
 		}
@@ -975,6 +1097,12 @@
 		var data = { supplyCompCd: null , burdenRate : null , delYn : null};
 		gagaAgGrid.addRowData(inComGridOptions , data , "supplyCompCd" );
 	});
+	// 행삭제시
+	$('#btnDelRow').on('click' , function(){
+		inComGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(inComGridOptions)});
+	});
+
+
 
 	// 쿠폰번호 자동생성 클릭시
 	function clickCreateChk(){
@@ -1018,6 +1146,10 @@
 
 		});
 	}
+	// 쿠폰발행팝업
+	function fnCustomerIssuePopUp(){
+		cfnCpnPubForCustPopup();
+	};
 
 	// 전송시 값 세팅
 	function setReqValue(){
@@ -1100,13 +1232,13 @@
 			$("#CouponForm input:radio[name='rdoDcWay']:radio[value=" + cpnDetail.dcWay + "]").prop('checked', true);
 			$("#CouponForm input:radio[name='rdoCpnType']:radio[value=" + cpnDetail.cpnType + "]").prop('checked', true);
 			$("#CouponForm input:radio[name='rdoApplyScope']:radio[value=" + cpnDetail.applyScope + "]").prop('checked', true);
-			$("#CouponForm #dcPval").val(cpnDetail.dcPval.addComma());
-			$("#CouponForm #dcMval").val(cpnDetail.dcMval.addComma());
-			$("#CouponForm #dcAval").val(cpnDetail.dcAval.addComma());
-			$("#CouponForm #maxDcAmt").val(cpnDetail.maxDcAmt.addComma());
-			$("#CouponForm #totPubLimitQty").val(cpnDetail.totPubLimitQty.addComma());
-			$("#CouponForm #custPubLimitQty").val(cpnDetail.custPubLimitQty.addComma());
-			$("#CouponForm #onePubQty").val(cpnDetail.onePubQty.addComma());
+			$("#CouponForm #dcPval").val(cpnDetail.dcPval);
+			$("#CouponForm #dcMval").val(cpnDetail.dcMval);
+			$("#CouponForm #dcAval").val(cpnDetail.dcAval);
+			$("#CouponForm #maxDcAmt").val(cpnDetail.maxDcAmt);
+			$("#CouponForm #totPubLimitQty").val(cpnDetail.totPubLimitQty);
+			$("#CouponForm #custPubLimitQty").val(cpnDetail.custPubLimitQty);
+			$("#CouponForm #onePubQty").val(cpnDetail.onePubQty);
 			$("#CouponForm #usableCustGb").val(cpnDetail.usableCustGb).prop("selected", true);
 			$("#CouponForm #usableCustGrade").val(cpnDetail.usableCustGrade).prop("selected", true);
 			$("#CouponForm #endAlimYn").val(cpnDetail.endAlimYn).prop("selected", true);
@@ -1117,14 +1249,24 @@
 			$("#CouponForm #custJoinYn").val(cpnDetail.custJoinYn).prop("selected", true);
 			$("#CouponForm #pdGb").val(cpnDetail.pdGb).prop("selected", true);
 			$("#CouponForm #siteCd").val(cpnDetail.siteCd).prop("selected", true);
+			$("#CouponForm #afChannel").val(cpnDetail.afChannel).prop("selected", true);
 			$("#CouponForm #cpnNm").val(cpnDetail.cpnNm);
 			$("#CouponForm #downYn").val(cpnDetail.downYn);
-			$("#CouponForm #buyLimitAmt").val(cpnDetail.buyLimitAmt.addComma());
+			$("#CouponForm #buyLimitAmt").val(cpnDetail.buyLimitAmt);
 			$("#CouponForm #cpnId").val(cpnDetail.cpnId);
+
+			/*
+			$("#CouponForm input:checkbox[name='cpnCreateType']").parent("label").addClass("formControl");
+			$("#CouponForm input:checkbox[name='cpnCreateType']").parent("label").prop('disabled', true);
+			$("#CouponForm input:checkbox[name='cpnCreateType']").addClass("formControl");
+			$("#CouponForm input:checkbox[name='cpnCreateType']").prop('disabled', true);
+			*/
 			// 만약 쿠폰 발급한 내역이 있으면 쿠폰수정못하게 readonly , disabled 속성 추가
 			if (issueCnt > 0) {
 				$("#CouponForm #usableCustGb").attr('readonly', true);
 				$("#CouponForm #usableCustGb").attr('disabled', true);
+				$("#CouponForm #afChannel").attr('readonly', true);
+				$("#CouponForm #afChannel").attr('disabled', true);
 				$("#CouponForm #usableCustGrade").attr('readonly', true);
 				$("#CouponForm #usableCustGrade").attr('disabled', true);
 				$("#CouponForm #endAlimYn").attr('readonly', true);
@@ -1216,10 +1358,20 @@
 				$("#CouponForm #custJoinStMM").attr('disabled', true);
 			}
 		}
+		// 기본세팅
 		pdGbChange();
 		firstYnChange();
 		custJoinYnChange();
 		fnChangeAfLinkCdList();
+
+		// 제휴채널2뎁스 기본세팅
+		if(cpnDetail != null ) {
+			$("#CouponForm #afLinkCd").val(cpnDetail.afLinkCd).prop("selected", true);
+			if(issueCnt > 0 ) {
+				$("#CouponForm #afLinkCd").attr('readonly', true);
+				$("#CouponForm #afLinkCd").attr('disabled', true);
+			}
+		}
 	});
 
 	// 날짜분리 ( 시작/종료날짜구분(start , end) , 날짜String , 적용타겟대상 )
@@ -1238,7 +1390,7 @@
 			$("#CouponForm #"+targetGb+"EdMM").val(timeArr[1]);
 		}
 	}
-
+	// 제한없음 문구 변경
 	$("input[name=totPubLimitQty],input[name=custPubLimitQty],input[name=buyLimitAmt],input[name=onePubQty]").change(function(){
 		if($(this).val() == "0"){
 			$("#"+$(this).attr("name")+"Span").html("*제한없음");
@@ -1251,6 +1403,11 @@
 		$("input[name=totPubLimitQty],input[name=custPubLimitQty],input[name=buyLimitAmt],input[name=onePubQty]").change();
 	}, 1);
 
+	// 콤마 찍어주기
+	$(function(){
+		setComma("CouponForm" , true);
+	});
+
 	function setComma(formId, pBoolean){
 		setTimeout(function(){
 			//숫자타입 콤마 찍어주기
@@ -1270,7 +1427,6 @@
 			});
 		}, 300);
 	}
-
 	/*]]>*/
 </script>
 </html>

+ 243 - 0
src/main/webapp/WEB-INF/views/marketing/CouponPubForCustPopupForm.html

@@ -0,0 +1,243 @@
+<!DOCTYPE html>
+<html lang="ko"
+	  xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : CouponPubForCustPopupForm.html
+ * @desc    : 고객 쿠폰 발행 팝업 화면
+ *============================================================================
+ * ISTYLE24
+ * Copyright(C) 2020 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2021.01.20   xyzp1539       최초 작성
+ *******************************************************************************
+ -->
+<div class="modalPopup" data-width="960" data-height="900">
+	<div class="panelStyle" >
+		<div class="panelTitle">
+			<h2>쿠폰발행</h2>
+			<button type="button" class="close" onclick="uifnPopupClose('CpnPubForCustPopup')"><i class="fa fa-times"></i></button>
+		</div>
+		<div class="panelContent">
+			<form id="custSearchForm" name="custSearchForm" action="#" th:action="@{'/customer/active/list'}" >
+				<table class="frmStyle">
+					<colgroup>
+						<col width="10%">
+						<col width="40%">
+						<col width="10%">
+						<col width="40%">
+					</colgroup>
+					<tbody>
+						<tr>
+							<th>사이트코드</th>
+							<td>
+								<select name="siteCd" id="siteCd">
+									<option th:if="${siteCdList}" th:each="oneData , status : ${siteCdList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+								</select>
+							</td>
+							<th>회원ID</th>
+							<td>
+								<input type="text" class="w200" id="custId" name="custId">
+							</td>
+						</tr>
+						<tr>
+							<th>회원구분</th>
+							<td>
+								<select name="custGb" id="custGb">
+									<option th:if="${usableCustGbList}" th:each="oneData , status : ${usableCustGbList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+								</select>
+							</td>
+							<th>회원등급</th>
+							<td>
+								<select name="custGrade" id="custGrade">
+									<option value="">전체</option>
+									<option th:if="${usableCustGradeList}" th:each="oneData , status : ${usableCustGradeList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+								</select>
+							</td>
+						</tr>
+						<tr>
+							<th>이메일</th>
+							<td>
+								<input type="text" class="w200"  id="email" name="email">
+							</td>
+							<th>회원명</th>
+							<td>
+								<input type="text" class="w200" id="custNm" name="custNm">
+							</td>
+						</tr>
+					</tbody>
+				</table>
+			</form>
+			<div class="aR">
+				<input type="button" value="조회" class="btn btn-info btn-lg" onclick="fnSearchPubCustList()">
+			</div>
+			<div id="pubCustgridList" style="width:100%; height:420px;" class="ag-theme-balham"></div>
+			<form id="pubRegForm" name="pubRegForm" th:action="@{'/marketing/coupon/insertCustPub'}">
+				<input type="hidden" name="custList" id="custList">
+				<input type="hidden" name="cpnId" id="cpnId">
+				<table class="frmStyle">
+					<colgroup>
+						<col width="10%">
+						<col width="40%">
+						<col width="10%">
+						<col width="40%">
+					</colgroup>
+					<tbody>
+					<tr>
+						<th class="availDateTr">유효기간시작일시<em class="required" title="필수"></em></th>
+						<td class="availDateTr">
+							<input type="hidden" name="availStdt" id="availStdt" data-valid-name="유효기간시작일시" required="required">
+							<input type="text" class="schDate w100" name="availStDay" id="availStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
+							<select name="availStHH" id="availStHH">
+								<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+							</select>
+							<select name="availStMM" id="availStMM">
+								<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+							</select>
+						<th class="availDateTr">유효기간종료일시<em class="required" title="필수"></em></th>
+						<td class="availDateTr">
+							<input type="hidden" id="availEddt" name="availEddt" data-valid-name="유효기간종료일시" required="required">
+							<input type="text" class="schDate w100" name="availEdDay" id="availEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
+							<select name="availEdHH" id="availEdHH">
+								<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+							</select>
+							<select name="availEdMM" id="availEdMM">
+								<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+							</select>
+						</td>
+					</tr>
+					<tr>
+						<th>발급사유<em class="required" title="필수"></em></th>
+						<td>
+							<select name="pubReason" id="pubReason" required="required" data-valid-name="발급사유">
+								<option th:if="${cpnPubReasonList}" th:each="oneData , status : ${cpnPubReasonList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+							</select>
+						</td>
+						<th>만료알림발송여부<em class="required" title="필수"></em></th>
+						<td>
+							<select name="endAlimSendYn" id="endAlimSendYn" data-valid-name="만료알림발송여부" required="required">
+								<option value="Y">Y</option>
+								<option value="N" selected="selected">N</option>
+							</select>
+						</td>
+					</tr>
+					<tr>
+						<th>상세사유</th>
+						<td colspan="5">
+							<textarea name="pubReasonDtl" id="pubReasonDtl" cols="50" rows="5" style="height: 100px;"></textarea>
+						</td>
+					</tr>
+					</tbody>
+				</table>
+			</form>
+			<div class="aR">
+				<input type="button" value="발행" class="btn btn-info btn-lg" onclick="fnCpnPubCustomer()">
+			</div>
+		</div>
+	</div>
+</div>
+<script th:inline="javascript">
+	/*<![CDATA[*/
+	var siteCdList = gagajf.convertToArray([[${siteCdList}]]);
+	var usableCustGbList = gagajf.convertToArray([[${usableCustGbList}]]);
+	var usableCustGradeList = gagajf.convertToArray([[${usableCustGradeList}]]);
+
+	var columnDefs = [
+		{ headerName: "사이트" , field:"siteCd" , width:100, cellClass:"text-center" ,
+			cellEditor: 'agRichSelectCellEditor',
+			cellEditorParams: { values: gagaAgGrid.extractValues(siteCdList) },
+			valueFormatter: function (params) { return gagaAgGrid.lookupValue(siteCdList, params.value); },
+			valueParser: function (params) { return gagaAgGrid.lookupKey(siteCdList, params.newValue);}
+		} ,
+		{ headerName: "회원번호" , field:"custNo" , width:100, cellClass:"text-center"} ,
+		{ headerName: "회원명" , field:"custNm" , width:120, cellClass:"text-center" } ,
+		{ headerName: "이메일" , field:"email" , width:200, cellClass:"text-center"} ,
+		{ headerName: "회원구분" , field:"custGb" , width:120, cellClass:"text-center" ,
+			cellEditor: 'agRichSelectCellEditor',
+			cellEditorParams: { values: gagaAgGrid.extractValues(usableCustGbList) },
+			valueFormatter: function (params) { return gagaAgGrid.lookupValue(usableCustGbList, params.value); },
+			valueParser: function (params) { return gagaAgGrid.lookupKey(usableCustGbList, params.newValue);}
+		} ,
+		{ headerName: "회원등급" , field:"custGrade" , width:120, cellClass:"text-center" ,
+			cellEditor: 'agRichSelectCellEditor',
+			cellEditorParams: { values: gagaAgGrid.extractValues(usableCustGradeList) },
+			valueFormatter: function (params) { return gagaAgGrid.lookupValue(usableCustGradeList, params.value); },
+			valueParser: function (params) { return gagaAgGrid.lookupKey(usableCustGradeList, params.newValue);}
+		}
+	];
+
+	var pubCustGridOptions = gagaAgGrid.getGridOptions(columnDefs);
+
+	// 고객 조회
+	function fnSearchPubCustList(){
+		gagaAgGrid.fetch($("#custSearchForm").prop('action') , pubCustGridOptions , '#custSearchForm');
+	}
+
+	function fnCpnPubCustomer(){
+		setReqValue();
+		checkValidation();
+
+		var fromDate = $('#pubRegForm input[name=availStdt]').val();
+		var toDate = $('#pubRegForm input[name=availEddt]').val();
+
+		if (gagajf.isNull(fromDate) || gagajf.isNull(toDate)) {
+			mcxDialog.alertC("유효기간 시작일자와 종료일자를 입력하세요.", {
+				sureBtnText: "확인",
+				sureBtnClick: function() {
+					$('#pubRegForm input[name=availStdt]').focus();
+				}
+			});
+			return false;
+		}
+
+		if (fromDate > toDate) {
+			mcxDialog.alertC("등록 시작일자는 종료일자 보다 클 수 없습니다.", {
+				sureBtnText: "확인",
+				sureBtnClick: function() {
+					$('#pubRegForm input[name=availEddt]').focus();
+				}
+			});
+			return false;
+		}
+
+		var selectVal = gagaAgGrid.getAllRowData(pubCustGridOptions);
+		if(selectVal.length < 1) {
+			mcxDialog.alert("발행하고자 하는 회원이 없습니다.");
+			return false;
+		}
+
+		mcxDialog.confirm('발행하시겠습니까?' , {
+			cancelBtnText: "취소",
+			sureBtnText: "확인" ,
+			sureBtnClick: function(){
+				gagajf.ajaxFormSubmit($("#pubRegForm").prop('action') , "#pubRegForm" , function(){
+					uifnPopupClose('CpnPubForCustPopup');
+				});
+			}
+		});
+	}
+	
+	function setReqValue(){
+		// 유효기간 세팅
+		$('#pubRegForm #availStdt').val($('#pubRegForm #availStDay').val() + " " + $('#pubRegForm #availStHH').val() + ":" + $('#pubRegForm #availStMM').val() + ":00");
+		$('#pubRegForm #availEddt').val($('#pubRegForm #availEdDay').val() + " " + $('#pubRegForm #availEdHH').val() + ":" + $('#pubRegForm #availEdMM').val() + ":59");
+		// 회원 그리드값 세팅
+		var custAllData = gagaAgGrid.getAllRowData(pubCustGridOptions);
+		var jsonCustPubData = JSON.stringify(custAllData);
+		$("#pubRegForm #custList").val(jsonCustPubData);
+		$("#pubRegForm #cpnId").val($("#CouponForm #cpnId2").val());
+	}
+
+	$(document).ready(function(){
+		gagaAgGrid.createGrid('pubCustgridList', pubCustGridOptions);
+
+		$('#pubRegForm #availEdHH option:last').attr("selected", "selected");
+		$('#pubRegForm #availEdMM option:last').attr("selected", "selected");
+
+	});
+
+	/*]]>*/
+</script>
+</html>

+ 30 - 28
src/main/webapp/WEB-INF/views/marketing/MorebetterPopupForm.html

@@ -15,7 +15,7 @@
  *******************************************************************************
  -->
 <div class="modalPopup frGoodsPro" data-width="1100">
-	<div class="panelStyle" style="max-height:900px;overflow-y:scroll;">
+	<div class="panelStyle" style="max-height:700px;overflow-y:scroll;">
 		<div class="panelTitle">
 			<strong th:text="${'다다익선 ' + (mode == 'N' ? '등록' : '상세')}">다다익선 등록</strong>
 			<button type="button" class="close" onclick="fnMorebetterFormClose()"><i class="fa fa-times"></i></button>
@@ -120,7 +120,7 @@
 								<th>공급업체/브랜드</th>
 								<td>
 									<!-- 수정시 프로모션명 입력 : before -->
-									<div class="padding10 wid45">
+									<div class="padding10" style="display:inline-block;width:49%;">
 										<span>공급업체 설정</span>
 										<div class="padding10 inner-tb-solid">
 											<button type="button" class="btn btnRight btn-success btn-lg" id="btnAddCompany">업체 추가</button>
@@ -129,7 +129,7 @@
 											<div id="gridFGPromotionCompanyList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
 										</div>
 									</div>
-									<div class="padding10 wid45">
+									<div class="padding10" style="display:inline-block;width:49%;">
 										<span>브랜드 설정</span>
 										<div class="padding10 inner-tb-solid">
 											<button type="button" class="btn btnRight btn-success btn-lg" id="btnAddBrand">브랜드 추가</button>
@@ -298,7 +298,7 @@
 	// 브랜드 리스트 설정
 	var columnBrandList = [
 		{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
-		{headerName: "브랜드ID", field: "brandCd", width: 120, cellClass: 'text-center'},
+		{headerName: "브랜드ID", field: "brandCd", width: 110, cellClass: 'text-center'},
 		{headerName: "브랜드명", field: "brandEnm", width: 120, cellClass: 'text-center'},
 		{headerName: "공급업체명", field: "supplyCompNm", width: 150, cellClass: 'text-center'},
 		{headerName: "적용대상", field: "targetGb", width: 150, cellClass: 'text-center', hide: true},
@@ -316,7 +316,8 @@
 		{headerName: "상품코드", field: "goodsCd", width: 120, cellClass: 'text-center'},
 		{headerName: "상품명", field: "goodsNm", width: 120, cellClass: 'text-center'},
 		{headerName: "적용대상", field: "targetGb", width: 150, cellClass: 'text-center', hide: true},
-		{headerName: "시퀀스", field: "tmtbGoodsSq", width: 150, cellClass: 'text-center', hide: true}
+		{headerName: "시퀀스", field: "tmtbGoodsSq", width: 150, cellClass: 'text-center', hide: true},
+		{headerName: "실제적용대상 시퀀스", field: "tmtbApplyGoodsSq", width: 150, cellClass: 'text-center', hide: true}
 	];
 	// 제외상품 리스트 설정
 	var columnExceptGoodsList = [
@@ -330,7 +331,8 @@
 		{headerName: "상품코드", field: "goodsCd", width: 120, cellClass: 'text-center'},
 		{headerName: "상품명", field: "goodsNm", width: 120, cellClass: 'text-center'},
 		{headerName: "적용대상", field: "targetGb", width: 150, cellClass: 'text-center', hide: true},
-		{headerName: "시퀀스", field: "tmtbGoodsSq", width: 150, cellClass: 'text-center', hide: true}
+		{headerName: "시퀀스", field: "tmtbGoodsSq", width: 150, cellClass: 'text-center', hide: true},
+		{headerName: "실제적용대상 시퀀스", field: "tmtbApplyGoodsSq", width: 150, cellClass: 'text-center', hide: true}
 	];
 
 	// 업체분담율 리스트 설정
@@ -487,12 +489,12 @@
 			cancelBtnText: "취소",
 			sureBtnText: "확인",
 			sureBtnClick: function(){
-				var compAllData = gagaAgGrid.selectedRowData(gridOptionsFGCompanyList);
-				var brandAllData = gagaAgGrid.selectedRowData(gridOptionsFGBrandList);
-				var applyAllData = gagaAgGrid.selectedRowData(gridOptionsFGApplyGoodsList);
-				var exceptAllData = gagaAgGrid.selectedRowData(gridOptionsFGExceptGoodsList);
-				var burdenAllData = gagaAgGrid.selectedRowData(gridOptionsApplyBurdenList);
-				var sectionGbAllData = gagaAgGrid.selectedRowData(gridOptionsSectionGbList);
+				var compAllData = gagaAgGrid.getAllRowData(gridOptionsFGCompanyList);	//selectedRowData
+				var brandAllData = gagaAgGrid.getAllRowData(gridOptionsFGBrandList);
+				var applyAllData = gagaAgGrid.getAllRowData(gridOptionsFGApplyGoodsList);
+				var exceptAllData = gagaAgGrid.getAllRowData(gridOptionsFGExceptGoodsList);
+				var burdenAllData = gagaAgGrid.getAllRowData(gridOptionsApplyBurdenList);
+				var sectionGbAllData = gagaAgGrid.getAllRowData(gridOptionsSectionGbList);
 
 				var jsonSupplyCompData = JSON.stringify(compAllData);
 				$('#moreBetterForm input[name=supplyCompList]').val(jsonSupplyCompData);
@@ -557,19 +559,19 @@
 		}
 
 		// 각 ag-grid list 수량
-		let supplyCompCnt = gagaAgGrid.selectedRowData(gridOptionsFGCompanyList).length;
-		let brandCnt = gagaAgGrid.selectedRowData(gridOptionsFGBrandList).length;
-		let applyGoodsCnt = gagaAgGrid.selectedRowData(gridOptionsFGApplyGoodsList).length;
-		let exceptGoodsCnt = gagaAgGrid.selectedRowData(gridOptionsFGExceptGoodsList).length;
-		let applyBurdenCnt = gagaAgGrid.selectedRowData(gridOptionsApplyBurdenList).length;
-		let sectionGbCnt = gagaAgGrid.selectedRowData(gridOptionsSectionGbList).length;
+		let supplyCompCnt = gagaAgGrid.getAllRowData(gridOptionsFGCompanyList).length;
+		let brandCnt = gagaAgGrid.getAllRowData(gridOptionsFGBrandList).length;
+		let applyGoodsCnt = gagaAgGrid.getAllRowData(gridOptionsFGApplyGoodsList).length;
+		let exceptGoodsCnt = gagaAgGrid.getAllRowData(gridOptionsFGExceptGoodsList).length;
+		let applyBurdenCnt = gagaAgGrid.getAllRowData(gridOptionsApplyBurdenList).length;
+		let sectionGbCnt = gagaAgGrid.getAllRowData(gridOptionsSectionGbList).length;
 
 		if(applyGoodsCnt < 1){
-			mcxDialog.alert("선택된 적용상품이 없습니다.");
+			mcxDialog.alert("적용상품이 없습니다.");
 			return false;
 		}
 		if(sectionGbCnt < 1){
-			mcxDialog.alert("선택된 할인구간이 없습니다.");
+			mcxDialog.alert("할인구간을 설정해주세요.");
 			return false;
 		}
 
@@ -581,12 +583,12 @@
 			cancelBtnText: "취소",
 			sureBtnText: "확인",
 			sureBtnClick: function(){
-				var compAllData = gagaAgGrid.selectedRowData(gridOptionsFGCompanyList);
-				var brandAllData = gagaAgGrid.selectedRowData(gridOptionsFGBrandList);
-				var applyAllData = gagaAgGrid.selectedRowData(gridOptionsFGApplyGoodsList);
-				var exceptAllData = gagaAgGrid.selectedRowData(gridOptionsFGExceptGoodsList);
-				var burdenAllData = gagaAgGrid.selectedRowData(gridOptionsApplyBurdenList);
-				var sectionGbAllData = gagaAgGrid.selectedRowData(gridOptionsSectionGbList);
+				var compAllData = gagaAgGrid.getAllRowData(gridOptionsFGCompanyList);
+				var brandAllData = gagaAgGrid.getAllRowData(gridOptionsFGBrandList);
+				var applyAllData = gagaAgGrid.getAllRowData(gridOptionsFGApplyGoodsList);
+				var exceptAllData = gagaAgGrid.getAllRowData(gridOptionsFGExceptGoodsList);
+				var burdenAllData = gagaAgGrid.getAllRowData(gridOptionsApplyBurdenList);
+				var sectionGbAllData = gagaAgGrid.getAllRowData(gridOptionsSectionGbList);
 
 				var jsonSupplyCompData = JSON.stringify(compAllData);
 				$('#moreBetterForm input[name=supplyCompList]').val(jsonSupplyCompData);
@@ -604,14 +606,14 @@
 
 				$('#moreBetterForm input[name=applyGb]').val($('input:radio[name="sectionGb"]:checked').val());
 
-				/*
+
 				var jsonData = JSON.stringify($('#moreBetterForm').serializeObject());
 				gagajf.ajaxJsonSubmit($('#moreBetterForm').prop('action'), jsonData, function() {
 					fnMorebetterFormClose();
 					$('#btnInit').trigger('click');
 					$('#btnSearch').trigger('click');
 				});
-				*/
+
 			}
 		});