|  | @@ -5,6 +5,7 @@ import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.config.exception.ExceptionEnum;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.entity.ResultVo;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.entity.login.UserInfo;
 | 
	
		
			
				|  |  | +import thyyxxk.webserver.entity.outpatient.coupon.CouponGainWay;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.entity.outpatient.coupon.ZdCoupon;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.service.outpatient.coupon.CouponManageService;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.utils.ResultVoUtil;
 | 
	
	
		
			
				|  | @@ -39,6 +40,12 @@ public class CouponManageController {
 | 
	
		
			
				|  |  |                          "总量不能小于余量!");
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        if (coupon.getGainWay() == CouponGainWay.PURCHASE) {
 | 
	
		
			
				|  |  | +            if (coupon.getPrice() <= 0) {
 | 
	
		
			
				|  |  | +                return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "优惠券单价必须大于0");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            coupon.setEffectiveDays(365 * 100);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          String response = service.updateCouponState(coupon);
 | 
	
		
			
				|  |  |          return ResultVoUtil.success(response);
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -62,6 +69,18 @@ public class CouponManageController {
 | 
	
		
			
				|  |  |                  StringUtil.isBlank(coupon.getDescription())) {
 | 
	
		
			
				|  |  |              return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "优惠券描述不能为空。");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        if (null == coupon.getGainWay()) {
 | 
	
		
			
				|  |  | +            return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "优惠券获取方式不能为空。");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (null == coupon.getPrice()) {
 | 
	
		
			
				|  |  | +            coupon.setPrice(0);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (coupon.getGainWay() == CouponGainWay.PURCHASE) {
 | 
	
		
			
				|  |  | +            if (coupon.getPrice() <= 0) {
 | 
	
		
			
				|  |  | +                return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "优惠券单价必须大于0");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            coupon.setEffectiveDays(365 * 100);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          if (null == coupon.getValue()) {
 | 
	
		
			
				|  |  |              return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "优惠券金额不能为空。");
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -74,6 +93,7 @@ public class CouponManageController {
 | 
	
		
			
				|  |  |          if (null == coupon.getType()) {
 | 
	
		
			
				|  |  |              return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "优惠券下发方式不能为空。");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          String response = service.insertNewCoupon(coupon);
 | 
	
		
			
				|  |  |          if (response.equals("SUCCESS")) {
 | 
	
		
			
				|  |  |              return ResultVoUtil.success("新增优惠券成功。");
 |