From 3f5d62a7b4d20f6c63021361e7a48cab02e6cca3 Mon Sep 17 00:00:00 2001
From: 陶杰 <1378534974@qq.com>
Date: 星期二, 03 九月 2024 15:15:23 +0800
Subject: [PATCH] 1.优惠券相关代码提交

---
 src/main/java/com/mzl/flower/web/v2/coupon/CouponRecordController.java |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/mzl/flower/web/v2/coupon/CouponRecordController.java b/src/main/java/com/mzl/flower/web/v2/coupon/CouponRecordController.java
index e7cdb4f..4c03990 100644
--- a/src/main/java/com/mzl/flower/web/v2/coupon/CouponRecordController.java
+++ b/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);

--
Gitblit v1.9.3