From ee9688b912bb993b54252a26f8ad9e0e04df21c3 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期五, 21 六月 2024 18:11:21 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/controller/management/MgtCouponController.java |   34 ++++++++++++++++++++++++++++++----
 1 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/controller/management/MgtCouponController.java b/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/controller/management/MgtCouponController.java
index af8bba0..6ea3538 100644
--- a/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/controller/management/MgtCouponController.java
+++ b/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/controller/management/MgtCouponController.java
@@ -1,6 +1,10 @@
 package com.ruoyi.promotion.controller.management;
 
 
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.util.DateUtils;
+import com.alibaba.excel.write.metadata.WriteSheet;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.utils.page.PageDTO;
 import com.ruoyi.promotion.controller.management.dto.MgtCouponDTO;
@@ -11,9 +15,11 @@
 import com.ruoyi.promotion.controller.management.vo.MgtCouponVO;
 import com.ruoyi.promotion.service.ICouponService;
 import com.ruoyi.system.api.validate.InsertGroup;
-import com.ruoyi.system.api.validate.ModifyGroup;
+import com.ruoyi.system.api.validate.UpdateGroup;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import java.util.Date;
+import java.util.List;
 import lombok.RequiredArgsConstructor;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -69,7 +75,7 @@
      */
     @ApiOperation("编辑优惠券")
     @PutMapping("/update")
-    public R<?> updateCoupon(@Validated(ModifyGroup.class) @RequestBody MgtCouponDTO dto) {
+    public R<?> updateCoupon(@Validated(UpdateGroup.class) @RequestBody MgtCouponDTO dto) {
         couponService.updateCoupon(dto);
         return R.ok();
     }
@@ -77,8 +83,7 @@
     /**
      * 上架/下架
      *
-     * @param dto
-     * @return
+     * @param dto 管理后台-优惠券上架下架数据传输对象
      */
     @ApiOperation("上架/下架")
     @PutMapping("/upd-status")
@@ -99,4 +104,25 @@
             @Validated @RequestBody MgtCouponReceiveQuery query) {
         return R.ok(couponService.getReceiveDetail(query));
     }
+
+    /**
+     * 导出优惠券领取详情
+     *
+     * @param query 管理后台-优惠券领取详情查询对象
+     */
+    @ApiOperation("领取详情-导出")
+    @PostMapping("/receive-detail/export")
+    public void exportReceiveDetail(@RequestBody MgtCouponReceiveQuery query) {
+        List<CouponReceiveDetailVO> couponReceiveDetailVOList = couponService.getCouponReceiveDetailList(
+                query);
+        String fileName =
+                "优惠券领取明细" + DateUtils.format(new Date(), "yyyyMMddHHmmss") + ".xlsx";
+
+        try (ExcelWriter excelWriter = EasyExcel.write(fileName, CouponReceiveDetailVO.class)
+                .build()) {
+            WriteSheet writeSheet = EasyExcel.writerSheet("优惠券领取详情").build();
+            excelWriter.write(couponReceiveDetailVOList, writeSheet);
+        }
+    }
+    
 }

--
Gitblit v1.7.1