陶杰
2024-09-03 3f5d62a7b4d20f6c63021361e7a48cab02e6cca3
src/main/java/com/mzl/flower/web/v2/coupon/CouponRecordController.java
@@ -10,11 +10,13 @@
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;
@@ -41,6 +43,8 @@
    @Autowired
    private CouponTemplateService2 couponTemplateService;
    private CustomerService customerService;
    @PostMapping("")
@@ -59,6 +63,9 @@
            throw new ValidationException("优惠券已下架");
        }
        // 根据当前获取获取商户的ID
        final CustomerDTO currentCustomer = customerService.getCurrentCustomer();
        dto.setCustomerId(currentCustomer.getId());
        couponRecordService.createCouponRecord(dto);
        return returnData(R.SUCCESS.getCode(), null);