|  |  | 
 |  |  |         CreateCouponTemplateBO couponTemplateBO = new CreateCouponTemplateBO(); | 
 |  |  |         BeanUtils.copyProperties(dto, couponTemplateBO); | 
 |  |  |  | 
 |  |  |         // 设置成积分优惠券 | 
 |  |  |         // 设置成会员优惠券 | 
 |  |  |         couponTemplateBO.setCategory(CouponCategoryEnum.MEMBER.getStatus()); | 
 |  |  |  | 
 |  |  |         couponTemplateService.createCouponTemplate(couponTemplateBO); | 
 |  |  | 
 |  |  |         BeanUtils.copyProperties(couponTemplateDO,couponTemplateBO); | 
 |  |  |         BeanUtils.copyProperties(dto, couponTemplateBO); | 
 |  |  |  | 
 |  |  |         // 设置成积分优惠券 | 
 |  |  |         // 设置成会员优惠券 | 
 |  |  |         couponTemplateBO.setCategory(CouponCategoryEnum.MEMBER.getStatus()); | 
 |  |  |  | 
 |  |  |         couponTemplateService.updateCouponTemplate(couponTemplateBO); | 
 |  |  | 
 |  |  |     public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVipVO>>> page( | 
 |  |  |             Page page, QueryCouponDTO dto | 
 |  |  |     ) { | 
 |  |  |         // 设置只查询积分优惠券的 | 
 |  |  |         // 设置只查询会员优惠券的 | 
 |  |  |         dto.setCategory(CouponCategoryEnum.MEMBER.getStatus()); | 
 |  |  |         Page<CouponTemplateVO> resultPage = couponTemplateService.getPage(page, dto); | 
 |  |  |         return returnData(R.SUCCESS.getCode(), ConverterUtil.transPage(resultPage, CouponTemplateVipVO.class)); | 
 |  |  | 
 |  |  |         return returnData(R.SUCCESS.getCode(), ConverterUtil.transList(couponTemplateService.getList(dto), CouponTemplateVipVO.class)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PutMapping("/active/{id}") | 
 |  |  |     @ApiOperation(value = "发布", notes = "发布") | 
 |  |  |     public ResponseEntity<ReturnDataDTO> active(@PathVariable String id) { | 
 |  |  |  | 
 |  |  |         CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); | 
 |  |  |         if (null == couponTemplateDO) { | 
 |  |  |             throw new ValidationException("优惠券不存在"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         couponTemplateService.activeCouponTemplate(id); | 
 |  |  |  | 
 |  |  |         return returnData(R.SUCCESS.getCode(), null); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PutMapping("/expire/{id}") | 
 |  |  |     @ApiOperation(value = "下架", notes = "下架") | 
 |  |  |     public ResponseEntity<ReturnDataDTO> expire(@PathVariable String id) { | 
 |  |  |  | 
 |  |  |         CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); | 
 |  |  |         if (null == couponTemplateDO) { | 
 |  |  |             throw new ValidationException("优惠券不存在"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         couponTemplateService.expireCouponTemplate(id); | 
 |  |  |  | 
 |  |  |         return returnData(R.SUCCESS.getCode(), null); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     private void valid(CreateCouponTemplateVipDTO dto){ | 
 |  |  |  | 
 |  |  | 
 |  |  |             throw new ValidationException("会员等级不存在"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         if (StringUtils.isNotBlank(dto.getCouponDiscountType()) | 
 |  |  |                 && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) | 
 |  |  |                 && dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0) { | 
 |  |  |             throw new ValidationException("订单金额不能小于折扣金额"); | 
 |  |  |         if (StringUtils.isNotBlank(dto.getCouponDiscountType()) && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType())) { | 
 |  |  |  | 
 |  |  |             if(dto.getMinOrderAmount().compareTo(BigDecimal.ZERO)<=0){ | 
 |  |  |                 throw new ValidationException("优惠券使用条件不能小于0"); | 
 |  |  |             } | 
 |  |  |             if(dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0){ | 
 |  |  |                 throw new ValidationException("优惠券使用条件不能小于面值金额"); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         if (StringUtils.isNotBlank(dto.getCouponDiscountType()) | 
 |  |  |                 && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) | 
 |  |  |                 && dto.getCouponDiscountValue().compareTo(BigDecimal.ZERO) <= 0) { |