Преглед на файлове

Merge branch 'develop' of http://112.172.147.34:4936/style24/style24.admin.git into develop

gagamel преди 5 години
родител
ревизия
3077b8b38a
променени са 42 файла, в които са добавени 5856 реда и са изтрити 1788 реда
  1. 35 0
      README.md
  2. 117 3
      src/main/java/com/style24/admin/biz/dao/TsaCouponDao.java
  3. 0 2
      src/main/java/com/style24/admin/biz/dao/TsaDeliveryDao.java
  4. 170 0
      src/main/java/com/style24/admin/biz/dao/TsaFreegiftPromotionDao.java
  5. 0 32
      src/main/java/com/style24/admin/biz/dao/TsaMarketingDao.java
  6. 244 82
      src/main/java/com/style24/admin/biz/service/TsaCouponService.java
  7. 0 1
      src/main/java/com/style24/admin/biz/service/TsaDeliveryService.java
  8. 255 0
      src/main/java/com/style24/admin/biz/service/TsaFreegiftPromotionService.java
  9. 0 77
      src/main/java/com/style24/admin/biz/service/TsaMarketingService.java
  10. 2 1
      src/main/java/com/style24/admin/biz/service/TsaOrderChangeService.java
  11. 198 31
      src/main/java/com/style24/admin/biz/web/TsaMarketingController.java
  12. 78 90
      src/main/java/com/style24/admin/biz/web/TsaOrderChangeController.java
  13. 69 0
      src/main/java/com/style24/admin/biz/web/TsaOrderRefundController.java
  14. 1 1
      src/main/java/com/style24/persistence/domain/Category.java
  15. 13 22
      src/main/java/com/style24/persistence/domain/Coupon.java
  16. 22 0
      src/main/java/com/style24/persistence/domain/CouponBurden.java
  17. 43 0
      src/main/java/com/style24/persistence/domain/CouponRefval.java
  18. 28 0
      src/main/java/com/style24/persistence/domain/CustCoupon.java
  19. 3 0
      src/main/java/com/style24/persistence/domain/CustomerSearch.java
  20. 13 0
      src/main/java/com/style24/persistence/domain/Delivery.java
  21. 47 9
      src/main/java/com/style24/persistence/domain/FreeGoodsPromotion.java
  22. 4 2
      src/main/java/com/style24/persistence/domain/FreeGoodsSectionVal.java
  23. 403 0
      src/main/java/com/style24/persistence/domain/Order.java
  24. 369 79
      src/main/java/com/style24/persistence/mybatis/shop/TsaCoupon.xml
  25. 9 0
      src/main/java/com/style24/persistence/mybatis/shop/TsaCustomer.xml
  26. 0 1
      src/main/java/com/style24/persistence/mybatis/shop/TsaDelivery.xml
  27. 379 0
      src/main/java/com/style24/persistence/mybatis/shop/TsaFreegiftPromotion.xml
  28. 0 33
      src/main/java/com/style24/persistence/mybatis/shop/TsaMarketing.xml
  29. 3 0
      src/main/java/com/style24/persistence/mybatis/shop/TsaOcm.xml
  30. 53 17
      src/main/java/com/style24/persistence/mybatis/shop/TsaOrderChange.xml
  31. 89 0
      src/main/resources/config/application-tsit.yml
  32. 25 0
      src/main/resources/log/logback-tsit.xml
  33. 5 5
      src/main/webapp/WEB-INF/views/display/CategorySearchForm.html
  34. 0 944
      src/main/webapp/WEB-INF/views/marketing/CouponCreatePopupForm.html
  35. 21 17
      src/main/webapp/WEB-INF/views/marketing/CouponListForm.html
  36. 1432 0
      src/main/webapp/WEB-INF/views/marketing/CouponPopupForm.html
  37. 243 0
      src/main/webapp/WEB-INF/views/marketing/CouponPubForCustPopupForm.html
  38. 41 22
      src/main/webapp/WEB-INF/views/marketing/FreeGoodsPromotionForm.html
  39. 557 312
      src/main/webapp/WEB-INF/views/marketing/FreeGoodsPromotionRegiForm.html
  40. 877 0
      src/main/webapp/WEB-INF/views/order/ExchangeRequestForm.html
  41. 1 1
      src/main/webapp/ux/css/admin.ui.css
  42. 7 4
      src/main/webapp/ux/js/admin.popup.js

