From 3a61aa096c3191e97770a92e4e145fe63ddc1aa4 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期五, 27 二月 2026 18:41:05 +0800
Subject: [PATCH] 经销商管理

---
 server/dmmall_service/src/main/java/com/doumee/service/business/impl/CouponServiceImpl.java |   31 ++++++++++++++++++++++++-------
 1 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/server/dmmall_service/src/main/java/com/doumee/service/business/impl/CouponServiceImpl.java b/server/dmmall_service/src/main/java/com/doumee/service/business/impl/CouponServiceImpl.java
index 53fd9d8..bdea826 100644
--- a/server/dmmall_service/src/main/java/com/doumee/service/business/impl/CouponServiceImpl.java
+++ b/server/dmmall_service/src/main/java/com/doumee/service/business/impl/CouponServiceImpl.java
@@ -76,10 +76,19 @@
                 || coupon.getType()==null
                 ||coupon.getLimitPrice()==null
                 ||coupon.getPrice()==null
+                ||coupon.getUseType() ==null
                 ||coupon.getNum()==null
+                ||(coupon.getUseType() ==0 &&(
+                    coupon.getStartDate()==null
+                    ||coupon.getEndDate()==null
+                  ))
+                ||(coupon.getUseType() ==1 &&(
+                    coupon.getValidDays()==null
+                    || coupon.getValidDays()<=0
+                  ))
               /*  ||coupon.getIntegral()==null*/
-                ||coupon.getStartDate()==null
-                ||coupon.getEndDate()==null
+//                ||coupon.getStartDate()==null
+//                ||coupon.getEndDate()==null
 //                ||coupon.getValidDays()==null
 
         ){
@@ -96,6 +105,12 @@
             if(Objects.isNull(shop)){
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "鍏宠仈鐨勫簵閾轰笉瀛樺湪锛�");
             }
+        }
+        if(coupon.getUseType() ==0){
+            coupon.setValidDays(null);
+        }else{
+            coupon.setStartDate(null);
+            coupon.setEndDate(null);
         }
         coupon.setApplyIds("");
         if(Constants.equalsInteger(coupon.getApplyType(),Constants.TWO) && coupon.getApplyIdList()!=null){
@@ -139,7 +154,7 @@
         isCreateParamValid(coupon);
         Coupon query= couponMapper.selectById(coupon.getId());
         initCouponStatus(query);
-     /*   if(!Constants.equalsInteger(query.getCouponStatus(),Constants.ZERO)){
+       /* if(!Constants.equalsInteger(query.getCouponStatus(),Constants.ZERO)){
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "娲诲姩宸插紑濮�/宸茬粨鏉熺姸鎬侊紝涓嶆敮鎸佺紪杈戞搷浣�");
         }*/
         coupon.setEditor(user.getId());
@@ -192,8 +207,9 @@
         Utils.MP.blankToNull(pageWrap );
         queryWrapper.selectAll(Coupon.class);
         queryWrapper.like(StringUtils.isNotBlank(pageWrap. getName()),Coupon::getName,pageWrap.getName());
+        queryWrapper.eq(pageWrap.getStatus()!=null,Coupon::getStatus,pageWrap.getStatus());
         queryWrapper.eq(Coupon::getIsdeleted,Constants.ZERO);
-        queryWrapper.orderByDesc(Coupon::getCreateDate);
+        queryWrapper.orderByDesc(Coupon::getId);
         List<Coupon> result =  couponJoinMapper.selectList( queryWrapper);
         for(Coupon model:result){
             initCouponStatus(model);
@@ -207,9 +223,10 @@
         MPJLambdaWrapper<Coupon> queryWrapper = new MPJLambdaWrapper<>();
         Utils.MP.blankToNull(pageWrap.getModel());
         queryWrapper.selectAll(Coupon.class);
-        queryWrapper.select("(select count(id) from member_coupon where ISDELETED=0 and COUPON_ID=t.id) as received");
-        queryWrapper.select("(select count(id) from member_coupon where ISDELETED=0 and COUPON_ID=t.id and STATUS=0) as unused");
-        queryWrapper.select("(select count(id) from member_coupon where ISDELETED=0 and COUPON_ID=t.id and STATUS=1) as used");
+        //宸插彂鏀炬暟閲忥紙涓嶅寘鍚畾鍚戝彂鏀撅級
+        queryWrapper.select("(select count(id) from member_coupon where ISDELETED=0 and COUPON_ID=t.id and GET_METHOD !=2) as received");
+//        queryWrapper.select("(select count(id) from member_coupon where ISDELETED=0 and COUPON_ID=t.id and STATUS=0) as unused");
+//        queryWrapper.select("(select count(id) from member_coupon where ISDELETED=0 and COUPON_ID=t.id and STATUS=1) as used");
 
         queryWrapper.like(StringUtils.isNotBlank(pageWrap.getModel().getName()),Coupon::getName,pageWrap.getModel().getName());
         queryWrapper.eq(pageWrap.getModel().getCouponType()!=null,Coupon::getCouponType,pageWrap.getModel().getCouponType());

--
Gitblit v1.9.3