From 7ec17b93b34a060233e5f193fa47fa243f7efafc Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期四, 28 八月 2025 01:07:52 +0800
Subject: [PATCH] 导出以及页面

---
 framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeActivityServiceImpl.java |   68 +++++++++++++++++++++++++++++++++-
 1 files changed, 66 insertions(+), 2 deletions(-)

diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeActivityServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeActivityServiceImpl.java
index 08175bd..4351b3d 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeActivityServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeActivityServiceImpl.java
@@ -1,8 +1,8 @@
 package cn.lili.modules.lmk.service.impl;
 
 import cn.lili.common.utils.StringUtils;
-import cn.lili.modules.lmk.domain.entity.ActivityRefPrize;
 import cn.lili.modules.lmk.domain.vo.ActivityRefPrizeInfoVO;
+import cn.lili.modules.lmk.domain.vo.PrizeDetailVO;
 import cn.lili.modules.lmk.enums.general.PrizeActivityStatusEnum;
 import cn.lili.modules.lmk.service.ActivityRefPrizeService;
 import cn.lili.utils.COSUtil;
@@ -11,6 +11,8 @@
 import cn.lili.modules.lmk.mapper.PrizeActivityMapper;
 import cn.lili.modules.lmk.service.PrizeActivityService;
 import cn.lili.base.Result;
+import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
+import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import cn.lili.modules.lmk.domain.form.PrizeActivityForm;
 import cn.lili.modules.lmk.domain.vo.PrizeActivityVO;
@@ -23,6 +25,7 @@
 import org.springframework.util.CollectionUtils;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -40,6 +43,62 @@
     private final PrizeActivityMapper prizeActivityMapper;
 
     private final COSUtil cOSUtil;
+
+    @Override
+    public Result getONPrizeActivity(){
+        PrizeActivity prizeActivity = new LambdaQueryChainWrapper<>(baseMapper)
+                .eq(PrizeActivity::getDeleteFlag,Boolean.FALSE)
+                .eq(PrizeActivity::getEnableStatus,PrizeActivityStatusEnum.ON.name())
+                .one();
+        PrizeActivityVO prizeActivityVO = new PrizeActivityVO();
+        if (prizeActivity != null){
+            PrizeActivityVO vo = PrizeActivityVO.getVoByEntity(prizeActivity, prizeActivityVO);
+            if (StringUtils.isNotBlank(vo.getActivityCover())){
+                vo.setActivityCoverUrl(cOSUtil.getPreviewUrl(vo.getActivityCover()));
+            }
+        }
+        return Result.ok().data(prizeActivityVO);
+    }
+
+    @Override
+    public Result getPopup() {
+        //鑾峰緱寮圭獥娲诲姩
+        PrizeActivity prizeActivity = new LambdaQueryChainWrapper<>(baseMapper)
+                .eq(PrizeActivity::getDeleteFlag,Boolean.FALSE)
+                .eq(PrizeActivity::getPopup,Boolean.TRUE)
+                .one();
+        PrizeActivityVO prizeActivityVO = new PrizeActivityVO();
+        if (prizeActivity != null){
+            PrizeActivityVO vo = PrizeActivityVO.getVoByEntity(prizeActivity, prizeActivityVO);
+            if (StringUtils.isNotBlank(vo.getActivityCover())){
+                vo.setActivityCoverUrl(cOSUtil.getPreviewUrl(vo.getActivityCover()));
+            }
+        }
+        return Result.ok().data(prizeActivityVO);
+    }
+
+    @Override
+    public Result popup(String id){
+        //璁剧疆id鐨勬椿鍔ㄤ负寮圭獥娲诲姩锛屽皢鍏朵粬娲诲姩鐨勫脊绐楃姸鎬佹敼涓篺alse.
+        PrizeActivity prizeActivity = baseMapper.selectById(id);
+        if (prizeActivity.getPopup()){
+            prizeActivity.setPopup(Boolean.FALSE);
+            prizeActivityMapper.updateById(prizeActivity);
+            return Result.ok("鍙栨秷寮圭獥娲诲姩鎴愬姛!");
+        }else {
+            prizeActivity.setPopup(Boolean.TRUE);
+            //淇敼鍏朵粬娲诲姩鐨勬帹鑽愮姸鎬佸悗锛屼慨鏀硅瀵硅薄鐨勪慨鏀圭姸鎬�
+            prizeActivityMapper.updateById(prizeActivity);
+            new LambdaUpdateChainWrapper<>(baseMapper).eq(PrizeActivity::getPopup,Boolean.TRUE)
+                    .eq(PrizeActivity::getDeleteFlag,Boolean.FALSE)
+                    .set(PrizeActivity::getPopup, Boolean.FALSE)
+                    .ne(PrizeActivity::getId, prizeActivity.getId())
+                    .set(PrizeActivity::getUpdateTime, new Date())
+                    .update();
+            return Result.ok("寮圭獥娲诲姩寮�鍚垚鍔�");
+        }
+
+    }
 
     @Override
     public Result publishPrizeActivity(String id) {
@@ -83,6 +142,7 @@
     public Result add(PrizeActivityForm form) {
         PrizeActivity entity = PrizeActivityForm.getEntityByForm(form, null);
         entity.setEnableStatus(PrizeActivityStatusEnum.OFF.name());
+        entity.setPopup(Boolean.FALSE);
         baseMapper.insert(entity);
         return Result.ok("娣诲姞鎴愬姛");
     }
@@ -173,7 +233,6 @@
         Assert.notNull(vo, "璁板綍涓嶅瓨鍦�");
         return Result.ok().data(vo);
     }
-
     /**
      * 鍒楄〃
      * @return
@@ -186,4 +245,9 @@
                 .collect(Collectors.toList());
         return Result.ok().data(vos);
     }
+
+    @Override
+    public PrizeDetailVO prizeInfo(String id) {
+        return prizeActivityMapper.prizeInfo(id);
+    }
 }

--
Gitblit v1.8.0