|  |  |  | 
|---|
|  |  |  | private CouponTemplateService2 couponTemplateService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping("") | 
|---|
|  |  |  | @ApiOperation(value = "新增", notes = "新增") | 
|---|
|  |  |  | public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody CreateCouponRecordDTO dto) { | 
|---|
|  |  |  | 
|---|
|  |  |  | throw new ValidationException("优惠券不存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(StringUtils.isNotBlank(couponTemplateDO.getStatus()) && !couponTemplateDO.getStatus().equals(CouponStatusEnum.INACTIVE.getStatus())){ | 
|---|
|  |  |  | if(StringUtils.isNotBlank(couponTemplateDO.getStatus()) && couponTemplateDO.getStatus().equals(CouponStatusEnum.INACTIVE.getStatus())){ | 
|---|
|  |  |  | throw new ValidationException("优惠券还未发布"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(StringUtils.isNotBlank(couponTemplateDO.getStatus()) && !couponTemplateDO.getStatus().equals(CouponStatusEnum.EXPIRED.getStatus())){ | 
|---|
|  |  |  | if(StringUtils.isNotBlank(couponTemplateDO.getStatus()) && couponTemplateDO.getStatus().equals(CouponStatusEnum.EXPIRED.getStatus())){ | 
|---|
|  |  |  | throw new ValidationException("优惠券已下架"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | couponRecordService.createCouponRecord(dto); | 
|---|
|  |  |  | return returnData(R.SUCCESS.getCode(), null); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PutMapping("/{id}") | 
|---|
|  |  |  | @ApiOperation(value = "修改", notes = "修改") | 
|---|
|  |  |  | public ResponseEntity<ReturnDataDTO>  update(@Validated @RequestBody CreateCouponRecordDTO dto) { | 
|---|
|  |  |  | public ResponseEntity<ReturnDataDTO>  update(@PathVariable String id,@Validated @RequestBody CreateCouponRecordDTO dto) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dto.setId(id); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | CouponRecordDO couponRecordDO= couponRecordService.getById(dto.getId()); | 
|---|
|  |  |  | if(null==couponRecordDO){ | 
|---|