From 1e2d55b9f92cebfc9909e83e09478c864fa11ca0 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 09 一月 2025 11:47:13 +0800
Subject: [PATCH] bug修改

---
 manage/src/main/java/com/jilongda/manage/controller/TCouponController.java |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/manage/src/main/java/com/jilongda/manage/controller/TCouponController.java b/manage/src/main/java/com/jilongda/manage/controller/TCouponController.java
index ae1bbe9..c925cd1 100644
--- a/manage/src/main/java/com/jilongda/manage/controller/TCouponController.java
+++ b/manage/src/main/java/com/jilongda/manage/controller/TCouponController.java
@@ -15,6 +15,7 @@
 import com.jilongda.manage.service.TAppUserService;
 import com.jilongda.manage.service.TCouponReceiveService;
 import com.jilongda.manage.service.TCouponService;
+import com.jilongda.manage.utils.OssUploadUtil;
 import com.jilongda.manage.utils.QRCodeUtil;
 import com.jilongda.manage.vo.TAppUserVO;
 import com.jilongda.manage.vo.TCouponInfoVO;
@@ -103,7 +104,7 @@
                     TCouponReceive tCouponReceive = new TCouponReceive();
                     tCouponReceive.setCouponId(dto.getId());
                     tCouponReceive.setUserId(userId);
-                    tCouponReceive.setType(2);
+                    tCouponReceive.setType(3);
                     tCouponReceive.setAmount(dto.getAmount());
                     tCouponReceive.setStoreId(dto.getStoreId());
                     if (dto.getTime()!=0){
@@ -119,8 +120,9 @@
                 String code = "{\"id\": "+dto.getId()+ "}";
                 BufferedImage blueImage = QRCodeUtil.createImage(code);
                 MultipartFile blueFile = convert(blueImage, new Date().getTime() + UUIDUtil.getRandomCode(3) + ".PNG");
-                // todo 没有云存储
-//                String s = OssUploadUtil.ossUpload("img/", blueFile);
+                String s = OssUploadUtil.ossUpload("eyes/", blueFile);
+                dto.setQrCode(s);
+                couponService.updateById(dto);
                 break;
         }
         return ApiResult.success();
@@ -152,9 +154,18 @@
                 .eq(TCouponReceive::getCouponId, id)
                 .eq(TCouponReceive::getStatus, 2)).size();
         tCouponInfoVO.setUseCount(size1);
-
+        if (byId.getType()==3){
+            // 查询领取人
+            List<Integer> collect = couponReceiveService.lambdaQuery()
+                    .eq(TCouponReceive::getCouponId, id).list()
+                    .stream().map(TCouponReceive::getUserId)
+                    .distinct()
+                    .collect(Collectors.toList());
+            tCouponInfoVO.setUserIds(collect);
+        }
         return ApiResult.success(tCouponInfoVO);
     }
+
     public static MultipartFile convert(BufferedImage bufferedImage, String fileName) throws IOException {
         // 将 BufferedImage 转换为字节数组
         ByteArrayOutputStream baos = new ByteArrayOutputStream();

--
Gitblit v1.7.1