|  |  |  | 
|---|
|  |  |  | import com.mzl.flower.dto.request.coupon.QueryCouponRecordDTO; | 
|---|
|  |  |  | import com.mzl.flower.dto.response.coupon.CouponRecordResultVO; | 
|---|
|  |  |  | import com.mzl.flower.dto.response.coupon.CouponRecordVO; | 
|---|
|  |  |  | import com.mzl.flower.dto.response.customer.CustomerDTO; | 
|---|
|  |  |  | import com.mzl.flower.entity.coupon.CouponRecordDO; | 
|---|
|  |  |  | import com.mzl.flower.entity.coupon.CouponTemplateDO; | 
|---|
|  |  |  | import com.mzl.flower.enums.CouponStatusEnum; | 
|---|
|  |  |  | import com.mzl.flower.service.coupon.CouponRecordService; | 
|---|
|  |  |  | import com.mzl.flower.service.coupon.CouponTemplateService2; | 
|---|
|  |  |  | import com.mzl.flower.service.customer.CustomerService; | 
|---|
|  |  |  | import com.mzl.flower.utils.ConverterUtil; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private CouponTemplateService2 couponTemplateService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private CustomerService customerService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping("") | 
|---|
|  |  |  | @ApiOperation(value = "新增", notes = "新增") | 
|---|
|  |  |  | 
|---|
|  |  |  | if(StringUtils.isNotBlank(couponTemplateDO.getStatus()) && couponTemplateDO.getStatus().equals(CouponStatusEnum.EXPIRED.getStatus())){ | 
|---|
|  |  |  | throw new ValidationException("优惠券已下架"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 根据当前获取获取商户的ID | 
|---|
|  |  |  | final CustomerDTO currentCustomer = customerService.getCurrentCustomer(); | 
|---|
|  |  |  | dto.setCustomerId(currentCustomer.getId()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | couponRecordService.createCouponRecord(dto); | 
|---|
|  |  |  | return returnData(R.SUCCESS.getCode(), null); | 
|---|