From 985e48474a3decdcab3d5d99dc0b5211b381c2a6 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期三, 02 七月 2025 09:19:45 +0800
Subject: [PATCH] Merge branch '2.0' of http://120.76.84.145:10101/gitblit/r/java/HongRuiTang into 2.0
---
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/business/MerLotteryEventController.java | 36 +++++++++++++++++++++---------------
1 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/business/MerLotteryEventController.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/business/MerLotteryEventController.java
index 52f9647..d6fc5dc 100644
--- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/business/MerLotteryEventController.java
+++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/business/MerLotteryEventController.java
@@ -5,8 +5,8 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.uuid.IdUtils;
import com.ruoyi.common.security.utils.SecurityUtils;
-import com.ruoyi.goods.api.domain.LotteryEvent;
-import com.ruoyi.goods.api.domain.LotteryEventPrize;
+import com.ruoyi.goods.api.domain.TLotteryEvent;
+import com.ruoyi.goods.api.domain.TLotteryEventPrize;
import com.ruoyi.goods.domain.dto.DelShopLotteryDrawDto;
import com.ruoyi.goods.domain.dto.ShopLotteryDrawListDto;
import com.ruoyi.goods.domain.dto.ShopWinningRecordDto;
@@ -19,6 +19,7 @@
import com.ruoyi.goods.service.lottery.IUserLotteryEventService;
import com.ruoyi.system.api.domain.poji.goods.Goods;
import com.ruoyi.system.api.domain.poji.shop.Shop;
+import com.ruoyi.system.api.service.RemoteMemberService;
import com.ruoyi.system.api.service.RemoteShopService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -56,6 +57,9 @@
@Resource
private GoodsService goodsService;
+ @Resource
+ private RemoteMemberService remoteMemberService;
+
@RequestMapping(value = "/getShopLotteryDrawList", method = RequestMethod.POST)
@ApiOperation(value = "获取门店抽奖活动列表【2.0】")
@@ -75,15 +79,15 @@
@RequestMapping(value = "/delShopLotteryDraw", method = RequestMethod.POST)
@ApiOperation(value = "门店删除抽奖活动【2.0】")
public R delShopLotteryDraw(@RequestBody DelShopLotteryDrawDto dto) {
- LotteryEvent lotteryEvent = lotteryEventService.getById(dto.getId());
+ TLotteryEvent lotteryEvent = lotteryEventService.getById(dto.getId());
if (null == lotteryEvent) {
return R.fail("抽奖活动不存在");
}
if (LocalDateTime.now().isAfter(lotteryEvent.getStartTime())) {
- return R.fail("删除失败");
+ return R.fail("活动已开始,不能删除!");
}
if (!lotteryEvent.getShopId().equals(dto.getShopId())) {
- return R.fail("删除失败");
+ return R.fail("删除失败,该活动不属于该店铺");
}
lotteryEvent.setDelFlag(1);
lotteryEventService.updateById(lotteryEvent);
@@ -93,15 +97,15 @@
@RequestMapping(value = "/getShopLotteryDrawInfo", method = RequestMethod.POST)
@ApiOperation(value = "获取门店抽奖详情【2.0】")
- public R<LotteryEvent> getShopLotteryDrawInfo(@RequestBody DelShopLotteryDrawDto dto) {
- LotteryEvent lotteryEvent = lotteryEventService.getById(dto.getId());
- if (null == lotteryEvent) {
+ public R<TLotteryEvent> getShopLotteryDrawInfo(@RequestBody DelShopLotteryDrawDto dto) {
+ TLotteryEvent lotteryEvent = lotteryEventService.getById(dto.getId());
+ if (null == lotteryEvent || 1 == lotteryEvent.getDelFlag()) {
return R.fail("抽奖活动不存在");
}
- if (!lotteryEvent.getShopId().equals(dto.getShopId())) {
+ if (!lotteryEvent.getShopId().equals(dto.getShopId().intValue())) {
return R.fail("查询失败");
}
- List<LotteryEventPrize> list = lotteryEventPrizeService.list(new LambdaQueryWrapper<LotteryEventPrize>().eq(LotteryEventPrize::getLotteryEventId, dto.getId()));
+ List<TLotteryEventPrize> list = lotteryEventPrizeService.list(new LambdaQueryWrapper<TLotteryEventPrize>().eq(TLotteryEventPrize::getLotteryEventId, dto.getId()));
lotteryEvent.setPrizes(list);
return R.ok(lotteryEvent);
}
@@ -109,17 +113,19 @@
@RequestMapping(value = "/editShopLotteryDraw", method = RequestMethod.POST)
@ApiOperation(value = "保存门店抽奖【2.0】")
- public R editShopLotteryDraw(@RequestBody LotteryEvent lotteryEvent) {
+ public R editShopLotteryDraw(@RequestBody TLotteryEvent lotteryEvent) {
if (lotteryEvent.getId() == null) {
lotteryEvent.setId(IdUtils.simpleUUID());
+ String weiXinQrCode = remoteMemberService.getWeiXinQrCode("id=" + lotteryEvent.getId() + "&activityType=" + lotteryEvent.getActivityType(), "/pages/turntable/index");
+ lotteryEvent.setWxMiniProgramQrCode(weiXinQrCode);
}
lotteryEvent.setUpdateTime(LocalDateTime.now());
lotteryEvent.setUpdateUserId(SecurityUtils.getUserId());
lotteryEventService.saveOrUpdate(lotteryEvent);
//先删除原有的奖品
- lotteryEventPrizeService.remove(new LambdaQueryWrapper<LotteryEventPrize>().eq(LotteryEventPrize::getLotteryEventId, lotteryEvent.getId()));
+ lotteryEventPrizeService.remove(new LambdaQueryWrapper<TLotteryEventPrize>().eq(TLotteryEventPrize::getLotteryEventId, lotteryEvent.getId()));
//添加新的奖品
- List<LotteryEventPrize> prizes = lotteryEvent.getPrizes();
+ List<TLotteryEventPrize> prizes = lotteryEvent.getPrizes();
prizes.forEach(s -> {
s.setId(IdUtils.simpleUUID());
if (s.getPrizeType() == 2 && StringUtils.isEmpty(s.getObjectName())) {
@@ -135,11 +141,11 @@
@RequestMapping(value = "/getShopWinningRecord", method = RequestMethod.POST)
@ApiOperation(value = "获取中奖记录列表【2.0】")
public R<Page<ShopWinningRecordVo>> getShopWinningRecord(@RequestBody ShopWinningRecordDto dto) {
- LotteryEvent lotteryEvent = lotteryEventService.getById(dto.getId());
+ TLotteryEvent lotteryEvent = lotteryEventService.getById(dto.getId());
if (null == lotteryEvent) {
return R.fail("抽奖活动不存在");
}
- if (!lotteryEvent.getShopId().equals(dto.getShopId())) {
+ if (!lotteryEvent.getShopId().equals(dto.getShopId().intValue())) {
return R.fail("查询失败");
}
Page<ShopWinningRecordVo> page = new Page<>();
--
Gitblit v1.7.1