Sfoglia il codice sorgente

Merge branch 'sowon' into develop

sowon4187 5 anni fa
parent
commit
17905533e0

+ 19 - 3
src/main/java/com/style24/front/biz/service/TsfCouponService.java

@@ -767,15 +767,32 @@ public class TsfCouponService {
 		coupon.setCustNo(TsfSession.getInfo().getCustNo());
 		coupon.setCustNo(TsfSession.getInfo().getCustNo());
 		coupon.setCustGrade(TsfSession.getInfo().getCustGrade());
 		coupon.setCustGrade(TsfSession.getInfo().getCustGrade());
 		Collection<Coupon> quickCouponList = couponDao.getQuickCouponDownList(coupon);
 		Collection<Coupon> quickCouponList = couponDao.getQuickCouponDownList(coupon);
-
+		
+		Coupon temp = quickCouponList.iterator().next();
+		System.out.println(temp);
 		String result = "SUCESS";
 		String result = "SUCESS";
 
 
 		if (quickCouponList == null || quickCouponList.isEmpty()) {
 		if (quickCouponList == null || quickCouponList.isEmpty()) {
 			result = "ERROR_10";
 			result = "ERROR_10";
 			return result;
 			return result;
 		}
 		}
+		
+		if (temp.getTotPubLimitQty() > 0) {
+			if (temp.getCustPubLimitQty() <= temp.getCustCouponCnt()) {
+				result = "ERROR_30";
+				return result;
+			}
+		}
+		// 첫구매여부 (Y:구매이력이없음 | N:구매이력있음) - 구매기간일자 해당기간에 구매이력이 없으면 다운로드 가능
+		if ("Y".equals(temp.getFirstOrdYn())) {
+			int firstOrdcnt = orderService.getCustFirstOrderCount(temp);
+			if (firstOrdcnt > 0) {
+				//log.info("상품쿠폰 다운  skip: 쿠폰첫구매정보 : {}, {} ~ {} ", coupon.getFirstOrdYn(), coupon.getBuyStdt(), coupon.getBuyEddt());
+				result = "ERROR_20";
+				return result;
+			}
+		}
 
 
-		int count = 0;
 		if (coupon.getCpnId() > 0) {
 		if (coupon.getCpnId() > 0) {
 			for (Coupon quickCoupon : quickCouponList) {
 			for (Coupon quickCoupon : quickCouponList) {
 				if (quickCoupon != null) {
 				if (quickCoupon != null) {
@@ -789,7 +806,6 @@ public class TsfCouponService {
 					custCoupon.setUpdNo(coupon.getCustNo());
 					custCoupon.setUpdNo(coupon.getCustNo());
 					custCoupon.setRegNo(coupon.getCustNo());
 					custCoupon.setRegNo(coupon.getCustNo());
 					coreCouponDao.saveCouponCustPub(custCoupon);
 					coreCouponDao.saveCouponCustPub(custCoupon);
-					count++;
 				}
 				}
 			}
 			}
 		}
 		}

+ 6 - 1
src/main/java/com/style24/front/biz/web/TsfMypageController.java

@@ -1557,6 +1557,7 @@ public class TsfMypageController extends TsfBaseController {
 	public GagaMap getQuickDownCouponList() {
 	public GagaMap getQuickDownCouponList() {
 		GagaMap result = new GagaMap();
 		GagaMap result = new GagaMap();
 		Coupon coupon = new Coupon();
 		Coupon coupon = new Coupon();
+		coupon.setQuickYn("N");
 		Collection<Coupon> ownCouponList = couponService.getQuickCouponDownList(coupon);
 		Collection<Coupon> ownCouponList = couponService.getQuickCouponDownList(coupon);
 		result.set("ownCouponList", ownCouponList);
 		result.set("ownCouponList", ownCouponList);
 		result.set("couponCount",couponService.getMypageCouponInfo(coupon));
 		result.set("couponCount",couponService.getMypageCouponInfo(coupon));
@@ -1576,11 +1577,15 @@ public class TsfMypageController extends TsfBaseController {
 		String couponResult = couponService.saveQuickCoupon(coupon);
 		String couponResult = couponService.saveQuickCoupon(coupon);
 		if ("ERROR_10".equals(couponResult)) {
 		if ("ERROR_10".equals(couponResult)) {
 			result.set("message", "발급가능 쿠폰이 없습니다.");
 			result.set("message", "발급가능 쿠폰이 없습니다.");
+		}else if("ERROR_20".equals(couponResult)){
+			result.set("message", "죄송합니다. 해당 쿠폰은 다운로드가 불가합니다.");
+		}else if("ERROR_30".equals(couponResult)){
+			result.set("message", "죄송합니다. 해당 쿠폰은 다운로드가 불가합니다.");
 		}else {
 		}else {
 			result.set("message", "쿠폰이 발급되었습니다.");
 			result.set("message", "쿠폰이 발급되었습니다.");
 		}
 		}
+		coupon.setQuickYn("Y");
 		result.set("status", "200");
 		result.set("status", "200");
-		
 		result.set("couponList", couponService.getQuickCouponDownList(coupon));
 		result.set("couponList", couponService.getQuickCouponDownList(coupon));
 		return result;
 		return result;
 	}
 	}

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

@@ -1292,6 +1292,7 @@
 		      ,C.CUST_PUB_LIMIT_QTY 
 		      ,C.CUST_PUB_LIMIT_QTY 
 		      ,C.TOT_PUB_LIMIT_QTY
 		      ,C.TOT_PUB_LIMIT_QTY
 		      ,C.MAX_DC_AMT 
 		      ,C.MAX_DC_AMT 
+		      ,C.FIRST_ORD_YN
 		      , IFNULL((SELECT COUNT(1) FROM TB_CUST_COUPON WHERE CPN_ID = C.CPN_ID AND CUST_NO = #{custNo}),0) AS CUST_COUPON_CNT
 		      , IFNULL((SELECT COUNT(1) FROM TB_CUST_COUPON WHERE CPN_ID = C.CPN_ID AND CUST_NO = #{custNo}),0) AS CUST_COUPON_CNT
 		      , CONCAT(CASE WHEN C.BUY_LIMIT_AMT = 0 THEN ''
 		      , CONCAT(CASE WHEN C.BUY_LIMIT_AMT = 0 THEN ''
 		                   ELSE CONCAT(FORMAT(C.BUY_LIMIT_AMT , 0),'원 이상 구매 시 ')
 		                   ELSE CONCAT(FORMAT(C.BUY_LIMIT_AMT , 0),'원 이상 구매 시 ')
@@ -1328,7 +1329,9 @@
 		         WHEN 'M' = 'P' THEN C.DC_MVAL
 		         WHEN 'M' = 'P' THEN C.DC_MVAL
 		     ELSE C.DC_AVAL END) > 0                  -- PC, MOBILE,APP 별로 0 보다 큰 쿠폰
 		     ELSE C.DC_AVAL END) > 0                  -- PC, MOBILE,APP 별로 0 보다 큰 쿠폰
 		AND IF (C.TOT_PUB_LIMIT_QTY = 0, 9999999999,C.TOT_PUB_LIMIT_QTY) > (SELECT COUNT(1) FROM TB_CUST_COUPON WHERE CPN_ID = C.CPN_ID) -- 총발행제한수
 		AND IF (C.TOT_PUB_LIMIT_QTY = 0, 9999999999,C.TOT_PUB_LIMIT_QTY) > (SELECT COUNT(1) FROM TB_CUST_COUPON WHERE CPN_ID = C.CPN_ID) -- 총발행제한수
+		<if test='quickYn == "N" and quickYn != ""'>
 		AND IF (C.CUST_PUB_LIMIT_QTY = 0, 9999999999,C.CUST_PUB_LIMIT_QTY) > (SELECT COUNT(1) FROM TB_CUST_COUPON WHERE CPN_ID = C.CPN_ID AND CUST_NO= #{custNo}) -- 고객당발행제한수량
 		AND IF (C.CUST_PUB_LIMIT_QTY = 0, 9999999999,C.CUST_PUB_LIMIT_QTY) > (SELECT COUNT(1) FROM TB_CUST_COUPON WHERE CPN_ID = C.CPN_ID AND CUST_NO= #{custNo}) -- 고객당발행제한수량
+		</if>
 		AND (SELECT COUNT(1)
 		AND (SELECT COUNT(1)
 		     FROM TB_COUPON_CUST_GBN
 		     FROM TB_COUPON_CUST_GBN
 		     WHERE CPN_ID = C.CPN_ID
 		     WHERE CPN_ID = C.CPN_ID

+ 2 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsfOrder.xml

@@ -509,7 +509,9 @@
 		SELECT COUNT(*) 
 		SELECT COUNT(*) 
 		FROM TB_ORDER
 		FROM TB_ORDER
 		WHERE CUST_NO = #{custNo}
 		WHERE CUST_NO = #{custNo}
+		<if test="buyStdt != null and buyStdt != ''">
 		AND ORD_DT BETWEEN CONCAT(#{buyStdt}, '000000') and CONCAT(#{buyEddt}, '235959')
 		AND ORD_DT BETWEEN CONCAT(#{buyStdt}, '000000') and CONCAT(#{buyEddt}, '235959')
+		</if>
 	</select>
 	</select>
 	
 	
 	<!-- 보유쿠폰체크 -->
 	<!-- 보유쿠폰체크 -->

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

@@ -1604,7 +1604,7 @@
 		WHERE PLAN_GB = 'S'
 		WHERE PLAN_GB = 'S'
 		AND OPEN_YN = 'Y'
 		AND OPEN_YN = 'Y'
 		AND NOW() BETWEEN DISP_STDT AND DISP_EDDT 
 		AND NOW() BETWEEN DISP_STDT AND DISP_EDDT 
-		ORDER BY UPD_DT DESC LIMIT 1
+		ORDER BY REG_DT DESC LIMIT 1
 	</select>
 	</select>
 	
 	
 </mapper>
 </mapper>

+ 5 - 10
src/main/webapp/WEB-INF/views/web/common/fragments/FooterWeb.html

@@ -1356,20 +1356,15 @@
 	// 쿠폰다운로드 콜백
 	// 쿠폰다운로드 콜백
 	var fnQuickCouponCallBack = function(result){
 	var fnQuickCouponCallBack = function(result){
 		if (result.status == "200"){
 		if (result.status == "200"){
-			let list = result.couonList;
-
-			list.forEach(function(coupon){
-				if (Number(coupon.custPubLimitQty) > 0){
-					if (Number(coupon.custPubLimitQty) <= Number(coupon.custCouponCnt)){
-						$('#coupon_'+ coupon.cpnId).html('<span>받기완료</span>');
-						$('#coupon_'+ coupon.cpnId).attr('disabled', true);
+			$.each(result.couponList, function (idx, item) {
+				if (Number(item.custPubLimitQty) > 0){
+					if (Number(item.custPubLimitQty) <= Number(item.custCouponCnt)){
+						$('#coupon_'+ item.cpnId).html('<span>받기완료</span>');
+						$('#coupon_'+ item.cpnId).attr('disabled', true);
 					}
 					}
 				}
 				}
 			});
 			});
-			
 		}			
 		}			
-		//issueCouponBtn();
-		
 	}
 	}