zoujiajian 1 년 전
부모
커밋
c81ab123c1
1개의 변경된 파일7개의 추가작업 그리고 0개의 파일을 삭제
  1. 7 0
      netflix-service/src/main/java/com/cyksj/service/mange/coupon/impl/CouponCommonServiceImpl.java

+ 7 - 0
netflix-service/src/main/java/com/cyksj/service/mange/coupon/impl/CouponCommonServiceImpl.java

@@ -66,6 +66,13 @@ public class CouponCommonServiceImpl implements CouponCommonService {
 		if (coupon.getId() == null || coupon.getId() < 1) {
 			throw BusinessRuntimeException.getInstance("请输入正确的优惠券id");
 		}
+		if (coupon.getType() == Coupon.Type.reduce) {
+			coupon.setDiscount(BigDecimal.ZERO);
+		}
+		if (coupon.getType() == Coupon.Type.discount) {
+			coupon.setReduceCondition(BigDecimal.ZERO);
+			coupon.setReduceMoney(BigDecimal.ZERO);
+		}
 		Coupon entity = couponMapper.selectById(coupon.getId());
 		if (entity == null || !entity.getDeleted()) {
 			throw BusinessRuntimeException.getInstance("该优惠券不存在");