jk-GitHub-coder 3 éve
szülő
commit
ce08d44ec0

+ 13 - 0
YijiaRestful/src/main/java/com/platform/yijia/controller/CouponController.java

@@ -82,6 +82,19 @@ public class CouponController {
                     if(cgcInfo !=null && cgcInfo.getIssueGiveCount() >=  cgcInfo.getGiveCount()){
                         resultData = ResultData.error(CodeMsg.COUPON_GIVE_COUNT_MAX);
                     }else {
+                        if(cgcInfo !=null){
+                            //更新次数
+                            Integer issueGiveCount = cgcInfo.getIssueGiveCount();
+                            int i = issueGiveCount + 1;
+                            couponUserGiveCount.setIssueGiveCount(i);
+                            couponUserGiveCount.setUpdateTime(new Date());
+                            couponService.updateCouponUserGiveCount(couponUserGiveCount);
+                        }else {
+                            //新增次数
+                            couponUserGiveCount.setIssueGiveCount(1);
+                            couponUserGiveCount.setCreteTime(new Date());
+                            couponService.addCouponUserGiveCount(couponUserGiveCount);
+                        }
                         //该领取方式能领取优惠券的时间类型
                         String availableControl = couponIssuesList.get(0).getAvailableControl();
                         switch (availableControl){