From bf6989e1f9cc614cf0439f048280cbcdb78d4009 Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期五, 29 八月 2025 02:12:03 +0800
Subject: [PATCH] 提交本地代码

---
 framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeServiceImpl.java |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 54 insertions(+), 5 deletions(-)

diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeServiceImpl.java
index c0359cf..60f23e6 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeServiceImpl.java
@@ -7,6 +7,7 @@
 import cn.lili.common.security.context.UserContext;
 import cn.lili.common.utils.StringUtils;
 import cn.lili.modules.lmk.domain.entity.*;
+import cn.lili.modules.lmk.domain.form.AddPrizeNumForm;
 import cn.lili.modules.lmk.domain.query.PrizeRecordTimeQuery;
 import cn.lili.modules.lmk.domain.vo.PrizeDetailVO;
 import cn.lili.modules.lmk.domain.vo.PrizeProbabilityVO;
@@ -56,6 +57,7 @@
     private final RocketmqCustomProperties rocketmqCustomProperties;
     private final RocketMQTemplate rocketMQTemplate;
     private final COSUtil cosUtil;
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Result prize(String prizeId) {
@@ -174,7 +176,7 @@
         prizeRecordTimeQuery.setEndTime(endTime);
         prizeRecordTimeQuery.setRecordActivityId(prizeId);
         prizeRecordListByTime = prizeRecordService.getPrizeRecordListByTime(prizeRecordTimeQuery);
-        prizeRecordListByTime.stream().filter(item->{
+        prizeRecordListByTime.stream().filter(item -> {
             return item.getActivityPrizeRefId() != null;
         }).forEach(item -> {
             ActivityRefPrize activityRefPrize = canPrizeMap.get(item.getActivityPrizeRefId());
@@ -384,7 +386,7 @@
         if (useNum >= maxPrize) {
             return Result.ok().data(0);
         } else {
-            return Result.ok().data(userPrizeNum>maxPrize?maxPrize-useNum:notUseNum);
+            return Result.ok().data(userPrizeNum > maxPrize ? maxPrize - useNum : notUseNum);
         }
     }
 
@@ -421,16 +423,16 @@
         }
         PrizeDetailVO data = prizeActivityService.prizeInfo(prizeActivityId);
         String activityCover = data.getActivityCover();
-        if (StringUtils.isNotBlank(activityCover)&&!activityCover.contains("http")) {
+        if (StringUtils.isNotBlank(activityCover) && !activityCover.contains("http")) {
             data.setActivityCover(cosUtil.getPreviewUrl(activityCover));
         }
         data.getPrizeInfoVOS().forEach(info -> {
             String prizeImg = info.getPrizeImg();
             String prizeCover = info.getPrizeCover();
-            if (StringUtils.isNotBlank(prizeImg)&&!prizeImg.contains("http")) {
+            if (StringUtils.isNotBlank(prizeImg) && !prizeImg.contains("http")) {
                 info.setPrizeImg(cosUtil.getPreviewUrl(prizeImg));
             }
-            if (StringUtils.isNotBlank(prizeCover)&&!prizeCover.contains("http")) {
+            if (StringUtils.isNotBlank(prizeCover) && !prizeCover.contains("http")) {
                 info.setPrizeCover(cosUtil.getPreviewUrl(prizeCover));
             }
         });
@@ -441,4 +443,51 @@
     public Result grantRecord(String prizeActivityId) {
         return prizeDrawService.grantRecord(prizeActivityId);
     }
+
+    @Override
+    public Result addPrizeNum(AddPrizeNumForm addPrizeNumForm) {
+        PrizeActivity activity = prizeActivityService.getById(addPrizeNumForm.getPrizeActivityId());
+        if (activity == null) {
+            throw new ServiceException("褰撳墠娲诲姩涓嶅瓨鍦�");
+        }
+        if (!PrizeActivityStatusEnum.ON.name().equals(activity.getEnableStatus())) {
+            throw new ServiceException("褰撳墠娲诲姩娌″紑鍚�");
+        }
+        Date date = new Date();
+        //娲诲姩缁撴潫涓嶉渶瑕佹坊鍔�
+        if (date.after(activity.getEndTime())) {
+            throw new ServiceException("褰撳墠娲诲姩宸茬粨鏉�");
+        }
+        Integer maxPrize = activity.getMaxPrize();
+        String userId = addPrizeNumForm.getUserId();
+        List<PrizeNumber> prizeNumberList = getPrizeNumberList(activity.getId(), userId);
+        if (prizeNumberList.size() >= maxPrize) {
+            throw new ServiceException("鎶藉娆℃暟宸茶揪鍒颁笂闄愪簡");
+        }
+        PrizeUserActionEnum actionEnum = PrizeUserActionEnum.select(addPrizeNumForm.getAddType());
+        if (actionEnum == null) {
+            throw new ServiceException("褰撳墠绫诲瀷涓嶅瓨鍦�");
+        }
+       Boolean check ;
+         //todo 杩涜鏁版嵁鏍¢獙
+        switch (actionEnum) {
+            case BUY:
+                System.err.println("BUY");
+                break;
+            case SHARE:
+                //鐩存帴鑾峰緱鎶藉娆℃暟
+                System.err.println("SHARE");
+                break;
+            case SEE_SHOP:
+                System.err.println("SEE_SHOP");
+                break;
+            case SEE_VIDEO:
+                System.err.println("SEE_VIDEO");
+                break;
+            default:
+
+                break;
+        }
+        return null;
+    }
 }

--
Gitblit v1.8.0