Bläddra i källkod

调整优惠券在修改和结束时的错误状态处理

lijun 2 år sedan
förälder
incheckning
5bbd2e138e

+ 5 - 7
imcs-bt-be/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/coupon/CouponController.java

@@ -13,7 +13,6 @@ import com.github.zuihou.business.coupon.service.CouponService;
 import com.github.zuihou.business.memberCoupon.dao.MemberCouponMapper;
 import com.github.zuihou.business.memberCoupon.dto.MemberCouponDTO;
 import com.github.zuihou.business.memberCoupon.entity.MemberCoupon;
-import com.github.zuihou.business.order.entity.Order;
 import com.github.zuihou.business.util.RedisLock;
 import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
@@ -22,7 +21,6 @@ import com.github.zuihou.security.annotation.PreAuth;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
@@ -70,9 +68,9 @@ public class CouponController extends SuperController<CouponService, Long, Coupo
     }
 
     @PostMapping("/updateCoupon")
-    @SysLog(value = "新增", request = false)
+    @SysLog(value = "修改", request = false)
 //    @PreAuth("hasPermit('{}add')")
-    @ApiOperation(value = "保存优惠券", notes = "保存优惠券")
+    @ApiOperation(value = "修改优惠券", notes = "保存优惠券")
     public R updateCoupon(@RequestBody @Validated CouponUpdateDTO updateDTO) {
         Coupon bdCoupon = getDbCouponById(updateDTO.getId());
         // 优惠券不存在或者优惠券已删除删除
@@ -80,7 +78,7 @@ public class CouponController extends SuperController<CouponService, Long, Coupo
             return R.fail("优惠券不存在");
         }
         // 优惠券已冻结
-        if ("1".equals(bdCoupon.getStatus())) {
+        if ("0".equals(bdCoupon.getStatus())) {
             return R.fail("优惠券已冻结");
         }
         Coupon model = BeanUtil.toBean(updateDTO, this.getEntityClass());
@@ -145,12 +143,12 @@ public class CouponController extends SuperController<CouponService, Long, Coupo
             return R.success("优惠券不存在");
         }
         // 优惠券已冻结
-        if ("1".equals(bdCoupon.getStatus())) {
+        if ("0".equals(bdCoupon.getStatus())) {
             return R.success("优惠券已冻结");
         }
         Coupon updateCoupon = new Coupon(couponId);
         // 设置冻结标记
-        updateCoupon.setStatus("1");
+        updateCoupon.setStatus("0");
         baseService.updateById(updateCoupon);
         return R.success();
     }