+ 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 해야한다.
+```

+ 117 - 3
src/main/java/com/style24/admin/biz/dao/TsaCouponDao.java

@@ -3,10 +3,11 @@ 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.Coupon;
+import org.springframework.stereotype.Component;
 
 /**
  * 쿠폰 DAO
@@ -19,7 +20,7 @@ public interface TsaCouponDao {
 
 	/**
 	 * 쿠폰 리스트 조회
-	 * @param  Coupon
+	 * @param  param
 	 * @return ArrayList<Coupon>
 	 * @author xyzp1539
 	 * @since 2020-12-22
@@ -28,7 +29,7 @@ public interface TsaCouponDao {
 
 	/**
 	 * 쿠폰 리스트 카운트 조회
-	 * @param  Coupon
+	 * @param  param
 	 * @return int
 	 * @author xyzp1539
 	 * @since 2020-12-22
@@ -52,4 +53,117 @@ public interface TsaCouponDao {
 	 */
 	Collection<Coupon> getCouponRetrieveList(Coupon coupon);
 
+	/**
+	 * 쿠폰 적용대상 등록
+	 * @param supplyComp
+	 * @author xyzp1539
+	 * @since  2021-01-14
+	 */
+	void saveCouponRefVal(CouponRefval supplyComp);
+
+	/**
+	 * 쿠폰 입점업체 분담 등록
+	 * @param burden
+	 * @author xyzp1539
+	 * @since  2021-01-14
+	 */
+	void saveCouponBurden(CouponBurden burden);
+
+	/**
+	 * 자사브랜드 조회
+	 * @param
+	 * @author xyzp1539
+	 * @since  2021-01-14
+	 */
+    Collection<CommonCode> getSelfBrandList();
+
+	/**
+	 * 쿠폰 상세 조회
+	 * @param  cpnId
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-15
+	 */
+    Coupon getCouponDetail(String cpnId);
+
+	/**
+	 * 쿠폰 발급개수 조회
+	 * @param  cpnId
+	 * @return int
+	 * @author xyzp1539
+	 * @since 2021-01-15
+	 */
+	int getCouponIssueCnt(String cpnId);
+
+	/**
+	 * 쿠폰 적용 대상 - 제외상품
+	 * @param  cpnRefval
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	ArrayList<CouponRefval> getCouponRefvalExceptGoodsList(CouponRefval cpnRefval);
+
+	/**
+	 * 쿠폰 적용 대상 - 브랜드
+	 * @param cpnRefval
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	ArrayList<CouponRefval> getCouponRefvalBrandList(CouponRefval cpnRefval);
+
+	/**
+	 * 쿠폰 적용 대상 - 카테고리
+	 * @param cpnRefval
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	ArrayList<CouponRefval> getCouponRefvalCategoryList(CouponRefval cpnRefval);
+
+	/**
+	 * 쿠폰 적용 대상 - 적용/제외상품
+	 * @param  cpnRefval
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	ArrayList<CouponRefval> getCouponRefvalGoodsList(CouponRefval cpnRefval);
+
+	/**
+	 * 쿠폰 적용 대상 - 공급처
+	 * @param cpnRefval
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	ArrayList<CouponRefval> getCouponRefvalSupplyCompList(CouponRefval cpnRefval);
+
+	/**
+	 * 쿠폰 입점업쳅 분담율 조회
+	 * @param cpnId
+	 * @return  Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	ArrayList<Coupon> getCouponBurdenList(String cpnId);
+
+	/**
+	 * 쿠폰 적용대상 삭제
+	 * @param  couponRefval
+	 * @return
+	 * @author xyzp1539
+	 * @since 2021-01-19
+	 */
+    void updateCouponRefval(CouponRefval couponRefval);
+
+    /**
+     * 고객 쿠폰 발행
+     * @param  custPub
+     * @return
+     * @author xyzp1539
+     * @since 2021-01-21
+     */
+	void saveCouponCustPub(CustCoupon custPub);
 }

+ 0 - 2
src/main/java/com/style24/admin/biz/dao/TsaDeliveryDao.java

@@ -112,6 +112,4 @@ public interface TsaDeliveryDao {
 	 * @since 2020. 11. 11
 	 */	
 	Collection<Delivery> getDeliveryWithdrawDirectiveList(Delivery delivery);
-
-		
 }

+ 170 - 0
src/main/java/com/style24/admin/biz/dao/TsaFreegiftPromotionDao.java

@@ -0,0 +1,170 @@
+package com.style24.admin.biz.dao;
+
+import java.util.Collection;
+import java.util.List;
+
+import com.style24.persistence.domain.*;
+import org.springframework.stereotype.Component;
+
+import com.style24.core.support.annotation.ShopDs;
+
+/**
+ * 마케팅 Dao
+ *
+ * @author xodud1202
+ * @since 2020. 12. 17
+ */
+@ShopDs
+@Component
+public interface TsaFreegiftPromotionDao {
+	/**
+	 * 사은품 프로모션 리스트
+	 * @param param
+	 * @return
+	 * @author xodud1202
+	 * @since 2020. 12. 17
+	 */
+	Collection<FreeGoodsPromotion> getFreeGoodsPromotionList(FreeGoodsPromotion param);
+
+	/**
+	 * 사은품 프로모션 등록 제휴몰 리스트 조회
+	 * @param param
+	 * @return
+	 * @author xodud1202
+	 * @since 2021. 01. 18
+	 */
+	List<Extmall> getFreegiftExtmallList(FreeGoodsPromotion param);
+
+	/**
+	 * 사은품 프로모션 등록 공급업체 리스트 조회
+	 * @param param
+	 * @return
+	 * @author xodud1202
+	 * @since 2021. 01. 18
+	 */
+	List<SupplyCompany> getFreegiftSupplyCompList(FreeGoodsPromotion param);
+
+	/**
+	 * 사은품 프로모션 등록 브랜드 리스트 조회
+	 * @param param
+	 * @return
+	 * @author xodud1202
+	 * @since 2021. 01. 18
+	 */
+	List<Brand> getFreegiftBrandList(FreeGoodsPromotion param);
+
+	/**
+	 * 사은품 프로모션 등록 적용상품 리스트 조회
+	 * @param param
+	 * @return
+	 * @author xodud1202
+	 * @since 2021. 01. 18
+	 */
+	List<Goods> getFreegiftGoodsList(FreeGoodsPromotion param);
+
+	/**
+	 * 사은품 프로모션 등록 적용상품 리스트 조회
+	 * @param param
+	 * @return
+	 * @author xodud1202
+	 * @since 2021. 01. 18
+	 */
+	List<FreeGoodsPromotion> getFreegiftSectionList(FreeGoodsPromotion param);
+
+	/**
+	 * 사은품 프로모션 등록 적용상품 리스트 조회
+	 * @param param
+	 * @return
+	 * @author xodud1202
+	 * @since 2021. 01. 18
+	 */
+	List<FreeGoodsSectionVal> getFreegiftFreegoodsList(FreeGoodsPromotion param);
+
+	/**
+	 * 사은품 프로모션 마스터 정보 저장
+	 * @param param
+	 * @author xodud1202
+	 * @since 2021. 01. 15
+	 */
+	void createFreegoodsPromotionInfo(FreeGoodsPromotion param);
+
+	/**
+	 * 사은품 프로모션 제휴몰 정보 저장
+	 * @param param
+	 * @author xodud1202
+	 * @since 2021. 01. 15
+	 */
+	void createFreegiftExtmallInfo(FreeGoodsPromotion param);
+
+	/**
+	 * 사은품 프로모션 대상 정보 저장
+	 * @param param
+	 * @author xodud1202
+	 * @since 2021. 01. 15
+	 */
+	void createFreegiftGoodsInfo(FreeGoodsPromotion param);
+
+	/**
+	 * 사은품 프로모션 사은품 지급 조건 저장
+	 * @param param
+	 * @author xodud1202
+	 * @since 2021. 01. 15
+	 */
+	void createFreegiftSectionInfo(FreeGoodsPromotion param);
+
+	/**
+	 * 사은품 프로모션 사은품 저장
+	 * @param param
+	 * @author xodud1202
+	 * @since 2021. 01. 15
+	 */
+	void createPromotionFreeGoodsInfo(FreeGoodsPromotion param);
+
+	/**
+	 * 사은품 프로모션 마스터 정보 저장
+	 * @param param
+	 * @author xodud1202
+	 * @since 2021. 01. 19
+	 */
+	void updateFreegoodsPromotionInfo(FreeGoodsPromotion param);
+
+	/**
+	 * 사은품 외부몰 정보 삭제
+	 * @param param
+	 * @author xodud1202
+	 * @since 2021. 01. 19
+	 */
+	void deleteFreegiftExtmallInfo(FreeGoodsPromotion param);
+
+	/**
+	 * 사은품 적용 업체/브랜드/상품 제외상품 정보 삭제
+	 * @param param
+	 * @author xodud1202
+	 * @since 2021. 01. 19
+	 */
+	void deleteFreegiftGoodsInfo(FreeGoodsPromotion param);
+
+	/**
+	 * 사은품 적용 조건 정보 삭제
+	 * @param param
+	 * @author xodud1202
+	 * @since 2021. 01. 19
+	 */
+	void deleteFreegiftSectionInfo(FreeGoodsPromotion param);
+
+	/**
+	 * 사은품 프로모션 지급 사은품 정보 삭제
+	 * @param param
+	 * @author xodud1202
+	 * @since 2021. 01. 19
+	 */
+	void deleteFreegiftValInfo(FreeGoodsPromotion param);
+
+	/**
+	 * 사은품 프로모션 상태 수정
+	 * @param param
+	 * @author xodud1202
+	 * @since 2021. 01. 20
+	 */
+	void updateFreegoodsPromotionStat(FreeGoodsPromotion param);
+}

+ 0 - 32
src/main/java/com/style24/admin/biz/dao/TsaMarketingDao.java

@@ -1,32 +0,0 @@
-package com.style24.admin.biz.dao;
-
-import java.util.Collection;
-
-import org.springframework.stereotype.Component;
-
-import com.style24.core.support.annotation.ShopDs;
-import com.style24.persistence.domain.FreeGoodsPromotion;
-
-/**
- * 마케팅 Dao
- *
- * @author xodud1202
- * @since 2020. 12. 17
- */
-@ShopDs
-@Component
-public interface TsaMarketingDao {
-	/* xodud1202 진행 */
-
-	/**
-	 * 사은품 프로모션 리스트
-	 * @param marketing
-	 * @return
-	 * @author xodud1202
-	 * @since 2020. 12. 17
-	 */
-	Collection<FreeGoodsPromotion> getFreeGoodsPromotionList(FreeGoodsPromotion marketing);
-
-	/* // xodud1202 진행 */
-
-}

+ 244 - 82
src/main/java/com/style24/admin/biz/service/TsaCouponService.java

@@ -8,6 +8,7 @@ import java.util.Date;
 
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
+import com.style24.persistence.domain.*;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -17,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;
 
@@ -37,9 +37,6 @@ public class TsaCouponService {
 	@Autowired
 	private TsaCommonService commonService;
 
-
-
-
 	/**
 	 * 쿠폰 저장
 	 * @param params
@@ -47,14 +44,14 @@ public class TsaCouponService {
 	 * @since  2021-01-11
 	 */
 	@Transactional("shopTxnManager")
-	public void couponSave(Coupon params) {
+	public void saveCoupon(Coupon params) {
 		String cpnId = "";		// 쿠폰ID
 
 		params.setRegNo(TsaSession.getInfo().getUserNo());
 		params.setUpdNo(TsaSession.getInfo().getUserNo());
 
 		// 자동생성이면 시퀀스 가져오기
-		/*if(StringUtils.isBlank(params.getCpnId())) {
+		if(StringUtils.isBlank(params.getCpnId())) {
 			Integer sequence = commonService.getNextSequence("SEQ_COUPON");
 			cpnId = "CPN"+sequence;
 		} else {
@@ -63,21 +60,107 @@ public class TsaCouponService {
 		params.setCpnId(cpnId);
 
 		couponDao.couponInsert(params);
-		*/
+
 		Gson gson = new Gson();
+		Integer sequence;
+		// 적용대상 - 공급업체
+		Collection<CouponRefval> supplyCompList = gson.fromJson(params.getSupplyCompList() , new TypeToken<Collection<CouponRefval>>(){}.getType());
+		for(CouponRefval supplyComp : supplyCompList) {
+			sequence = null;
 
-		Collection<Coupon>	supplyCompList = gson.fromJson(params.getSupplyCompList() , new TypeToken<Collection<Coupon>>(){}.getType());
-		for(Coupon supplyComp : supplyCompList) {
-		//	couponDao.couponRefValInsert(supplyComp);
+			if(supplyComp.getCpnRefvalSq() != null && supplyComp.getCpnRefvalSq() > 0){
+				sequence = supplyComp.getCpnRefvalSq();
+			}
+
+			supplyComp.setCpnId(cpnId);
+			supplyComp.setCpnRefvalSq(sequence);
+			supplyComp.setCpnTarget("G260_13");
+			supplyComp.setRefVal(supplyComp.getSupplyCompCd());
+			supplyComp.setRegNo(TsaSession.getInfo().getUserNo());
+			supplyComp.setUpdNo(TsaSession.getInfo().getUserNo());
+			couponDao.saveCouponRefVal(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());
+		// 적용대상 - 브랜드
+		Collection<CouponRefval> brandList = gson.fromJson(params.getBrandList() , new TypeToken<Collection<CouponRefval>>(){}.getType());
+		for(CouponRefval brand : brandList) {
+			sequence = null;
 
-		//checkCpnValidation(params);
+			if(brand.getCpnRefvalSq() != null && brand.getCpnRefvalSq() > 0){
+				sequence = brand.getCpnRefvalSq();
+			}
 
+			brand.setCpnId(cpnId);
+			brand.setCpnRefvalSq(sequence);
+			brand.setCpnTarget("G260_12");
+			brand.setRefVal(brand.getBrandCd());
+			brand.setRegNo(TsaSession.getInfo().getUserNo());
+			brand.setUpdNo(TsaSession.getInfo().getUserNo());
+
+			couponDao.saveCouponRefVal(brand);
+		}
+		// 적용대상 - 적용상품
+		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();
+			}
+			applyGoods.setCpnId(cpnId);
+			applyGoods.setCpnRefvalSq(sequence);
+			applyGoods.setCpnTarget("G260_10");
+			applyGoods.setRefVal(applyGoods.getGoodsCd());
+			applyGoods.setRegNo(TsaSession.getInfo().getUserNo());
+			applyGoods.setUpdNo(TsaSession.getInfo().getUserNo());
+
+			couponDao.saveCouponRefVal(applyGoods);
+		}
+		// 적용대상 - 카테고리
+		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();
+			}
+			cate.setCpnId(cpnId);
+			cate.setCpnRefvalSq(sequence);
+			cate.setCpnTarget("G260_11");
+			cate.setRefVal(cate.getCateNo());
+			cate.setRefFormalGb(cate.getFormalGb());
+			cate.setRefBrandCd(cate.getBrandCd());		// ag-grid 브랜드코드
+			cate.setRegNo(TsaSession.getInfo().getUserNo());
+			cate.setUpdNo(TsaSession.getInfo().getUserNo());
+
+			couponDao.saveCouponRefVal(cate);
+		}
+		// 적용대상 - 제외상품
+		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();
+			}
+
+			exceptGoods.setCpnId(cpnId);
+			exceptGoods.setCpnRefvalSq(sequence);
+			exceptGoods.setCpnTarget("G260_14");
+			exceptGoods.setRefVal(exceptGoods.getGoodsCd());
+			exceptGoods.setRegNo(TsaSession.getInfo().getUserNo());
+			exceptGoods.setUpdNo(TsaSession.getInfo().getUserNo());
+
+			couponDao.saveCouponRefVal(exceptGoods);
+		}
+		// 입점업체분담율
+		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());
+
+			couponDao.saveCouponBurden(burden);
+		}
 	}
 
 	/**
@@ -103,85 +186,164 @@ public class TsaCouponService {
 	}
 
 	/**
-	 * 쿠폰 벨리데이션 체크
-	 * @param params
+	 * 쿠폰조회 목록
+	 * @param coupon - 쿠폰 정보
+	 * @return
+	 * @author gagamel
+	 * @since 2021. 1. 8
+	 */
+	public Collection<Coupon> getCouponRetrieveList(Coupon coupon) {
+		return couponDao.getCouponRetrieveList(coupon);
+	}
+
+	/**
+	 * 쿠폰조회 목록
+	 * @param
+	 * @return
+	 * @author gagamel
+	 * @since 2021. 1. 8
+	 */
+	public Collection<CommonCode> getSelfBrandList() {
+		return couponDao.getSelfBrandList();
+	}
+
+	/**
+	 * 쿠폰 상세 조회
+	 * @param  cpnId
+	 * @return Coupon
 	 * @author xyzp1539
-	 * @since  2021-01-12
+	 * @since 2021-01-15
 	 */
-	public void checkCpnValidation(Coupon params) {
-		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-		// 할인율이면  100% 초과 체크하기
-		if(params.getDcWay() != null && params.getDcWay().equals("G240_11")) {
-			if(params.getDcAval() > 100) {
-				throw new IllegalStateException("모바일 앱 할인율은 100을 초과할수 없습니다.");
-			} else if(params.getDcPval() > 100) {
-				throw new IllegalStateException("PC할인율은 100을 초과할수 없습니다.");
-			} else if(params.getDcMval() > 100) {
-				throw new IllegalStateException("모바일 웹 100을 초과할수 없습니다.");
-			}
-		}
+    public Coupon getCouponDetail(String cpnId) { return couponDao.getCouponDetail(cpnId);}
 
-		// 기간/일수구분이 일수인 경우 날짜 체크
-		if(params.getPdGb() != null && params.getPdGb().equals("D")) {
-			try {
-				Date date1 = format.parse(params.getAvailStdt());
-				Date date2 = format.parse(params.getAvailEddt());
-
-				log.info("checkCpnValidation params.getAvailEddt() :  {}" , params.getAvailEddt());
-				log.info("checkCpnValidation params.getAvailStdt :  {}" , params.getAvailStdt());
-				if(date2.before(date1)) {
-					throw new IllegalStateException("유효기간 종료날짜가 시작날짜보다 작습니다.");
-				}
-			} catch (ParseException exception) {
-			}
-		}
+	/**
+	 * 쿠폰 발급 개수 조회
+	 * @param  cpnId
+	 * @return  cnt
+	 * @author xyzp1539
+	 * @since 2021-01-15
+	 */
+	public int getCouponIssueCnt(String cpnId) {
+		return couponDao.getCouponIssueCnt(cpnId);
+	}
 
-		// 직접다운로드인 경우 기간 체크
-		if(params.getDnGb() != null && params.getDnGb().equals("G058_20")) {
-			try {
-				Date date1 = format.parse(params.getDownStdt());
-				Date date2 = format.parse(params.getDownEddt());
-
-				log.info("checkCpnValidation params.getDownStdt() :  {}" , params.getDownStdt());
-				log.info("checkCpnValidation params.getDownEddt :  {}" , params.getDownEddt());
-				if(date2.before(date1)) {
-					throw new IllegalStateException("다운로드 종료날짜가 시작날짜보다 작습니다.");
-				}
-			} catch (ParseException exception) {
-			}
-		}
+	/**
+	 * 쿠폰 적용 대상 - 제외상품
+	 * @param  cpnId
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	public ArrayList<CouponRefval> getCouponRefvalExceptGoodsList(String cpnId ) {
+		CouponRefval cpnRefval = new CouponRefval();
+		cpnRefval.setCpnId(cpnId);
+		cpnRefval.setCpnTarget("G260_14");
+		return couponDao.getCouponRefvalExceptGoodsList(cpnRefval);
+	}
 
-		// 첫구매 적용하는 경우 날짜 체크
-		if(params.getFirstYn() != null && params.getFirstYn().equals("Y")) {
-			try {
-				Date date1 = format.parse(params.getBuyStdt());
-				Date date2 = format.parse(params.getBuyEddt());
-
-				log.info("checkCpnValidation params.getBuyStdt() :  {}" , params.getBuyStdt());
-				log.info("checkCpnValidation params.getBuyEddt :  {}" , params.getBuyEddt());
-				if(date2.before(date1)) {
-					throw new IllegalStateException("첫구매 종료날짜가 시작날짜보다 작습니다.");
-				}
-			} catch (ParseException exception) {
-			}
-		}
+	/**
+	 * 쿠폰 적용 대상 - 브랜드
+	 * @param cpnId
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	public ArrayList<CouponRefval> getCouponRefvalBrandList(String cpnId ) {
+		CouponRefval cpnRefval = new CouponRefval();
+		cpnRefval.setCpnId(cpnId);
+		cpnRefval.setCpnTarget("G260_12");
+		return couponDao.getCouponRefvalBrandList(cpnRefval);
+	}
 
-		// 신규회원여부 적용하는 경우 날짜 체크
-		if(params.getCustJoinYn() != null && params.getCustJoinYn().equals("Y")) {
+	/**
+	 * 쿠폰 적용 대상 - 카테고리
+	 * @param cpnId
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	public ArrayList<CouponRefval> getCouponRefvalCategoryList(String cpnId) {
+		CouponRefval cpnRefval = new CouponRefval();
+		cpnRefval.setCpnId(cpnId);
+		cpnRefval.setCpnTarget("G260_11");
+		return couponDao.getCouponRefvalCategoryList(cpnRefval);
+	}
 
-		}
+	/**
+	 * 쿠폰 적용 대상 - 적용상품
+	 * @param  cpnId
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	public ArrayList<CouponRefval> getCouponRefvalGoodsList(String cpnId , String cpnTarget) {
+		CouponRefval cpnRefval = new CouponRefval();
+		cpnRefval.setCpnId(cpnId);
+		cpnRefval.setCpnTarget(cpnTarget);
+		return couponDao.getCouponRefvalGoodsList(cpnRefval);
+	}
 
+	/**
+	 * 쿠폰 적용 대상 - 공급처
+	 * @param cpnId
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	public ArrayList<CouponRefval> getCouponRefvalSupplyCompList(String cpnId) {
+		CouponRefval cpnRefval = new CouponRefval();
+		cpnRefval.setCpnId(cpnId);
+		cpnRefval.setCpnTarget("G260_13");
+		return couponDao.getCouponRefvalSupplyCompList(cpnRefval);
 	}
 
 	/**
-	 * 쿠폰조회 목록
-	 * @param coupon - 쿠폰 정보
+	 * 쿠폰 입점업체 분담율 조회
+	 * @param  
+	 * @return 
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	public ArrayList<Coupon> getCouponBurdenList(String cpnId) {
+		return couponDao.getCouponBurdenList(cpnId);
+	}
+
+	/**
+	 * 쿠폰 적용대상 삭제
+	 * @param   couponRefval
 	 * @return
-	 * @author gagamel
-	 * @since 2021. 1. 8
+	 * @author xyzp1539
+	 * @since 2021-01-19
 	 */
-	public Collection<Coupon> getCouponRetrieveList(Coupon coupon) {
-		return couponDao.getCouponRetrieveList(coupon);
+	@Transactional("shopTxnManager")
+	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);
+		}
+	}
 }

+ 0 - 1
src/main/java/com/style24/admin/biz/service/TsaDeliveryService.java

@@ -182,5 +182,4 @@ public class TsaDeliveryService {
 	public Collection<Delivery> getDeliveryWithdrawDirectiveList(Delivery delivery) {
 		return deliveryDao.getDeliveryWithdrawDirectiveList(delivery);
 	}
-	
 }

+ 255 - 0
src/main/java/com/style24/admin/biz/service/TsaFreegiftPromotionService.java

@@ -0,0 +1,255 @@
+package com.style24.admin.biz.service;
+
+import com.gagaframework.web.parameter.GagaMap;
+import com.style24.admin.biz.dao.TsaFreegiftPromotionDao;
+import com.style24.admin.support.security.session.TsaSession;
+import com.style24.persistence.domain.Extmall;
+import com.style24.persistence.domain.FreeGoodsPromotion;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ *상품관리 Service
+ *
+ * @author xodud1202
+ * @since 2020. 12. 17
+ */
+@Service
+@Slf4j
+public class TsaFreegiftPromotionService {
+
+	@Autowired
+	private TsaFreegiftPromotionDao freegiftPromotionDao;
+
+	/**
+	 * 사은품 프로모션 리스트
+	 * @param param
+	 * @return Collection<FreeGoodsPromotion>
+	 * @author xodud1202
+	 * @since 2020. 12. 17
+	 */
+	public Collection<FreeGoodsPromotion> getFreeGoodsPromotionList(FreeGoodsPromotion param) {
+		return freegiftPromotionDao.getFreeGoodsPromotionList(param);
+	}
+
+	/**
+	 * 사은품 프로모션 디테일 조회
+	 * @param param
+	 * @return GagaMap
+	 * @author xodud1202
+	 * @since 2020. 12. 17
+	 */
+	public GagaMap getFreegiftDetailInfo(FreeGoodsPromotion param) {
+		GagaMap result = new GagaMap();
+
+		// 사은품 프로모션 마스터 정보 조회
+		List<FreeGoodsPromotion> freeGoodsList = (ArrayList<FreeGoodsPromotion>) getFreeGoodsPromotionList(param);
+		// 상세 조회 내역이 없거나, 1개가 아닐 경우
+		if(freeGoodsList == null || freeGoodsList.size() != 1 ) {
+			return null;
+		}
+		FreeGoodsPromotion freegift = freeGoodsList.get(0);							// 사은품 프로모션 마스터 정보
+		freegift.setExtmallList(getFreegiftExtmallList(param));						// 사은품 프로모션 제휴몰 정보
+		freegift.setBrandList(freegiftPromotionDao.getFreegiftBrandList(param));			// 사은품 프로모션 브랜드 정보
+		freegift.setSupplyCompList(freegiftPromotionDao.getFreegiftSupplyCompList(param));	// 사은품 프로모션 공급업체 정보
+		param.setGoodsGb("G800_20");
+		freegift.setApplyGoodsList(freegiftPromotionDao.getFreegiftGoodsList(param));			// 사은품 프로모션 적용상품 정보
+		param.setGoodsGb("G800_30");
+		freegift.setExceptGoodsList(freegiftPromotionDao.getFreegiftGoodsList(param));			// 사은품 프로모션 제외상품 정보
+
+		List<FreeGoodsPromotion> freegoodsSectionList = freegiftPromotionDao.getFreegiftSectionList(param);
+		for(int i = 0 ; i < freegoodsSectionList.size() ; i++) {
+			param.setFreegiftSectionSq(freegoodsSectionList.get(i).getFreegiftSectionSq());
+			if(i == 0) {		// 첫번째 조건
+				freegift.setSectionVal(freegoodsSectionList.get(i).getSectionVal());
+				freegift.setFreeGoods1(freegiftPromotionDao.getFreegiftFreegoodsList(param));
+			} else {			// 두번째 사은품 조건
+				freegift.setSectionVal2(freegoodsSectionList.get(i).getSectionVal());
+				freegift.setFreeGoods2(freegiftPromotionDao.getFreegiftFreegoodsList(param));
+			}
+		}
+
+		result.put("freegift", freegift);
+		result.put("param", param);
+		return result;
+	}
+
+	/**
+	 * 사은품 프로모션 제휴몰 리스트
+	 * @param param
+	 * @return List<Extmall>
+	 * @author xodud1202
+	 * @since 2020. 12. 17
+	 */
+	public List<Extmall> getFreegiftExtmallList(FreeGoodsPromotion param) {
+		return freegiftPromotionDao.getFreegiftExtmallList(param);
+	}
+
+	/**
+	 * 사은품 프로모션 정보 저장
+	 * @param param
+	 * @author xodud1202
+	 * @since 2021. 12. 19
+	 */
+	@Transactional("shopTxnManager")
+	public void saveFreegoodsPromotionInfo(FreeGoodsPromotion param) {
+		param.setRegNo(TsaSession.getInfo().getUserNo());
+		param.setUpdNo(TsaSession.getInfo().getUserNo());
+
+		if("U".equals(param.getGbn()) && param.getFreegiftSq() != 0) {
+			freegiftPromotionDao.updateFreegoodsPromotionInfo(param);	// 사은품 프로모션 정보 수정
+			freegiftPromotionDao.deleteFreegiftExtmallInfo(param);		// 사은품 프로모션 제휴몰 데이터 삭제
+			freegiftPromotionDao.deleteFreegiftGoodsInfo(param);		// 사은품 프로모션 적용 업체/브랜드/상품 제외상품 정보 삭제
+			freegiftPromotionDao.deleteFreegiftSectionInfo(param);		// 사은품 프로모션 적용 업체/브랜드/상품 제외상품 정보 삭제
+			freegiftPromotionDao.deleteFreegiftValInfo(param);			// 사은품 프로모션 적용 업체/브랜드/상품 제외상품 정보 삭제
+		} else {
+			param.setFreegiftStat("G232_10");					// 프로모션 등록이면 대기 상태로 저장
+			freegiftPromotionDao.createFreegoodsPromotionInfo(param);   // 사은품 프로모션 마스터 정보 저장
+		}
+
+		// 제휴몰 등록
+		if(param.getExtmallYn() != null && "Y".equals(param.getExtmallYn()) ) {
+			if(param.getExtmallList() != null && param.getExtmallList().size() > 0) {
+				FreeGoodsPromotion extmallInfo = new FreeGoodsPromotion();
+				extmallInfo.setFreegiftSq(param.getFreegiftSq());
+				extmallInfo.setRegNo(param.getRegNo());
+				extmallInfo.setUpdNo(param.getUpdNo());
+
+				// 제휴몰 리스트만큼 반복
+				for(int i = 0 ; i < param.getExtmallList().size() ; i++) {
+					extmallInfo.setExtmallId(param.getExtmallList().get(i).getExtmallId());
+					extmallInfo.setVendorId(param.getExtmallList().get(i).getVendorId());
+					freegiftPromotionDao.createFreegiftExtmallInfo(extmallInfo);		// 제휴몰 리스트 정보 저장
+				}
+			}
+		}
+
+		// 공급업체 등록
+		if(param.getSupplyCompList() != null && param.getSupplyCompList().size() > 0) {
+			FreeGoodsPromotion supplyComp = new FreeGoodsPromotion();
+			supplyComp.setFreegiftSq(param.getFreegiftSq());
+			supplyComp.setGoodsGb("G800_20");			// 적용 상품 (공급업체, 브랜드, 적용 상품 3가지는 적용 상품 코드로 등록함 G800_20|적용상품, G800_30|제외상품)
+			supplyComp.setTargetGb("G260_13");			// 적용 대상 (G260_10|상품, G260_12|브랜드, G260_13|공급처)
+			supplyComp.setRegNo(param.getRegNo());
+			supplyComp.setUpdNo(param.getUpdNo());
+
+			// 공급업체 리스트만큼 반복
+			for(int i = 0 ; i < param.getSupplyCompList().size() ; i++) {
+				supplyComp.setTargetVal(param.getSupplyCompList().get(i).getSupplyCompCd());
+				freegiftPromotionDao.createFreegiftGoodsInfo(supplyComp);				// 적용 공급업체 리스트 저장
+			}
+		}
+
+		// 브랜드 설정 데이터 저장
+		if(param.getBrandList() != null && param.getBrandList().size() > 0) {
+			FreeGoodsPromotion brand = new FreeGoodsPromotion();
+			brand.setFreegiftSq(param.getFreegiftSq());
+			brand.setGoodsGb("G800_20");			// 적용 상품 (공급업체, 브랜드, 적용 상품 3가지는 적용 상품 코드로 등록함 G800_20|적용상품, G800_30|제외상품)
+			brand.setTargetGb("G260_12");			// 적용 대상 (G260_10|상품, G260_12|브랜드, G260_13|공급처)
+			brand.setRegNo(param.getRegNo());
+			brand.setUpdNo(param.getUpdNo());
+
+			// 브랜드 리스트만큼 반복
+			for(int i = 0 ; i < param.getBrandList().size() ; i++) {
+				brand.setTargetVal(param.getBrandList().get(i).getBrandCd());
+				freegiftPromotionDao.createFreegiftGoodsInfo(brand);				// 적용 브랜드 리스트 저장
+			}
+		}
+
+		// 적용 상품 데이터 저장
+		if(param.getApplyGoodsList() != null && param.getApplyGoodsList().size() > 0) {
+			FreeGoodsPromotion applyGoods = new FreeGoodsPromotion();
+			applyGoods.setFreegiftSq(param.getFreegiftSq());
+			applyGoods.setGoodsGb("G800_20");			// 적용 상품 (공급업체, 브랜드, 적용 상품 3가지는 적용 상품 코드로 등록함 G800_20|적용상품, G800_30|제외상품)
+			applyGoods.setTargetGb("G260_10");			// 적용 대상 (G260_10|상품, G260_12|브랜드, G260_13|공급처)
+			applyGoods.setRegNo(param.getRegNo());
+			applyGoods.setUpdNo(param.getUpdNo());
+
+			// 브랜드 리스트만큼 반복
+			for(int i = 0 ; i < param.getApplyGoodsList().size() ; i++) {
+				applyGoods.setTargetVal(param.getApplyGoodsList().get(i).getGoodsCd());
+				freegiftPromotionDao.createFreegiftGoodsInfo(applyGoods);			// 적용 상품 리스트 저장
+			}
+		}
+
+		// 제외 상품 데이터 저장
+		if(param.getExceptGoodsList() != null && param.getExceptGoodsList().size() > 0) {
+			FreeGoodsPromotion exceptGoods = new FreeGoodsPromotion();
+			exceptGoods.setFreegiftSq(param.getFreegiftSq());
+			exceptGoods.setGoodsGb("G800_30");			// 적용 상품 (공급업체, 브랜드, 적용 상품 3가지는 적용 상품 코드로 등록함 G800_20|적용상품, G800_30|제외상품)
+			exceptGoods.setTargetGb("G260_10");			// 적용 대상 (G260_10|상품, G260_12|브랜드, G260_13|공급처)
+			exceptGoods.setRegNo(param.getRegNo());
+			exceptGoods.setUpdNo(param.getUpdNo());
+
+			// 적용 상품 리스트만큼 반복
+			for(int i = 0 ; i < param.getExceptGoodsList().size() ; i++) {
+				exceptGoods.setTargetVal(param.getExceptGoodsList().get(i).getGoodsCd());
+				freegiftPromotionDao.createFreegiftGoodsInfo(exceptGoods);			// 적용 상품 리스트 저장
+			}
+		}
+
+		// 사은품 조건1 사은품 존재 여부 및 구매금액 제한 조건 체크
+		if(param.getFreeGoods1() != null && param.getFreeGoods1().size() > 0 && param.getSectionVal() > 0) {
+			// 사은품 지급조건 Section 저장
+			FreeGoodsPromotion freegoodsGiveInfo = new FreeGoodsPromotion();
+			freegoodsGiveInfo.setFreegiftSq(param.getFreegiftSq());
+			freegoodsGiveInfo.setSectionGb("G810_11");				// 사은품 프로모션 구간 설정 구분값 (G810_10|수량, G810_11|금액)  >>  사은품 프로모션 기획서상 금액 구분만 존재함.
+			freegoodsGiveInfo.setSectionVal(param.getSectionVal());	// 사은품조건 section1 구매금액 조건
+			freegoodsGiveInfo.setRegNo(param.getRegNo());
+			freegoodsGiveInfo.setUpdNo(param.getUpdNo());
+			freegiftPromotionDao.createFreegiftSectionInfo(freegoodsGiveInfo);	// 사은품 지급 조건 영역 저장
+
+			// 지급 사은품 리스트1 반복
+			for (int i = 0 ; i < param.getFreeGoods1().size() ; i++) {
+				freegoodsGiveInfo.setItemCd(param.getFreeGoods1().get(i).getProductNo() + "");		// 사은품 번호
+				freegoodsGiveInfo.setUsePoint(param.getFreeGoods1().get(i).getUsePoint());			// 사은품 포인트액
+				freegoodsGiveInfo.setItemQty(param.getFreeGoods1().get(i).getItemQty());			// 주문시 지급 수량
+				freegoodsGiveInfo.setLimitQty(param.getFreeGoods1().get(i).getLimitQty());			// 한정 수량
+				freegoodsGiveInfo.setLeftQty(param.getFreeGoods1().get(i).getLimitQty());			// 잔여 수량
+
+				freegiftPromotionDao.createPromotionFreeGoodsInfo(freegoodsGiveInfo);	// 사은품 지급 상품 영역 저장
+			}
+		}
+
+		// 사은품 조건2 사은품 존재 여부 및 구매금액 제한 조건 체크
+		if(param.getFreeGoods2() != null && param.getFreeGoods2().size() > 0 && param.getSectionVal2() > 0) {
+			// 사은품 지급조건 Section 저장
+			FreeGoodsPromotion freegoodsGiveInfo = new FreeGoodsPromotion();
+			freegoodsGiveInfo.setFreegiftSq(param.getFreegiftSq());
+			freegoodsGiveInfo.setSectionGb("G810_11");					// 사은품 프로모션 구간 설정 구분값 (G810_10|수량, G810_11|금액)  >>  사은품 프로모션 기획서상 금액 구분만 존재함.
+			freegoodsGiveInfo.setSectionVal(param.getSectionVal2());	// 사은품조건 section2 구매금액 조건
+			freegoodsGiveInfo.setRegNo(param.getRegNo());
+			freegoodsGiveInfo.setUpdNo(param.getUpdNo());
+			freegiftPromotionDao.createFreegiftSectionInfo(freegoodsGiveInfo);	// 사은품 지급 조건 영역 저장
+
+			// 지급 사은품 리스트2 반복
+			for (int i = 0 ; i < param.getFreeGoods2().size() ; i++) {
+				freegoodsGiveInfo.setItemCd(param.getFreeGoods2().get(i).getProductNo() + "");		// 사은품 번호
+				freegoodsGiveInfo.setUsePoint(param.getFreeGoods2().get(i).getUsePoint());			// 사은품 포인트액
+				freegoodsGiveInfo.setItemQty(param.getFreeGoods2().get(i).getItemQty());			// 주문시 지급 수량
+				freegoodsGiveInfo.setLimitQty(param.getFreeGoods2().get(i).getLimitQty());			// 한정 수량
+				freegoodsGiveInfo.setLeftQty(param.getFreeGoods2().get(i).getLimitQty());			// 잔여 수량
+
+				freegiftPromotionDao.createPromotionFreeGoodsInfo(freegoodsGiveInfo);	// 사은품 지급 상품 영역 저장
+			}
+		}
+	}
+
+	/**
+	 * 사은품 프로모션 상태 수정
+	 * @param param
+	 * @author xodud1202
+	 * @since 2021. 12. 20
+	 */
+	@Transactional("shopTxnManager")
+	public void updateFreegoodsPromotionStat(FreeGoodsPromotion param) {
+		param.setUpdNo(TsaSession.getInfo().getUserNo());
+		freegiftPromotionDao.updateFreegoodsPromotionStat(param);
+	}
+}

+ 0 - 77
src/main/java/com/style24/admin/biz/service/TsaMarketingService.java

@@ -1,77 +0,0 @@
-package com.style24.admin.biz.service;
-
-import java.util.Collection;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Service;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.style24.admin.biz.dao.TsaMarketingDao;
-import com.style24.core.biz.thirdparty.NaverLowestPriceApi;
-import com.style24.core.biz.thirdparty.SafetyKoreaApi;
-import com.style24.core.support.message.TscMessageByLocale;
-import com.style24.persistence.domain.FreeGoodsPromotion;
-
-import lombok.extern.slf4j.Slf4j;
-
-/**
- *상품관리 Service
- *
- * @author xodud1202
- * @since 2020. 12. 17
- */
-@Service
-@Slf4j
-public class TsaMarketingService {
-
-	@Autowired
-	private TscMessageByLocale message;
-
-	@Autowired
-	private Environment env;
-
-	@Autowired
-	private TsaMarketingDao marketingDao;
-
-	@Autowired
-	private TsaBusinessService businessService;
-
-	@Autowired
-	private TsaCommonService commonService;
-
-	@Autowired
-	private TsaRendererService rendererService;
-
-	@Autowired
-	private TsaNoticeService noticeService;
-
-	@Autowired
-	private SafetyKoreaApi safetyKoreaApi;
-
-	@Autowired
-	private NaverLowestPriceApi naverLowestPriceApi;
-
-	@Autowired
-	private ObjectMapper mapper;
-
-	private static final String NUMBER_PATTERN = "^[0-9]+$";
-
-	private static final String SELF_GOOODS_AFTER = "STY";
-
-	/* xodud1202 진행 */
-
-	/**
-	 * 사은품 프로모션 리스트
-	 * @param param
-	 * @return
-	 * @author xodud1202
-	 * @since 2020. 12. 17
-	 */
-	public Collection<FreeGoodsPromotion> getFreeGoodsPromotionList(FreeGoodsPromotion param) {
-		return marketingDao.getFreeGoodsPromotionList(param);
-	}
-
-	/* // xodud1202 진행 */
-
-}

+ 2 - 1
src/main/java/com/style24/admin/biz/service/TsaOrderChangeService.java

@@ -11,10 +11,11 @@ import org.springframework.transaction.annotation.Transactional;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.gagaframework.web.parameter.GagaMap;
-import com.style24.admin.biz.dao.TsaOrderChangeDao;
 import com.style24.admin.biz.dao.TsaOrderDao;
+import com.style24.admin.biz.dao.TsaOrderChangeDao;
 import com.style24.admin.biz.dao.TsaRefundDao;
 import com.style24.admin.support.security.session.TsaSession;
+import com.style24.core.biz.dao.TscOrderChangeDao;
 import com.style24.core.support.message.TscMessageByLocale;
 import com.style24.persistence.domain.Order;
 import com.style24.persistence.domain.OrderChange;

+ 198 - 31
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;
@@ -20,20 +22,13 @@ import org.springframework.web.servlet.ModelAndView;
 import com.style24.admin.biz.service.TsaBusinessService;
 import com.style24.admin.biz.service.TsaCommonService;
 import com.style24.admin.biz.service.TsaCouponService;
-import com.style24.admin.biz.service.TsaMarketingService;
+import com.style24.admin.biz.service.TsaFreegiftPromotionService;
 import com.style24.admin.biz.service.TsaMorebetterService;
 import com.style24.admin.biz.service.TsaRendererService;
 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;
 
@@ -57,7 +52,7 @@ public class TsaMarketingController extends TsaBaseController {
 	private Environment env;
 
 	@Autowired
-	private TsaMarketingService marketingService;
+	private TsaFreegiftPromotionService freegiftService;
 
 	@Autowired
 	private TsaBusinessService businessService;
@@ -100,14 +95,14 @@ public class TsaMarketingController extends TsaBaseController {
 	public GagaMap getFreeGoodsPromotionList(@RequestBody FreeGoodsPromotion param) {
 		GagaMap result = new GagaMap();
 
-		List<FreeGoodsPromotion> marketingList = (ArrayList<FreeGoodsPromotion>)marketingService.getFreeGoodsPromotionList(param);
+		List<FreeGoodsPromotion> freeGoodsList = (ArrayList<FreeGoodsPromotion>)freegiftService.getFreeGoodsPromotionList(param);
 
 		param.setRegNo(TsaSession.getInfo().getUserNo()); // 엑셀조회시 로그인 사용자의 엑셀 상품조회시 사용
 		param.setPageable(new TscPageRequest(param.getPageNo() - 1, param.getPageSize()));
-		param.getPageable().setTotalCount(marketingList.size());
+		param.getPageable().setTotalCount(freeGoodsList.size());
 
 		result.set("pageing", param);
-		result.set("freeGoodsList", marketingList);
+		result.set("freeGoodsList", freeGoodsList);
 
 		return result;
 	}
@@ -127,11 +122,24 @@ public class TsaMarketingController extends TsaBaseController {
 		// 상품상태
 		String[] exceptCds = {"G008_00"};
 		mav.addObject("goodsStatList", rendererService.getCommonCodeList("G008", "Y", exceptCds));
+
 		mav.addObject("param", param);
+
 		mav.setViewName("marketing/FreeGoodsPromotionRegiForm");
 		return mav;
 	}
 
+	/**
+	 * 사은품 프로모션 목록 조회
+	 * @author xodud1202
+	 * @since 2020. 12. 16
+	 */
+	@PostMapping("/freeGoodsPromotion/detail")
+	@ResponseBody
+	public GagaMap getFreeGoodsPromotionDetail(FreeGoodsPromotion param) {
+		return freegiftService.getFreegiftDetailInfo(param);
+	}
+
 	/**
 	 * 사은품 프로모션 등록
 	 * @param param
@@ -140,8 +148,34 @@ public class TsaMarketingController extends TsaBaseController {
 	 * @since 2021. 01. 14
 	 */
 	@ResponseBody
-	@GetMapping("/freeGoodsPromotion/save")
-	public GagaResponse freeGoodsPromotionSave(FreeGoodsPromotion param) {
+	@PostMapping("/freeGoodsPromotion/save")
+	public GagaResponse freeGoodsPromotionSave(@RequestBody FreeGoodsPromotion param) {
+		try {
+			freegiftService.saveFreegoodsPromotionInfo(param);
+		} catch(Exception e) {
+			e.printStackTrace();
+			return super.error(message.getMessage("FAIL_0001"));
+		}
+
+		return super.ok(message.getMessage("SUCC_0001"));
+	}
+
+	/**
+	 * 사은품 프로모션 등록
+	 * @param param
+	 * @return ModelAndView
+	 * @author xodud1202
+	 * @since 2021. 01. 14
+	 */
+	@ResponseBody
+	@PostMapping("/freeGoodsPromotion/changeStat")
+	public GagaResponse freeGoodsPromotionChangeStat(@RequestBody FreeGoodsPromotion param) {
+		try {
+			freegiftService.updateFreegoodsPromotionStat(param);
+		} catch(Exception e) {
+			e.printStackTrace();
+			return super.error(message.getMessage("FAIL_0001"));
+		}
 
 		return super.ok(message.getMessage("SUCC_0001"));
 	}
@@ -207,9 +241,11 @@ public class TsaMarketingController extends TsaBaseController {
 	 */
 	@GetMapping("/coupon/popup/form")
 	@ResponseBody
-	public ModelAndView couponCreatePopup() {
+	public ModelAndView couponCreatePopup(@RequestParam(value="cpnId") String cpnId ) {
 		ModelAndView mav = new ModelAndView();
 		String num = "";
+		String mode = "N";
+		int issueCnt = 0;
 
 		// 일시 시 리스트 세팅
 		Collection<CommonCode> hhList = new ArrayList<CommonCode>();
@@ -246,15 +282,28 @@ public class TsaMarketingController extends TsaBaseController {
 
 			mmList.add(temp);
 		}
-
+		// 시간 분 리스트 세팅
+		mav.addObject("mmList", mmList);
+		// 시간 시 리스트 세팅
+		mav.addObject("hhList", hhList);
+		// 입점업체 조회
+		mav.addObject("ibSupplyCompList", rendererService.getSupplyCompanyList("", "N"));
+		// 정상/이월 조회
+		mav.addObject("formalGbList" , rendererService.getCommonCodeList("G009"));
+		// 카테고리 구분 조회
+		mav.addObject("cateGbList" , rendererService.getCommonCodeList("G032"));
+		// 자사 브랜드 조회
+		mav.addObject("selfBrandList" , couponService.getSelfBrandList());
+		// 사이트코드 조회
+		mav.addObject("siteCdList", rendererService.getCommonCodeList("G000"));
+		// 쿠폰상태 조회
+		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("siteCdList", rendererService.getCommonCodeList("G000"));
+		mav.addObject("usableCustGradeList", rendererService.getCommonCodeList("G110"));
 		// 재발급 여부 조회
 		mav.addObject("reissuanceList", rendererService.getCommonCodeList("G231"));
 		// 할인방식 조회
@@ -263,16 +312,35 @@ public class TsaMarketingController extends TsaBaseController {
 		mav.addObject("dnGbList", rendererService.getCommonCodeList("G058"));
 		// 결제수단 조회
 		mav.addObject("payTypeList", rendererService.getCommonCodeList("G015"));
-		// 쿠폰상태 조회
-		mav.addObject("cpnStatList", rendererService.getCommonCodeList("G232"));
-		// 시간 분 리스트 세팅
-		mav.addObject("mmList", mmList);
-		// 시간 시 리스트 세팅
-		mav.addObject("hhList", hhList);
-		// 입점업체 조회
-		mav.addObject("ibSupplyCompList", rendererService.getSupplyCompanyList("", "N"));
+		// 상위제휴채널 조회
+		mav.addObject("upperAfLinkCdList", rendererService.getCommonCodeList("G053"));
+
+		// 이미 쿠폰 아이디가 있으면 적용대상 조회
+		if(!StringUtils.isBlank(cpnId)) {
+			mode = "U";
+			issueCnt = couponService.getCouponIssueCnt(cpnId);
+			// 쿠폰상세조회
+			mav.addObject("cpnDetail" , couponService.getCouponDetail(cpnId));
+			// 쿠폰적용대상 - 공급업체 조회
+			mav.addObject("cpnDtlRefvalSupplyCompList" , couponService.getCouponRefvalSupplyCompList(cpnId));
+			// 쿠폰적용대상 - 적용상품 조회
+			mav.addObject("cpnDtlRefvalApplyGoodsList" , couponService.getCouponRefvalGoodsList(cpnId , "G260_10"));
+			// 쿠폰적용대상 - 카테고리 조회
+			mav.addObject("cpnDtlRefvalCateList" , couponService.getCouponRefvalCategoryList(cpnId));
+			// 쿠폰적용대상 - 브랜드 조회
+			mav.addObject("cpnDtlRefvalBrandList" , couponService.getCouponRefvalBrandList(cpnId));
+			// 쿠폰적용대상 - 제외상품 조회
+			mav.addObject("cpnDtlRefvalExceptGoodsList" , couponService.getCouponRefvalGoodsList(cpnId , "G260_14"));
+			// 쿠폰 입점업체분담율 조회
+			mav.addObject("cpnDtlBurdenList" , couponService.getCouponBurdenList(cpnId));
+		}
 
-		mav.setViewName("marketing/CouponCreatePopupForm");
+		//issueCnt = 3;
+
+		mav.addObject("mode" , mode);
+		mav.addObject("issueCnt" , issueCnt);
+
+		mav.setViewName("marketing/CouponPopupForm");
 		return mav;
 	}
 
@@ -285,13 +353,112 @@ public class TsaMarketingController extends TsaBaseController {
 	 */
 	@PostMapping("/coupon/save")
 	@ResponseBody
-	public GagaResponse couponSave(@RequestBody Coupon coupon) {
+	public GagaResponse saveCoupon(@RequestBody Coupon coupon) {
 		log.info("couponSave : {}", coupon);
 
-		couponService.couponSave(coupon);
+		couponService.saveCoupon(coupon);
 
 		return super.ok(message.getMessage("SUCC_0001"));
 	}
+
+	/**
+	 * 쿠폰 적용대상 삭제수정
+	 * @param CouponRefval
+	 * @return
+	 * @author xyzp1539
+	 * @since 2021-01-19
+	 */
+	@PostMapping("/coupon/refval/update")
+	@ResponseBody
+	public GagaResponse updateCouponRefval(@RequestBody CouponRefval CouponRefval) {
+		log.info("couponSave : {}", CouponRefval);
+
+		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 진행 */

+ 78 - 90
src/main/java/com/style24/admin/biz/web/TsaOrderChangeController.java

@@ -16,14 +16,17 @@ import org.springframework.web.servlet.ModelAndView;
 
 import com.gagaframework.web.parameter.GagaMap;
 import com.gagaframework.web.rest.server.GagaResponse;
+import com.style24.admin.biz.service.TsaDeliveryService;
 import com.style24.admin.biz.service.TsaOrderChangeService;
 import com.style24.admin.biz.service.TsaOrderService;
 import com.style24.admin.biz.service.TsaRendererService;
 import com.style24.admin.support.controller.TsaBaseController;
 import com.style24.admin.support.security.session.TsaSession;
 import com.style24.core.biz.service.TscOrderChangeService;
+import com.style24.core.biz.service.TscOrderRefundService;
 import com.style24.core.support.env.TscConstants;
 import com.style24.core.support.message.TscMessageByLocale;
+import com.style24.persistence.domain.Delivery;
 import com.style24.persistence.domain.Order;
 import com.style24.persistence.domain.OrderChange;
 
@@ -43,9 +46,6 @@ public class TsaOrderChangeController extends TsaBaseController {
 	@Autowired
 	private TscMessageByLocale message;
 	
-	@Autowired
-	private Environment env;
-	
 	@Autowired
 	private TsaRendererService rendererService;
 	
@@ -58,7 +58,11 @@ public class TsaOrderChangeController extends TsaBaseController {
 	@Autowired
 	private TscOrderChangeService coreOrderChangeService;
 	
+	@Autowired
+	private TscOrderRefundService coreOrderRefundService;
+	
 	/**
+	 * 취소요청 화면
 	 * 취소신청 (NAPY, 외부몰) (배치)
 	 * @param OrderChange - 주문취소신청정보
 	 * @return
@@ -69,8 +73,6 @@ public class TsaOrderChangeController extends TsaBaseController {
 	@ResponseBody
 	public GagaResponse cnclReq(@RequestBody OrderChange cnclReq) {
 		
-		GagaMap mav = new GagaMap();
-		
 		if (cnclReq== null) {
 			throw new IllegalStateException(message.getMessage("FAIL_1001"));
 		}
@@ -95,18 +97,11 @@ public class TsaOrderChangeController extends TsaBaseController {
 	@PostMapping("/cnclReqComplete")
 	@ResponseBody
 	public GagaResponse cnclReqComplete(@RequestBody OrderChange cnclReq) {
-		GagaMap mav = new GagaMap();
 		
 		if (cnclReq== null) {
 			throw new IllegalStateException(message.getMessage("FAIL_1001"));
 		}
 		
-		// * 필요 데이타
-		// 주문번호, 주문상세, 취소신청수량, 신청구분(취소신청, 취소완료), 몰구분(자사, NAPY, EXTMALL)
-		
-		// 1. 취소신청목록으로 변환
-		List<Order> cnclReqList = coreOrderChangeService.getCnclReqList(cnclReq);
-		
 		return super.ok("성공");
 	}
 	
@@ -146,7 +141,7 @@ public class TsaOrderChangeController extends TsaBaseController {
 	}
 	
 	/**
-	 * 주문취소완료 (관리자)
+	 * 취소완료 (관리자)
 	 * @param Collection<Order> - 주문취소신청목록
 	 * @return
 	 * @author jsh77b
@@ -154,15 +149,15 @@ public class TsaOrderChangeController extends TsaBaseController {
 	 */
 	@PostMapping("/cancel")
 	@ResponseBody
-	public GagaResponse orderCancel(@RequestBody OrderChange cancelReq) {
+	public GagaResponse orderCancel(@RequestBody OrderChange cnclReq) {
 		
 		GagaMap mav = new GagaMap();
 		
-		if (cancelReq== null) {
+		if (cnclReq== null) {
 			throw new IllegalStateException(message.getMessage("FAIL_1001"));
 		}
 		
-		List<Order> cnclReqList = cancelReq.getCancelReqList(); // 취소요청정보
+		List<Order> cnclReqList = cnclReq.getCancelReqList(); // 취소요청정보
 		
 		// To Do List
 		// @ 결품취소로직 추가
@@ -172,53 +167,35 @@ public class TsaOrderChangeController extends TsaBaseController {
 		// 1. 세션회원조회
 		int userNo = TsaSession.getInfo().getUserNo();
 		
-		// 1. 환불금액정보 계산 & 조회
-		// 2021.01.19 취소신청정보를 목록 (주문상세번호, 취소/반품수량) 으로 표현		
-		mav = coreOrderChangeService.cnclRtnRefundAmt(cnclReqList);
+		// 2. 환불금액계산
+		// 2021.01.19 취소신청정보를 목록 (주문상세번호, 취소/반품수량) 으로 표현
+		mav = coreOrderRefundService.cnclRtnRefundAmt(cnclReqList);
 		
-		// 2. 주문변경기본정보 설정
-		mav.set("ordNo"			, cancelReq.getOrdNo());
-		mav.set("chgReason"		, cancelReq.getChgReason());
-		mav.set("chgMemo"		, cancelReq.getChgMemo());
+		// 3. 주문변경 기본정보 설정
+		mav.set("ordNo"			, cnclReq.getOrdNo());				// 주문번호
+		mav.set("chgReason"		, cnclReq.getChgReason());			// 변경사유
+		mav.set("chgMemo"		, cnclReq.getChgMemo());			// 변경메모
 		
-		mav.set("accountNo"		, cancelReq.getAccountNo());
-		mav.set("accountNm"		, cancelReq.getAccountNm());
-		mav.set("bankCd"		, cancelReq.getBankCd());
+		mav.set("accountNo"		, cnclReq.getAccountNo());			// 환불계좌번호
+		mav.set("accountNm"		, cnclReq.getAccountNm());			// 환불계좌예금주명
+		mav.set("bankCd"		, cnclReq.getBankCd());				// 환불계좌은행코드
 		
-		mav.set("allCanYn"		, cancelReq.getAllCanYn());
-		mav.set("isCustomer"	, cancelReq.getIsCustomer());
+		mav.set("allCanYn"		, cnclReq.getAllCanYn());			// 무통장입금전 전체취소 여부
+		mav.set("isCustomer"	, cnclReq.getIsCustomer());			// 변경사유 (고객, 회사)
 		
-		// 3. 주문변경 DB 등록 (주문정보, 배송정보)
+		// 4. 주문변경 회수지정보 추가
+		mav.set("chgerNm"		, cnclReq.getChgerNm());			// 변경자명
+		mav.set("chgerPhnno"	, cnclReq.getChgerPhnno());			// 변경자핸드폰번호
+		mav.set("chgerTelno"	, cnclReq.getChgerTelno());			// 변경자전화번호
+				
+		// 5. 주문변경 DB 등록 (TB_ORDER_CHANGE, TB_ORDER_CHANGE_DETAIL)
 		coreOrderChangeService.cnclComplete(mav, userNo);
 		
 		return super.ok("성공");
 	}
 	
 	/**
-	 * 주문 취소/반품 신청환불금액 계산
-	 * @param Collection<Order>- 주문취소신청목록
-	 * @return
-	 * @author jsh77b
-	 * @since 2020. 12. 29
-	 */
-	@PostMapping("/cancel/refundAmt")
-	@ResponseBody
-	public GagaMap orderCancelRefundAmt(@RequestBody List<Order> cancelReqList) {
-		
-		GagaMap mav = new GagaMap();
-		
-		if (cancelReqList == null || cancelReqList.isEmpty()) {
-			throw new IllegalStateException(message.getMessage("FAIL_1001"));
-		}
-		
-		// 1. 환불금액정보 계산 & 조회
-		mav = coreOrderChangeService.cnclRtnRefundAmt(cancelReqList);
-		
-		return mav;
-	}
-	
-	/**
-	 * 반품요청 화면
+	 * 반품요청 화면 (관리자)
 	 * 
 	 * @param ordNo - 주문번호
 	 * @param cncWait - 취소대기요청 구분
@@ -256,7 +233,7 @@ public class TsaOrderChangeController extends TsaBaseController {
 	}
 	
 	/**
-	 * 주문반품신청
+	 * 반품신청 (관리자)
 	 * @param Collection<Order> - 주문취소신청목록
 	 * @return
 	 * @author jsh77b
@@ -264,48 +241,43 @@ public class TsaOrderChangeController extends TsaBaseController {
 	 */
 	@PostMapping("/returnRequest")
 	@ResponseBody
-	public GagaResponse orderReturnRequest(@RequestBody OrderChange cancelReq) {
+	public GagaResponse orderReturnRequest(@RequestBody OrderChange rtnReq) {
 		
 		GagaMap mav = new GagaMap();
 		
-		if (cancelReq== null) {
+		if (rtnReq== null) {
 			throw new IllegalStateException(message.getMessage("FAIL_1001"));
 		}
 
-		List<Order> cancelReqList = cancelReq.getCancelReqList(); // 취소요청정보
-		
-		// To Do List
-		// @ 결품취소로직 현재는 일반취소로직만존재
-		// @ 주문취소 취소시 상태값 체크
-		// @ 취소, 반품시 배송비 체크 로직 
+		List<Order> cancelReqList = rtnReq.getCancelReqList(); // 취소요청정보
 		
 		// 1. 세션회원조회
 		int userNo = TsaSession.getInfo().getUserNo();
 		
-		// 1. 환불금액정보 계산 & 조회
-		mav = coreOrderChangeService.cnclRtnRefundAmt(cancelReqList);
-		
-		// 2. 주문변경기본정보 설정
-		mav.set("ordNo"			, cancelReq.getOrdNo());
-		mav.set("chgReason"		, cancelReq.getChgReason());
-		mav.set("chgMemo"		, cancelReq.getChgMemo());
-		
-		mav.set("accountNo"		, cancelReq.getAccountNo());
-		mav.set("accountNm"		, cancelReq.getAccountNm());
-		mav.set("bankCd"		, cancelReq.getBankCd());
-		
-		mav.set("allCanYn"		, cancelReq.getAllCanYn());
-		mav.set("isCustomer"	, cancelReq.getIsCustomer());
-		
-		//3. 회수지정보추가
-		mav.set("chgerNm"		, cancelReq.getChgerNm());
-		mav.set("chgerZipNo"	, cancelReq.getChgerZipNo());
-		mav.set("chgerBaseAddr"	, cancelReq.getChgerBaseAddr());
-		mav.set("chgerDtlAddr"	, cancelReq.getChgerDtlAddr());
-		mav.set("chgerPhnno"	, cancelReq.getChgerPhnno());
-		mav.set("chgerTelno"	, cancelReq.getChgerTelno());
-		
-		// 4. 주문변경 DB 등록 (주문정보, 배송정보)
+		// 2. 환불금액계산
+		mav = coreOrderRefundService.cnclRtnRefundAmt(cancelReqList);
+		
+		// 3. 주문변경 기본정보 설정
+		mav.set("ordNo"			, rtnReq.getOrdNo());				// 주문번호
+		mav.set("chgReason"		, rtnReq.getChgReason());			// 변경사유
+		mav.set("chgMemo"		, rtnReq.getChgMemo());				// 변경메모
+			
+		mav.set("accountNo"		, rtnReq.getAccountNo());			// 환불계좌번호
+		mav.set("accountNm"		, rtnReq.getAccountNm());			// 환불계좌예금주명
+		mav.set("bankCd"		, rtnReq.getBankCd());				// 환불계좌은행코드
+		
+		mav.set("allCanYn"		, rtnReq.getAllCanYn());			// 무통장입금전 전체취소 여부 
+		mav.set("isCustomer"	, rtnReq.getIsCustomer());			// 변경사유 (고객, 회사)
+		
+		// 4. 주문변경 회수지정보 추가
+		mav.set("chgerNm"		, rtnReq.getChgerNm());				// 변경자명
+		mav.set("chgerZipNo"	, rtnReq.getChgerZipNo());			// 회수지우편번호
+		mav.set("chgerBaseAddr"	, rtnReq.getChgerBaseAddr());		// 회수지기본주소
+		mav.set("chgerDtlAddr"	, rtnReq.getChgerDtlAddr());		// 회수지상세주소
+		mav.set("chgerPhnno"	, rtnReq.getChgerPhnno());			// 변경자핸드폰번호
+		mav.set("chgerTelno"	, rtnReq.getChgerTelno());			// 변경자전화번호
+		
+		// 5. 주문변경 DB 등록 (TB_ORDER_CHANGE, TB_ORDER_CHANGE_DETAIL, TB_REFUND)
 		coreOrderChangeService.rtnReq(mav, userNo);
 		
 		return super.ok("성공");
@@ -313,6 +285,20 @@ public class TsaOrderChangeController extends TsaBaseController {
 	
 	
 	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
 	/**
 	 * 환불계좌목록
 	 *
@@ -417,13 +403,15 @@ public class TsaOrderChangeController extends TsaBaseController {
 
 		Collection<Order> orderInfoList = orderService.getOrderInfoList(order);
 
-		mav.addObject("chgReasonList"				, rendererService.getAvailCommonCodeList("G686"));	// 반품사유
-		mav.addObject("cancelRequestTargetList"		, cancelRequestTargetList);							// 반품요청대상 목록
+		mav.addObject("chgReasonList"				, rendererService.getAvailCommonCodeList("G689"));	// 교환사유
+		mav.addObject("cancelRequestTargetList"		, cancelRequestTargetList);							// 교환요청대상 목록
 		mav.addObject("orderInfoList"				, orderInfoList);									// 주문정보
 		mav.addObject("ordNo"						, ordNo);
-		mav.addObject("orderDelvRtnAddrInfo"		, orderService.getDeliveryAddrList(order));			// 배송정보
+		mav.addObject("orderDelvAddrInfo"			, orderService.getDeliveryAddrList(order));			// 배송정보
+		mav.addObject("TelExcNoList"				, rendererService.getAvailCommonCodeList("G095"));	// 전화번호국번
+		mav.addObject("PhnExcNoList"				, rendererService.getAvailCommonCodeList("G096"));	// (휴대전화)번호국번
 
-		mav.setViewName("order/ReturnRequestForm");
+		mav.setViewName("order/ExchangeRequestForm");
 
 		return mav;
 	}

+ 69 - 0
src/main/java/com/style24/admin/biz/web/TsaOrderRefundController.java

@@ -0,0 +1,69 @@
+package com.style24.admin.biz.web;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.gagaframework.web.parameter.GagaMap;
+import com.style24.admin.support.controller.TsaBaseController;
+import com.style24.core.biz.service.TscOrderRefundService;
+import com.style24.core.support.message.TscMessageByLocale;
+import com.style24.persistence.domain.Order;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 취소관리 Controller
+ *
+ * @author jsh77b
+ * @since 2020. 11. 16
+ */
+@Controller
+@RequestMapping("/refund")
+@Slf4j
+public class TsaOrderRefundController extends TsaBaseController {
+	
+	@Autowired
+	private TscMessageByLocale message;
+	
+	@Autowired
+	private TscOrderRefundService coreOrderRefundService;
+
+	/**
+	 * 주문 취소/반품 신청환불금액 계산
+	 * @param Collection<Order>- 주문취소신청목록
+	 * @return
+	 * @author jsh77b
+	 * @since 2020. 12. 29
+	 */
+	@PostMapping("/refundAmt")
+	@ResponseBody
+	public GagaMap orderCancelRefundAmt(@RequestBody List<Order> cancelReqList) {
+		
+		GagaMap mav = new GagaMap();
+		
+		if (cancelReqList == null || cancelReqList.isEmpty()) {
+			throw new IllegalStateException(message.getMessage("FAIL_1001"));
+		}
+		
+		// 1. 환불금액계산
+		mav = coreOrderRefundService.cnclRtnRefundAmt(cancelReqList);
+		
+		return mav;
+	}
+}
+
+
+
+
+
+
+
+
+
+

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

@@ -41,7 +41,7 @@ public class Category extends TscBaseDomain {
 	// 검색조건
 	private String siteCd;		// 사이트코드
 	private Integer selLvl;		// 선택레벨
-	private String callbackFn;	// 콜백함수
+	private String callBackFun;	// 콜백함수
 
 	// 품목카테고리매핑관리 화면에서 사용
 	private String fullCateNo;	// FULL카테고리번호

+ 13 - 22
src/main/java/com/style24/persistence/domain/Coupon.java

@@ -1,5 +1,6 @@
 package com.style24.persistence.domain;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.style24.persistence.TscBaseDomain;
 import com.style24.persistence.TscPageRequest;
 import lombok.Data;
@@ -15,7 +16,7 @@ import java.util.Collection;
 @SuppressWarnings("serial")
 @Data
 public class Coupon extends TscBaseDomain {
-
+    // TB_COUPON
     private String  cpnId;					// 쿠폰ID
     private String  cpnNm;					// 쿠폰명
     private String  siteCd;					// 사이트코드(공통코드G000)
@@ -52,30 +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 int     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  cateList;               // 카테고리 리스트
+    private String  burdenList;             // 업체 분담율 리스트
 
-    private String  supplyCompList;          // 공급업체 리스트
-    private String  brandList;               // 브랜드 리스트
-    private String  applyGoodsList;          // 적용상품 리스트
-    private String  exceptGoodsList;         // 제외상품 리스트
-    private String  burdenList;              // 업체 분담율 리스트
-    private String  cateList;                // 카테고리 리스트
+    // TB_COUPON_BAN_GOODS
+    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;
 
 }

+ 13 - 0
src/main/java/com/style24/persistence/domain/Delivery.java

@@ -298,4 +298,17 @@ public class Delivery extends TscBaseDomain {
 
 	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 	private String[] multiOrdDtlStat = null;
+	
+	// 출고처 정보
+	private String delvAssignGrade;
+	private String stockApplRate;
+	private String delvLocZipcode;
+	private String delvLocBaseAddr;
+	private String delvLocDtlAddr;
+	private String rtnLocZipcode;
+	private String rtnLocBaseAddr;
+	private String rtnLocDtlAddr;
+	private String rtnLocTelno;
+	private String rtnLocNm;
+	private String invoicePrintType;
 }

+ 47 - 9
src/main/java/com/style24/persistence/domain/FreeGoodsPromotion.java

@@ -5,6 +5,8 @@ import com.style24.persistence.TscBaseDomain;
 import com.style24.persistence.TscPageRequest;
 import lombok.Data;
 
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 /**
@@ -17,33 +19,69 @@ import java.util.List;
 @Data
 public class FreeGoodsPromotion extends TscBaseDomain {
 	// 사은품 프로모션
-	private int freeGiftSq;				// 프로모션ID
-	private String freeGiftName;		// 프로모션명
-	private String freeGiftStat;		// 프로모션 상태
-	private String freeGiftStdt;		// 프로모션 시작일
-	private String freeGiftEddt;		// 프로모션 종료일
+	private int freegiftSq;				// 프로모션ID
+	private String freegiftNm;			// 프로모션명
+	private String freegiftStat;		// 프로모션 상태
+	private String freegiftStdt;		// 프로모션 시작일
+	private String freegiftEddt;		// 프로모션 종료일
 	private String selfYn;				// 자사몰 적용 여부
 	private String allYn;				// 모두 지급 구분 (모두지급 일때는 포인트 금액을 설정 할 수 없음 Y(모두지급), N(선택사은품))
+	private String freegiftStatNm;		// 프로모션 상태명
+
+	// 사은품 프로모션 섹션정보
+	private int freegiftSectionSq;		// 사은품 지급 조건 section 번호
+	private int sectionVal;				// 사은품조건1 구매금액 조건
+	private int sectionVal2;			// 사은품조건2 구매금액 조건
+	private String sectionGb;			// 사은품 프로모션 구간 설정 구분값 (G810_10|수량, G810_11|금액)
 
 	// 사은품 프로모션 제휴몰
 	private int freegiftExtmallSq;		// 프로모션 제휴몰 ID
+	private String extmallYn;			// 제휴몰 여부
 	private String extmallId;			// 외부몰ID
 	private String vendorId;			// 벤더ID
+	private String extmallNm;			// 외부몰명
+
+	// 사은품 프로모션 공급업체
+	private String supplyCompCd;		// 업체코드
+	private String supplyCompNm;		// 업체명
+
+	// 사은품 프로모션 브랜드
+	private String brandCd;				// 브랜드코드
+	private String brandKnm;			// 브랜드국문명
+	private String brandEnm;			// 브랜드국문명
 
 	// 사은품 프로모션 적용 및 제외 상품
 	private String goodsGb;				// 상품 구분 (G800_10|기본상품, G800_20|적용상품, G800_30|제외상품, G800_40|ALL)
+	private String goodsCd;				// 상품 코드
+	private String goodsNm;				// 상품명
+	private String goodsStat;			// 상품상태
 	private String targetGb;			// 적용 구분 (G260_10|상품, G260_12|브랜드, G260_13|공급처)
 	private String targetVal;			// 적용 값 (브랜드코드, 상품코드, 공급처코드)
-	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)	private String[] applyGoodsCds;		// 적용 상품 번호
-	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)	private String[] exceptGoodsCds;	// 제외 상품 번호
+	private int listPrice;
+	private int currPrice;
+
+
+	// 사은품 프로모션 사은품 조건
+	private String itemCd;				// 사은품 번호
+	private int usePoint;				// 포인트액
+	private int limitQty;				// 한정수량
+	private int itemQty;				// 지급수량
+	private int leftQty;				// 남은 수량
 
-	// 사은품 조건
-	private List<FreeGoodsSectionVal> goodsListNew;		// 사은품 조건 리스트
+	List<SupplyCompany> supplyCompList;	// 공급업체 리스트
+	List<Brand> brandList;				// 브랜드 리스트
+	List<Extmall> extmallList;			// 제휴몰 리스트
+	List<Goods> applyGoodsList;			// 적용 상품 리스트
+	List<Goods> exceptGoodsList;		// 제외 상품 리스트
+	List<FreeGoodsSectionVal> freeGoods1;	// 지급 사은품 리스트1
+	List<FreeGoodsSectionVal> freeGoods2;	// 지급 사은품 리스트2
 
 	// 기타 조건
 	private String promotionGubun;		// 프로모션 조회 검색 구분
 	private String searchTxt;			// 프로모션 검색 조건
 	private String gbn;					// 팝업 구분 : C=등록, U=수정
+	private String stDate;				// 검색 기간 조건 시작일
+	private String edDate;				// 검색 기간 조건 종료일
 
 	// Pagination
 	private TscPageRequest pageable;

+ 4 - 2
src/main/java/com/style24/persistence/domain/FreeGoodsSectionVal.java

@@ -19,10 +19,12 @@ public class FreeGoodsSectionVal {
 	private int itemQty;				// 지급 수량
 	private int limitQty;				// 한정 수량
 	private int leftQty;				// 잔여 수량
-	private String sectionGb;			// 사은품 조건 구분(G810_10|수량, G810_11|금액)
-	private String sectionVal;				// 구간 설정 값 | 구간 할인 시작 (수량이상, 금액이상)
+	private int productNo;				// 사은품 코드
+	private String sectionGb;			// 사은품 조건 구분(G810_10|수량, G810_11|금액) > 수량은 기획서 상 조건 없음.
+	private String sectionVal;			// 구간 설정 값 | 구간 할인 시작 (수량이상, 금액이상)
 	private String productCd;			// 사은품 코드
 	private String itemCd;				// 사은품ID
 	private String itemOptCd1;			// ??
 	private String itemOptCd2;			// ??
+	private String goodsNm;				// 사은품명
 }

+ 403 - 0
src/main/java/com/style24/persistence/domain/Order.java

@@ -0,0 +1,403 @@
+package com.style24.persistence.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.style24.persistence.TscBaseDomain;
+
+import com.style24.persistence.TscPageRequest;
+import lombok.Data;
+
+/**
+ * 주문 Domain
+ *
+ * @author jsh77b
+ * @since 2020. 11. 16
+ */
+@SuppressWarnings("serial")
+@Data
+public class Order extends TscBaseDomain {
+	
+	// 주문마스터
+	private int ordNo;
+	private String mallGb;
+	private String mallGbNm;
+	private String ordDt;
+	private String payDt;
+	private int custNo;
+	private String ordNm;
+	private String ordTelno;
+	private String siteCd;
+	private String siteCdNm;
+	private int npayOrdNo;
+	private String frontGb;
+	private String frontGbNm;
+	private String extmallNm;
+
+	// 주문상세
+	private int ordDtlNo;
+	private String ordExchGb;
+	private String ordDtlStat;
+	private int orgOrdDtlNo;
+	private String supplyCompCd;
+	private String goodsCd;
+	private String formalGb;
+	private String formalGbNm;
+	private String goodsType;
+	private int listPrice;
+	private int currPrice;
+	private double dcRate;
+	private int optAddPrice;
+	private int ordQty;
+	private int ordAmt;
+	private int cnclRtnQty;
+	private int cnclRtnAmt;
+	private int cpn1CpnSq;
+	private int cpn1DcAmt;
+	private int tmtb1Sq;
+	private int tmtb1DcAmt;
+	private int tmtb2Sq;
+	private int tmtb2DcAmt;
+	private int goodsCpnSq;
+	private int goodsCpnDcAmt;
+	private int cartCpnSq;
+	private int cartCpnDcAmt;
+	
+	private int pntDcAmt;
+	private int prePntDcAmt;
+	private int savePntAmt;
+	
+	private int realOrdAmt;
+	private String venderId;
+	private String extmallId;
+	private String agentOrderId;
+	private String extmallOrderId;
+	private String changeableYn;
+	private String changeFeeFreeYn;
+	private String returnableYn;
+	private String returnFeeFreeYn;
+	
+	private String soldoutYn;
+	private String soldoutMemo;
+	private String soldoutRegNo;
+	private String soldoutRegDt;
+	private int delvAddrSq;
+	private String shotDelvYn;
+	private String giftPackYn;
+	
+	private String delvLocCd;
+	private String delvAssigngDt;
+	private String delvAddignStat;
+	private String dstrbtMemo;
+	private String delvStdt;
+	private String delvEddt;
+	
+	private String shipCompCd;
+	private String invoiceNo;
+	private String invoiceSendYn;
+	private String sellStoreCd;
+	private double sellFeeRate;
+	
+	private String afLinkCd;
+	private String ithrCd;
+	private String contentsLoc;
+	
+	private int planDtlsq;
+	private int socialSq;
+	
+	private String condition;
+	private String[] conditions = null;
+	
+	private String stDate;
+	private String edDate;
+	private String searchDateGb;
+	private String orderNm;
+	private int custId;
+	private String orderPhnno;
+	private String vendorId;
+	private String sizeCd;
+	private String goodsNm;
+	private String payMeans;
+	private String chgStat;
+	private String recipNm;
+	private String chgGb;
+	private String wdInvoiceSendYn;
+	
+	// 상품정보
+	private String imgPath1;
+	private String sysImgNm;
+	private String brandCd;
+	private String optCd1;
+	private String optCd2;
+	private String goodsTypeNm;
+	private String brandEnm;
+	private String itemCd;
+	private String goodsNum;
+	private String supplyGoodsCd;
+	private String optCd2s;
+	private int currStockQty;
+	private String currStockQtys;
+	
+	private int totDcAmt;
+	private String dateGbn;
+	private String mallCd;
+	private String search;
+	
+	/* Multi CheckBox 항목*/
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private String[] multiBrand;
+
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private String[] multiOrdStat;
+
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private String[] multiOrdDtlStat;
+	
+	private int sumOrdAmt;
+	private int sumOrdCnclAmt;
+	private int sumRealPayAmt;
+	private int ordNoCnt;
+	private int sumOrdQty;
+	private int sumOrdCnclQty;
+	
+	private String excelFileNm;
+	
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private int[] ordNoList;
+	
+	private String delYn;
+	private String recipPhnno;
+	private String recipTelno;
+	private String recipZipNo;
+	private String recipBaseAddr;
+	private String recipDtlAddr;
+	private String ordEmail;
+	private String delvMemo;
+	private String delvAddrEditYn;
+	private String exchGbNm;
+	
+	private String escrowYn;
+	private String payMeansNm;
+	private String cardNm;
+	private String vaBank;
+	private String pgTradeNo;
+	private String payStat;
+	private String payStatNm;
+	private int payAmt;
+	private String vaDeadLine;
+	
+	private String delvFeeGb;
+	private String delvFeeGbNm;
+	private int delvFee;
+	private String delvUsacYn;
+	private String delvUsacDt;
+	private int delvFeeSq;
+	
+	private String coundelClsf;
+	private String relGoodsCd;
+	private String questTitle;
+	private String questDt;
+	private String ansDt;
+	private int andNo;
+	
+	private int ordChgSq;
+	private String chgGbNm;
+	private String chgStatNm;
+	private String chgReason;
+	private String chgReasonNm;
+	private String chgMemo;
+	private String chgerNm;
+	private String chgerPhnno;
+	private String chgerZipNo;
+	private String chgerBaseAddr;
+	private String chgerDtlAddr;
+	private String wdInvoiceNo;
+	
+	private String supplyCompNm;
+	private String brandKnm;
+	private String ordDtlStatNm;	
+	private String ordPhnno;
+	
+	private String custGrade;
+	private String custGradeNm;
+	private String custGb;
+	private String custGbNm;
+	private String managedRsn;
+	private String managedRsnNm;
+	
+	private int itemQty;
+	private int itemPrice;
+	private String itemNm;
+	private int gfcdUseAmt;
+	
+	// Pagination
+	private TscPageRequest pageable;
+	private int pageNo = 1;
+	private int pageSize = 50;
+	private int pageUnit = 10;
+	
+	// 주문문의 1:1 응답 칼럼
+	private String counselClsfNm;
+	private String ansNo;
+	private String ansNm;
+	private String regNm;
+	private String updNm;
+	
+	// 주문메모칼럼
+	private int orderMemoSq;
+	private String memo;
+	private String orgFileNm;
+	private String sysFileNm;
+	
+	// 사은품칼럼
+	private int ordFreegiftSq;
+	private int freegiftSq;
+	private String freegiftNm;
+	private int freegiftValSq;
+	private int usePoint;
+	private int seq;
+	private String userNm;
+	
+	// 환불계좌칼럼
+	private String raBank;
+	private String raBankNm;
+	private String raNo;
+	private String raNm;
+	private String defaultYn;
+	
+	// 주문상세변경내역칼럼
+	private String userId;
+	private String updId;
+	private String shipCompNm;
+	private String shipCompId;
+	
+	// 주문쿠폰
+	private int cpnSq;
+	private int cpnId;
+	private int cpnDcAmt;
+	private String cpnType;
+	private String targetCd1;
+	private String targetCd2;
+	private String cpnNm;
+	private String dcWay;
+	private int dcPval;
+	private int dcMval;
+	private int dcAval;
+	
+	// 주문포인트
+	private int pntPrate;
+	private int pntMrate;
+	private int pntAmt;
+	private String occurGb;
+	private String occurGbNm;
+	private String occurDtlDesc;
+	
+	// 주문상품권
+	private String gfcdNm;
+	private String gfcdNo;
+	private int gfcdAmt;
+	private int chgGfcdAmt;
+	private int usGfcdAmt;
+	private int rmGfcdAmt;
+	
+	// 다다익선
+	private int tmtbSq;
+	private String tmtbNm;
+	private int tmtbDcAmt;
+	
+	// 상태변경
+	private String g20;
+	private String g30;
+	private String g40;
+	private String g50;
+	private String g55;
+	private String g60;
+	
+	// 취소요청
+	private String cncWait;
+	private int ordReqChgQty;
+	private int itemReqChgQty;
+	private int itemOrdPrice;
+	private int minOrdAmt;
+	private int orgDelvFee;
+	private String delvFeeCd;
+	private int ordCanChgQty;
+	private String allCanYn;
+	
+	private String addDelvFeeYn;
+	private int addDelvFee;
+	private int ordDtlItemSq;
+	
+	private int paySq;
+	private int refundAmt;
+	private int rfCpn1Amt;
+	private int rfTmtb1Amt;
+	private int rfTmtb2Amt;
+	private int rfGoodsCpnAmt;
+	private int rfCartCpnAmt;
+	private int rfPntAmt;
+	private int rfPrePntAmt;
+	private int rfGfcdUseAmt;
+
+	private int pgCpnAmt;
+	private int npayPntAmt;
+	private String payGb;
+	private String pgGb;
+	private String pgTid;
+	private String cardType;
+	private String cardKind;
+	private String cardBank;
+	private String cardMips;
+	private String cardPcableYn;
+	private String vaNo;
+	private String vaNm;
+	private String vaDeadline;
+	private String telecom;
+
+	private String accountNo;
+	private String accountNm;
+	private String bankCd;
+	private String bankNm;
+
+	private int realDelvAmt;
+	private int delvCpnSq;
+	private int delvCpnDcAmt;
+
+	private int chgQty;
+	private int rtnDelvFee;
+	private int excDelvFee;
+
+	private String[] ordDtlStatArr;
+	
+	// 교환요청
+	private String ordChgOpt;
+	private String rtnLocZipcode;
+	private String rtnLocBaseAddr;
+	private String rtnLocDtlAddr;
+	private String rtnLocTelno;
+	private String rtnLocNm;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 369 - 79
src/main/java/com/style24/persistence/mybatis/shop/TsaCoupon.xml

@@ -5,67 +5,67 @@
 	<select id="getCouponList" parameterType="Coupon" resultType="Coupon">
 		/* TsaCoupon.getCouponList */
 		SELECT T.*
-		, COUNT(CUST_CPN_SQ) AS ISSUE_CNT
-		, COUNT(USED_DT) AS USE_CNT
-		FROM (
-		SELECT SITE_CD
-		, CPN_ID
-		, CPN_NM
-		, USABLE_CUST_GB
-		, CPN_TYPE
-		, DC_WAY
-		, DC_PVAL
-		, DC_MVAL
-		, MAX_DC_AMT
-		, PD_GB
-		, AVAIL_STDT
-		, AVAIL_EDDT
-		, FN_GET_USER_NM(REG_NO) AS REG_NM
-		, REG_DT
-		FROM TB_COUPON
-		WHERE 1=1
-		<if test="siteCd != null and siteCd != ''">
-			AND SITE_CD = #{siteCd}
-		</if>
-		<if test="cpnId != null and cpnId != ''">
-			AND CPN_ID = #{cpnId}
-		</if>
-		<if test="cpnType != null and cpnType != ''">
-			AND CPN_TYPE = #{cpnType}
-		</if>
-		<if test="regNo != null and regNo != ''">
-			AND REG_NO = #{regNo}
-		</if>
-		<if test="dcWay != null and dcWay != ''">
-			AND DC_WAY = #{dcWay}
-		</if>
-		<if test="cpnNm != null and cpnNm != ''">
-			AND CPN_NM LIKE LOWER('%' || #{cpnNm} || '%')
-		</if>
-		<if test="pdGb != null and pdGb != ''">
-			AND PD_GB = #{pdGb}
-		</if>
-		<if test="availStdt != null and availStdt != '' and availEddt != null and availEddt != ''">
-			AND AVAIL_STDT >= DATE_FORMAT(#{availStdt} , '%Y-%m-%d')
-			AND AVAIL_EDDT <![CDATA[ <= ]]> DATE_FORMAT(#{availEddt} , '%Y-%m-%d')
-		</if>
-		) T
+			 , COUNT(CUST_CPN_SQ) AS ISSUE_CNT
+			 , COUNT(USED_DT) AS USE_CNT
+		 FROM (
+				SELECT SITE_CD
+					 , CPN_ID
+					 , CPN_NM
+					 , USABLE_CUST_GB
+					 , CPN_TYPE
+					 , DC_WAY
+					 , DC_PVAL
+					 , DC_MVAL
+					 , MAX_DC_AMT
+					 , PD_GB
+					 , AVAIL_STDT
+					 , AVAIL_EDDT
+					 , FN_GET_USER_NM(REG_NO) AS REG_NM
+					 , REG_DT
+				  FROM TB_COUPON
+				 WHERE 1=1
+				<if test="siteCd != null and siteCd != ''">
+				   AND SITE_CD = #{siteCd}
+				</if>
+				<if test="cpnId != null and cpnId != ''">
+				   AND CPN_ID = #{cpnId}
+				</if>
+				<if test="cpnType != null and cpnType != ''">
+				   AND CPN_TYPE = #{cpnType}
+				</if>
+				<if test="regNo != null and regNo != ''">
+				   AND REG_NO = #{regNo}
+				</if>
+				<if test="dcWay != null and dcWay != ''">
+				   AND DC_WAY = #{dcWay}
+				</if>
+				<if test="cpnNm != null and cpnNm != ''">
+				   AND CPN_NM LIKE LOWER('%' || #{cpnNm} || '%')
+				</if>
+				<if test="pdGb != null and pdGb != ''">
+				   AND PD_GB = #{pdGb}
+				</if>
+				<if test="availStdt != null and availStdt != '' and availEddt != null and availEddt != ''">
+				   AND AVAIL_STDT >= DATE_FORMAT(#{availStdt} , '%Y-%m-%d')
+				   AND AVAIL_EDDT <![CDATA[ <= ]]> DATE_FORMAT(#{availEddt} , '%Y-%m-%d')
+				</if>
+			) T
 		LEFT OUTER JOIN TB_CUST_COUPON CC
-		ON T.CPN_ID = CC.CPN_ID
+		             ON T.CPN_ID = CC.CPN_ID
 		GROUP BY  T.SITE_CD
-		, T.CPN_ID
-		, T.CPN_NM
-		, T.USABLE_CUST_GB
-		, T.CPN_TYPE
-		, T.DC_WAY
-		, T.DC_PVAL
-		, T.DC_MVAL
-		, T.MAX_DC_AMT
-		, T.PD_GB
-		, T.AVAIL_STDT
-		, T.AVAIL_EDDT
-		, T.REG_NM
-		, T.REG_DT
+				, T.CPN_ID
+				, T.CPN_NM
+				, T.USABLE_CUST_GB
+				, T.CPN_TYPE
+				, T.DC_WAY
+				, T.DC_PVAL
+				, T.DC_MVAL
+				, T.MAX_DC_AMT
+				, T.PD_GB
+				, T.AVAIL_STDT
+				, T.AVAIL_EDDT
+				, T.REG_NM
+				, T.REG_DT
 		ORDER BY  T.REG_DT DESC
 	</select>
 
@@ -73,32 +73,32 @@
 	<select id="getCouponListCnt" parameterType="Coupon" resultType="int">
 		/* TsaCoupon.getCouponListCnt */
 		SELECT COUNT(1)
-		FROM TB_COUPON
-		WHERE 1=1
+		  FROM TB_COUPON
+		 WHERE 1=1
 		<if test="siteCd != null and siteCd != ''">
-			AND SITE_CD = #{siteCd}
+		   AND SITE_CD = #{siteCd}
 		</if>
 		<if test="cpnId != null and cpnId != ''">
-			AND CPN_ID = #{cpnId}
+		   AND CPN_ID = #{cpnId}
 		</if>
 		<if test="cpnType != null and cpnType != ''">
-			AND CPN_TYPE = #{cpnType}
+		   AND CPN_TYPE = #{cpnType}
 		</if>
 		<if test="regNo != null and regNo != ''">
-			AND REG_NO = #{regNo}
+		   AND REG_NO = #{regNo}
 		</if>
 		<if test="dcWay != null and dcWay != ''">
-			AND DC_WAY = #{dcWay}
+		   AND DC_WAY = #{dcWay}
 		</if>
 		<if test="cpnNm != null and cpnNm != ''">
-			AND CPN_NM LIKE LOWER('%' || #{cpnNm} || '%')
+		   AND CPN_NM LIKE LOWER('%' || #{cpnNm} || '%')
 		</if>
 		<if test="pdGb != null and pdGb != ''">
-			AND PD_GB = #{pdGb}
+		   AND PD_GB = #{pdGb}
 		</if>
 		<if test="availStdt != null and availStdt != '' and availEddt != null and availEddt != ''">
-			AND AVAIL_STDT >= DATE_FORMAT(#{availStdt} , '%Y-%m-%d')
-			AND AVAIL_EDDT <![CDATA[ <= ]]> DATE_FORMAT(#{availEddt} , '%Y-%m-%d')
+		   AND AVAIL_STDT >= DATE_FORMAT(#{availStdt} , '%Y-%m-%d')
+		   AND AVAIL_EDDT <![CDATA[ <= ]]> DATE_FORMAT(#{availEddt} , '%Y-%m-%d')
 		</if>
 	</select>
 
@@ -109,9 +109,7 @@
 			CPN_ID
 		  , CPN_NM
 		  , SITE_CD
-		  <if test='afLinkCd != null and afLinkCd != ""'>
 		  , AF_LINK_CD
-	      </if>
 		  , USABLE_CUST_GB
 		  , USABLE_CUST_GRADE
 		  , CPN_TYPE
@@ -134,10 +132,8 @@
 		  , TOT_PUB_LIMIT_QTY
 		  , ONE_PUB_QTY
 		  , DN_GB
-		  <if test='dnGb != null and dnGb == "G058_20"'>
 		  , DOWN_STDT
 		  , DOWN_EDDT
-		  </if>
 		  , BUY_LIMIT_AMT
 		  , PLAN_SQ
 		  , REISSUANCE
@@ -165,9 +161,7 @@
 		    #{cpnId}
 		  , #{cpnNm}
 		  , #{siteCd}
-		  <if test='afLinkCd != null and afLinkCd != ""'>
 		  , #{afLinkCd}
-		  </if>
 		  , #{usableCustGb}
 		  , #{usableCustGrade}
 		  , #{cpnType}
@@ -190,10 +184,8 @@
 		  , #{totPubLimitQty}
 		  , #{onePubQty}
 		  , #{dnGb}
-		  <if test='dnGb != null and dnGb == "G058_20"'>
 		  , DATE_FORMAT(#{downStdt} , '%Y-%m-%d %H:%i:%s')
 		  , DATE_FORMAT(#{downEddt} , '%Y-%m-%d %H:%i:%s')
-		  </if>
 		  , #{buyLimitAmt}
 		  , #{planSq}
 		  , #{reissuance}
@@ -217,7 +209,43 @@
 		  , #{payType}
 		  </if>
 		  , #{custJoinYn}
-		)
+		) ON DUPLICATE KEY UPDATE
+			CPN_NM = #{cpnNm}
+		  , SITE_CD = #{siteCd}
+		  , AF_LINK_CD = #{afLinkCd}
+		  , USABLE_CUST_GB = #{usableCustGb}
+		  , USABLE_CUST_GRADE = #{usableCustGrade}
+		  , CPN_TYPE = #{cpnType}
+		  , APPLY_SCOPE = #{applyScope}
+		  , DC_WAY = #{dcWay}
+		  , DC_PVAL = #{dcPval}
+		  , DC_MVAL = #{dcMval}
+		  , DC_AVAL = #{dcAval}
+		  , MAX_DC_AMT = #{maxDcAmt}
+		  , PD_GB = #{pdGb}
+		  , AVAIL_STDT = #{availStdt}
+		  , AVAIL_EDDT = #{availEddt}
+		  , AVAIL_DAYS = #{availDays}
+		  , CUST_PUB_LIMIT_QTY = #{custPubLimitQty}
+		  , TOT_PUB_LIMIT_QTY = #{totPubLimitQty}
+		  , ONE_PUB_QTY = #{onePubQty}
+		  , DOWN_STDT = #{downStdt}
+		  , DOWN_EDDT = #{downEddt}
+		  , BUY_LIMIT_AMT = #{buyLimitAmt}
+		  , PLAN_SQ = #{planSq}
+		  , REISSUANCE = #{reissuance}
+		  , CPN_STAT = #{cpnStat}
+		  , END_ALIM_YN = #{endAlimYn}
+		  , UPD_NO = #{updNo}
+		  , UPD_DT = now()
+		  , FIRST_YN = #{firstYn}
+		  , DOWN_YN = #{downYn}
+		  , CUST_JOIN_STDT = #{custJoinStdt}
+		  , CUST_JOIN_EDDT = #{custJoinEddt}
+		  , BUY_STDT = #{buyStdt}
+		  , BUY_EDDT = #{buyEddt}
+		  , PAY_TYPE = #{payType}
+		  , CUST_JOIN_YN = #{custJoinYn}
 	</insert>
 
 	<!-- 쿠폰조회 목록 -->
@@ -254,4 +282,266 @@
 		</if>
 	</select>
 
+	<!-- 쿠폰 적용대상 등록 -->
+	<insert id="saveCouponRefVal" parameterType="Coupon">
+		/* TsaCoupon.saveCouponRefVal */
+		INSERT INTO TB_COUPON_REFVAL (
+		    CPN_ID
+		  <if test='cpnRefvalSq != null and cpnRefvalSq > 0'>
+		  , CPN_REFVAL_SQ
+		  </if>
+		  , CPN_TYPE
+		  , CPN_TARGET
+		  , REF_VAL
+		  <if test='refFormalGb != null and refFormalGb != ""'>
+		  , REF_FORMAL_GB
+		  </if>
+		  <if test='refBrandCd != null and refBrandCd != ""'>
+		  , REF_BRAND_CD
+		  </if>
+		  , REG_NO
+		  , REG_DT
+		  , UPD_NO
+		  , UPD_DT
+		)
+		SELECT CPN_ID
+		     <if test="cpnRefvalSq != null and cpnRefvalSq > 0">
+			 , #{cpnRefvalSq}
+			 </if>
+			 , CPN_TYPE
+			 , #{cpnTarget}
+			 , #{refVal}
+			 <if test='refFormalGb != null and refFormalGb != ""'>
+			 , #{refFormalGb}
+			 </if>
+			 <if test='refBrandCd != null and refBrandCd != ""'>
+			 , #{refBrandCd}
+			 </if>
+			 , REG_NO
+			 , now()
+			 , UPD_NO
+			 , now()
+		  FROM TB_COUPON
+		 WHERE CPN_ID = #{cpnId}
+		    ON DUPLICATE KEY UPDATE
+			REF_VAL = #{refVal}
+		  , REF_FORMAL_GB = #{refFormalGb}
+		  , REF_BRAND_CD = #{refBrandCd}
+		  , UPD_NO = #{updNo}
+		  , UPD_DT = now()
+	</insert>
+
+	<!-- 쿠폰 입점업체 분담율 등록 -->
+	<insert id="saveCouponBurden" parameterType="CouponBurden">
+		/* TsaCoupon.saveCouponBurden */
+		INSERT INTO TB_COUPON_BURDEN(
+		    CPN_ID
+		  , SUPPLY_COMP_CD
+		  , BURDEN_RATE
+		  , REG_NO
+		  , REG_DT
+		  , UPD_NO
+		  , UPD_DT
+		)
+		SELECT CPN_ID
+			 , #{supplyCompCd}
+			 , #{burdenRate}
+			 , REG_NO
+			 , now()
+			 , UPD_NO
+			 , now()
+		  FROM TB_COUPON
+		 WHERE CPN_ID = #{cpnId}
+			ON DUPLICATE KEY UPDATE
+			   BURDEN_RATE = #{burdenRate}
+			 , UPD_NO = #{updNo}
+			 , UPD_DT = now()
+	</insert>
+
+	<!-- 자사브랜드 조회-->
+	<select id="getSelfBrandList" resultType="CommonCode">
+		/* TsaCoupon.getSelfBrandList */
+		SELECT BRAND_CD  AS CD
+		     , BRAND_ENM AS CD_NM
+		  FROM TB_BRAND
+		 WHERE 1 = 1
+		   AND USE_YN = 'Y'
+		   AND SELF_YN = 'Y'
+		ORDER  BY SUPPLY_COMP_CD, DISP_ORD
+	</select>
+
+	<!-- 쿠폰 상세 조회-->
+	<select id="getCouponDetail" parameterType="String" resultType="Coupon">
+		/* TsaCoupon.getCouponDetail */
+		SELECT CPN_ID
+			 , CPN_NM
+			 , SITE_CD
+			 , AF_LINK_CD
+			 , USABLE_CUST_GB
+			 , USABLE_CUST_GRADE
+			 , CPN_TYPE
+			 , APPLY_SCOPE
+			 , DC_WAY
+			 , DC_PVAL
+			 , DC_MVAL
+			 , DC_AVAL
+			 , MAX_DC_AMT
+			 , PD_GB
+			 , AVAIL_STDT
+			 , AVAIL_EDDT
+			 , AVAIL_DAYS
+			 , CUST_PUB_LIMIT_QTY
+			 , TOT_PUB_LIMIT_QTY
+			 , ONE_PUB_QTY
+			 , DN_GB
+			 , DOWN_STDT
+			 , DOWN_EDDT
+			 , BUY_LIMIT_AMT
+			 , PLAN_SQ
+			 , REISSUANCE
+			 , CPN_STAT
+			 , END_ALIM_YN
+			 , FIRST_YN
+			 , DOWN_YN
+			 , CUST_JOIN_STDT
+			 , CUST_JOIN_EDDT
+			 , BUY_STDT
+			 , BUY_EDDT
+			 , PAY_TYPE
+			 , CUST_JOIN_YN
+			 , (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>
+
+	<!-- 쿠폰 발급 개수 조회 -->
+	<select id="getCouponIssueCnt" parameterType="String" resultType="int">
+		/* TsaCoupon.getCouponIssueCnt*/
+		SELECT COUNT(1)
+		  FROM TB_CUST_COUPON
+		 WHERE CPN_ID = #{cpnId}
+	</select>
+
+	<!-- 쿠폰 적용대상 조회 - 제외/적용 상품 -->
+	<select id="getCouponRefvalGoodsList" parameterType="CouponRefval" resultType="CouponRefval">
+		/* TsaCoupon.getCouponRefvalGoodsList */
+		SELECT FN_GET_CODE_NM('G073',B.GOODS_GB) AS GOODS_GB
+			 , B.GOODS_CD
+			 , B.GOODS_NM
+			 , C.BRAND_ENM
+			 , A.CPN_REFVAL_SQ
+		  FROM TB_COUPON_REFVAL A
+		 INNER JOIN TB_GOODS B ON A.REF_VAL = B.GOODS_CD
+		 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="CouponRefval" resultType="CouponRefval">
+		/* TsaCoupon.getCouponRefvalExceptGoodsList */
+		SELECT B.BRAND_CD
+			 , B.BRAND_ENM
+		     , C.SUPPLY_COMP_NM
+			 , A.CPN_REFVAL_SQ
+		  FROM TB_COUPON_REFVAL A
+		 INNER JOIN TB_BRAND B ON A.REF_VAL = B.BRAND_CD
+		 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="CouponRefval" resultType="CouponRefval">
+		/* TsaCoupon.getCouponRefvalCategoryList */
+		SELECT B.CATE_GB
+			 , A.REF_VAL AS CATE_NO
+			 , B.FULL_CATE_NM 					AS CATE_NM
+			 , B.SITE_CD
+			 , A.REF_FORMAL_GB					AS FORMAL_GB
+		     , A.REF_BRAND_CD					AS BRAND_CD
+			 , A.CPN_REFVAL_SQ
+		  FROM TB_COUPON_REFVAL A
+		 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="CouponRefval" resultType="CouponRefval">
+		/* TsaCoupon.getCouponRefvalSupplyCompList */
+		SELECT B.SUPPLY_COMP_CD
+			 , B.SUPPLY_COMP_NM
+			 , A.CPN_REFVAL_SQ
+		  FROM TB_COUPON_REFVAL A
+		 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="CouponBurden">
+		/* TsaCoupon.getCouponBurdenList */
+		SELECT SUPPLY_COMP_CD
+			 , BURDEN_RATE
+			 , DEL_YN
+			 , CPN_ID
+		  FROM TB_COUPON_BURDEN
+		 WHERE CPN_ID = #{value}
+	</select>
+
+	<!-- 쿠폰 적용대상 수정-->
+	<update id="updateCouponRefval" parameterType="CouponRefval" >
+		/* TsaCoupon.updateCouponRefval */
+		UPDATE TB_COUPON_REFVAL
+		   SET DEL_YN = 'Y'
+			 , UPD_NO = #{updNo}
+			 , UPD_DT = now()
+		 WHERE CPN_ID = #{cpnId}
+		   AND CPN_REFVAL_SQ IN
+		  <foreach collection="cpnRefvalSqArr" item="item" open="(" separator="," close=")">
+			#{item}
+		  </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>
 
 	<!-- 회원기본정보 -->

+ 0 - 1
src/main/java/com/style24/persistence/mybatis/shop/TsaDelivery.xml

@@ -400,5 +400,4 @@
 		/* TsaDelivery.getDeliveryWithdrawDirectiveList */
 		SELECT '1' FROM DUAL
 	</select>
-	
 </mapper>

+ 379 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsaFreegiftPromotion.xml

@@ -0,0 +1,379 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.style24.admin.biz.dao.TsaFreegiftPromotionDao">
+	<!-- 사은품 프로모션 리스트 조회 -->
+	<select id="getFreeGoodsPromotionList" parameterType="FreeGoodsPromotion" resultType="FreeGoodsPromotion">
+		/* TsaMarketing.getFreeGoodsPromotionList :  사은품 프로모션 리스트 조회 */
+		SELECT FG.FREEGIFT_SQ
+			 , FG.FREEGIFT_NM
+			 , FG.FREEGIFT_STAT
+		     , (SELECT CD_NM FROM TB_COMMON_CODE WHERE CD = FG.FREEGIFT_STAT) AS FREEGIFT_STAT_NM
+		     , FG.SELF_YN
+			 , DATE_FORMAT(FG.FREEGIFT_STDT, '%Y.%m.%d') AS FREEGIFT_STDT
+			 , DATE_FORMAT(FG.FREEGIFT_EDDT, '%Y.%m.%d') AS FREEGIFT_EDDT
+			 , (SELECT USER_NM FROM TB_USER WHERE USER_NO = FG.REG_NO) AS REG_NM
+			 , DATE_FORMAT(FG.REG_DT, '%Y.%m.%d %H:%i:%S') AS REG_DT
+			 , (SELECT USER_NM FROM TB_USER WHERE USER_NO = FG.UPD_NO) AS UPD_NM
+			 , DATE_FORMAT(FG.UPD_DT, '%Y.%m.%d %H:%i:%S') AS UPD_DT
+		  FROM TB_FREEGIFT FG
+		 WHERE 1=1
+		   AND DEL_YN = 'N'
+		<if test="searchTxt != null and searchTxt != ''">
+			<if test="promotionGubun != null and promotionGubun == 'freegiftSq'">
+		   AND FG.FREEGIFT_SQ = #{searchTxt}
+			</if>
+			<if test="promotionGubun != null and promotionGubun == 'freegiftNm'">
+		   AND FG.FREEGIFT_NM = #{searchTxt}
+			</if>
+		</if>
+		/* 프로모션ID로 검색하면 기간보다 우선하여 검색한다 */
+		<if test="searchTxt == '' or promotionGubun != 'freegiftSq'">
+			<if test="stDate != null and stDate != ''">
+				<if test="edDate != null and edDate != ''">
+			   AND FREEGIFT_STDT BETWEEN STR_TO_DATE(#{stDate},'%Y-%m-%d%H%i%S') AND STR_TO_DATE(CONCAT(#{edDate}, '235959'),'%Y-%m-%d%H%i%S')
+			   AND FREEGIFT_EDDT BETWEEN STR_TO_DATE(#{stDate},'%Y-%m-%d%H%i%S') AND STR_TO_DATE(CONCAT(#{edDate}, '235959'),'%Y-%m-%d%H%i%S')
+				</if>
+			</if>
+		</if>
+		<if test="freegiftSq != null and freegiftSq != ''">
+		   AND FG.FREEGIFT_SQ = #{freegiftSq}
+		</if>
+		 ORDER BY REG_DT DESC
+	</select>
+
+	<!-- 사은품 프로모션 제휴몰 리스트 조회 -->
+	<select id="getFreegiftExtmallList" parameterType="FreeGoodsPromotion" resultType="Extmall">
+		/* TsaMarketing.getFreegiftExtmallList : 사은품 프로모션 제휴몰 리스트 조회 */
+		SELECT FE.FREEGIFT_EXTMALL_SQ
+		     , FE.FREEGIFT_SQ
+		     , FE.EXTMALL_ID
+		     , FE.VENDOR_ID
+		     , (SELECT EXTMALL_NM FROM TB_EXTMALL WHERE EXTMALL_ID = FE.EXTMALL_ID AND VENDOR_ID = FE.VENDOR_ID) AS EXTMALL_NM
+		     , FE.DEL_YN
+		     , (SELECT USER_NM FROM TB_USER WHERE USER_NO = FE.REG_NO) AS REG_NM
+			 , DATE_FORMAT(FE.REG_DT, '%Y.%m.%d %H:%i:%S') AS REG_DT
+		     , (SELECT USER_NM FROM TB_USER WHERE USER_NO = FE.UPD_NO) AS UPD_NM
+		     , DATE_FORMAT(FE.UPD_DT, '%Y.%m.%d %H:%i:%S') AS UPD_DT
+		  FROM TB_FREEGIFT_EXTMALL FE
+		 WHERE 1=1
+		   AND DEL_YN = 'N'
+		<if test="freegiftSq != null and freegiftSq != ''">
+		   AND FE.FREEGIFT_SQ = #{freegiftSq}
+		</if>
+		ORDER BY EXTMALL_ID ASC
+	</select>
+
+	<!-- 사은품 프로모션 공급업체 리스트 조회 -->
+	<select id="getFreegiftSupplyCompList" parameterType="FreeGoodsPromotion" resultType="FreeGoodsPromotion">
+		/* TsaMarketing.getFreegiftSupplyCompList : 사은품 프로모션 공급업체 리스트 조회 */
+		SELECT FG.FREEGIFT_GOODS_SQ
+		     , FG.FREEGIFT_SQ
+		     , FG.GOODS_GB
+		     , FG.TARGET_GB
+		     , FG.TARGET_VAL
+		     , SC.SUPPLY_COMP_CD
+		     , SC.SUPPLY_COMP_NM
+			 , (SELECT USER_NM FROM TB_USER WHERE USER_NO = FG.REG_NO) AS REG_NM
+			 , DATE_FORMAT(FG.REG_DT, '%Y.%m.%d %H:%i:%S') AS REG_DT
+			 , (SELECT USER_NM FROM TB_USER WHERE USER_NO = FG.UPD_NO) AS UPD_NM
+			 , DATE_FORMAT(FG.UPD_DT, '%Y.%m.%d %H:%i:%S') AS UPD_DT
+		  FROM TB_FREEGIFT_GOODS FG
+		 INNER JOIN TB_SUPPLY_COMPANY SC
+		    ON SC.SUPPLY_COMP_CD = FG.TARGET_VAL
+		 WHERE 1=1
+		   AND DEL_YN = 'N'
+		   AND FG.GOODS_GB = 'G800_20'			/* G800_10|기본상품, G800_20|적용상품, G800_30|제외상품, G800_40|ALL */
+		   AND FG.TARGET_GB = 'G260_13'			/* G260_10|상품, G260_12|브랜드, G260_13|공급처 */
+		   AND FG.FREEGIFT_SQ =	#{freegiftSq}		/* 사은품 프로모션 번호 */
+		ORDER BY TARGET_VAL ASC
+	</select>
+
+	<!-- 사은품 프로모션 브랜드 리스트 조회 -->
+	<select id="getFreegiftBrandList" parameterType="FreeGoodsPromotion" resultType="FreeGoodsPromotion">
+		/* TsaMarketing.getFreegiftBrandList : 사은품 프로모션 브랜드 리스트 조회 */
+		SELECT FG.FREEGIFT_GOODS_SQ
+			 , FG.FREEGIFT_SQ
+			 , FG.GOODS_GB
+			 , FG.TARGET_GB
+			 , FG.TARGET_VAL
+		     , B.BRAND_CD
+		     , B.BRAND_KNM
+		     , B.BRAND_ENM
+			 , (SELECT USER_NM FROM TB_USER WHERE USER_NO = FG.REG_NO) AS REG_NM
+			 , DATE_FORMAT(FG.REG_DT, '%Y.%m.%d %H:%i:%S') AS REG_DT
+			 , (SELECT USER_NM FROM TB_USER WHERE USER_NO = FG.UPD_NO) AS UPD_NM
+			 , DATE_FORMAT(FG.UPD_DT, '%Y.%m.%d %H:%i:%S') AS UPD_DT
+		 FROM TB_FREEGIFT_GOODS FG
+	    INNER JOIN TB_BRAND B
+		   ON B.BRAND_CD = FG.TARGET_VAL
+	    WHERE 1=1
+		  AND DEL_YN = 'N'
+		  AND FG.GOODS_GB =	'G800_20'			/* G800_10|기본상품, G800_20|적용상품, G800_30|제외상품, G800_40|ALL */
+		  AND FG.TARGET_GB = 'G260_12'			/* G260_10|상품, G260_12|브랜드, G260_13|공급처 */
+		  AND FG.FREEGIFT_SQ =	#{freegiftSq}	/* 사은품 프로모션 번호 */
+	    ORDER BY TARGET_VAL ASC
+	</select>
+
+	<!-- 사은품 프로모션 상품 리스트 조회 -->
+	<select id="getFreegiftGoodsList" parameterType="FreeGoodsPromotion" resultType="FreeGoodsPromotion">
+		/* TsaMarketing.getFreegiftApplyGoodsList : 사은품 프로모션 적용 상품 리스트 조회 */
+		SELECT FG.FREEGIFT_GOODS_SQ
+			 , FG.FREEGIFT_SQ
+			 , FG.GOODS_GB
+			 , FG.TARGET_GB
+			 , FG.TARGET_VAL
+			 , G.GOODS_CD
+		     , (SELECT BRAND_ENM FROM TB_BRAND WHERE BRAND_CD = G.BRAND_CD) AS BRAND_ENM
+		     , G.BRAND_CD
+		     , G.GOODS_NM
+		     , G.GOODS_STAT
+		     , G.LIST_PRICE
+		     , G.CURR_PRICE
+			 , (SELECT USER_NM FROM TB_USER WHERE USER_NO = FG.REG_NO) AS REG_NM
+			 , DATE_FORMAT(FG.REG_DT, '%Y.%m.%d %H:%i:%S') AS REG_DT
+			 , (SELECT USER_NM FROM TB_USER WHERE USER_NO = FG.UPD_NO) AS UPD_NM
+			 , DATE_FORMAT(FG.UPD_DT, '%Y.%m.%d %H:%i:%S') AS UPD_DT
+		FROM TB_FREEGIFT_GOODS FG
+		INNER JOIN TB_GOODS G
+		ON G.GOODS_CD = FG.TARGET_VAL
+		WHERE DEL_YN = 'N'
+		AND FG.TARGET_GB = 'G260_10'		/* G260_10|상품, G260_12|브랜드, G260_13|공급처 */
+		AND FG.GOODS_GB = #{goodsGb}		/* G800_10|기본상품, G800_20|적용상품, G800_30|제외상품, G800_40|ALL */
+		AND FG.FREEGIFT_SQ = #{freegiftSq}	/* 사은품 프로모션 번호 */
+		ORDER BY TARGET_VAL ASC
+	</select>
+
+	<!-- 사은품 프로모션 섹션정보 리스트 조회 -->
+	<select id="getFreegiftSectionList" parameterType="FreeGoodsPromotion" resultType="FreeGoodsPromotion">
+		/* TsaMarketing.getFreegiftSectionList : 사은품 프로모션 섹션정보 리스트 조회 */
+		SELECT FC.FREEGIFT_SECTION_SQ
+		     , FC.SECTION_GB
+		     , FC.SECTION_VAL
+		FROM   TB_FREEGIFT_SECTION FC
+		WHERE  FC.DEL_YN = 'N'
+		AND    FC.FREEGIFT_SQ = #{freegiftSq}	/* 사은품 프로모션 번호 */
+		ORDER BY FC.FREEGIFT_SECTION_SQ ASC
+	</select>
+
+	<!-- 사은품 프로모션 섹션정보 리스트 조회 -->
+	<select id="getFreegiftFreegoodsList" parameterType="FreeGoodsPromotion" resultType="FreeGoodsSectionVal">
+		/* TsaMarketing.getFreegiftFreegoodsList : 사은품 프로모션 등록 사은품 리스트 조회 */
+		SELECT FV.FREEGIFT_SECTION_SQ
+		     , FV.USE_POINT
+		     , FV.ITEM_QTY
+		     , FV.LIMIT_QTY
+		     , FV.ITEM_CD
+			 , FG.PRODUCT_NO
+			 , FG.GOODS_NM
+		FROM TB_FREEGIFT_VAL FV
+		INNER JOIN TB_FREE_GOODS FG
+		ON FV.ITEM_CD = FG.PRODUCT_NO
+		WHERE FV.DEL_YN = 'N'
+		AND FV.FREEGIFT_SQ = #{freegiftSq}					/* 사은품 프로모션 번호 */
+		AND FV.FREEGIFT_SECTION_SQ = #{freegiftSectionSq}	/* 사은품 프로모션 섹션 번호 */
+		ORDER BY FV.FREEGIFT_SECTION_SQ, FV.ITEM_CD
+	</select>
+
+	<!-- 사은품 프로모션 마스터 정보 저장 -->
+	<insert id="createFreegoodsPromotionInfo" parameterType="FreeGoodsPromotion">
+		/* TsaMarketing.createFreegoodsPromotionInfo : 사은품 프로모션 마스터 정보 저장 */
+		<selectKey keyProperty="freegiftSq" resultType="int" order="AFTER">
+			SELECT LAST_INSERT_ID()
+		</selectKey>
+		INSERT INTO TB_FREEGIFT (
+			  FREEGIFT_NM
+			, FREEGIFT_STAT
+			, FREEGIFT_STDT
+			, FREEGIFT_EDDT
+			, SELF_YN
+			, ALL_YN
+			, REG_NO
+			, REG_DT
+			, UPD_NO
+			, UPD_DT
+		) VALUES (
+			  #{freegiftNm}
+			, #{freegiftStat}
+			, STR_TO_DATE(#{freegiftStdt},'%Y%m%d%H%i%S')
+			, STR_TO_DATE(CONCAT(#{freegiftEddt}, '235959'),'%Y%m%d%H%i%S')
+			, #{selfYn}
+			, #{allYn}
+			, #{regNo}
+			, CURRENT_TIMESTAMP
+			, #{updNo}
+			, CURRENT_TIMESTAMP
+		)
+	</insert>
+
+	<!-- 사은품 프로모션 제휴몰 정보 저장 -->
+	<insert id="createFreegiftExtmallInfo" parameterType="FreeGoodsPromotion">
+		/* TsaMarketing.createFreegiftExtmallInfo : 사은품 프로모션 제휴몰 정보 저장 */
+		INSERT INTO TB_FREEGIFT_EXTMALL (
+			  FREEGIFT_SQ
+			, EXTMALL_ID
+			, VENDOR_ID
+			, REG_NO
+			, REG_DT
+			, UPD_NO
+			, UPD_DT
+		) VALUES (
+			  #{freegiftSq}
+			, #{extmallId}
+			, #{vendorId}
+			, #{regNo}
+			, CURRENT_TIMESTAMP
+			, #{updNo}
+			, CURRENT_TIMESTAMP
+		)
+	</insert>
+
+	<!-- 사은품 프로모션 대상 정보 저장 -->
+	<insert id="createFreegiftGoodsInfo" parameterType="FreeGoodsPromotion">
+		/* TsaMarketing.createFreegiftGoodsInfo : 사은품 프로모션 대상 정보 저장 */
+		INSERT INTO TB_FREEGIFT_GOODS (
+			  FREEGIFT_SQ
+			, GOODS_GB
+			, TARGET_GB
+			, TARGET_VAL
+			, REG_NO
+			, REG_DT
+			, UPD_NO
+			, UPD_DT
+		) VALUES (
+			  #{freegiftSq}
+			, #{goodsGb}
+			, #{targetGb}
+			, #{targetVal}
+			, #{regNo}
+			, CURRENT_TIMESTAMP
+			, #{updNo}
+			, CURRENT_TIMESTAMP
+		 )
+	</insert>
+
+	<!-- 사은품 지급 조건 -->
+	<insert id="createFreegiftSectionInfo" parameterType="FreeGoodsPromotion">
+		/* TsaMarketing.createFreegiftSectionInfo : 사은품 지급 조건 저장 */
+		<selectKey keyProperty="freegiftSectionSq" resultType="int" order="AFTER">
+			SELECT LAST_INSERT_ID()
+		</selectKey>
+		INSERT INTO TB_FREEGIFT_SECTION (
+			  FREEGIFT_SQ
+			, SECTION_GB
+			, SECTION_VAL
+			, REG_NO
+			, REG_DT
+			, UPD_NO
+			, UPD_DT
+		) VALUES (
+			  #{freegiftSq}
+			, #{sectionGb}
+			, #{sectionVal}
+			, #{regNo}
+			, CURRENT_TIMESTAMP
+			, #{updNo}
+			, CURRENT_TIMESTAMP
+		)
+	</insert>
+
+	<!-- 사은품 프로모션 지급 사은품 저장 -->
+	<insert id="createPromotionFreeGoodsInfo" parameterType="FreeGoodsPromotion">
+		/* TsaMarketing.createPromotionFreeGoodsInfo : 사은품 프로모션 지급 사은품 저장 */
+		INSERT INTO TB_FREEGIFT_VAL (
+			  FREEGIFT_SQ
+			, FREEGIFT_SECTION_SQ
+			, USE_POINT
+			, ITEM_QTY
+			, ITEM_CD
+			, LIMIT_QTY
+			, LEFT_QTY
+			, REG_NO
+			, REG_DT
+			, UPD_NO
+			, UPD_DT
+		) VALUES (
+			  #{freegiftSq}
+			, #{freegiftSectionSq}
+			, #{usePoint}
+			, #{itemQty}
+			, #{itemCd}
+			, #{limitQty}
+			, #{leftQty}
+			, #{regNo}
+			, CURRENT_TIMESTAMP
+			, #{updNo}
+			, CURRENT_TIMESTAMP
+		)
+	</insert>
+
+	<!-- 사은품 프로모션 마스터 정보 수정 -->
+	<update id="updateFreegoodsPromotionInfo" parameterType="FreeGoodsPromotion">
+		/* TsaMarketing.updateFreegoodsPromotionInfo : 사은품 프로모션 마스터 정보 수정 */
+		UPDATE TB_FREEGIFT
+        SET FREEGIFT_STDT = STR_TO_DATE(#{freegiftStdt},'%Y%m%d%H%i%S')
+          , FREEGIFT_EDDT = STR_TO_DATE(CONCAT(#{freegiftEddt}, '235959'),'%Y%m%d%H%i%S')
+          , FREEGIFT_NM = #{freegiftNm}
+		  , SELF_YN = #{selfYn}
+		  , ALL_YN = #{allYn}
+		  , UPD_NO = #{updNo}
+		  , UPD_DT = CURRENT_TIMESTAMP
+		WHERE FREEGIFT_SQ = #{freegiftSq}
+	</update>
+
+	<!-- 사은품 프로모션 제휴몰 정보 삭제  -->
+	<update id="deleteFreegiftExtmallInfo" parameterType="FreeGoodsPromotion">
+		/* TsaMarketing.deleteFreegiftExtmallInfo : 사은품 프로모션 제휴몰 정보 삭제 */
+		UPDATE TB_FREEGIFT_EXTMALL SET
+			  DEL_YN = 'Y'
+			, UPD_NO = #{updNo}
+			, UPD_DT = CURRENT_TIMESTAMP
+		WHERE FREEGIFT_SQ = #{freegiftSq}
+		  AND DEL_YN = 'N'
+	</update>
+
+	<!-- 사은품 적용 업체/브랜드/상품 제외상품 정보 삭제  -->
+	<delete id="deleteFreegiftGoodsInfo" parameterType="FreeGoodsPromotion">
+		/* TsaMarketing.deleteFreegiftSupplyCompInfo : 사은품 적용 업체/브랜드/상품 제외상품 정보 삭제 */
+		UPDATE TB_FREEGIFT_GOODS SET
+			 DEL_YN = 'Y'
+		   , UPD_NO = #{updNo}
+		   , UPD_DT = CURRENT_TIMESTAMP
+		WHERE FREEGIFT_SQ = #{freegiftSq}
+		  AND DEL_YN = 'N'
+	</delete>
+
+	<!-- 사은품 적용 조건 정보 삭제  -->
+	<delete id="deleteFreegiftSectionInfo" parameterType="FreeGoodsPromotion">
+		/* TsaMarketing.deleteFreegiftSectionInfo : 사은품 적용 조건 정보 삭제 */
+		UPDATE TB_FREEGIFT_SECTION SET
+			DEL_YN = 'Y'
+		  , UPD_NO = #{updNo}
+		  , UPD_DT = CURRENT_TIMESTAMP
+		WHERE FREEGIFT_SQ = #{freegiftSq}
+		  AND DEL_YN = 'N'
+	</delete>
+
+	<!-- 사은품 프로모션 지급 사은품 정보 삭제 -->
+	<delete id="deleteFreegiftValInfo" parameterType="FreeGoodsPromotion">
+		/* TsaMarketing.deleteFreegiftValInfo : 사은품 프로모션 지급 사은품 정보 삭제 */
+		UPDATE TB_FREEGIFT_VAL SET
+			DEL_YN = 'Y'
+		  , UPD_NO = #{updNo}
+		  , UPD_DT = CURRENT_TIMESTAMP
+		WHERE FREEGIFT_SQ = #{freegiftSq}
+		  AND DEL_YN = 'N'
+	</delete>
+
+	<!-- 사은품 프로모션 상태 수정 -->
+	<update id="updateFreegoodsPromotionStat" parameterType="FreeGoodsPromotion">
+		/* TsaMarketing.updateFreegoodsPromotionStat : 사은품 프로모션 상태 수정 */
+		UPDATE TB_FREEGIFT SET
+			  FREEGIFT_STAT = #{freegiftStat}
+		<if test="freegiftStat == 'G232_14'">
+			, DEL_YN = 'Y'
+		</if>
+			, UPD_NO = #{updNo}
+			, UPD_DT = CURRENT_TIMESTAMP
+		WHERE FREEGIFT_SQ = #{freegiftSq}
+	</update>
+</mapper>

+ 0 - 33
src/main/java/com/style24/persistence/mybatis/shop/TsaMarketing.xml

@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.style24.admin.biz.dao.TsaMarketingDao">
-	<!-- xodud1202 진행 -->
-
-	<!-- 품목 목록 -->
-	<select id="getFreeGoodsPromotionList" parameterType="FreeGoodsPromotion" resultType="FreeGoodsPromotion">
-		/* TsaMarketing.getFreeGoodsPromotionList */
-		SELECT FG.FREEGIFT_SQ
-		, FG.FREEGIFT_NM
-		, FG.FREEGIFT_STAT
-		, DATE_FORMAT(FG.FREEGIFT_STDT, '%Y.%m.%d') AS FREEGIFT_STDT
-		, DATE_FORMAT(FG.FREEGIFT_EDDT, '%Y.%m.%d') AS FREEGIFT_EDDT
-		, (SELECT USER_NM FROM TB_USER WHERE USER_NO = FG.REG_NO) AS REG_NM
-		, DATE_FORMAT(FG.REG_DT, '%Y.%m.%d %H:%i:%S') AS REG_DT
-		, (SELECT USER_NM FROM TB_USER WHERE USER_NO = FG.UPD_NO) AS UPD_NM
-		, DATE_FORMAT(FG.UPD_DT, '%Y.%m.%d %H:%i:%S') AS UPD_DT
-		FROM TB_FREEGIFT FG
-		WHERE 1=1
-		<if test="searchTxt != null and searchTxt != ''">
-			<if test="promotionGubun != null and promotionGubun == 'freegiftSq'">
-				AND FG.FREEGIFT_SQ = #{searchTxt}
-			</if>
-			<if test="promotionGubun != null and promotionGubun == 'freegiftNm'">
-				AND FG.FREEGIFT_NM = #{searchTxt}
-			</if>
-		</if>
-		ORDER BY REG_DT DESC
-	</select>
-
-	<!-- // xodud1202 진행 -->
-
-</mapper>

+ 3 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsaOcm.xml

@@ -17,6 +17,9 @@
 		     , USE_YN            /*사용여부*/
 		FROM   TB_EXTMALL A
 		WHERE  1 = 1
+		<if test="extmallId != null and extmallId != ''">
+		AND    EXTMALL_ID = #{extmallId}
+		</if>
 		<if test="vendorId != null and vendorId != ''">
 		AND    VENDOR_ID = #{vendorId}
 		</if>

+ 53 - 17
src/main/java/com/style24/persistence/mybatis/shop/TsaOrderChange.xml

@@ -51,6 +51,14 @@
 		     , DFP.RTN_DELV_FEE
 		     , DFP.DELV_FEE + DFP.RTN_DELV_FEE AS EXC_DELV_FEE
 		     , 0			AS ORD_CAN_CHG_QTY
+		     , VS.OPT_CD2S
+		     , VS.CURR_STOCK_QTYS
+		     , DL.RTN_LOC_NM
+		     , DL.RTN_LOC_ZIPCODE
+		     , DL.RTN_LOC_BASE_ADDR
+		     , DL.RTN_LOC_DTL_ADDR
+		     , DL.RTN_LOC_TELNO
+		     , DL.SELF_YN
 		FROM   TB_ORDER_DETAIL OD
 		INNER  JOIN TB_GOODS G1
 		ON     OD.GOODS_CD = G1.GOODS_CD
@@ -90,6 +98,34 @@
 		ON     DF.SUPPLY_COMP_CD  = DFP.SUPPLY_COMP_CD 
 		AND    DF.DELV_FEE_CD = DFP.DELV_FEE_CD 
 		AND    DFP.USE_YN = 'Y'
+		INNER  JOIN (
+			SELECT TDL.DELV_LOC_CD
+			     , TDL.RTN_LOC_NM
+			     , TDL.RTN_LOC_TELNO
+			     , TDL.RTN_LOC_ZIPCODE
+			     , TDL.RTN_LOC_BASE_ADDR
+			     , TDL.RTN_LOC_DTL_ADDR
+			     , CASE WHEN TSC.DISTRIBUTION_GB IN ('G065_10', 'G065_11', 'G065_12')
+						THEN 'Y'
+						ELSE 'N'
+				   END AS SELF_YN
+			  FROM TB_DELIVERY_LOC TDL
+			 INNER JOIN TB_SUPPLY_COMPANY TSC
+			    ON TDL.SUPPLY_COMP_CD = TSC.SUPPLY_COMP_CD
+		) DL
+		ON     OD.DELV_LOC_CD = DL.DELV_LOC_CD
+		INNER  JOIN (
+			SELECT GOODS_CD
+			     , OPT_CD1
+			     , GROUP_CONCAT(OPT_CD2 ORDER BY DISP_ORD DESC, OPT_CD2 SEPARATOR ',')        AS OPT_CD2S
+			     , GROUP_CONCAT(CURR_STOCK_QTY ORDER BY DISP_ORD DESC, OPT_CD2 SEPARATOR ',') AS CURR_STOCK_QTYS
+			  FROM VW_STOCK
+			 WHERE GOODS_CD IN (SELECT ITEM_CD FROM TB_ORDER_DETAIL_ITEM WHERE ORD_NO = #{ordNo})
+			   AND (CURR_STOCK_QTY - BASE_STOCK_QTY) > 0
+			 GROUP BY GOODS_CD, OPT_CD1
+		) VS
+		ON     ODI.ITEM_CD = VS.GOODS_CD
+		AND    ODI.OPT_CD1 = VS.OPT_CD1
 		WHERE  1=1
 		<if test="ordDtlStatArr != null and ordDtlStatArr != ''">
         AND    OD.ORD_DTL_STAT IN
@@ -100,6 +136,7 @@
 		AND    OD.ORD_NO = #{ordNo}
 		GROUP  BY OD.ORD_NO
 		     , OD.ORD_DTL_NO
+		     , ODI.ORD_DTL_ITEM_SQ
 	    ORDER  BY OD.ORD_NO
 	         , OD.ORD_DTL_NO
 	</select>
@@ -140,9 +177,9 @@
 			 , #{addPayCost}
 			 , #{addPayAmt}
 			 , #{regNo}
-			 , SYSDATE()
+			 , NOW()
 			 , #{updNo}
-			 , SYSDATE()
+			 , NOW()
 		)
 	</insert>
 
@@ -168,7 +205,7 @@
 		     , ODI.REAL_ORD_AMT 	= ODI.REAL_ORD_AMT 			- #{realOrdAmt}
 		     , ODI.GFCD_USE_AMT 	= ODI.GFCD_USE_AMT 			- #{gfcdUseAmt}
 		     , ODI.UPD_NO 			= #{updNo}
-		     , ODI.UPD_DT 			= SYSDATE()
+		     , ODI.UPD_DT 			= NOW()
 		WHERE  1=1
 		AND    ODI.ORD_NO 			= #{ordNo} 
 		AND    ODI.ORD_DTL_NO 		= #{ordDtlNo} 
@@ -259,7 +296,7 @@
 		AND    OP.OPT_CD2 = ODI.OPT_CD2
 		SET    OP.CURR_STOCK_QTY = OP.CURR_STOCK_QTY + (ODI.ITEM_QTY * #{ordCanChgQty})
 		     , OP.UPD_NO = #{updNo}
-		     , OP.UPD_DT = SYSDATE()
+		     , OP.UPD_DT = NOW()
 		WHERE  1=1
 		AND    ODI.ORD_NO 			= #{ordNo} 
 		AND    ODI.ORD_DTL_NO 		= #{ordDtlNo} 
@@ -502,11 +539,11 @@
 			, #{ordDtlNo}
 			, #{chgQty}
 			, #{chgStat}
-			, SYSDATE()
+			, NOW()
 			, #{regNo}
-			, SYSDATE()
+			, NOW()
 			, #{updNo}
-			, SYSDATE()
+			, NOW()
 		)
 	</insert>
 	
@@ -545,7 +582,7 @@
 			, UPD_DT
 		) 
 		SELECT ORD_NO
-		 	 , SYSDATE()
+		 	 , NOW()
 			 , PAY_MEANS
 			 , #{payAmt}
 			 , #{pgCpnAmt}
@@ -570,9 +607,9 @@
 			 , ESCROW_YN
 			 , #{ordChgSq}
 			 , #{regNo}
-			 , SYSDATE()
+			 , NOW()
 			 , #{updNo}
-			 , SYSDATE()
+			 , NOW()
 		FROM   TB_PAYMENT 
 		WHERE  1=1
 		AND    ORD_NO = #{ordNo}
@@ -618,7 +655,7 @@
 			, #{rfPrePntAmt}
 			, #{rfGfcdUseAmt}
 			, #{regNo}
-			, SYSDATE()
+			, NOW()
 		)
 	</insert>
 
@@ -656,9 +693,9 @@
 			, 'N'
 			, null
 			, #{regNo}
-			, SYSDATE()
+			, NOW()
 			, #{updNo}
-			, SYSDATE()
+			, NOW()
 		)
 	</insert>
 	
@@ -668,7 +705,7 @@
 		UPDATE TB_ORD_FREEGIFT_VAL
 		SET    DEL_YN= 'N'
 		     , UPD_NO = #{updNo}
-		     , UPD_DT = SYSDATE()
+		     , UPD_DT = NOW()
 		WHERE  FREEGIFT_VAL_SQ IN (
 			SELECT OFRV.FREEGIFT_VAL_SQ 
 			FROM   TB_ORD_FREEGIFT OFR
@@ -750,14 +787,13 @@
 			, 'N'
 			, 'N'
 			, #{regNo}
-			, SYSDATE()
+			, NOW()
 			, #{updNo}
-			, SYSDATE()
+			, NOW()
 		)
 	</insert>
 	
 	
-	
 </mapper>
 
 

+ 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>

+ 5 - 5
src/main/webapp/WEB-INF/views/display/CategorySearchForm.html

@@ -14,7 +14,7 @@
  * 1.0  2021.01.11   xyzp1539    최초 작성
  *******************************************************************************
  -->
-<div class="modalPopup" data-width="900" id="popupCategory">
+<div class="modalPopup" data-width="1100" id="popupCategory">
 	<div class="panelStyle">
 		<!-- TITLE -->
 		<div class="panelTitle">
@@ -126,7 +126,7 @@
 			return false;
 		}
 		
-		var callbackFn = [[${params.callbackFn}]];
+		var callbackFn = [[${params.callBackFun}]];
 
 		var jsonData = JSON.stringify(selectedData);
 
@@ -162,11 +162,11 @@
 				selLvl = 1;
 			}
 		}
-		$('#searchForm input[name=selLvl]').val(selLvl);
+		$('#searchCategoryListForm input[name=selLvl]').val(selLvl);
 
 		// Fetch data
-		gagaAgGrid.fetch($('#searchForm').prop('action'), gridOptions, '#searchForm', function(data) {
-			let selLvl = Number($('#searchForm input[name=selLvl]').val()) + 1;
+		gagaAgGrid.fetch($('#searchCategoryListForm').prop('action'), categoryGridOptions, '#searchCategoryListForm', function(data) {
+			let selLvl = Number($('#searchCategoryListForm input[name=selLvl]').val()) + 1;
 
 			for (let i = 2; i <= 5; i++) {
 				if (i >= selLvl) {

+ 0 - 944
src/main/webapp/WEB-INF/views/marketing/CouponCreatePopupForm.html

@@ -1,944 +0,0 @@
-<!DOCTYPE html>
-<html lang="ko"
-	  xmlns:th="http://www.thymeleaf.org">
-<!--
- *******************************************************************************
- * @source  : CouponCreatePopupForm.html
- * @desc    : 쿠폰 등록 팝업 화면
- *============================================================================
- * ISTYLE24
- * Copyright(C) 2020 TSIT, All rights reserved.
- *============================================================================
- * VER  DATE         AUTHOR      DESCRIPTION
- * ===  ===========  ==========  =============================================
- * 1.0  2020.12.23   xyzp1539       최초 작성
- *******************************************************************************
- -->
-<div class="modalPopup" data-width="1200">
-	<div class="panelStyle" >
-		<div class="panelTitle">
-			<h2>쿠폰등록</h2>
-			<button type="button" class="close" onclick="uifnPopupClose('CouponCreatePopup')"><i class="fa fa-times"></i></button>
-		</div>
-		<div class="panelContent">
-			<form id="couponCreateForm" name="couponCreateForm" th:action="@{'/marketing/coupon/save'}" >
-				<input type="hidden" name="supplyCompList" id="supplyCompList">
-				<input type="hidden" name="brandList" id="brandList">
-				<input type="hidden" name="applyGoodsList" id="applyGoodsList">
-				<input type="hidden" name="exceptGoodsList" id="excepGoodsList">
-				<input type="hidden" name="burdenList" id="burdenList">
-				<input type="hidden" name="cateList" id="cateList">
-
-				<div class="tabs">
-					<div class="tabsNav">
-						<ul>
-							<li class="on"><a href="#coupontab1">기본정보</a></li>
-							<li><a href="#coupontab2">적용대상</a></li>
-							<li><a href="#coupontab3">입점업체분담율</a></li>
-						</ul>
-					</div>
-					<ul class="tabsCont">
-						<li class="tab on" id="coupontab1">
-							<div class="panelStyle">
-								<table class="frmStyle">
-									<colgroup>
-										<col style="width:10%">
-										<col style="width:40%;">
-										<col style="width:10%">
-										<col style="width:40%;">
-									</colgroup>
-									<tr>
-										<th>쿠폰번호<em class="required" title="필수"></em></th>
-										<td colspan="5">
-											<input type="hidden" name="copyCpnId" maxlength="50" value="">
-											<input type="hidden" name="mode" maxlength="50" value="">
-											<input type="text" name="cpnId" maxlength="50" value="" style="width:70%;" disabled="true" placeholder="자동생성" data-valid-name="쿠폰번호">
-											<label class="chkBox checked" onclick="clickCreateChk(this);" id="cpnCreateLab">
-												<input type="checkbox" name="cpnCreateType" id="cpnCreateType" value="true" class="type-check" checked />쿠폰번호 자동생성
-											</label>
-										</td>
-									</tr>
-									<tr>
-										<th>쿠폰명<em class="required" title="필수"></em></th>
-										<td colspan="5">
-											<input type="text" name="cpnNm" id="cpnNm" style="width: 70%;" required="required" data-valid-name="쿠폰명">
-										</td>
-									</tr>
-									<tr>
-										<th>쿠폰유형<em class="required" title="필수"></em></th>
-										<td colspan="5">
-											<input type="hidden" id="cpnType" name="cpnType" required="required" data-valid-name="쿠폰유형">
-											<label class="rdoBtn" th:if="${cpnTypeList}" th:each="oneData, status : ${cpnTypeList}"> <input type="radio" name="rdoCpnType"  th:text="${oneData.cdNm}" th:value="${oneData.cd}"/></label>
-										</td>
-									</tr>
-									<tr>
-										<th>사용가능고객구분<em class="required" title="필수"></em></th>
-										<td>
-											<select name="usableCustGb" id="usableCustGb" required="required" data-valid-name="사용가능고객구분">
-												<option th:if="${usableCustGbList}" th:each="oneData , status : ${usableCustGbList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
-											</select>
-										</td>
-										<th>사이트<em class="required" title="필수"></em></th>
-										<td>
-											<select name="siteCd" id="siteCd" required="required" data-valid-name="사이트">
-												<option th:if="${siteCdList}" th:each="oneData , status : ${siteCdList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
-											</select>
-										</td>
-									</tr>
-									<tr>
-										<th>사용고객등급구분<em class="required" title="필수"></em></th>
-										<td>
-											<select name="usableCustGrade" id="usableCustGrade" required="required" data-valid-name="사용고객등급구분">
-												<option value="ALL">[전체]</option>
-												<option th:if="${usableCustGradeList}" th:each="oneData , status : ${usableCustGradeList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
-											</select>
-										</td>
-										<th>만료알림여부<em class="required" title="필수"></em></th>
-										<td>
-											<select name="endAlimYn" id="endAlimYn" required="required" data-valid-name="만료알림여부">
-												<option value="Y">Y</option>
-												<option value="N" selected="selected">N</option>
-											</select>
-										</td>
-									</tr>
-									<tr>
-										<th>할인방식<em class="required" title="필수"></em></th>
-										<td>
-											<input type="hidden" name="dcWay" id="dcWay" required="required" data-valid-name="할인방식">
-											<label class="rdoBtn" th:if="${dcWayList}" th:each="oneData, status : ${dcWayList}"> <input type="radio" name="rdoDcWay"  th:text="${oneData.cdNm}" th:value="${oneData.cd}"/></label>
-										</td>
-										<th>구매제한금액<em class="required" title="필수"></em></th>
-										<td>
-											<input type="text" id="buyLimitAmt" name="buyLimitAmt" class="w200" required="required" value="0" style="text-align: right;" data-valid-name="구매제한금액">원
-										</td>
-									</tr>
-									<tr>
-										<th>할인값(PC)<em class="required" title="필수"></em></th>
-										<td>
-											<input type="text" class="w200" id="dcPval" name="dcPval" value="0" required="required" data-valid-name="할인값(PC)" data-valid-type="numeric" style="text-align: right"><span id="dcPvalSpan">원</span>
-										</td>
-										<th>할인값(모바일웹)<em class="required" title="필수"></em></th>
-										<td>
-											<input type="text" class="w200" id="dcMval" name="dcMval" value="0" required="required" data-valid-name="할인값(모바일웹)" data-valid-type="numeric" style="text-align: right"><span id="dcMvalSpan">원</span>
-										</td>
-									</tr>
-									<tr>
-										<th>할인값(모바일앱)<em class="required" title="필수"></em></th>
-										<td>
-											<input type="text" class="w200" id="dcAval" name="dcAval" value="0" required="required" data-valid-name="할인값(모바일앱)" data-valid-type="numeric" style="text-align: right"><span id="dcAvalSpan">원</span>
-										</td>
-										<th>최대할인금액<em class="required" title="필수"></em></th>
-										<td>
-											<input type="text" class="w200" id="maxDcAmt" name="maxDcAmt" value="0" required="required" data-valid-name="최대할인금액" data-valid-type="numeric" style="text-align: right;"><span id="maxDcAmtSpan">원</span>
-										</td>
-									</tr>
-									<tr>
-										<th>다운로드시작일시<em class="required" title="필수"></em></th>
-										<td>
-											<input type="hidden" name="downStdt" id="downStdt" required="required" data-valid-name="다운로드시작일시">
-											<input type="text" class="schDate w100" name="downStDay" id="downStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
-											<select name="downStHH" id="downStHH">
-												<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-											<select name="downStMM" id="downStMM">
-												<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-										<th>다운로드종료일시<em class="required" title="필수"></em></th>
-										<td>
-											<input type="hidden" id="downEddt" name="downEddt" required="required" data-valid-name="다운로드종료일시">
-											<input type="text" class="schDate w100" name="downEdDay" id="downEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
-											<select name="downEdHH" id="downEdHH">
-												<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-											<select name="downEdMM" id="downEdMM">
-												<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="pdGb" id="pdGb" onchange="pdGbChange(this)" required="required" data-valid-name="기간/일수구분">
-												<option value="P">기간</option>
-												<option value="D">일수</option>
-											</select>
-										</td>
-										<th>적용범위<em class="required" title="필수"></em></th>
-										<td>
-											<input type="hidden" name="applyScope" id="applyScope" required="required" data-valid-name="적용범위">
-											<label class="rdoBtn"> <input type="radio" name="rdoApplyScope" value="A"/>전체</label>
-											<label class="rdoBtn"> <input type="radio" name="rdoApplyScope" value="I"/>개별</label>
-										</td>
-									</tr>
-									<tr class="availDayTr" style="display: none;">
-										<th>유효기간일수<em class="required" title="필수"></em></th>
-										<td>
-											<input type="text" name="availDays" id="availDays" class="w200" data-valid-name="유효기간일수">
-										</td>
-									</tr>
-									<tr>
-										<th class="availDateTr">유효기간시작일시<em class="required" title="필수"></em></th>
-										<td class="availDateTr">
-											<input type="hidden" name="availStdt" id="availStdt" data-valid-name="유효기간시작일시">
-											<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="유효기간종료일시">
-											<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="firstYn" id="firstYn" onchange="firstYnChange(this)" required="required" data-valid-name="첫구매여부">
-												<option value="Y">Y</option>
-												<option value="N" selected="selected">N</option>
-											</select>
-										</td>
-										<th>다운로드가능여부<em class="required" title="필수"></em></th>
-										<td>
-											<select name="downYn" id="downYn" required="required" data-valid-name="다운로드가능여부">
-												<option value="Y">Y</option>
-												<option value="Y" selected="selected">N</option>
-											</select>
-										</td>
-									</tr>
-									<tr>
-										<th class="buyDateTr">첫구매기간시작일시<em class="required" title="필수"></em></th>
-										<td class="buyDateTr">
-											<input type="hidden" id="buyEddt" name="buyEddt" data-valid-name="첫구매기간종료일시">
-											<input type="text" class="schDate w100" name="buyStDay" id="buyStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
-											<select name="buyStHH" id="buyStHH">
-												<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-											<select name="buyStMM" id="buyStMM">
-												<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-										<th class="buyDateTr">첫구매기간종료일시<em class="required" title="필수"></em></th>
-										<td class="buyDateTr">
-											<input type="hidden" name="buyStdt" id="buyStdt" data-valid-name="첫구매기간시작일시">
-											<input type="text" class="schDate w100" name="buyEdDay" id="buyEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
-											<select name="buyEdHH" id="buyEdHH">
-												<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-											<select name="buyEdMM" id="buyEdMM">
-												<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 colspan="5">
-											<select name="custJoinYn" id="custJoinYn" onchange="custJoinYnChange(this)" required="required" data-valid-name="신규회원여부">
-												<option value="Y">Y</option>
-												<option value="N" selected="selected">N</option>
-											</select>
-										</td>
-									</tr>
-									<tr>
-										<th class="custJoinDateTr">신규회원기간시작일시<em class="required" title="필수"></em></th>
-										<td class="custJoinDateTr">
-											<input type="hidden" name="custJoinStdt" id="custJoinStdt" data-valid-name="신규회원기간시작일시">
-											<input type="text" class="schDate w100" name="custJoinStDay" id="custJoinStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
-											<select name="custJoinStHH" id="custJoinStHH">
-												<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-											<select name="custJoinStMM" id="custJoinStMM">
-												<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-										<th class="custJoinDateTr">신규회원기간종료일시<em class="required" title="필수"></em></th>
-										<td class="custJoinDateTr">
-											<input type="hidden" id="custJoinEddt" name="custJoinEddt" data-valid-name="신규회원기간종료일시">
-											<input type="text" class="schDate w100" name="custJoinEdDay" id="custJoinEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
-											<select name="custJoinEdHH" id="custJoinEdHH">
-												<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-											<select name="custJoinEdMM" id="custJoinEdMM">
-												<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>
-											<input type="text" class="w200" name="totPubLimitQty" id="totPubLimitQty" value="0" required="required" data-valid-name="총발행제한수량" data-valid-type="numeric" style="text-align: right;">개<span class="cRed" id="totPubLimitQtySpan"> *제한없음</span>
-										</td>
-										<th>1인당발행제한수량<em class="required" title="필수"></em></th>
-										<td>
-											<input type="text" class="w200" name="custPubLimitQty" id="custPubLimitQty" value="0" required="required" data-valid-name="1인당발행제한수량" data-valid-type="numeric" style="text-align: right;">개<span class="cRed" id="custPubLimitQtySpan"> *제한없음</span>
-										</td>
-									</tr>
-									<tr>
-										<th>최소주문금액<em class="required" title="필수"></em></th>
-										<td><input type="text" class="w200" name="minBuyAmt" id="minBuyAmt" value="0" required="required" data-valid-name="최소주문금액" data-valid-type="numeric" style="text-align: right;">원<span class="cRed" id="minBuyAmtSpan"> *제한없음</span></td>
-										<th>1회발행수량<em class="required" title="필수"></em></th>
-										<td><input type="text" class="w200" name="onePubQty" id="onePubQty" value="1" required="required" data-valid-name="1회발행수량" data-valid-type="numeric" style="text-align: right;">개</td>
-									</tr>
-									<tr>
-										<th>재발급여부<em class="required" title="필수"></em></th>
-										<td>
-											<select name="reissuance" id="reissuance" required="required" data-valid-name="재발급여부" >
-												<option th:if="${reissuanceList}" th:each="oneData , status : ${reissuanceList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
-											</select>
-										</td>
-										<th>다운로드구분<em class="required" title="필수"></em></th>
-										<td>
-											<select name="dnGb" id="dnGb" required="required" data-valid-name="다운로드구분">
-												<option th:if="${dnGbList}" th:each="oneData , status:${dnGbList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
-											</select>
-										</td>
-									</tr>
-									<tr>
-										<th>쿠폰상태<em class="required" title="필수"></em></th>
-										<td>
-											<select name="cpnStat" id="cpnStat" ata-valid-name="쿠폰상태" required="required">
-												<option th:if="${cpnStatList}" th:each="oneData , status : ${cpnStatList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
-											</select>
-										</td>
-									</tr>
-									<tr class="payTypeTr" style="display: none;">
-										<th>결제수단<em class="required" title="필수"></em></th>
-										<td>
-											<select name="payType" id="payType" data-valid-name="결제수단">
-												<option value="">[전체]</option>
-												<option th:if="${payTypeList}" th:each="oneData , status : ${payTypeList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
-											</select>
-										</td>
-									</tr>
-								</table>
-								<div class="mdPopBtnB aR">
-									<button type="button" class="btn btn-info btn-lg" onclick="fnCouponCreate();">등록</button>
-								</div>
-							</div>
-						</li>
-						<!-- 쿠폰적용대상-->
-						<li class="tab" id="coupontab2" >
-							<div class="panelStyle">
-								<div class="panelTitle">
-									<h2 style="position: relative">적용 대상 상품 등록</h2>
-								</div>
-								<div class="inner-panelContent">
-									<div class="panelContent">
-										<table class="frmStyle">
-											<colgroup>
-												<col style="width:15%;">
-												<col style="width:85%;">
-											</colgroup>
-											<tbody>
-												<tr>
-													<th>공급처</th>
-													<td>
-														<div class="padding10 inner-tb-solid">
-															<button type="button" class="btn btnRight btn-success btn-lg" id="btnSupplyAdd">공급처 추가</button>
-															<button type="button" class="btn btnRight btn-success btn-lg" id="btnSupplyDel">선택삭제</button>
-															<br/>
-															<div id="supplyGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
-														</div>
-													</td>
-												</tr>
-												<tr>
-													<th>브랜드</th>
-													<td>
-														<div class="padding10 inner-tb-solid">
-															<button type="button" class="btn btnRight btn-success btn-lg" id="btnBrandAdd">브랜드 추가</button>
-															<button type="button" class="btn btnRight btn-success btn-lg" id="btnBrandDel">선택삭제</button>
-															<br/>
-															<div id="brandGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
-														</div>
-													</td>
-												</tr>
-												<tr>
-													<th>카테고리</th>
-													<td>
-														<div class="padding10 inner-tb-solid">
-															<button type="button" class="btn btnRight btn-success btn-lg" id="btnCateAdd">카테고리 추가</button>
-															<button type="button" class="btn btnRight btn-success btn-lg" id="btnCateDel">선택삭제</button>
-															<br/>
-															<div id="cateGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
-														</div>
-													</td>
-												</tr>
-												<tr>
-													<th>적용상품</th>
-													<td>
-														<div class="padding10 inner-tb-solid">
-															<button type="button" class="btn btnRight btn-success btn-lg" id="btnGoodsAdd">상품 추가</button>
-															<button type="button" class="btn btnRight btn-success btn-lg" id="btnGoodsDel">선택삭제</button>
-															<br/>
-															<div id="goodsGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
-														</div>
-													</td>
-												</tr>
-											</tbody>
-										</table>
-									</div>
-								</div>
-								<div class="panelTitle">
-									<h2 style="position: relative">적용 제외 대상 상품 등록</h2>
-								</div>
-								<div class="inner-panelContent">
-									<div class="panelContent">
-										<table class="frmStyle">
-											<colgroup>
-												<col style="width:15%;">
-												<col style="width:85%;">
-											</colgroup>
-											<tbody>
-											<tr>
-												<th>제외상품</th>
-												<td>
-													<div class="padding10 inner-tb-solid">
-														<button type="button" class="btn btnRight btn-success btn-lg" id="btnExcepGoodsAdd">제외상품 추가</button>
-														<button type="button" class="btn btnRight btn-success btn-lg" id="btnExcepGoodsDel">선택삭제</button>
-														<br/>
-														<div id="excepGoodsGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
-													</div>
-												</td>
-											</tr>
-											</tbody>
-										</table>
-									</div>
-								</div>
-							</div>
-						</li>
-						<!-- 쿠폰적용대상끝-->
-						<!-- 입점업체분담율-->
-						<li class="tab" id="coupontab3">
-							<div class="panelStyle">
-								<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>
-									</li>
-								</ul>
-
-								<div id="inComGridList" style="width: 100%; height: 570px" class="ag-theme-balham"></div>
-
-							</div>
-						</li>
-						<!-- 입점업체분담끝-->
-					</ul>
-				</div>
-			</form>
-		</div>
-	</div>
-</div>
-<script th:inline="javascript">
-	/*<![CDATA[*/
-	var ibSupplyComList = gagajf.convertToArray([[${ibSupplyCompList}]]);
-	var delYnList = { "Y":"Yes", "N":"No" };
-
-	// ag-grid 입점업체분담율 컬럼
-	var columnDefs = [
-		{ headerName: "입점업체" , field:"supplyCompCd" , width:150, cellClass:"text-center" ,
-			cellEditor: 'agRichSelectCellEditor',
-			cellEditorParams: { values: gagaAgGrid.extractValues(ibSupplyComList) },
-			valueFormatter: function (params) { return gagaAgGrid.lookupValue(ibSupplyComList, params.value); },
-			valueParser: function (params) { return gagaAgGrid.lookupKey(ibSupplyComList, params.newValue);}
-		} ,
-		{ headerName: "쿠폰분담율(%)", field:"burdenRate" , width:150, cellClass: "text-center" ,
-		  cellEditorParams: { maxlength: 10, required: true }
-		} ,
-		{ headerName: "삭제여부" , field: "delYn"  , width:150, cellClass: "text-center" ,
-			cellEditor: 'agRichSelectCellEditor',
-			cellEditorParams: { values: gagaAgGrid.extractValues(delYnList) },
-			valueFormatter: function (params) { return gagaAgGrid.lookupValue(delYnList, params.value); },
-			valueParser: function (params) { return gagaAgGrid.lookupKey(delYnList, params.newValue); }
-		}
-	];
-
-	// ag-grid 공급처 컬럼
-	var supplyColumnDefs = [
-		{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
-		{ headerName : "공급업체코드" , field: "supplyCompCd" , width:150, cellClass: 'text-center'} ,
-		{ headerName: "공급업체명" , field: "supplyCompNm" , width:150, cellClass: 'text-center'}
-	];
-
-	// ag-grid 브랜드 컬럼
-	var brandSelColumnDefs = [
-		{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
-		{ headerName : "브랜드ID" , field: "brandCd" , width: 120, 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'}
-	];
-
-	// ag-grid 적용상품 컬럼
-	var goodsSelColumnDefs = [
-		{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: "targetGB" , width: 150, cellClass: 'text-center'}
-	];
-
-	// ag-grid 카테고리 컬럼
-	var cateSelColumnDefs = [
-		{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
-		{ headerName: "카테고리코드" , field: "cateNo" , width: 100 , cellClass: 'text-center'} ,
-		{ headerName: "카테고리명" , field: "cateNm" , width: 120 , cellClass: 'text-center'},
-		//{ headerName: "적용대사"}
-	];
-
-	// ag-grid 제외상품 컬럼
-	var excepGoodsColumnDefs = [
-		{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'} ,
-	];
-
-	var inComGridOptions = gagaAgGrid.getGridOptions(columnDefs);
-	var cateGridOptions = gagaAgGrid.getGridOptions(cateSelColumnDefs);
-	var goodsGridOptions = gagaAgGrid.getGridOptions(goodsSelColumnDefs);
-	var brandGridOptions = gagaAgGrid.getGridOptions(brandSelColumnDefs);
-	var supplyGridOptions = gagaAgGrid.getGridOptions(supplyColumnDefs);
-	var excepGoodsGridOptions = gagaAgGrid.getGridOptions(excepGoodsColumnDefs);
-
-	inComGridOptions.defaultColDef.editable = true;
-	inComGridOptions.rowSelection = "multiple";
-	goodsGridOptions.rowSelection = "multiple";
-	supplyGridOptions.rowSelection = "multiple";
-	excepGoodsGridOptions.rowSelection = "multiple";
-	cateGridOptions.rowSelection = "multiple";
-	brandGridOptions.rowSelection = "multiple";
-	inComGridOptions.stopEditingWhenGridLosesFocus = true;
-
-	// 쿠폰 등록 버튼 클릭시
-	function fnCouponCreate(){
-		// 필수값들 셋팅
-		setReqValue();
-
-		// 필수값 validation 체크
-		if (!gagajf.validation('#couponCreateForm')) {
-			return false;
-		}
-
-		//신규가입 지급한다면 validation 체크
-		if( $('#custJoinYn option:selected').val() == "Y" ){
-			var fromDate = $('#couponCreateForm input[name=custJoinStdt]').val();
-			var toDate = $('#couponCreateForm input[name=custJoinEddt]').val();
-
-			if (gagajf.isNull(fromDate) || gagajf.isNull(toDate)) {
-				mcxDialog.alertC("신규가입기간 시작일자와 종료일자를 입력하세요.", {
-					sureBtnText: "확인",
-					sureBtnClick: function() {
-						$('#couponCreateForm input[name=custJoinStdt]').focus();
-					}
-				});
-				return false;
-			}
-
-			if (fromDate > toDate) {
-				mcxDialog.alertC("등록 시작일자는 종료일자 보다 클 수 없습니다.", {
-					sureBtnText: "확인",
-					sureBtnClick: function() {
-						$('#couponCreateForm input[name=custJoinEddt]').focus();
-					}
-				});
-				return false;
-			}
-		}
-
-		// 첫구매 지급하면 validation 체크
-		if( $('#firstYn option:selected').val() == "Y" ){
-			var fromDate = $('#couponCreateForm input[name=buyStdt]').val();
-			var toDate = $('#couponCreateForm input[name=buyEddt]').val();
-
-			if (gagajf.isNull(fromDate) || gagajf.isNull(toDate)) {
-				mcxDialog.alertC("신규가입기간 시작일자와 종료일자를 입력하세요.", {
-					sureBtnText: "확인",
-					sureBtnClick: function() {
-						$('#couponCreateForm input[name=buyStdt]').focus();
-					}
-				});
-				return false;
-			}
-
-			if (fromDate > toDate) {
-				mcxDialog.alertC("등록 시작일자는 종료일자 보다 클 수 없습니다.", {
-					sureBtnText: "확인",
-					sureBtnClick: function() {
-						$('#couponCreateForm input[name=buyEddt]').focus();
-					}
-				});
-				return false;
-			}
-		}
-
-		// 할인율 validation 체크 (100을 넘길수없음)
-		if($('#dcWay').val() == 'G240_11') {
-			if($('#dcPval').val() > 100) {
-				mcxDialog.alert('PC할인율은 100을 초과할수없습니다.');
-				$('#dcPval').focus();
-				return false;
-			} else if( $('#dcMval').val() > 100) {
-				mcxDialog.alert('모바일(웹)할인율은 100을 초과할수없습니다.');
-				$('#dcMval').focus();
-				return false;
-			}  else if( $('#dcAval').val() > 100) {
-				mcxDialog.alert('모바일(앱)할인율은 100을 초과할수없습니다.');
-				$('#dcAval').focus();
-				return false;
-			}
-		}
-
-		mcxDialog.confirm('저장하시겠습니까?' , {
-			cancelBtnText:"취소",
-			sureBtnText:"확인",
-			sureBtnClick: function () {
-				gagajf.ajaxFormSubmit($('#couponCreateForm').prop('action'), '#couponCreateForm', function() {
-					uifnPopupClose('CouponCreatePopup');
-					$('#btnSearch').trigger('click');
-				});
-			}
-		});
-	}
-
-	// 할인방식 변경
-	$("#couponCreateForm input[name=rdoDcWay]").bind('click change', function () {
-		var radioValue = $(this).val();
-
-		if(radioValue == 'G240_10') {
-			$('#dcPvalSpan').text("원");
-			$('#dcMvalSpan').text("원");
-			$('#dcAvalSpan').text("원");
-		} else {
-			$('#dcPvalSpan').text("%");
-			$('#dcMvalSpan').text("%");
-			$('#dcAvalSpan').text("%");
-		}
-	});
-
-	// 쿠폰 상태 변경
-	$("#couponCreateForm input[name=rdoCpnType]").bind('click change', function () {
-		var radioValue = $(this).val();
-
-		// 상품쿠폰 선택시 적용범위 개별로 변경 나머진 전체
-		if(radioValue == 'G230_11') {
-			$("input:radio[name='rdoApplyScope']:radio[value='I']").prop('checked', true);
-		} else {
-			$("input:radio[name='rdoApplyScope']:radio[value='A']").prop('checked', true);
-		}
-
-		// 주문서 쿠폰 선택시 결제수단 노출
-		if(radioValue == 'G230_20') {
-			$('.payTypeTr').css('display' , '');
-			$('#couponCreateForm #payType').attr('required' , true);
-		} else {
-			$('.payTypeTr').css('display' , 'none');
-			$('#couponCreateForm #payType').attr('required' , false );
-		}
-
-		$('#couponCreateForm #cpnType').val(radioValue);
-	});
-
-	// 적용대상 - 브랜드 추가 버튼시
-	$('#btnBrandAdd').on('click' , function(){
-		cfnOpenBrandListPopup("fnSetPopupBrandInfo", "M");
-	});
-
-	// 브랜드 설정 / 브랜드 추가 콜백함수 (단수로 가져오므로 복수일 경우에 수정 확인 필요)
-	var fnSetPopupBrandInfo = function(result) {
-		for(let i = 0 ; i < result.length ; i++) {
-			let addChk = true, gridListValue = gagaAgGrid.getAllRowData(brandGridOptions);		// 받아온 모든 데이터
-
-			// 받아온 data for
-			for(let j = 0 ; j < gridListValue.length ; j++) {
-				if(gridListValue[j].brandCd == result[i].brandCd) {	addChk = false;	}					// 중복체크
-			}
-
-			// 중복되지 않은 데이터 리스트에 추가
-			if(addChk) {
-				gagaAgGrid.addRowData(brandGridOptions, {"brandCd" : result[i].brandCd, "brandEnm" : result[i].brandEnm, "supplyCompNm" : result[i].supplyCompNm});
-			}
-		}
-	};
-
-	// 적용대상 - 브랜드 삭제 버튼시
-	$('#btnBrandDel').on('click' , function(){
-		brandGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(brandGridOptions)});
-	});
-
-	// 적용대상 - 공급처 추가 버튼시
-	$('#btnSupplyAdd').on('click' , function (){
-		cfnOpenCompanyListPopup("fnSetPopupComapnyInfo");
-	});
-
-	// 공급업체 설정 / 업체 추가 콜백함수
-	var fnSetPopupComapnyInfo = function(result) {
-		// 기존 리스트 데이터 for
-		for(let i = 0 ; i < result.length ; i++) {
-			let addChk = true, gridListValue = gagaAgGrid.getAllRowData(supplyGridOptions);		// 받아온 모든 데이터
-
-			// 받아온 data for
-			for(let j = 0 ; j < gridListValue.length ; j++) {
-				// 동일한 data는 추가하지 않음
-				if(gridListValue[j].supplyCompCd == result[i].supplyCompCd) {	addChk = false;	}		// 중복체크
-			}
-
-			// 중복되지 않은 데이터 리스트에 추가
-			if(addChk) {
-				gagaAgGrid.addRowData(supplyGridOptions, {"supplyCompCd" : result[i].supplyCompCd, "supplyCompNm" : result[i].supplyCompNm});
-			}
-		}
-	};
-
-	// 적용대상 - 공급처 삭제시시
-	$('#btnSupplyDel').on('click' , function () {
-		supplyGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(supplyGridOptions)});
-	});
-
-	// 적용대상 - 카테고리 추가시
-	$('#btnCateAdd').on('click' , function () {
-		cfnOpenCategoryPopup("fnSetPopupCategoryInfo");
-	});
-
-	// 카테고리 추가 콜백 함수
-	var fnSetPopupCategoryInfo = function (result) {
-		// 기존 리스트 데이터 for
-		for(let i = 0 ; i < result.length ; i++) {
-			let addChk = true, gridListValue = gagaAgGrid.getAllRowData(cateGridOptions);		// 받아온 모든 데이터
-
-			// 받아온 data for
-			for(let j = 0 ; j < gridListValue.length ; j++) {
-				// 동일한 data는 추가하지 않음
-				if(gridListValue[j].supplyCompCd == result[i].supplyCompCd) {	addChk = false;	}		// 중복체크
-			}
-
-			// 중복되지 않은 데이터 리스트에 추가
-			if(addChk) {
-				gagaAgGrid.addRowData(cateGridOptions, {"supplyCompCd" : result[i].supplyCompCd, "supplyCompNm" : result[i].supplyCompNm});
-			}
-		}
-	}
-
-	// 적용대상 - 카테고리 삭제시
-	$('#btnCateDel').on('click' , function () {
-		cateGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(cateGridOptions)});
-	});
-
-	// 적용대상 - 상품 추가시
-	$('#btnGoodsAdd').on('click' , function () {
-		cfnOpenGoodsPopup("fnSetPopupApplyGoodsInfo");
-	});
-
-	// 적용 상품 리스트 콜백함수
-	var fnSetPopupApplyGoodsInfo = function(result) {
-		gridAddGoodsList(goodsGridOptions, result , "apply");
-	};
-
-	// 적용대상 - 상품 삭제 시
-	$('#btnGoodsDel').on('click' , function () {
-		goodsGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(goodsGridOptions)});
-	});
-
-	// 적용대상 - 제외상품 추가시
-	$('#btnExcepGoodsAdd').on('click' , function(){
-		gridAddGoodsList(excepGoodsGridOptions, result , "except");
-	});
-
-	$('#btnExcepGoodsDel').on('click' , function () {
-		excepGoodsGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(excepGoodsGridOptions)});
-	});
-
-	// ag-grid 상품관련 list 콜백함수
-	function gridAddGoodsList(OriginGridListOption, result, gubun) {
-		var goodsGbVal = "G800_10";
-		if(gubun == 'except'){
-			goodsGbVal = "G800_30";
-		}
-
-		for(let i = 0 ; i < result.length ; i++) {
-			let addChk = true, gridListValue = gagaAgGrid.getAllRowData(OriginGridListOption);		// 받아온 모든 데이터
-
-			// 받아온 data for
-			for(let j = 0 ; j < gridListValue.length ; j++) {
-				if(gridListValue[j].goodsCd == result[i].goodsCd) {	addChk = false;	}				// 중복체크
-			}
-
-			// 중복되지 않은 데이터 리스트에 추가
-			if(addChk) {
-				//gagaAgGrid.addRowData(OriginGridListOption, result[i], "goodsCd");
-				gagaAgGrid.addRowData(OriginGridListOption, {"goodsGb": goodsGbVal, "goodsCd" : result[i].goodsCd, "goodsNm" : result[i].goodsNm});
-			}
-		}
-	}
-
-	// 기간 일수 변경시
-	function pdGbChange(pThis){
-		var selectVal = $(pThis).val();
-
-		if(typeof selectVal == "undefined") {
-			selectVal = "P";
-		}
-
-		if(selectVal == "P") {
-			$('.availDateTr').css('display' , '');
-			$('.availDayTr').css('display' , 'none');
-			$('#couponCreateForm #availDays').attr('required' , false);
-			$('#couponCreateForm #availStDay').attr('required' , true);
-			$('#couponCreateForm #availEdDay').attr('required' , true);
-			$('#couponCreateForm #availStdt').attr('required' , true);
-			$('#couponCreateForm #availEddt').attr('required' , true);
-		} else {
-			$('.availDateTr').css('display' , 'none');
-			$('.availDayTr').css('display' , '');
-			$('#couponCreateForm #availDays').attr('required' , true);
-			$('#couponCreateForm #availStDay').attr('required' , false);
-			$('#couponCreateForm #availEdDay').attr('required' , false);
-			$('#couponCreateForm #availStdt').attr('required' , false);
-			$('#couponCreateForm #availEddt').attr('required' , false);
-		}
-	}
-
-	// 첫구매여부 변경시
-	function firstYnChange(pThis){
-		var selectVal = $(pThis).val();
-
-		if(typeof selectVal == "undefined") {
-			selectVal = "N";
-		}
-
-		if(selectVal == "Y" ) {
-			$('.buyDateTr').css('display' , '');
-			$('#buyStdt').attr('required' , true);
-			$('#buyEddt').attr('required' , true);
-		} else {
-			$('.buyDateTr').css('display' , 'none');
-			$('#buyStdt').attr('required' , false);
-			$('#buyEddt').attr('required' , false);
-		}
-	}
-
-	// 신규회원여부 변경시
-	function custJoinYnChange(pThis){
-		var selectVal = $(pThis).val();
-
-		if(typeof selectVal == "undefined") {
-			selectVal = "N";
-		}
-
-		if(selectVal == "Y" ) {
-			$('.custJoinDateTr').css('display' , '');
-			$('#custJoinStdt').attr('required' , true);
-			$('#custJoinEddt').attr('required' , true);
-		} else {
-			$('.custJoinDateTr').css('display' , 'none');
-			$('#custJoinStdt').attr('required' , false);
-			$('#custJoinEddt').attr('required' , false);
-		}
-	}
-
-	// 행추가시
-	$('#btnAddRow').on('click' , function(){
-		var data = { supplyCompCd: null , burdenRate : null , delYn : null};
-		gagaAgGrid.addRowData(inComGridOptions , data , "supplyCompCd" );
-	});
-
-	// 쿠폰번호 자동생성 클릭시
-	function clickCreateChk(){
-		var flag = $('#couponCreateForm input[name=cpnCreateType]').prop("checked");
-
-		if(!flag) {
-			$("#couponCreateForm input[name=cpnId]").prop("disabled", true);
-			$("#couponCreateForm input[name=cpnId]").attr("required", false);
-			$("#couponCreateForm input[name=cpnId]").attr("placeholder", "자동생성");
-			$('#couponCreateForm input[name=cpnCreateType]').prop("checked" , false);
-		} else{
-			$("#couponCreateForm input[name=cpnId]").prop("disabled", false);
-			$("#couponCreateForm input[name=cpnId]").attr("required", true);
-			$("#couponCreateForm input[name=cpnId]").attr("placeholder", "");
-			$('#couponCreateForm input[name=cpnCreateType]').prop("checked" , true);
-		}
-	}
-
-	// 전송시 값 세팅
-	function setReqValue(){
-		// 쿠폰유형값 세팅
-		$('#couponCreateForm #cpnType').val($('#couponCreateForm input:radio[name="rdoCpnType"]:checked').val());
-		// 할인방식값 세팅
-		$('#couponCreateForm #dcWay').val($('#couponCreateForm input:radio[name="rdoDcWay"]:checked').val());
-		// 적용범위값 세팅
-		$('#couponCreateForm #applyScope').val($('#couponCreateForm input:radio[name="rdoApplyScope"]:checked').val());
-		// 다운로드기간 세팅
-		$('#couponCreateForm #downStdt').val($('#couponCreateForm #downStDay').val() + " " + $('#couponCreateForm #downStHH').val() + ":" + $('#couponCreateForm #downStMM').val() + ":00");
-		$('#couponCreateForm #downEddt').val($('#couponCreateForm #downEdDay').val() + " " + $('#couponCreateForm #downEdHH').val() + ":" + $('#couponCreateForm #downEdMM').val() + ":59");
-		// 유효기간 세팅
-		$('#couponCreateForm #availStdt').val($('#couponCreateForm #availStDay').val() + " " + $('#couponCreateForm #availStHH').val() + ":" + $('#couponCreateForm #availStMM').val() + ":00");
-		$('#couponCreateForm #availEddt').val($('#couponCreateForm #availEdDay').val() + " " + $('#couponCreateForm #availEdHH').val() + ":" + $('#couponCreateForm #availEdMM').val() + ":59");
-		// 첫구매기간세팅
-		$('#couponCreateForm #buyStdt').val($('#couponCreateForm #buyStDay').val() + " " + $('#couponCreateForm #buyStHH').val() + ":" + $('#couponCreateForm #buyStMM').val() + ":00");
-		$('#couponCreateForm #buyEddt').val($('#couponCreateForm #buyEdDay').val() + " " + $('#couponCreateForm #buyEdHH').val() + ":" + $('#couponCreateForm #buyEdMM').val() + ":59");
-		// 신규회원기간 세팅
-		$('#couponCreateForm #custJoinStdt').val($('#couponCreateForm #custJoinStDay').val() + " " + $('#couponCreateForm #custJoinStHH').val() + ":" + $('#couponCreateForm #custJoinStMM').val() + ":00");
-		$('#couponCreateForm #custJoinEddt').val($('#couponCreateForm #custJoinEdDay').val() + " " + $('#couponCreateForm #custJoinEdHH').val() + ":" + $('#couponCreateForm #custJoinEdMM').val() + ":59");
-		// 적용대상 - 공급처 그리드 전체값 세팅
-		var supplyAllData = gagaAgGrid.getAllRowData(supplyGridOptions);
-		var jsonSupplyCompData = JSON.stringify(supplyAllData);
-		$('#couponCreateForm #supplyCompList').val(jsonSupplyCompData);
-		// 적용대상 - 브랜드 그리드 전체값 세팅
-		var brandAllData = gagaAgGrid.getAllRowData(brandGridOptions);
-		var jsonBrandData = JSON.stringify(brandAllData);
-		$('#couponCreateForm #brandList').val(jsonBrandData);
-		// // 적용대상 - 카테고리 그리드 전체값 세팅
-		var cateAllData = gagaAgGrid.getAllRowData(cateGridOptions);
-		var jsonCateData = JSON.stringify(cateAllData);
-		$('#couponCreateForm #cateList').val(jsonCateData);
-		// 적용대상 - 적용상품 그리드 전체값 세팅
-		var goodsAllData = gagaAgGrid.getAllRowData(goodsGridOptions);
-		var jsonGoodsData = JSON.stringify(goodsAllData);
-		$('#couponCreateForm #applyGoodsList').val(jsonGoodsData);
-		// 적용대상 - 제외상품 그리드 전체값 세팅
-		var exceptGoodsAllData = gagaAgGrid.getAllRowData(excepGoodsGridOptions);
-		var jsonExceptGoodsData = JSON.stringify(exceptGoodsAllData);
-		$('#couponCreateForm #excepGoodsList').val(jsonExceptGoodsData);
-		// 입점업체분담율 그리드 전체값 세팅
-		var inCompBurdenAllData = gagaAgGrid.getAllRowData(inComGridOptions);
-		var jsonInCompBurdenData = JSON.stringify(inCompBurdenAllData);
-		$('#couponCreateForm #burdenList').val(jsonInCompBurdenData);
-
-	}
-
-	$(document).ready(function() {
-		// 초기화시 데이터 세팅
-		$('input[name=rdoCpnType]').eq(0).attr("checked" , true);
-		$('input[name=rdoDcWay]').eq(0).attr("checked" , true);
-		$('input[name=rdoApplyScope]').eq(0).attr("checked" , true)
-		$('#couponCreateForm #availEdHH option:last').attr("selected" , "selected");
-		$('#couponCreateForm #availEdMM option:last').attr("selected" , "selected");
-		$('#downEdHH option:last').attr("selected" , "selected");
-		$('#downEdMM option:last').attr("selected" , "selected");
-		$('#custJoinEdHH option:last').attr("selected" , "selected");
-		$('#custJoinEdMM option:last').attr("selected" , "selected");
-		$('#buyEdHH option:last').attr("selected" , "selected");
-		$('#buyEdMM option:last').attr("selected" , "selected");
-
-		pdGbChange();
-		firstYnChange();
-		custJoinYnChange();
-
-		gagaAgGrid.createGrid('inComGridList', inComGridOptions);
-		gagaAgGrid.createGrid('brandGridList' , brandGridOptions);
-		gagaAgGrid.createGrid('cateGridList' , cateGridOptions);
-		gagaAgGrid.createGrid('supplyGridList' , supplyGridOptions);
-		gagaAgGrid.createGrid('goodsGridList' , goodsGridOptions);
-		gagaAgGrid.createGrid('excepGoodsGridList' , excepGoodsGridOptions);
-
-	});
-
-	/*]]>*/
-</script>
-</html>

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

@@ -154,7 +154,9 @@
 				valueParser: function (params) { return gagaAgGrid.lookupKey(siteCdList, params.newValue); }
 			},
 			{headerName: "쿠폰ID", field: "cpnId", width: 130, cellClass: 'text-center'},
-			{headerName: "쿠폰명", field: "cpnNm", width: 140, cellClass: 'text-center'},
+			{headerName: "쿠폰명", field: "cpnNm", width: 140, cellClass: 'text-center' , cellRenderer: function (params) {
+				return "<a href=\"javascript:void(0);\" onclick=\"cfnCouponCreatePopup('" + params.data.cpnId + "');\">" + params.value + "</a>";
+			}},
 			{headerName: "사용가능고객구분", field: "usableCustGb", width: 140, cellClass: 'text-center' ,
 				cellEditor: 'agRichSelectCellEditor',
 				cellEditorParams: { values: gagaAgGrid.extractValues(usableCustGbList) },
@@ -173,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' ,
@@ -197,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) {
@@ -210,20 +225,9 @@
 
 		// 쿠폰등록 팝업창
 		function fnCouponCreateForm(){
-			cfnCouponCreatePopup();
+			cfnCouponCreatePopup('');
 		}
 
-		// Row Click
-		/*
-        gridOptions.onCellClicked = function(event) {
-            var goodsCd = event.data.goodsCd;
-            if (event.colDef.field == "freeGiftName"){
-                // 수ㅜ정 필요
-                // cfnOpenGoodsDetailPopup('U',goodsCd);
-            }
-        }
-        */
-
 		// 초기화 클릭시
 		$('#btnInit').on('click', function() {
 			$('#searchForm')[0].reset();

+ 1432 - 0
src/main/webapp/WEB-INF/views/marketing/CouponPopupForm.html

@@ -0,0 +1,1432 @@
+<!DOCTYPE html>
+<html lang="ko"
+	  xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : CouponPopupForm.html
+ * @desc    : 쿠폰 등록 팝업 화면
+ *============================================================================
+ * ISTYLE24
+ * Copyright(C) 2020 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2020.12.23   xyzp1539       최초 작성
+ *******************************************************************************
+ -->
+<div class="modalPopup" data-width="1200">
+	<div class="panelStyle" >
+		<div class="panelTitle">
+			<h2 th:text="${'쿠폰 ' + (mode == 'N' ? '등록' : '수정')}">쿠폰등록</h2>
+			<button type="button" class="close" onclick="uifnPopupClose('CouponRegForm')"><i class="fa fa-times"></i></button>
+		</div>
+		<div class="panelContent">
+			<form id="CouponForm" name="CouponForm" action="#" th:action="@{'/marketing/coupon/save'}" >
+				<input type="hidden" name="supplyCompList" id="supplyCompList">
+				<input type="hidden" name="brandList" id="brandList">
+				<input type="hidden" name="applyGoodsList" id="applyGoodsList">
+				<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">
+						<ul>
+							<li class="on"><a href="#coupontab1">기본정보</a></li>
+							<li><a href="#coupontab2">적용대상</a></li>
+							<li><a href="#coupontab3">입점업체분담율</a></li>
+						</ul>
+					</div>
+					<ul class="tabsCont">
+						<li class="tab on" id="coupontab1">
+							<div class="panelStyle">
+								<table class="frmStyle">
+									<colgroup>
+										<col style="width:10%">
+										<col style="width:40%;">
+										<col style="width:10%">
+										<col style="width:40%;">
+									</colgroup>
+									<tbody>
+										<tr>
+											<th>쿠폰번호<em class="required" title="필수"></em></th>
+											<td colspan="5">
+												<input type="hidden" name="copyCpnId" maxlength="50" value="">
+												<input type="text" name="cpnId" id="cpnId" maxlength="50"  style="width:70%;" disabled="true" readonly="readonly" placeholder="자동생성" data-valid-name="쿠폰번호">
+												<label class="chkBox checked" onclick="clickCreateChk(this);">
+													<input type="checkbox" name="cpnCreateType" value="true" class="type-check" checked />쿠폰번호 자동생성
+												</label>
+											</td>
+										</tr>
+										<tr>
+											<th>쿠폰명<em class="required" title="필수"></em></th>
+											<td colspan="5">
+												<input type="text" name="cpnNm" id="cpnNm" style="width: 70%;" required="required" data-valid-name="쿠폰명">
+											</td>
+										</tr>
+										<tr>
+											<th>쿠폰유형<em class="required" title="필수"></em></th>
+											<td colspan="5">
+												<input type="hidden" id="cpnType" name="cpnType" required="required"  data-valid-name="쿠폰유형">
+												<label class="rdoBtn" th:if="${cpnTypeList}" th:each="oneData, status : ${cpnTypeList}"> <input type="radio" name="rdoCpnType"  th:text="${oneData.cdNm}" th:value="${oneData.cd}"/></label>
+											</td>
+										</tr>
+										<tr>
+											<th>사용가능고객구분<em class="required" title="필수"></em></th>
+											<td>
+												<select name="usableCustGb" id="usableCustGb" required="required" data-valid-name="사용가능고객구분">
+													<option th:if="${usableCustGbList}" th:each="oneData , status : ${usableCustGbList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+												</select>
+											</td>
+											<th>사이트<em class="required" title="필수"></em></th>
+											<td>
+												<select name="siteCd" id="siteCd" required="required" data-valid-name="사이트">
+													<option th:if="${siteCdList}" th:each="oneData , status : ${siteCdList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+												</select>
+											</td>
+										</tr>
+										<tr>
+											<th>사용고객등급구분<em class="required" title="필수"></em></th>
+											<td>
+												<select name="usableCustGrade" id="usableCustGrade" required="required" data-valid-name="사용고객등급구분">
+													<option value="ALL">[전체]</option>
+													<option th:if="${usableCustGradeList}" th:each="oneData , status : ${usableCustGradeList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+												</select>
+											</td>
+											<th>만료알림여부<em class="required" title="필수"></em></th>
+											<td>
+												<select name="endAlimYn" id="endAlimYn" required="required" data-valid-name="만료알림여부">
+													<option value="Y">Y</option>
+													<option value="N" selected="selected">N</option>
+												</select>
+											</td>
+										</tr>
+										<tr>
+											<th>할인방식<em class="required" title="필수"></em></th>
+											<td>
+												<input type="hidden" name="dcWay" id="dcWay" required="required" data-valid-name="할인방식">
+												<label class="rdoBtn" th:if="${dcWayList}" th:each="oneData, status : ${dcWayList}"> <input type="radio" name="rdoDcWay"  th:text="${oneData.cdNm}" th:value="${oneData.cd}"/></label>
+											</td>
+											<th>구매제한금액<em class="required" title="필수"></em></th>
+											<td>
+												<input type="text" id="buyLimitAmt" name="buyLimitAmt" class="w200" required="required" value="0" style="text-align: right;" data-valid-name="구매제한금액" data-valid-type="numeric">원
+											</td>
+										</tr>
+										<tr>
+											<th>할인값(PC)<em class="required" title="필수"></em></th>
+											<td>
+												<input type="text" class="w200" id="dcPval" name="dcPval" value="0" required="required" data-valid-name="할인값(PC)" data-valid-type="numeric" style="text-align: right"><span id="dcPvalSpan">원</span>
+											</td>
+											<th>할인값(모바일웹)<em class="required" title="필수"></em></th>
+											<td>
+												<input type="text" class="w200" id="dcMval" name="dcMval" value="0" required="required" data-valid-name="할인값(모바일웹)" data-valid-type="numeric" style="text-align: right"><span id="dcMvalSpan">원</span>
+											</td>
+										</tr>
+										<tr>
+											<th>할인값(모바일앱)<em class="required" title="필수"></em></th>
+											<td>
+												<input type="text" class="w200" id="dcAval" name="dcAval" value="0" required="required" data-valid-name="할인값(모바일앱)" data-valid-type="numeric" style="text-align: right"><span id="dcAvalSpan">원</span>
+											</td>
+											<th>최대할인금액<em class="required" title="필수"></em></th>
+											<td>
+												<input type="text" class="w200" id="maxDcAmt" name="maxDcAmt" value="0" required="required" data-valid-name="최대할인금액" data-valid-type="numeric" style="text-align: right;"><span id="maxDcAmtSpan">원</span>
+											</td>
+										</tr>
+										<tr>
+											<th>다운로드시작일시<em class="required" title="필수"></em></th>
+											<td>
+												<input type="hidden" name="downStdt" id="downStdt" required="required" data-valid-name="다운로드시작일시">
+												<input type="text" class="schDate w100" name="downStDay" id="downStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
+												<select name="downStHH" id="downStHH">
+													<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+												<select name="downStMM" id="downStMM">
+													<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+											<th>다운로드종료일시<em class="required" title="필수"></em></th>
+											<td>
+												<input type="hidden" id="downEddt" name="downEddt" required="required" data-valid-name="다운로드종료일시">
+												<input type="text" class="schDate w100" name="downEdDay" id="downEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
+												<select name="downEdHH" id="downEdHH">
+													<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+												<select name="downEdMM" id="downEdMM">
+													<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="pdGb" id="pdGb" onchange="pdGbChange(this)" required="required" data-valid-name="기간/일수구분">
+													<option value="P">기간</option>
+													<option value="D">일수</option>
+												</select>
+											</td>
+											<th>적용범위<em class="required" title="필수"></em></th>
+											<td>
+												<input type="hidden" name="applyScope" id="applyScope" required="required" data-valid-name="적용범위">
+												<label class="rdoBtn"> <input type="radio" name="rdoApplyScope" value="A"/>전체</label>
+												<label class="rdoBtn"> <input type="radio" name="rdoApplyScope" value="I"/>개별</label>
+											</td>
+										</tr>
+										<tr class="availDayTr" style="display: none;">
+											<th>유효기간일수<em class="required" title="필수"></em></th>
+											<td>
+												<input type="text" name="availDays" id="availDays" class="w200" data-valid-name="유효기간일수">
+											</td>
+										</tr>
+										<tr>
+											<th class="availDateTr">유효기간시작일시<em class="required" title="필수"></em></th>
+											<td class="availDateTr">
+												<input type="hidden" name="availStdt" id="availStdt" data-valid-name="유효기간시작일시">
+												<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="유효기간종료일시">
+												<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="firstYn" id="firstYn" onchange="firstYnChange(this)" required="required" data-valid-name="첫구매여부">
+													<option value="Y">Y</option>
+													<option value="N" selected="selected">N</option>
+												</select>
+											</td>
+											<th>다운로드가능여부<em class="required" title="필수"></em></th>
+											<td>
+												<select name="downYn" id="downYn" required="required" data-valid-name="다운로드가능여부">
+													<option value="Y">Y</option>
+													<option value="Y" selected="selected">N</option>
+												</select>
+											</td>
+										</tr>
+										<tr>
+											<th class="buyDateTr">첫구매기간시작일시<em class="required" title="필수"></em></th>
+											<td class="buyDateTr">
+												<input type="hidden" id="buyEddt" name="buyEddt" data-valid-name="첫구매기간종료일시">
+												<input type="text" class="schDate w100" name="buyStDay" id="buyStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
+												<select name="buyStHH" id="buyStHH">
+													<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+												<select name="buyStMM" id="buyStMM">
+													<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+											<th class="buyDateTr">첫구매기간종료일시<em class="required" title="필수"></em></th>
+											<td class="buyDateTr">
+												<input type="hidden" name="buyStdt" id="buyStdt" data-valid-name="첫구매기간시작일시">
+												<input type="text" class="schDate w100" name="buyEdDay" id="buyEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
+												<select name="buyEdHH" id="buyEdHH">
+													<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+												<select name="buyEdMM" id="buyEdMM">
+													<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="custJoinYn" id="custJoinYn" onchange="custJoinYnChange(this)" required="required" data-valid-name="신규회원여부">
+													<option value="Y">Y</option>
+													<option value="N" selected="selected">N</option>
+												</select>
+											</td>
+											<th>총발행제한수량<em class="required" title="필수"></em></th>
+											<td>
+												<input type="text" class="w200" name="totPubLimitQty" id="totPubLimitQty" value="0" required="required" data-valid-name="총발행제한수량" data-valid-type="numeric" style="text-align: right;">개<span class="cRed" id="totPubLimitQtySpan"> *제한없음</span>
+											</td>
+										</tr>
+										<tr>
+											<th class="custJoinDateTr">신규회원기간시작일시<em class="required" title="필수"></em></th>
+											<td class="custJoinDateTr">
+												<input type="hidden" name="custJoinStdt" id="custJoinStdt" data-valid-name="신규회원기간시작일시">
+												<input type="text" class="schDate w100" name="custJoinStDay" id="custJoinStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
+												<select name="custJoinStHH" id="custJoinStHH">
+													<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+												<select name="custJoinStMM" id="custJoinStMM">
+													<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+											<th class="custJoinDateTr">신규회원기간종료일시<em class="required" title="필수"></em></th>
+											<td class="custJoinDateTr">
+												<input type="hidden" id="custJoinEddt" name="custJoinEddt" data-valid-name="신규회원기간종료일시">
+												<input type="text" class="schDate w100" name="custJoinEdDay" id="custJoinEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
+												<select name="custJoinEdHH" id="custJoinEdHH">
+													<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+												<select name="custJoinEdMM" id="custJoinEdMM">
+													<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+											</td>
+										</tr>
+										<tr>
+											<th>1인당발행제한수량<em class="required" title="필수"></em></th>
+											<td>
+												<input type="text" class="w200" name="custPubLimitQty" id="custPubLimitQty" value="0" required="required" data-valid-name="1인당발행제한수량" data-valid-type="numeric" style="text-align: right;">개<span class="cRed" id="custPubLimitQtySpan"> *제한없음</span>
+											</td>
+											<th>1회발행수량<em class="required" title="필수"></em></th>
+											<td><input type="text" class="w200" name="onePubQty" id="onePubQty" value="1" required="required" data-valid-name="1회발행수량" data-valid-type="numeric" style="text-align: right;">개</td>
+										</tr>
+										<tr>
+											<th>재발급여부<em class="required" title="필수"></em></th>
+											<td>
+												<select name="reissuance" id="reissuance" required="required" data-valid-name="재발급여부" >
+													<option th:if="${reissuanceList}" th:each="oneData , status : ${reissuanceList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+												</select>
+											</td>
+											<th>다운로드구분<em class="required" title="필수"></em></th>
+											<td>
+												<select name="dnGb" id="dnGb" required="required" data-valid-name="다운로드구분">
+													<option th:if="${dnGbList}" th:each="oneData , status:${dnGbList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+												</select>
+											</td>
+										</tr>
+										<tr class="payTypeTr" style="display: none;">
+											<th>결제수단<em class="required" title="필수"></em></th>
+											<td colspan="5">
+												<select name="payType" id="payType" data-valid-name="결제수단">
+													<option value="">[전체]</option>
+													<option th:if="${payTypeList}" th:each="oneData , status : ${payTypeList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+												</select>
+											</td>
+										</tr>
+										<tr>
+											<th>쿠폰상태<em class="required" title="필수"></em></th>
+											<td>
+												<select name="cpnStat" id="cpnStat" data-valid-name="쿠폰상태" required="required">
+													<option th:if="${cpnStatList}" th:each="oneData , status : ${cpnStatList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+												</select>
+											</td>
+											<th>제휴링크코드<em class="required" title="필수"></em></th>
+											<td>
+												<select name="afChannel" id="afChannel" onchange="fnChangeAfLinkCdList()" data-valid-name="제휴링크코드" required="required">
+													<option th:if="${upperAfLinkCdList}" th:each="oneData , status : ${upperAfLinkCdList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+												</select>
+												<select name="afLinkCd" id="afLinkCd">
+												</select>
+											</td>
+										</tr>
+									</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>
+							</div>
+						</li>
+						<!-- 쿠폰적용대상-->
+						<li class="tab" id="coupontab2" >
+							<div class="panelStyle">
+								<div class="inner-panelContent">
+									<div class="panelContent">
+										<div class="panelBar">
+											<h4>적용 대상 상품 등록</h4>
+										</div>
+										<table class="frmStyle">
+											<colgroup>
+												<col style="width:15%;">
+												<col style="width:85%;">
+											</colgroup>
+											<tbody>
+												<tr>
+													<th>공급처</th>
+													<td>
+														<div class="padding10 inner-tb-solid">
+															<button type="button" class="btn btnRight btn-success btn-lg" id="btnSupplyAdd">공급처 추가</button>
+															<button type="button" class="btn btnRight btn-success btn-lg" id="btnSupplyDel">선택삭제</button>
+															<br/>
+															<div id="supplyGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
+														</div>
+													</td>
+												</tr>
+												<tr>
+													<th>브랜드</th>
+													<td>
+														<div class="padding10 inner-tb-solid">
+															<button type="button" class="btn btnRight btn-success btn-lg" id="btnBrandAdd">브랜드 추가</button>
+															<button type="button" class="btn btnRight btn-success btn-lg" id="btnBrandDel">선택삭제</button>
+															<br/>
+															<div id="brandGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
+														</div>
+													</td>
+												</tr>
+												<tr>
+													<th>카테고리</th>
+													<td>
+														<div class="padding10 inner-tb-solid">
+															<button type="button" class="btn btnRight btn-success btn-lg" id="btnCateAdd">카테고리 추가</button>
+															<button type="button" class="btn btnRight btn-success btn-lg" id="btnCateDel">선택삭제</button>
+															<br/>
+															<div id="cateGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
+														</div>
+													</td>
+												</tr>
+												<tr>
+													<th>적용상품</th>
+													<td>
+														<div class="padding10 inner-tb-solid">
+															<button type="button" class="btn btnRight btn-success btn-lg" id="btnGoodsAdd">상품 추가</button>
+															<button type="button" class="btn btnRight btn-success btn-lg" id="btnGoodsDel">선택삭제</button>
+															<br/>
+															<div id="goodsGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
+														</div>
+													</td>
+												</tr>
+											</tbody>
+										</table>
+									</div>
+								</div>
+								<div class="inner-panelContent">
+									<div class="panelContent">
+										<div class="panelBar">
+											<h4>적용 대상 상품 등록</h4>
+										</div>
+										<table class="frmStyle">
+											<colgroup>
+												<col style="width:15%;">
+												<col style="width:85%;">
+											</colgroup>
+											<tbody>
+											<tr>
+												<th>제외상품</th>
+												<td>
+													<div class="padding10 inner-tb-solid">
+														<button type="button" class="btn btnRight btn-success btn-lg" id="btnExcepGoodsAdd">제외상품 추가</button>
+														<button type="button" class="btn btnRight btn-success btn-lg" id="btnExcepGoodsDel">선택삭제</button>
+														<br/>
+														<div id="excepGoodsGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
+													</div>
+												</td>
+											</tr>
+											</tbody>
+										</table>
+									</div>
+								</div>
+							</div>
+						</li>
+						<!-- 쿠폰적용대상끝-->
+						<!-- 입점업체분담율-->
+						<li class="tab" id="coupontab3">
+							<div class="panelStyle">
+								<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="btnDelRow">행삭제</button>
+									</li>
+								</ul>
+
+								<div id="inComGridList" style="width: 100%; height: 570px" class="ag-theme-balham"></div>
+
+							</div>
+						</li>
+						<!-- 입점업체분담끝-->
+					</ul>
+				</div>
+			</form>
+		</div>
+	</div>
+</div>
+<script th:inline="javascript">
+	/*<![CDATA[*/
+	// 상세조회 리스트
+	var mode = [[${mode}]];
+	var cpnDetail = [[${cpnDetail}]];
+	var cpnDtlRefvalSupplyCompList = [[${cpnDtlRefvalSupplyCompList}]];
+	var cpnDtlRefvalApplyGoodsList = [[${cpnDtlRefvalApplyGoodsList}]];
+	var cpnDtlRefvalCateList = [[${cpnDtlRefvalCateList}]];
+	var cpnDtlRefvalBrandList = [[${cpnDtlRefvalBrandList}]];
+	var cpnDtlRefvalExceptGoodsList = [[${cpnDtlRefvalExceptGoodsList}]];
+	var cpnDtlBurdenList = [[${cpnDtlBurdenList}]];
+	var issueCnt = [[${issueCnt}]];
+
+	// 공통코드 리스트
+	var ibSupplyComList = gagajf.convertToArray([[${ibSupplyCompList}]]);
+	var formalGbList = gagajf.convertToArray([[${formalGbList}]]);
+	var cateGbList = gagajf.convertToArray([[${cateGbList}]]);
+	var delYnList = { "Y":"Yes", "N":"No" };
+	var siteCdList = gagajf.convertToArray([[${siteCdList}]]);
+	var selfBrandList = gagajf.convertToArray([[${selfBrandList}]]);
+
+	// ag-grid 입점업체분담율 컬럼
+	var columnDefs = [
+		{ headerName: "입점업체" , field:"supplyCompCd" , width:150, cellClass:"text-center" ,
+			cellEditor: 'agRichSelectCellEditor',
+			cellEditorParams: { values: gagaAgGrid.extractValues(ibSupplyComList) },
+			valueFormatter: function (params) { return gagaAgGrid.lookupValue(ibSupplyComList, params.value); },
+			valueParser: function (params) { return gagaAgGrid.lookupKey(ibSupplyComList, params.newValue);}
+		} ,
+		{ headerName: "쿠폰분담율(%)", field:"burdenRate" , width:150, cellClass: "text-center" ,
+		  cellEditorParams: { maxlength: 10, required: true }
+		} ,
+		{ headerName: "삭제여부" , field: "delYn"  , width:150, cellClass: "text-center" ,
+			cellEditor: 'agRichSelectCellEditor',
+			cellEditorParams: { values: gagaAgGrid.extractValues(delYnList) },
+			valueFormatter: function (params) { return gagaAgGrid.lookupValue(delYnList, params.value); },
+			valueParser: function (params) { return gagaAgGrid.lookupKey(delYnList, params.newValue); }
+		} ,
+		{ headerName: "쿠폰번호"  , field: "cpnId" , width: 120 , cellClass: 'text-center' , hide:true}
+	];
+
+	// ag-grid 공급처 컬럼
+	var supplyColumnDefs = [
+		{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
+		{ headerName : "공급업체코드" , field: "supplyCompCd" , width:150, cellClass: 'text-center'} ,
+		{ headerName: "공급업체명" , field: "supplyCompNm" , width:150, cellClass: 'text-center'},
+		{ headerName: "쿠폰대상일련번호"  , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true}
+	];
+
+	// ag-grid 브랜드 컬럼
+	var brandSelColumnDefs = [
+		{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
+		{ headerName : "브랜드ID" , field: "brandCd" , width: 120, cellClass : 'text-center'} ,
+		{ headerName : "브랜드명" , field: "brandEnm" , width: 120, cellClass: 'text-center'} ,
+		{ headerName : "공급업체명", field: "supplyCompNm" , width: 150, cellClass: 'text-center' } ,
+		{ headerName: "쿠폰대상일련번호"  , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true}
+	];
+
+	// ag-grid 적용상품 컬럼
+	var goodsSelColumnDefs = [
+		{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: 250 , cellClass: 'text-center'} ,
+		{ headerName: "쿠폰대상일련번호"  , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true}
+	];
+
+	// ag-grid 카테고리 컬럼
+	var cateSelColumnDefs = [
+		{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
+		{ 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: "cateGb" , width: 100 , cellClass: 'text-center' ,
+			cellEditor: 'agRichSelectCellEditor',
+			cellEditorParams: { values: gagaAgGrid.extractValues(cateGbList) },
+			valueFormatter: function (params) { return gagaAgGrid.lookupValue(cateGbList, params.value); },
+			valueParser: function (params) { return gagaAgGrid.lookupKey(cateGbList, params.newValue); }
+		},
+		{ headerName: "카테고리코드" , field: "cateNo" , width: 100 , cellClass: 'text-center'} ,
+		{ headerName: "카테고리명" , field: "cateNm" , width: 120 , cellClass: 'text-center'},
+		{ headerName: "이월/정상구분" , field: "formalGb" , width: 120 , cellClass: 'text-center',
+			cellEditor: 'agRichSelectCellEditor',
+			cellEditorParams: { values: gagaAgGrid.extractValues(formalGbList) },
+			valueFormatter: function (params) { return gagaAgGrid.lookupValue(formalGbList, params.value); },
+			valueParser: function (params) { return gagaAgGrid.lookupKey(formalGbList, params.newValue); }
+		},
+		{ headerName: "브랜드명" , field:"brandCd" , width:150, cellClass: "text-center", required: true ,
+			editable: true, cellEditor: 'agRichSelectCellEditor',
+			cellEditorParams: { values: gagaAgGrid.extractValues(selfBrandList) },
+			valueFormatter: function (params) { return gagaAgGrid.lookupValue(selfBrandList, params.value); },
+			valueParser: function (params) { return gagaAgGrid.lookupKey(selfBrandList, params.newValue); }
+		},
+		{ headerName: "쿠폰대상일련번호"  , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true}
+	];
+
+	// ag-grid 제외상품 컬럼
+	var excepGoodsColumnDefs = [
+		{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: 250 , cellClass: 'text-center'} ,
+		{ headerName: "쿠폰대상일련번호"  , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true}
+	];
+
+	var inComGridOptions = gagaAgGrid.getGridOptions(columnDefs);
+	var cateGridOptions = gagaAgGrid.getGridOptions(cateSelColumnDefs);
+	var goodsGridOptions = gagaAgGrid.getGridOptions(goodsSelColumnDefs);
+	var brandGridOptions = gagaAgGrid.getGridOptions(brandSelColumnDefs);
+	var supplyGridOptions = gagaAgGrid.getGridOptions(supplyColumnDefs);
+	var excepGoodsGridOptions = gagaAgGrid.getGridOptions(excepGoodsColumnDefs);
+
+	inComGridOptions.defaultColDef.editable = true;
+	inComGridOptions.rowSelection = "multiple";
+	goodsGridOptions.rowSelection = "multiple";
+	supplyGridOptions.rowSelection = "multiple";
+	excepGoodsGridOptions.rowSelection = "multiple";
+	cateGridOptions.rowSelection = "multiple";
+	brandGridOptions.rowSelection = "multiple";
+	inComGridOptions.stopEditingWhenGridLosesFocus = true;
+
+	// 쿠폰 등록 버튼 클릭시
+	function fnCouponCreate(){
+		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');
+				});
+			}
+		});
+	}
+
+	// 쿠폰 수정 시
+	function fnCouponUpdate(){
+		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", "");
+				$("#CouponForm input[name=cpnId]").attr("readonly", false);
+
+				gagajf.ajaxFormSubmit($('#CouponForm').prop('action'), '#CouponForm', function() {
+					uifnPopupClose('CouponRegForm');
+					$('#btnSearch').trigger('click');
+				});
+			}
+		});
+	}
+
+	function checkValidation(){
+		//신규가입 지급한다면 validation 체크
+		if( $('#custJoinYn option:selected').val() == "Y" ){
+			var fromDate = $('#CouponForm input[name=custJoinStdt]').val();
+			var toDate = $('#CouponForm input[name=custJoinEddt]').val();
+
+			if (gagajf.isNull(fromDate) || gagajf.isNull(toDate)) {
+				mcxDialog.alertC("신규가입기간 시작일자와 종료일자를 입력하세요.", {
+					sureBtnText: "확인",
+					sureBtnClick: function() {
+						$('#CouponForm input[name=custJoinStdt]').focus();
+					}
+				});
+				return false;
+			}
+
+			if (fromDate > toDate) {
+				mcxDialog.alertC("등록 시작일자는 종료일자 보다 클 수 없습니다.", {
+					sureBtnText: "확인",
+					sureBtnClick: function() {
+						$('#CouponForm input[name=custJoinEddt]').focus();
+					}
+				});
+				return false;
+			}
+		}
+
+		// 첫구매 지급하면 validation 체크
+		if( $('#firstYn option:selected').val() == "Y" ){
+			var fromDate = $('#CouponForm input[name=buyStdt]').val();
+			var toDate = $('#CouponForm input[name=buyEddt]').val();
+
+			if (gagajf.isNull(fromDate) || gagajf.isNull(toDate)) {
+				mcxDialog.alertC("신규가입기간 시작일자와 종료일자를 입력하세요.", {
+					sureBtnText: "확인",
+					sureBtnClick: function() {
+						$('#CouponForm input[name=buyStdt]').focus();
+					}
+				});
+				return false;
+			}
+
+			if (fromDate > toDate) {
+				mcxDialog.alertC("등록 시작일자는 종료일자 보다 클 수 없습니다.", {
+					sureBtnText: "확인",
+					sureBtnClick: function() {
+						$('#CouponForm input[name=buyEddt]').focus();
+					}
+				});
+				return false;
+			}
+		}
+
+		// 할인율 validation 체크 (100을 넘길수없음)
+		if($('#dcWay').val() == 'G240_11') {
+			if($('#dcPval').val() > 100) {
+				mcxDialog.alert('PC할인율은 100을 초과할수없습니다.');
+				$('#dcPval').focus();
+				return false;
+			} else if( $('#dcMval').val() > 100) {
+				mcxDialog.alert('모바일(웹)할인율은 100을 초과할수없습니다.');
+				$('#dcMval').focus();
+				return false;
+			}  else if( $('#dcAval').val() > 100) {
+				mcxDialog.alert('모바일(앱)할인율은 100을 초과할수없습니다.');
+				$('#dcAval').focus();
+				return false;
+			}
+		}
+	}
+
+	// 할인방식 변경
+	$("#CouponForm input[name=rdoDcWay]").bind('click change', function () {
+		var radioValue = $(this).val();
+		//발급이력이있으면 수정안됨
+		if(issueCnt > 0 ) {
+			return false;
+		}
+
+		if(radioValue == 'G240_10') {
+			$('#dcPvalSpan').text("원");
+			$('#dcMvalSpan').text("원");
+			$('#dcAvalSpan').text("원");
+		} else {
+			$('#dcPvalSpan').text("%");
+			$('#dcMvalSpan').text("%");
+			$('#dcAvalSpan').text("%");
+		}
+	});
+
+	// 쿠폰 상태 변경
+	$("#CouponForm input[name=rdoCpnType]").bind('click change', function () {
+		var radioValue = $(this).val();
+
+		if(mode == "U") {
+			radioValue = cpnDetail.cpnType;
+		}
+		// 상품쿠폰 선택시 적용범위 개별로 변경 나머진 전체
+		if(radioValue == 'G230_11') {
+			$("input:radio[name='rdoApplyScope']:radio[value='I']").prop('checked', true);
+		} else {
+			$("input:radio[name='rdoApplyScope']:radio[value='A']").prop('checked', true);
+		}
+
+		// 주문서 쿠폰 선택시 결제수단 노출
+		if(radioValue == 'G230_20') {
+			$('.payTypeTr').css('display' , '');
+			$('#CouponForm #payType').attr('required' , true);
+		} else {
+			$('.payTypeTr').css('display' , 'none');
+			$('#CouponForm #payType').attr('required' , false );
+		}
+
+		$('#CouponForm #cpnType').val(radioValue);
+	});
+
+	// 적용대상 - 브랜드 추가 버튼시
+	$('#btnBrandAdd').on('click' , function(){
+		cfnOpenBrandListPopup("fnSetPopupBrandInfo", "M");
+	});
+
+	// 브랜드 설정 / 브랜드 추가 콜백함수 (단수로 가져오므로 복수일 경우에 수정 확인 필요)
+	var fnSetPopupBrandInfo = function(result) {
+		for(let i = 0 ; i < result.length ; i++) {
+			let addChk = true, gridListValue = gagaAgGrid.getAllRowData(brandGridOptions);		// 받아온 모든 데이터
+
+			// 받아온 data for
+			for(let j = 0 ; j < gridListValue.length ; j++) {
+				if(gridListValue[j].brandCd == result[i].brandCd) {	addChk = false;	}					// 중복체크
+			}
+
+			// 중복되지 않은 데이터 리스트에 추가
+			if(addChk) {
+				gagaAgGrid.addRowData(brandGridOptions, {"brandCd" : result[i].brandCd, "brandEnm" : result[i].brandEnm, "supplyCompNm" : result[i].supplyCompNm});
+			}
+		}
+	};
+
+	// 적용대상 - 브랜드 삭제 버튼시
+	$('#btnBrandDel').on('click' , function(){
+		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)});
+		}
+	});
+
+	// 적용대상 - 공급처 추가 버튼시
+	$('#btnSupplyAdd').on('click' , function (){
+		cfnOpenCompanyListPopup("fnSetPopupComapnyInfo" , "M");
+	});
+
+	// 공급업체 설정 / 업체 추가 콜백함수
+	var fnSetPopupComapnyInfo = function(result) {
+		// 기존 리스트 데이터 for
+		for(let i = 0 ; i < result.length ; i++) {
+			let addChk = true, gridListValue = gagaAgGrid.getAllRowData(supplyGridOptions);		// 받아온 모든 데이터
+
+			// 받아온 data for
+			for(let j = 0 ; j < gridListValue.length ; j++) {
+				// 동일한 data는 추가하지 않음
+				if(gridListValue[j].supplyCompCd == result[i].supplyCompCd) {	addChk = false;	}		// 중복체크
+			}
+
+			// 중복되지 않은 데이터 리스트에 추가
+			if(addChk) {
+				gagaAgGrid.addRowData(supplyGridOptions, {"supplyCompCd" : result[i].supplyCompCd, "supplyCompNm" : result[i].supplyCompNm});
+			}
+		}
+	};
+
+	// 적용대상 - 공급처 삭제시시
+	$('#btnSupplyDel').on('click' , function () {
+		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)});
+		}
+	});
+
+	// 적용대상 - 카테고리 추가시
+	$('#btnCateAdd').on('click' , function () {
+		cfnOpenCategoryPopup("fnSetPopupCategoryInfo");
+	});
+
+	// 카테고리 추가 콜백 함수
+	var fnSetPopupCategoryInfo = function (result) {
+		// 기존 리스트 데이터 for
+		for(let i = 0 ; i < result.length ; i++) {
+			let addChk = true, gridListValue = gagaAgGrid.getAllRowData(cateGridOptions);		// 받아온 모든 데이터
+
+			// 받아온 data for
+			for(let j = 0 ; j < gridListValue.length ; j++) {
+				// 동일한 data는 추가하지 않음
+				if(gridListValue[j].cateNo == result[i].cateNo) {	addChk = false;	}		// 중복체크
+			}
+
+			// 중복되지 않은 데이터 리스트에 추가
+			if(addChk) {
+				gagaAgGrid.addRowData(cateGridOptions, {"siteCd":result[i].siteCd , "cateGb":result[i].cateGb , "cateNo":result[i].cateNo, "cateNm":result[i].cateNm , "formalGb":result[i].formalGb , "brandEnm":null});
+			}
+		}
+	}
+
+	// 적용대상 - 카테고리 삭제시
+	$('#btnCateDel').on('click' , function () {
+		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)});
+		}
+	});
+
+	// 적용대상 - 상품 추가시
+	$('#btnGoodsAdd').on('click' , function () {
+		cfnOpenGoodsPopup("fnSetPopupApplyGoodsInfo");
+	});
+
+	// 적용 상품 리스트 콜백함수
+	var fnSetPopupApplyGoodsInfo = function(result) {
+		gridAddGoodsList(goodsGridOptions, result , "apply");
+	};
+
+	// 적용대상 - 상품 삭제 시
+	$('#btnGoodsDel').on('click' , function () {
+		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(){
+		cfnOpenGoodsPopup("fnSetPopupExceptGoodsInfo");
+	});
+	// 적용 상품 리스트 콜백함수
+	var fnSetPopupExceptGoodsInfo = function(result) {
+		gridAddGoodsList(excepGoodsGridOptions, result , "except");
+	};
+
+	// 적용대상 - 제외상품 삭제시
+	$('#btnExcepGoodsDel').on('click' , function () {
+		var selectVal = excepGoodsGridOptions.api.getSelectedRows();
+
+		if(selectVal.length == 0) {
+			mcxDialog.alert("선택된 행이 없습니다");
+			return;
+		}
+
+		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()
+					};
+
+					var jsonData = JSON.stringify(data);
+
+					gagajf.ajaxJsonSubmit('/marketing/coupon/refval/update', jsonData);
+				}
+			});
+		} else {
+			excepGoodsGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(excepGoodsGridOptions)});
+		}
+	});
+
+	// ag-grid 상품관련 list 콜백함수
+	function gridAddGoodsList(OriginGridListOption, result, gubun) {
+		var goodsGbVal = "G800_10";
+		if(gubun == 'except'){
+			goodsGbVal = "G800_30";
+		}
+
+		for(let i = 0 ; i < result.length ; i++) {
+			let addChk = true, gridListValue = gagaAgGrid.getAllRowData(OriginGridListOption);		// 받아온 모든 데이터
+
+			// 받아온 data for
+			for(let j = 0 ; j < gridListValue.length ; j++) {
+				if(gridListValue[j].goodsCd == result[i].goodsCd) {	addChk = false;	}				// 중복체크
+			}
+
+			// 중복되지 않은 데이터 리스트에 추가
+			if(addChk) {
+				gagaAgGrid.addRowData(OriginGridListOption, {"goodsGb": goodsGbVal, "goodsCd" : result[i].goodsCd, "goodsNm" : result[i].goodsNm});
+			}
+		}
+	}
+
+	// 기간 일수 변경시
+	function pdGbChange(pThis){
+		var selectVal = $(pThis).val();
+
+		if(typeof selectVal == "undefined") {
+			if(mode == "U") {
+				selectVal = cpnDetail.pdGb;
+			} else {
+				selectVal = "P";
+			}
+		}
+
+		if(selectVal == "P") {
+			$('.availDateTr').css('display' , '');
+			$('.availDayTr').css('display' , 'none');
+			$('#CouponForm #availDays').attr('required' , false);
+			$('#CouponForm #availStDay').attr('required' , true);
+			$('#CouponForm #availEdDay').attr('required' , true);
+			$('#CouponForm #availStdt').attr('required' , true);
+			$('#CouponForm #availEddt').attr('required' , true);
+		} else {
+			$('.availDateTr').css('display' , 'none');
+			$('.availDayTr').css('display' , '');
+			$('#CouponForm #availDays').attr('required' , true);
+			$('#CouponForm #availStDay').attr('required' , false);
+			$('#CouponForm #availEdDay').attr('required' , false);
+			$('#CouponForm #availStdt').attr('required' , false);
+			$('#CouponForm #availEddt').attr('required' , false);
+		}
+	}
+
+	// 첫구매여부 변경시
+	function firstYnChange(pThis){
+		var selectVal = $(pThis).val();
+
+		if(typeof selectVal == "undefined") {
+			if(mode == "U") {
+				selectVal = cpnDetail.firstYn;
+			} else {
+				selectVal = "N";
+			}
+		}
+
+		if(selectVal == "Y" ) {
+			$('.buyDateTr').css('display' , '');
+			$('#buyStdt').attr('required' , true);
+			$('#buyEddt').attr('required' , true);
+		} else {
+			$('.buyDateTr').css('display' , 'none');
+			$('#buyStdt').attr('required' , false);
+			$('#buyEddt').attr('required' , false);
+		}
+	}
+
+	// 신규회원여부 변경시
+	function custJoinYnChange(pThis){
+		var selectVal = $(pThis).val();
+
+		if(typeof selectVal == "undefined") {
+			if(mode == "U") {
+				selectVal = cpnDetail.custJoinYn;
+			} else {
+				selectVal = "N";
+			}
+		}
+
+		if(selectVal == "Y" ) {
+			$('.custJoinDateTr').css('display' , '');
+			$('#custJoinStdt').attr('required' , true);
+			$('#custJoinEddt').attr('required' , true);
+		} else {
+			$('.custJoinDateTr').css('display' , 'none');
+			$('#custJoinStdt').attr('required' , false);
+			$('#custJoinEddt').attr('required' , false);
+		}
+	}
+
+	// 행추가시
+	$('#btnAddRow').on('click' , function(){
+		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(){
+		var flag = $('#CouponForm input[name=cpnCreateType]').prop("checked");
+		// 발급받은 이력이 있으면 수정 안됨
+		if(issueCnt > 0 ) {
+			return false;
+		}
+
+		if(!flag) {
+			$("#CouponForm input[name=cpnId]").prop("disabled", true);
+			$("#CouponForm input[name=cpnId]").attr("required", false);
+			$("#CouponForm input[name=cpnId]").attr("readonly", true);
+			$("#CouponForm input[name=cpnId]").attr("placeholder", "자동생성");
+			$('#CouponForm input[name=cpnCreateType]').prop("checked" , false);
+		} else{
+			$("#CouponForm input[name=cpnId]").prop("disabled", false);
+			$("#CouponForm input[name=cpnId]").attr("required", true);
+			$("#CouponForm input[name=cpnId]").attr("placeholder", "");
+			$("#CouponForm input[name=cpnId]").attr("readonly", false);
+			$('#CouponForm input[name=cpnCreateType]').prop("checked" , true);
+		}
+	}
+
+	// 제휴링크채널 수정 (제휴링크가 꼭필요한지 확인필요)
+	function fnChangeAfLinkCdList(){
+		var actionUrl = "/business/aflink/list" + '?' + $('#afChannel').serialize();
+		var tag = "";
+
+		$("#CouponForm #afLinkCd").children('option').remove();
+
+		gagajf.ajaxJsonSubmit(actionUrl, '', function(data) {
+			for (let i = 0; i < data.length; i++) {
+				if (data[i].useYn == 'Y') {
+					tag += '<option value="' + data[i].afLinkCd + '">[' + data[i].afLinkCd + '] ' + data[i].afLinkNm + '</option>';
+				}
+			}
+
+			$("#CouponForm #afLinkCd").append(tag);
+			$("#CouponForm #afLinkCd option:first").attr("selected" , "selected");
+
+		});
+	}
+	// 쿠폰발행팝업
+	function fnCustomerIssuePopUp(){
+		cfnCpnPubForCustPopup();
+	};
+
+	// 전송시 값 세팅
+	function setReqValue(){
+		// 쿠폰유형값 세팅
+		$('#CouponForm #cpnType').val($('#CouponForm input:radio[name="rdoCpnType"]:checked').val());
+		// 할인방식값 세팅
+		$('#CouponForm #dcWay').val($('#CouponForm input:radio[name="rdoDcWay"]:checked').val());
+		// 적용범위값 세팅
+		$('#CouponForm #applyScope').val($('#CouponForm input:radio[name="rdoApplyScope"]:checked').val());
+		// 다운로드기간 세팅
+		$('#CouponForm #downStdt').val($('#CouponForm #downStDay').val() + " " + $('#CouponForm #downStHH').val() + ":" + $('#CouponForm #downStMM').val() + ":00");
+		$('#CouponForm #downEddt').val($('#CouponForm #downEdDay').val() + " " + $('#CouponForm #downEdHH').val() + ":" + $('#CouponForm #downEdMM').val() + ":59");
+		// 유효기간 세팅
+		$('#CouponForm #availStdt').val($('#CouponForm #availStDay').val() + " " + $('#CouponForm #availStHH').val() + ":" + $('#CouponForm #availStMM').val() + ":00");
+		$('#CouponForm #availEddt').val($('#CouponForm #availEdDay').val() + " " + $('#CouponForm #availEdHH').val() + ":" + $('#CouponForm #availEdMM').val() + ":59");
+		// 첫구매기간세팅
+		$('#CouponForm #buyStdt').val($('#CouponForm #buyStDay').val() + " " + $('#CouponForm #buyStHH').val() + ":" + $('#CouponForm #buyStMM').val() + ":00");
+		$('#CouponForm #buyEddt').val($('#CouponForm #buyEdDay').val() + " " + $('#CouponForm #buyEdHH').val() + ":" + $('#CouponForm #buyEdMM').val() + ":59");
+		// 신규회원기간 세팅
+		$('#CouponForm #custJoinStdt').val($('#CouponForm #custJoinStDay').val() + " " + $('#CouponForm #custJoinStHH').val() + ":" + $('#CouponForm #custJoinStMM').val() + ":00");
+		$('#CouponForm #custJoinEddt').val($('#CouponForm #custJoinEdDay').val() + " " + $('#CouponForm #custJoinEdHH').val() + ":" + $('#CouponForm #custJoinEdMM').val() + ":59");
+		// 적용대상 - 공급처 그리드 전체값 세팅
+		var supplyAllData = gagaAgGrid.getAllRowData(supplyGridOptions);
+		var jsonSupplyCompData = JSON.stringify(supplyAllData);
+		$('#CouponForm #supplyCompList').val(jsonSupplyCompData);
+		// 적용대상 - 브랜드 그리드 전체값 세팅
+		var brandAllData = gagaAgGrid.getAllRowData(brandGridOptions);
+		var jsonBrandData = JSON.stringify(brandAllData);
+		$('#CouponForm #brandList').val(jsonBrandData);
+		// // 적용대상 - 카테고리 그리드 전체값 세팅
+		var cateAllData = gagaAgGrid.getAllRowData(cateGridOptions);
+		var jsonCateData = JSON.stringify(cateAllData);
+		$('#CouponForm #cateList').val(jsonCateData);
+		// 적용대상 - 적용상품 그리드 전체값 세팅
+		var goodsAllData = gagaAgGrid.getAllRowData(goodsGridOptions);
+		var jsonGoodsData = JSON.stringify(goodsAllData);
+		$('#CouponForm #applyGoodsList').val(jsonGoodsData);
+		// 적용대상 - 제외상품 그리드 전체값 세팅
+		var exceptGoodsAllData = gagaAgGrid.getAllRowData(excepGoodsGridOptions);
+		var jsonExceptGoodsData = JSON.stringify(exceptGoodsAllData);
+		$('#CouponForm #excepGoodsList').val(jsonExceptGoodsData);
+		// 입점업체분담율 그리드 전체값 세팅
+		var inCompBurdenAllData = gagaAgGrid.getAllRowData(inComGridOptions);
+		var jsonInCompBurdenData = JSON.stringify(inCompBurdenAllData);
+		$('#CouponForm #burdenList').val(jsonInCompBurdenData);
+
+	}
+
+	$(document).ready(function() {
+		gagaAgGrid.createGrid('inComGridList', inComGridOptions);
+		gagaAgGrid.createGrid('brandGridList', brandGridOptions);
+		gagaAgGrid.createGrid('cateGridList', cateGridOptions);
+		gagaAgGrid.createGrid('supplyGridList', supplyGridOptions);
+		gagaAgGrid.createGrid('goodsGridList', goodsGridOptions);
+		gagaAgGrid.createGrid('excepGoodsGridList', excepGoodsGridOptions);
+
+		// 초기화시 데이터 세팅
+		if (mode == "N") {
+			$('input[name=rdoCpnType]').eq(0).attr("checked", true);
+			$('input[name=rdoDcWay]').eq(0).attr("checked", true);
+			$('input[name=rdoApplyScope]').eq(0).attr("checked", true)
+			$('#CouponForm #availEdHH option:last').attr("selected", "selected");
+			$('#CouponForm #availEdMM option:last').attr("selected", "selected");
+			$('#downEdHH option:last').attr("selected", "selected");
+			$('#downEdMM option:last').attr("selected", "selected");
+			$('#custJoinEdHH option:last').attr("selected", "selected");
+			$('#custJoinEdMM option:last').attr("selected", "selected");
+			$('#buyEdHH option:last').attr("selected", "selected");
+			$('#buyEdMM option:last').attr("selected", "selected");
+			$("#CouponForm #afChannel option:first").attr("selected" , "selected");
+		} else {
+			// 수정모드시 그리드 세팅
+			inComGridOptions.api.setRowData(cpnDtlBurdenList);
+			supplyGridOptions.api.setRowData(cpnDtlRefvalSupplyCompList);
+			goodsGridOptions.api.setRowData(cpnDtlRefvalApplyGoodsList);
+			excepGoodsGridOptions.api.setRowData(cpnDtlRefvalExceptGoodsList);
+			brandGridOptions.api.setRowData(cpnDtlRefvalBrandList);
+			cateGridOptions.api.setRowData(cpnDtlRefvalCateList);
+			// 기본정보 세팅
+			$("#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);
+			$("#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);
+			$("#CouponForm #firstYn").val(cpnDetail.firstYn).prop("selected", true);
+			$("#CouponForm #reissuance").val(cpnDetail.reissuance).prop("selected", true);
+			$("#CouponForm #dnGb").val(cpnDetail.dnGb).prop("selected", true);
+			$("#CouponForm #cpnStat").val(cpnDetail.cpnStat).prop("selected", true);
+			$("#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);
+			$("#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);
+				$("#CouponForm #endAlimYn").attr('disabled', true);
+				$("#CouponForm #firstYn").attr('readonly', true);
+				$("#CouponForm #firstYn").attr('disabled', true);
+				$("#CouponForm #reissuance").attr('readonly', true);
+				$("#CouponForm #reissuance").attr('disabled', true);
+				$("#CouponForm #dnGb").attr('readonly', true);
+				$("#CouponForm #dnGb").attr('disabled', true);
+				$("#CouponForm #custJoinYn").attr('readonly', true);
+				$("#CouponForm #custJoinYn").attr('disabled', true);
+				$("#CouponForm #pdGb").attr('readonly', true);
+				$("#CouponForm #pdGb").attr('disabled', true);
+				$("#CouponForm #downYn").attr('readonly', true);
+				$("#CouponForm #downYn").attr('disabled', true);
+				$("#CouponForm #siteCd").attr('readonly', true);
+				$("#CouponForm #siteCd").attr('disabled', true);
+				$("#CouponForm #cpnNm").attr('readonly', true);
+				$("#CouponForm #cpnNm").attr('disabled', true);
+				$("#CouponForm #dcPval").attr('readonly', true);
+				$("#CouponForm #dcPval").attr('disabled', true);
+				$("#CouponForm #dcMval").attr('readonly', true);
+				$("#CouponForm #dcMval").attr('disabled', true);
+				$("#CouponForm #dcAval").attr('readonly', true);
+				$("#CouponForm #dcAval").attr('disabled', true);
+				$("#CouponForm #maxDcAmt").attr('readonly', true);
+				$("#CouponForm #maxDcAmt").attr('disabled', true);
+				$("#CouponForm #totPubLimitQty").attr('readonly', true);
+				$("#CouponForm #totPubLimitQty").attr('disabled', true);
+				$("#CouponForm #custPubLimitQty").attr('readonly', true);
+				$("#CouponForm #custPubLimitQty").attr('disabled', true);
+				$("#CouponForm #onePubQty").attr('readonly', true);
+				$("#CouponForm #onePubQty").attr('disabled', true);
+				$("#CouponForm #downStDay").attr('readonly', true);
+				$("#CouponForm #downStDay").attr('disabled', true);
+				$("#CouponForm #downStHH").attr('readonly', true);
+				$("#CouponForm #downStHH").attr('disabled', true);
+				$("#CouponForm #downStMM").attr('readonly', true);
+				$("#CouponForm #downStMM").attr('disabled', true);
+				$("#CouponForm #buyLimitAmt").attr('readonly', true);
+				$("#CouponForm input:radio[name='rdoDcWay']").attr('readonly', true);
+				$("#CouponForm input:radio[name='rdoCpnType']").attr('readonly', true);
+				$("#CouponForm input:radio[name='rdoApplyScope']").attr('readonly', true);
+				$("#CouponForm .rdoBtn").css('cursor', 'auto');
+				$("#CouponForm #cpnId").attr('readonly', true);
+				$("#CouponForm #cpnId").attr('disabled', true);
+				$("#CouponForm input:checkbox[name='cpnCreateType']").attr('readonly', true);
+				$("#CouponForm input:checkbox[name='cpnCreateType']").attr('disabled', true);
+				$("#CouponForm input:checkbox[name=cpnCreateType]").attr('checked', true);
+				$("#CouponForm input:checkbox[name=cpnCreateType]").parent().addClass('checked');
+			}
+			// 다운로드기간 세팅
+			splitDate("start", cpnDetail.downStdt, "down");
+			splitDate("end", cpnDetail.downEddt, "down");
+			// 유효기간이 날짜인경우 날짜 세팅
+			if (cpnDetail.pdGb == "P") {
+				splitDate("start", cpnDetail.availStdt, "avail");
+				splitDate("end", cpnDetail.availEddt, "avail");
+				$("#CouponForm #availStDay").attr('readonly', true);
+				$("#CouponForm #availStDay").attr('disabled', true);
+				$("#CouponForm #availStHH").attr('readonly', true);
+				$("#CouponForm #availStHH").attr('disabled', true);
+				$("#CouponForm #availStMM").attr('readonly', true);
+				$("#CouponForm #availStMM").attr('disabled', true);
+			} else {
+				$("#CouponForm #availDays").val(cpnDetail.availDays);
+			}
+			// 첫구매여부 적용하는 경우 날짜 세팅
+			if (cpnDetail.firstYn == "Y") {
+				splitDate("start", cpnDetail.buyStdt, "buy");
+				splitDate("end", cpnDetail.buyEddt, "buy");
+				$("#CouponForm #buyStDay").attr('readonly', true);
+				$("#CouponForm #buyStDay").attr('disabled', true);
+				$("#CouponForm #buyStHH").attr('readonly', true);
+				$("#CouponForm #buyStHH").attr('disabled', true);
+				$("#CouponForm #buyStMM").attr('readonly', true);
+				$("#CouponForm #buyStMM").attr('disabled', true);
+			}
+			// 신규회원여부 적용하는 경우 날짜 세팅
+			if (cpnDetail.custJoinYn == "Y") {
+				splitDate("start", cpnDetail.custJoinStdt, "custJoin");
+				splitDate("end", cpnDetail.custJoinEddt, "custJoin");
+				$("#CouponForm #custJoinStDay").attr('readonly', true);
+				$("#CouponForm #custJoinStDay").attr('disabled', true);
+				$("#CouponForm #custJoinStHH").attr('readonly', true);
+				$("#CouponForm #custJoinStHH").attr('disabled', true);
+				$("#CouponForm #custJoinStMM").attr('readonly', true);
+				$("#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 , 적용타겟대상 )
+	function splitDate(stedGb , date , targetGb ){
+		var str = date;
+		var dateStr = str.split(' ');
+		var timeArr = dateStr[1].split(':');
+
+		if(stedGb == "start") {
+			$("#CouponForm #"+targetGb+"StDay").val(dateStr[0]);
+			$("#CouponForm #"+targetGb+"StHH").val(timeArr[0]);
+			$("#CouponForm #"+targetGb+"StMM").val(timeArr[1]);
+		} else {
+			$("#CouponForm #"+targetGb+"EdDay").val(dateStr[0]);
+			$("#CouponForm #"+targetGb+"EdHH").val(timeArr[0]);
+			$("#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("*제한없음");
+		}else{
+			$("#"+$(this).attr("name")+"Span").html("");
+		}
+		$("#"+$(this).attr("name")+"Span").css("color", "red");
+	});
+	setTimeout(function(){
+		$("input[name=totPubLimitQty],input[name=custPubLimitQty],input[name=buyLimitAmt],input[name=onePubQty]").change();
+	}, 1);
+
+	// 콤마 찍어주기
+	$(function(){
+		setComma("CouponForm" , true);
+	});
+
+	function setComma(formId, pBoolean){
+		setTimeout(function(){
+			//숫자타입 콤마 찍어주기
+			$("#"+formId+" [data-valid-type=numeric]").each(function(){
+				$(this).change(function(){
+					if(pBoolean){
+						$(this).val($(this).val().addComma());
+					}else{
+						$(this).val($(this).val().removeComma());
+					}
+				});
+				if(pBoolean){
+					$(this).val($(this).val().addComma());
+				}else{
+					$(this).val($(this).val().removeComma());
+				}
+			});
+		}, 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>

+ 41 - 22
src/main/webapp/WEB-INF/views/marketing/FreeGoodsPromotionForm.html

@@ -55,7 +55,7 @@
 							<td>
 								<label class="rdoBtn"><input type="radio" name="promotionGubun" id="promotionId" value="freegiftSq"  checked/>프로모션ID</label>
 								<label class="rdoBtn"><input type="radio" name="promotionGubun" id="promotionName" value="freegiftNm"/>프로모션명</label>
-								<input type="text" class="w900" name="searchTxt" id="searchTxt" />
+								<input type="text" class="w900" name="searchTxt" id="searchTxt" maxlength="30" />
 							</td>
 						</tr>
 					</table>
@@ -83,25 +83,26 @@
 							<option value="1000">1000개씩 보기</option>
 						</select>
 						<input type="hidden" name="pageNo" id="pageNo" value ="1"/>
+
+						<button type="button" class="btn btn-info btn-lg" id="btnFreeGoodsRegi" >프로모션등록</button>
 					</li>
 				</ul>
-				<div class="panelBar">
-					<div class="right">
-						<button type="button" class="btn btn-info btn-lg" id="btnFreeGoodsRegi" >프로모션등록</button>
-					</div>
-				</div>
 				<!-- 검색결과 영역 -->
-				<div id="gridList" style="width: 100%; height: 700px;" class="ag-theme-balham lh60"></div>
+				<div id="gridList" style="width: 100%; height: 700px;" class="ag-theme-balham"></div>
 			</div>
 		</form>
 <script type="text/javascript" src="/ux/plugins/gaga/gaga.paging.js"></script>
 <script th:inline="javascript">
 /*<![CDATA[*/
-	var columnDefs = [];
-	columnDefs = [
+	//let freegiftStatList = gagajf.convertToArray([[${freegiftStatList}]]);		// 프로모션 상태 리스트
+	let columnDefs = [
 		{headerName: "프로모션ID", field: "freegiftSq", width: 80, cellClass: 'text-center'},
-		{headerName: "프로모션명", field: "freegiftNm", width: 130, cellClass: 'text-center'},
-		{headerName: "상태", field: "freegiftStat", width: 140, cellClass: 'text-center'},
+		{headerName: "프로모션명", field: "freegiftNm", width: 350, cellClass: 'text-center'
+			,cellRenderer: function(params) {
+				return '<a href="javascript:void(0);">' + params.value + '</a>';
+			}
+		},
+		{headerName: "상태", field: "freegiftStatNm", width: 140, cellClass: 'text-center'},
 		{headerName: "시작일", field: "freegiftStdt", width: 140, cellClass: 'text-center'},
 		{headerName: "종료일", field: "freegiftEddt", width: 140, cellClass: 'text-center'},
 		{headerName: "등록자", field: "regNm", width: 200, cellClass: 'text-left'
@@ -121,10 +122,9 @@
 
 	// Row Click
 	gridOptions.onCellClicked = function(event) {
-		var goodsCd = event.data.goodsCd;
+		var freegiftSq = event.data.freegiftSq;
 		if (event.colDef.field == "freegiftNm"){
-			// 수정 필요
-			// cfnOpenGoodsDetailPopup('U',goodsCd);
+			cfnOpenFreeGoodsPromotionSetPopup('U', freegiftSq);
 		}
 	}
 
@@ -136,7 +136,7 @@
 	} */
 
 	// 초기화 클릭시
-	$('#btnInit').on('click', function() {
+	$('#searchForm #btnInit').on('click', function() {
 		$('#searchForm')[0].reset();
 		//$("#searchForm input[type=radio]").removeClass("checked");
 		$("#searchForm input[type=checkbox]").removeClass("checked");
@@ -146,7 +146,7 @@
 	});
 
 	// 조회클릭시
-	$('#btnSearch').on('click', function() {
+	$('#searchForm #btnSearch').on('click', function() {
 		$("#searchForm input[name=pageNo]").val('1');
 		fnFreeGoodsPromotionListSearch();
 	});
@@ -165,7 +165,6 @@
 		var toDate = $('#searchForm input[name=edDate]').val();
 
 		if (!gagajf.isNull(fromDate) || !gagajf.isNull(toDate)) {
-
 			if (gagajf.isNull(fromDate) || gagajf.isNull(toDate)) {
 				mcxDialog.alertC("기간 조회시 시작일자와 종료일자를 입력하세요.", {
 					sureBtnText: "확인",
@@ -185,6 +184,22 @@
 				});
 				return false;
 			}
+
+			// 검색 기간 1년 이내로 지정
+			let stDateArray = fromDate.split("-");
+			let stDate = new Date(stDateArray[0], stDateArray[1] - 1, stDateArray[2]);
+			let edDateArray = toDate.split("-");
+			let edDate = new Date(edDateArray[0], edDateArray[1] - 1, edDateArray[2]);
+			let betweenDate = (edDate.getTime() - stDate.getTime()) / 1000 / 60 / 60 / 24;
+			if(betweenDate > 365) {
+				mcxDialog.alertC("최대 1년까지 선택하실 수 있습니다.", {
+					sureBtnText: "확인",
+					sureBtnClick: function() {
+						$('#searchForm input[name=stDate]').focus();
+					}
+				});
+				return false;
+			}
 		}
 
 		return true;
@@ -201,12 +216,11 @@
 		
 	}
 
-	// 조회클릭시
-	$('#btnFreeGoodsRegi').on('click', function() {
+	// 프로모션 등록 클릭시
+	$('#searchForm #btnFreeGoodsRegi').on('click', function() {
 		cfnOpenFreeGoodsPromotionSetPopup('C');
 	});
 
-
 	//페이징
 	$('#searchForm select[name=pageSize]').on('change', function() {
 		$("#searchForm input[name=pageNo]").val('1');
@@ -214,12 +228,17 @@
 	});
 
 	$(document).ready(function() {
-
+		// 기간 검색 조건
 		cfnCreateCalendar('#sellTerms', 'stDate', 'edDate', true, '기간', 'X');
 
+		// 기간 검색 default 조건 (최근1주일)
+		let date = new Date();
+		$("#searchForm #edDate").val(date.format("YYYY-MM-DD"));	// 오늘 날짜
+		date.setDate(date.getDate() - 6);							//월~일, 금~목으로 6을 뺌
+		$("#searchForm #stDate").val(date.format("YYYY-MM-DD"));	// 1주일 전 날짜
+
 		// Create a agGrid
 		gagaAgGrid.createGrid('gridList', gridOptions);
-
 	});
 
 /*]]>*/

Файловите разлики са ограничени, защото са твърде много
+ 557 - 312
src/main/webapp/WEB-INF/views/marketing/FreeGoodsPromotionRegiForm.html


+ 877 - 0
src/main/webapp/WEB-INF/views/order/ExchangeRequestForm.html

@@ -0,0 +1,877 @@
+<!DOCTYPE html>
+<html lang="ko" xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : ExchangeRequestForm.html
+ * @desc    : 교환요청 화면
+ *============================================================================
+ * STYLE24
+ * Copyright(C) 2021 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2021.01.15   card007     최초 작성
+ *******************************************************************************
+ -->
+<div class="modalPopup" data-width="1400" data-height="600">
+	<div class="panelStyle">
+		<div class="panelTitle">
+			<h2>교환요청</h2>
+			<button type="button" class="close" onclick="uifnPopupClose('popupExchangeRequestForm');"><i class="fa fa-times"></i></button>
+		</div>
+			
+		<div class="panelContent" style="height:90%; overflow-y:auto; padding:0px 20px !important; ">
+			<form id="exchangeRequestFrm" name="exchangeRequestFrm" action="/orderChange/exchange" method="post" target="hdFrameForOrderExchange">
+				<input type="hidden" name="ordNo" th:value="${ordNo}"/>
+				<input type="hidden" name="chgReason" value=""/>
+				<input type="hidden" name="chgReasonDesc" value=""/>
+				
+				<h4>주문정보</h4>
+				<div id="gridOrderCancelRequestList" style="width:100%; height: 200px;" class="ag-theme-balham"></div>
+
+				<h4>배송비정보</h4>
+				<div id="gridDelvCdList" style="width:100%; height: 140px;" class="ag-theme-balham"></div>
+				
+				<div style="text-align:right; padding-bottom:5px; padding-top:5px;">
+					<button type="button" class="btn btn-success" id="fnExchangeRequestSubmit" onclick="fnExchangeRequestSubmit();">요청</button>
+				</div>
+				
+				<table class="frmStyle">
+					<colgroup>
+						<col style="width:160px;" />
+						<col style="width:320px;" />
+						<col style="width:160px;" />
+						<col />
+					</colgroup>
+					<tbody>
+						<tr>
+							<th>교환사유 <i class="star"></i></th>
+							<td>
+								<select name="selectChgReason" onchange="fnChangeChgReason($(this).val());">
+									<option value="">[선택하세요]</option>
+									<option th:if="${chgReasonList}" th:each="oneData, status : ${chgReasonList}" th:value="|${oneData.cd}:${oneData.cdNm}|" th:text="|[${oneData.cd}] ${oneData.cdNm}|"></option>
+								</select>
+							</td>
+							<th>귀책사유</th>
+							<td><span id="imputeReason"></span></td>
+						</tr>
+						<tr>
+							<th>회수방법</th>
+							<td>
+								<label class="rdoBtn"><input type="radio" name="wdGb" th:id="wdGb" value="W" onCLick="fnChangeQty()" checked="checked"/>회수요청<span></span></label>
+								<label class="rdoBtn"><input type="radio" name="wdGb" th:id="wdGb" value="D" onCLick="fnChangeQty()"/>직접발송<span></span></label>
+							</td>
+							<th>추가배송비</th>
+							<td id="addDelvFee"></td>
+						</tr>
+						<tr>
+							<th>요청메모</th>
+							<td colspan="3">
+								<textarea id="chgMemo" name="chgMemo" style="height:80px;" placeholder="교환사유를 300자내외로 작성해 주세요"></textarea>
+							</td>
+						</tr>
+					</tbody>
+				</table>
+				
+				<h4>회수지 정보</h4>
+				<table class="frmStyle">
+					<colgroup>
+						<col style="width:160px;" />
+						<col style="width:320px;" />
+						<col style="width:160px;" />
+						<col />
+					</colgroup>
+					<tbody>
+						<tr>
+							<th>보내는사람 <i class="star"></i></th>
+							<td colspan="3"><input type="text" name ="chgerNm" class=""/></td>
+						</tr>
+						<tr>
+							<th>회수지주소 <i class="star"></i></th>
+							<td colspan="3">
+								<input type="text" name ="chgerZipNo" class="w100" readonly="readonly"/>
+								<button type="button" class="btn btn-info" onclick="fnOpenDaumAddr('delvLoc');">우편번호찾기</button>
+								<input type="text" name ="chgerBaseAddr" class="w300"/>
+								<input type="text" name ="chgerDtlAddr" class="w300"/>
+							</td>
+						</tr>
+						<tr>
+							<th>일반전화</th>
+							<td>
+								<select name="chgerTelno1" class="w100">
+									<option value="">[선택하세요]</option>
+									<option th:if="${TelExcNoList}" th:each="oneData, status : ${TelExcNoList}" th:value="${oneData.cd}" th:text="${oneData.cd}"></option>
+								</select>
+								- <input type="text" name ="chgerTelno2" class="w60" value="0000" />
+								- <input type="text" name ="chgerTelno3" class="w60" value="0000" />
+							</td>
+							<th>휴대전화 <i class="star"></i></th>
+							<td>
+								<select name="chgerPhnno1" class="w100">
+									<option value="">[선택하세요]</option>
+									<option th:if="${PhnExcNoList}" th:each="oneData, status : ${PhnExcNoList}" th:value="${oneData.cd}" th:text="${oneData.cd}"></option>
+								</select>
+								- <input type="text" name ="chgerPhnno2" class="w60" value="0000" />
+								- <input type="text" name ="chgerPhnno3" class="w60" value="0000" />
+							</td>
+						</tr>
+					</tbody>
+				</table>
+
+				<h4>교환지 정보</h4>
+				<table class="frmStyle">
+					<colgroup>
+						<col style="width:160px;" />
+						<col style="width:320px;" />
+						<col style="width:160px;" />
+						<col />
+					</colgroup>
+					<tbody>
+					<tr>
+						<th>받는사람 <i class="star"></i></th>
+						<td colspan="3"><input type="text" name ="recipNm" class=""/></td>
+					</tr>
+					<tr>
+						<th>교환지주소 <i class="star"></i></th>
+						<td colspan="3">
+							<input type="text" name ="recipZipNo" class="w100" readonly="readonly"/>
+							<button type="button" class="btn btn-info" onclick="fnOpenDaumAddr('delvLoc');">우편번호찾기</button>
+							<input type="text" name ="recipBaseAddr" class="w300"/>
+							<input type="text" name ="recipDtlAddr" class="w300"/>
+						</td>
+					</tr>
+					<tr>
+						<th>일반전화</th>
+						<td>
+							<select name="recipTelno1" class="w100">
+								<option value="">[선택하세요]</option>
+								<option th:if="${TelExcNoList}" th:each="oneData, status : ${TelExcNoList}" th:value="${oneData.cd}" th:text="${oneData.cd}"></option>
+							</select>
+							- <input type="text" name ="recipTelno2" class="w60" value="0000" />
+							- <input type="text" name ="recipTelno3" class="w60" value="0000" />
+						</td>
+						<th>휴대전화 <i class="star"></i></th>
+						<td>
+							<select name="recipPhnno1" class="w100">
+								<option value="">[선택하세요]</option>
+								<option th:if="${PhnExcNoList}" th:each="oneData, status : ${PhnExcNoList}" th:value="${oneData.cd}" th:text="${oneData.cd}"></option>
+							</select>
+							- <input type="text" name ="recipPhnno2" class="w60" value="0000" />
+							- <input type="text" name ="recipPhnno3" class="w60" value="0000" />
+						</td>
+					</tr>
+					</tbody>
+				</table>
+			</form>
+		</div>
+	</div>
+</div>
+
+<!-- data -->
+<script th:inline="javascript">
+/*<![CDATA[*/
+var cancelRequestTargetList = [[${cancelRequestTargetList}]];				// 교환대상목록
+var ordNo 					= [[${ordNo}]];									// 주문번호
+var orderInfoList 			= [[${orderInfoList}]];							// 주문기본정보
+var payMeans 				= orderInfoList[0].payMeans;					// 결제수단
+var orderDelvAddrInfo		= [[${orderDelvAddrInfo}]];						// 회수지정보
+var addDelvFee				= 0;											// 추가배송비
+var addDelvFeeList			= [];											// 추가배송비정보
+
+var temp1 = true;
+var temp2 = false;
+
+// 1. 주문정보(교환대상)
+var columnExchangeReqList = [
+	{
+		headerName	: "주문상세정보",
+		children	: [
+			{headerName: "주문번호"		, field: "ordNo"			, width: 80		, cellClass: 'text-center', hide: temp1},
+			{headerName: "주문상세"		, field: "ordDtlNo"			, width: 80		, cellClass: 'text-center'},
+			{headerName: "주문상세"		, field: "ordDtlStat"		, width: 80		, cellClass: 'text-center', hide: temp1},
+			{headerName: "주문상세상태"		, field: "ordDtlStatNm"		, width: 100	, cellClass: 'text-center', hide: temp1},
+			{headerName: "상품코드"		, field: "goodsCd"			, width: 100	, cellClass: 'text-center', hide: temp1},
+			{headerName: "상품명"			, field: "goodsNm"			, width: 200	, cellClass: 'text-center', hide: temp1},
+			{headerName: "상품타입"		, field: "goodsTypeNm"		, width: 100	, cellClass: 'text-center', hide: temp2}
+		]
+	},
+	{
+		headerName	: "주문상세단품정보",
+		children	: [
+			{headerName: "단품번호"		, field: "ordDtlItemSq"		, width: 100	, cellClass: 'text-center', hide: temp2},
+			{headerName: "단품코드"		, field: "itemCd"			, width: 100	, cellClass: 'text-center', hide: temp2},
+			{headerName: "단품명"			, field: "itemNm"			, width: 200	, cellClass: 'text-center', hide: temp2},
+			{headerName: "옵션1"			, field: "optCd1"			, width: 80		, cellClass: 'text-center', hide: temp1},
+			{headerName: "옵션2"			, field: "optCd2"			, width: 80		, cellClass: 'text-center', hide: temp2},
+			{
+				headerName		: "단품수량"		
+				, field			: "itemQty"			
+				, width			: 80		
+				, cellClass		: 'text-center'
+				, cellRenderer	: function (params) {
+					return params.value.addComma();
+				}
+			},
+			{
+				headerName		: "단품금액"		
+				, field			: "itemPrice"			
+				, width			: 80		
+				, cellClass		: 'text-right'
+				, cellRenderer	: function (params) {
+					return params.value.addComma();
+				}
+			},
+			{
+				headerName		: "단품옵션금액"		
+				, field			: "optAddPrice"			
+				, width			: 80		
+				, cellClass		: 'text-right'
+				, cellRenderer	: function (params) {
+					return params.value.addComma();
+				}
+			}
+		]
+	},
+	{
+		headerName	: "주문상세수량",
+		children	: [
+			{
+				headerName		: "주문"		
+				, field			: "ordQty"			
+				, width			: 80		
+				, cellClass		: 'text-center'
+				, cellRenderer	: function (params) {
+					return params.value.addComma();
+				}
+			},
+			{
+				headerName		: "취소/요청"		
+				, field			: "cnclRtnQty"			
+				, width			: 80		
+				, cellClass		: 'text-center'
+				, cellRenderer	: function (params) {
+					var cnclRtnReqQty = parseInt(params.data.cnclRtnQty) + parseInt(params.data.ordReqChgQty);
+					return cnclRtnReqQty;
+				}
+			},
+			{headerName: "교환가능옵션"	, field: "optCd2s"			, width: 200		, cellClass: 'text-center', hide: temp2},
+			{
+				headerName		: "교환옵션"
+				, field			: "ordChgOpt"
+				, width			: 100
+				, cellClass		: "text-center"
+				, cellRenderer	: function (params) {
+					var optArr			= params.data.optCd2s.split(',');
+					var ordChgOpt = params.data.ordChgOpt;
+
+					var strVal			= '';
+					strVal += '<select class="ordChgOpt" name="ordChgOpt" ordDtlNo="' + params.data.ordDtlNo + '" ordDtlItemSq="' + params.data.ordDtlItemSq + '" onchange="fnChangeOption(this)">';
+					
+					if (gagajf.isNull(ordChgOpt)) {
+						strVal += '<option value="">선택</option>'
+					} else {
+						strVal += '<option value="" selected>선택</option>'
+					}
+
+					$.each(optArr, function(idx,item){
+						if (ordChgOpt == item) {
+							strVal += '<option value="' + item + '" selected>' + item + '</option>';
+						} else {
+							strVal += '<option value="' + item + '">' + item + '</option>';
+						}
+					});
+
+					return strVal;
+				}
+			},
+			{headerName: "재고수량"	, field: "currStockQty"			, width: 100			, cellClass: 'text-center', hide: temp2},
+			{
+				headerName		: "교환신청수량"
+				, field			: "ordCanChgQty"
+				, width			: 100
+				, cellClass		: 'text-center'
+				, cellRenderer	: function (params) {
+					var ordQty 			= parseInt(params.data.ordQty);
+					var cnclRtnQty 		= parseInt(params.data.cnclRtnQty);
+					var ordReqChgQty 	= parseInt(params.data.ordReqChgQty);
+					var ordCanChgQty 	= ordQty - (cnclRtnQty +  ordReqChgQty);
+					
+					var strVal 			= "";
+					strVal += '<select class="ordCanChgQty ' + params.data.ordDtlNo + '" name="ordCanChgQty" ordDtlNo="'+params.data.ordDtlNo+'" onchange="fnChangeQty(this)">';
+					
+					for (i=0 ; i<=ordCanChgQty ; i++) {
+						if (i == params.data.ordCanChgQty) {
+							strVal += "	<option value='"+i+"' selected>"+i+"</option>";
+						} else {
+							strVal += "	<option value='"+i+"'>"+i+"</option>";
+						}
+					}
+				
+					strVal += "</select>";
+					return strVal;
+				}
+			}
+		]
+	},
+	{
+		headerName	: "주문단품금액",
+		children	: [
+			{
+				headerName		: "주문"
+				, field			: "ordAmt"			
+				, width			: 80		
+				, cellClass		: 'text-right'
+				, cellRenderer	: function (params) {
+					return params.value.addComma();
+				}
+			},
+			{
+				headerName		: "취소"		
+				, field			: "cnclRtnAmt"			
+				, width			: 80		
+				, cellClass		: 'text-right'
+				, cellRenderer	: function (params) {
+					return params.value.addComma();
+				}
+			},
+			{
+				headerName		: "즉시할인"		
+				, field			: "cpn1DcAmt"			
+				, width			: 80		
+				, cellClass		: 'text-right'
+				, cellRenderer	: function (params) {
+					return params.value.addComma();
+				}
+			},
+			{
+				headerName		: "다다익선1"		
+				, field			: "tmtb1DcAmt"			
+				, width			: 80		
+				, cellClass		: 'text-right'
+				, cellRenderer	: function (params) {
+					return params.value.addComma();
+				}
+			},
+			{
+				headerName		: "다다익선2"		
+				, field			: "tmtb2DcAmt"			
+				, width			: 80		
+				, cellClass		: 'text-right'
+				, cellRenderer	: function (params) {
+					return params.value.addComma();
+				}
+			},
+			{
+				headerName		: "상품쿠폰"		
+				, field			: "goodsCpnDcAmt"			
+				, width			: 80		
+				, cellClass		: 'text-right'
+				, cellRenderer	: function (params) {
+					return params.value.addComma();
+				}
+			},
+			{
+				headerName		: "장바구니쿠폰"		
+				, field			: "cartCpnDcAmt"			
+				, width			: 80		
+				, cellClass		: 'text-right'
+				, cellRenderer	: function (params) {
+					return params.value.addComma();
+				}
+			},
+			{
+				headerName		: "포인트"		
+				, field			: "pntDcAmt"			
+				, width			: 80		
+				, cellClass		: 'text-right'
+				, cellRenderer	: function (params) {
+					return params.value.addComma();
+				}
+			},
+			{
+				headerName		: "선포인트"		
+				, field			: "prePntDcAmt"			
+				, width			: 80		
+				, cellClass		: 'text-right'
+				, cellRenderer	: function (params) {
+					return params.value.addComma();
+				}
+			},
+			{
+				headerName		: "상품권"		
+				, field			: "gfcdUseAmt"			
+				, width			: 80		
+				, cellClass		: 'text-right'
+				, cellRenderer	: function (params) {
+					return params.value.addComma();
+				}
+			},
+			{
+				headerName		: "실결제금액"		
+				, field			: "realOrdAmt"			
+				, width			: 80		
+				, cellClass		: 'text-right'
+				, cellRenderer	: function (params) {
+					return params.value.addComma();
+				}
+			}
+		]
+	},
+	{
+		headerName	: "주문배송비정보",
+		children	: [
+			{
+				headerName		: "배송비"		
+				, field			: "delvFee"			
+				, width			: 80		
+				, cellClass		: 'text-right'
+				, cellRenderer	: function (params) {
+					return params.value.addComma();
+				}
+				, hide			: temp2
+			},
+			{headerName: "업체"			, field: "supplyCompCd"		, width: 100	, cellClass: 'text-center', hide: temp2},
+			{headerName: "배송비코드"		, field: "delvFeeCd"		, width: 100	, cellClass: 'text-center', hide: temp2},
+			{
+				headerName		: "무료배송비"		
+				, field			: "minOrdAmt"			
+				, width			: 80		
+				, cellClass		: 'text-right'
+				, cellRenderer	: function (params) {
+					return params.value.addComma();
+				}
+				, hide			: temp2
+			},
+			{
+				headerName		: "기본배송비"		
+				, field			: "orgDelvFee"			
+				, width			: 80		
+				, cellClass		: 'text-right'
+				, cellRenderer	: function (params) {
+					return params.value.addComma();
+				}
+				, hide			: temp2
+			},
+			{
+				headerName		: "반품배송비"		
+				, field			: "rtnDelvFee"			
+				, width			: 80		
+				, cellClass		: 'text-right'
+				, cellRenderer	: function (params) {
+					return params.value.addComma();
+				}
+				, hide			: temp2
+			},
+			{
+				headerName		: "교환배송비"		
+				, field			: "excDelvFee"			
+				, width			: 80		
+				, cellClass		: 'text-right'
+				, cellRenderer	: function (params) {
+					return params.value.addComma();
+				}
+				, hide			: temp2
+			},
+			{headerName: "전체취소가능"		, field: "allCanYn"			, width: 100	, cellClass: 'text-center', hide: temp2},
+		]
+	}
+];
+var gridOptionsExchangeReqList = gagaAgGrid.getGridOptions(columnExchangeReqList);
+
+// Add on options
+gridOptionsExchangeReqList.suppressRowClickSelection = true;
+gridOptionsExchangeReqList.rowSelection = 'multiple';
+
+// 3. 배송비정보(환불정보)
+var columnDelvCdList = [
+	{headerName: "업체"			, field: "supplyCompNm"		, width: 100	, cellClass: 'text-center', hide: temp2},
+	{headerName: "배송비코드"		, field: "delvFeeCd"		, width: 100	, cellClass: 'text-center', hide: temp2},
+	{
+		headerName		: "추가배송비"
+		, field			: "addDelvFee"
+		, width			: 100
+		, cellClass		: 'text-right'
+		, cellRenderer	: function (params) {
+			return params.value.addComma();
+		}
+		, hide			: temp2
+	},
+	{headerName: "반품지명"		, field: "rtnLocNm"			, width: 100	, cellClass: 'text-center', hide: temp2},
+	{headerName: "반품지전화번호"	, field: "rtnLocTelno"		, width: 100	, cellClass: 'text-center', hide: temp2},
+	{headerName: "반품지우편번호"	, field: "rtnLocZipcode"	, width: 100	, cellClass: 'text-center', hide: temp2},
+	{headerName: "반품지기본주소"	, field: "rtnLocBaseAddr"	, width: 300	, cellClass: 'text-center', hide: temp2},
+	{headerName: "반품지상세주소"	, field: "rtnLocDtlAddr"	, width: 300	, cellClass: 'text-center', hide: temp2},
+];
+var gridOptionsDelvCdList = gagaAgGrid.getGridOptions(columnDelvCdList);
+</script>
+
+<script>
+//현재 사유는 고객 입니다.
+var isCustomer = false;
+
+//  사유
+var fnChangeChgReason = function(reasonCd){
+	var arrReasonCd = reasonCd.split(":");
+	var customerReasonArr = ['G689_10', 'G689_30'];
+	
+	isCustomer = false;
+
+	// 취소, 반품, 교환 사유 판단
+	for (i=0 ; i<customerReasonArr.length ; i++) {
+		if (customerReasonArr[i] == arrReasonCd[0]) {
+			isCustomer = true;
+		}
+	}
+	
+	// 귀책사유설정 회사, 고객
+	if (isCustomer) {
+		$("#imputeReason").text("고객");
+	} else {
+		$("#imputeReason").text("회사");
+	}
+
+	$('#cancelRequestFrm input[name=chgReason]').val(arrReasonCd[0]);
+	$('#cancelRequestFrm input[name=chgReasonDesc]').val(arrReasonCd[1]);
+	
+	// 추가배송비 설정
+	fnChangeQty();
+}
+
+// 교환요청
+var fnExchangeRequestSubmit = function () {
+	var temp 		= false;
+	var ordDtlStat	= cancelRequestTargetList[0].ordDtlStat; 
+	var allCanYn 	= "N";
+
+	// 1. 교환수량 체크
+	for (i=0 ; i<cancelRequestTargetList.length ; i++) {
+		if (cancelRequestTargetList[i].ordCanChgQty > 0) {
+			temp = true;
+		}
+	}
+
+	if (temp == false) {
+		mcxDialog.alert('취소 할 수량을 입력하세요.');
+		return;
+	}
+
+	// 3. 교환사유 체크
+	var chgReason = $("#exchangeRequestFrm select[name=selectChgReason]").val();
+
+	if (gagajf.isNull(chgReason)) {
+		mcxDialog.alert("취소사유를 입력하세요."); 
+		return ;
+	}
+
+	// 5. 회수지정보설정
+	var chgerNm			= $("#exchangeRequestFrm input[name=chgerNm]").val();
+	var chgerZipNo		= $("#exchangeRequestFrm input[name=chgerZipNo]").val();
+	var chgerBaseAddr	= $("#exchangeRequestFrm input[name=chgerBaseAddr]").val();
+	var chgerDtlAddr	= $("#exchangeRequestFrm input[name=chgerDtlAddr]").val();
+	
+	var chgerPhnno1		= $("#exchangeRequestFrm select[name=chgerPhnno1]").val();
+	var chgerPhnno2		= $("#exchangeRequestFrm input[name=chgerPhnno2]").val();
+	var chgerPhnno3		= $("#exchangeRequestFrm input[name=chgerPhnno3]").val();
+	
+	var chgerTelno1		= $("#exchangeRequestFrm select[name=chgerTelno1]").val();
+	var chgerTelno2		= $("#exchangeRequestFrm input[name=chgerTelno2]").val();
+	var chgerTelno3		= $("#exchangeRequestFrm input[name=chgerTelno3]").val();
+
+	if (gagajf.isNull(chgerZipNo)) {
+		mcxDialog.alert("회수지주소를 입력하세요."); return;
+	}
+	if (gagajf.isNull(chgerBaseAddr)) {
+		mcxDialog.alert("회수지주소를 입력하세요."); return;
+	}
+	if (gagajf.isNull(chgerDtlAddr)) {
+		mcxDialog.alert("회수지주소를 입력하세요."); return;
+	}
+	
+	if (gagajf.isNull(chgerPhnno1)) {
+		mcxDialog.alert("휴대전화를 입력하세요."); return;
+	}
+	if (gagajf.isNull(chgerPhnno2)) {
+		mcxDialog.alert("휴대전화를 입력하세요."); return;
+	}
+	if (gagajf.isNull(chgerPhnno3)) {
+		mcxDialog.alert("휴대전화를 입력하세요."); return;
+	}
+
+	var chgerPhnno 		= chgerPhnno1 + chgerPhnno2 + chgerPhnno3;
+	var chgerTelno 		= chgerTelno1 + chgerTelno2 + chgerTelno3;
+	var chgerEmail 		= orderInfoList[0].ordEmail;
+
+	// 교환지정보 설정
+	var recipNm			= $("#exchangeRequestFrm input[name=chgerNm]").val();
+	var recipZipNo		= $("#exchangeRequestFrm input[name=chgerZipNo]").val();
+	var recipBaseAddr	= $("#exchangeRequestFrm input[name=chgerBaseAddr]").val();
+	var recipDtlAddr	= $("#exchangeRequestFrm input[name=chgerDtlAddr]").val();
+
+	var recipPhnno1		= $("#exchangeRequestFrm select[name=chgerPhnno1]").val();
+	var recipPhnno2		= $("#exchangeRequestFrm input[name=chgerPhnno2]").val();
+	var recipPhnno3		= $("#exchangeRequestFrm input[name=chgerPhnno3]").val();
+
+	var recipTelno1		= $("#exchangeRequestFrm select[name=chgerTelno1]").val();
+	var recipTelno2		= $("#exchangeRequestFrm input[name=chgerTelno2]").val();
+	var recipTelno3		= $("#exchangeRequestFrm input[name=chgerTelno3]").val();
+	
+	if (gagajf.isNull(recipZipNo)) {
+		mcxDialog.alert("교환지주소를 입력하세요."); return;
+	}
+	if (gagajf.isNull(recipBaseAddr)) {
+		mcxDialog.alert("교환지주소를 입력하세요."); return;
+	}
+	if (gagajf.isNull(recipDtlAddr)) {
+		mcxDialog.alert("교환지주소를 입력하세요."); return;
+	}
+	
+	if (gagajf.isNull(recipPhnno1)) {
+		mcxDialog.alert("휴대전화를 입력하세요."); return;
+	}
+	if (gagajf.isNull(recipPhnno2)) {
+		mcxDialog.alert("휴대전화를 입력하세요."); return;
+	}
+	if (gagajf.isNull(recipPhnno3)) {
+		mcxDialog.alert("휴대전화를 입력하세요."); return;
+	}
+	
+	var recipPhnno 		= recipPhnno1 + recipPhnno2 + recipPhnno3;
+	var recipTelno 		= recipTelno1 + recipTelno2 + recipTelno3;
+	var recipEmail 		= orderInfoList[0].ordEmail;
+	
+	var jsonObj = {
+		"ordNo"				: $('#exchangeRequestFrm input[name=ordNo]').val()
+		,"chgReason" 		: $('#exchangeRequestFrm input[name=chgReason]').val()
+		,"chgMemo"			: $('#chgMemo').val()
+		,"exchangeReqList" 	: cancelRequestTargetList
+		,"isCustomer"		: isCustomer
+		,"chgerNm"			: chgerNm
+		,"chgerEmail"		: chgerEmail
+		,"chgerZipNo"		: chgerZipNo
+		,"chgerBaseAddr"	: chgerBaseAddr
+		,"chgerDtlAddr"		: chgerDtlAddr
+		,"chgerPhnno"		: chgerPhnno
+		,"chgerTelno"		: chgerTelno
+		,"recipNm"			: recipNm
+		,"recipEmail"		: recipEmail
+		,"recipZipNo"		: recipZipNo
+		,"recipBaseAddr"	: recipBaseAddr
+		,"recipDtlAddr"		: recipDtlAddr
+		,"recipPhnno"		: recipPhnno
+		,"recipTelno"		: recipTelno
+	}
+
+	// 주문번호, 교환사유, 교환메모, (취소, 반품, 교환 신청 정보 목록)
+	var jsonData = JSON.stringify(jsonObj);
+	
+	mcxDialog.confirm('교환요청하시겠습니까?', {
+		cancelBtnText		: "반품",
+		sureBtnClick		: function(){
+			// 교환 실행
+			gagajf.ajaxJsonSubmit(
+				'/orderChange/exchangeRequest/'
+				, jsonData
+				, function() {
+					uifnPopupClose('popupOrderDetail');
+					fnReOpenOrderDetailPopup();
+					uifnPopupClose('popupReturnRequestForm');
+				}
+			);
+		}
+	});
+}
+
+// 우편번호 DAUM을 이용한 우편번호 팝업 레이어
+var fnOpenDaumAddr = function(loc) {
+	let daumZip = new daum.Postcode({
+		oncomplete: function(data) {
+			// 우편번호와 주소 정보를 해당 필드에 넣는다.
+			if (loc == 'withdraw') {
+				$('#exchangeRequestFrm input[name=chgerZipNo]').val(data.zonecode);
+				$('#exchangeRequestFrm input[name=chgerBaseAddr]').val(cfnGetDaumRoadAddr(data));
+				$('#exchangeRequestFrm input[name=chgerDtlAddr]').focus();
+			} else if (loc == 'exchange') {
+				$('#exchangeRequestFrm input[name=recipZipNo]').val(data.zonecode);
+				$('#exchangeRequestFrm input[name=recipBaseAddr]').val(cfnGetDaumRoadAddr(data));
+				$('#exchangeRequestFrm input[name=recipDtlAddr]').focus();
+			}
+			
+			cfnCloseDaumAddr();
+		},
+		width: '100%'
+	});
+	
+	cfnOpenDaumAddr(daumZip);
+}
+
+// 회수지정보 설정
+var fnSetChger = function(){
+	var data = orderDelvAddrInfo[0];
+	var spRecipPhnno = (data.recipPhnno != null) ? data.recipPhnno.split('-') : null;
+	var spRecipTelno = (data.recipTelno != null) ? data.recipTelno.split('-') : null;
+	
+	$("#exchangeRequestFrm input[name=chgerNm]").val(data.recipNm);
+	$("#exchangeRequestFrm input[name=chgerZipNo]").val(data.recipZipNo);
+	$("#exchangeRequestFrm input[name=chgerBaseAddr]").val(data.recipBaseAddr);
+	$("#exchangeRequestFrm input[name=chgerDtlAddr]").val(data.recipDtlAddr);
+	
+	if (spRecipPhnno) {
+		$("#exchangeRequestFrm select[name=chgerPhnno1]").val(spRecipPhnno[0]);
+		$("#exchangeRequestFrm input[name=chgerPhnno2]").val(spRecipPhnno[1]);
+		$("#exchangeRequestFrm input[name=chgerPhnno3]").val(spRecipPhnno[2]);
+	}
+	
+	if (spRecipTelno) {
+		$("#exchangeRequestFrm select[name=chgerTelno1]").val(spRecipTelno[0]);
+		$("#exchangeRequestFrm input[name=chgerTelno2]").val(spRecipTelno[1]);
+		$("#exchangeRequestFrm input[name=chgerTelno3]").val(spRecipTelno[2]);
+	}
+}
+
+// 교환지정보 설정
+var fnSetExchangeAddr = function(){
+	var data = orderDelvAddrInfo[0];
+	var spRecipPhnno = (data.recipPhnno != null) ? data.recipPhnno.split('-') : null;
+	var spRecipTelno = (data.recipTelno != null) ? data.recipTelno.split('-') : null;
+	
+	$("#exchangeRequestFrm input[name=recipNm]").val(data.recipNm);
+	$("#exchangeRequestFrm input[name=recipZipNo]").val(data.recipZipNo);
+	$("#exchangeRequestFrm input[name=recipBaseAddr]").val(data.recipBaseAddr);
+	$("#exchangeRequestFrm input[name=recipDtlAddr]").val(data.recipDtlAddr);
+	
+	if (spRecipPhnno) {
+		$("#exchangeRequestFrm select[name=recipPhnno1]").val(spRecipPhnno[0]);
+		$("#exchangeRequestFrm input[name=recipPhnno2]").val(spRecipPhnno[1]);
+		$("#exchangeRequestFrm input[name=recipPhnno3]").val(spRecipPhnno[2]);
+	}
+	
+	if (spRecipTelno) {
+		$("#exchangeRequestFrm select[name=recipTelno1]").val(spRecipTelno[0]);
+		$("#exchangeRequestFrm input[name=recipTelno2]").val(spRecipTelno[1]);
+		$("#exchangeRequestFrm input[name=recipTelno3]").val(spRecipTelno[2]);
+	}
+}
+
+// 교환옵션 변경 이벤트
+var fnChangeOption = function(param) {
+	var optCd2 = $(param).val();
+	var ordDtlNo = $(param).attr('ordDtlNo');
+	var ordDtlItemSq = $(param).attr('ordDtlItemSq');
+
+	$.each(cancelRequestTargetList, function(idx, item){
+		if (item.ordDtlNo == ordDtlNo && item.ordDtlItemSq == ordDtlItemSq) {
+			var stockQtyArr = item.currStockQtys.split(',');
+			var sizeCdArr = item.optCd2s.split(',');
+			var stockIdx = sizeCdArr.indexOf(optCd2);
+			var stockQty = stockQtyArr[stockIdx];
+			item.currStockQty = stockQty;
+			item.ordChgOpt = optCd2;
+		}
+	});
+	
+	gridOptionsExchangeReqList.api.setRowData(cancelRequestTargetList);
+}
+
+// 교환수량 변경 이벤트
+var fnChangeQty = function(param) {
+	var ordCanChgQty = $(param).val();
+	var ordDtlNo = $(param).attr('ordDtlNo');
+	var exchangeRequestTargetList = [];
+
+	$.each(cancelRequestTargetList, function(idx, item){
+		if (item.ordDtlNo == ordDtlNo) {
+			if (gagajf.isNull(item.ordChgOpt)) {
+				mcxDialog.alert('교환옵션을 선택해주세요.');
+				return false;
+			}
+			
+			//var optCd2 = item.ordChgOpt;
+			//var stockQtyArr = item.currStockQtys.split(',');
+			//var sizeCdArr = item.optCd2s.split(',');
+			//var stockIdx = sizeCdArr.indexOf(optCd2);
+			//var stockQty = stockQtyArr[stockIdx];
+
+			//if (stockQty < ordCanChgQty) {
+			//	mcxDialog.alert(item.itemNm + ' ' + optCd2 + '의 재고수량이 부족합니다.');
+			//} else {
+			//	item.ordCanChgQty = ordCanChgQty;
+			//}
+			
+			item.ordCanChgQty = ordCanChgQty;
+			
+			if (ordCanChgQty > 0) {
+				exchangeRequestTargetList.push(item);
+			}
+		} else if (item.ordCanChgQty > 0) {
+			exchangeRequestTargetList.push(item);
+		}
+	});
+
+	// 추가배송비 설정
+	fnAddDelvFee(exchangeRequestTargetList);
+
+	gridOptionsExchangeReqList.api.setRowData(cancelRequestTargetList);
+}
+
+// 추가배송비 설정
+var fnAddDelvFee = function (exchangeRequestTargetList) {
+	var delvCdList = [];
+	var delvFeeList = [];
+	var delvFee = 0;
+
+	// 고객 귀책사유에 한하여 추가배송비 설정
+	$.each(exchangeRequestTargetList, function (idx, item) {
+		if (!delvCdList.includes(item.delvFeeCd)) {
+			if (isCustomer) {
+				var delvFeeTmp = $('#wdGb:checked').val() == 'W' ? item.excDelvFee : item.rtnDelvFee;
+				delvFee += delvFeeTmp;
+				item.addDelvFeeYn = 'Y';
+				item.addDelvFee = delvFeeTmp;
+			} else {
+				item.addDelvFeeYn = 'N';
+				item.addDelvFee = 0;
+			}
+
+			delvCdList.push(item.delvFeeCd);
+			delvFeeList.push(item);
+		}
+	});
+
+	addDelvFee = delvFee;
+	addDelvFeeList = delvFeeList;
+
+	// 회수방법 > 직접발송일 경우 그리드 표시
+	if ($('#wdGb:checked').val() == 'D') {
+		gridOptionsDelvCdList.api.setRowData(addDelvFeeList);
+	} else {
+		gridOptionsDelvCdList.api.setRowData();
+	}
+	
+	$('#addDelvFee').text(addDelvFee + '원');
+}
+
+$(document).ready(function() {
+	// 1. 그리드생성
+	gagaAgGrid.createGrid('gridOrderCancelRequestList'		, gridOptionsExchangeReqList);			// 주문정보
+	//gagaAgGrid.createGrid('gridOrderCancelRequestToBeList'	, gridOptionsExchangeReqToBeList);		// 취소정보
+	gagaAgGrid.createGrid('gridDelvCdList'					, gridOptionsDelvCdList);				// 배송비정보
+	gridOptionsExchangeReqList.api.setRowData(cancelRequestTargetList);
+	
+	// 2.1 TOTAL ROWS 없애기
+	gagaAgGrid.hideStatusBar('gridOrderCancelRequestList');
+	gagaAgGrid.hideStatusBar('gridOrderCancelRequestToBeList');
+	gagaAgGrid.hideStatusBar('gridDelvCdList');
+	
+	// 3. 회수지정보설정
+	fnSetChger();
+	
+	// 4. 교환지정보설정
+	fnSetExchangeAddr();
+});
+</script>
+</html>
+
+
+
+
+

+ 1 - 1
src/main/webapp/ux/css/admin.ui.css

@@ -815,7 +815,7 @@ table.mtz-monthpicker {border:1px solid #ddd; border-top:none;}
 
 /* 카테고리 Sort */
 .categoryOrder {margin-bottom:15px; background:#fcfcfc;}
-.categoryOrder li {clear:both; padding-left:15px; line-height:40px; cursor:move; border-top:1px dashed red; }
+.categoryOrder li {clear:both; padding-left:15px; line-height:40px; cursor:move; border-top:1px dashed #ff0000; }
 .categoryOrder li button.on {background-image:url(/image/icon_cate_minus.png);}
 /* .categoryOrder li:after {content:''; position:absolute; top:8px; left:-10px; width:21px; height:21px; background:url(/image/line_cate.png)} */
 .categoryOrder li:before{position:relative; content:''; width:1px; height:100%; background:#ddd;}

+ 7 - 4
src/main/webapp/ux/js/admin.popup.js

@@ -377,9 +377,9 @@ var cfnOpenPointDetailPopup = function(callbackfun, siteCd, custNo) {
  * @author : LMC
  */
 function cfnCouponCreatePopup(cpnId, callbackfun){
-	var actionUrl = "/marketing/coupon/popup/form";
-	if (typeof(callbackfun) != 'undefined') actionUrl += "?callBackFun=" + callbackfun;
-	cfnOpenModalPopup(actionUrl,'CouponCreatePopup');
+	var actionUrl = "/marketing/coupon/popup/form?cpnId=" + cpnId;
+	if (typeof(callbackfun) != 'undefined') actionUrl += "&callBackFun=" + callbackfun;
+	cfnOpenModalPopup(actionUrl,'CouponRegForm');
 }
 
 
@@ -711,12 +711,15 @@ var cfnOpenBrandListPopup = function(callbackfn, multiGb, searchTxt) {
  * @desc   : 프로모션 등록 팝업
  * <pre>
  *     cfnOpenFreeGoodsPromotionSetPopup('C');
+ *     or
+ *     cfnOpenFreeGoodsPromotionSetPopup('U', 11);
  * </pre>
  * @since  : 2020/12/21
  * @author : xodud1202
  */
-var cfnOpenFreeGoodsPromotionSetPopup = function(gbn) {
+var cfnOpenFreeGoodsPromotionSetPopup = function(gbn, freegiftSq) {
 	var actionUrl = "/marketing/freeGoodsRegiPopup/form?gbn=" + gbn;
+	if (typeof(freegiftSq) != 'undefined') actionUrl += "&freegiftSq=" + freegiftSq;
 
 	uifnPopupClose('popupFreeGoodsPromotionRegi');
 	cfnOpenModalPopup(actionUrl, 'popupFreeGoodsPromotionRegi');

Някои файлове не бяха показани, защото твърде много файлове са промени