From 68b7f670f7fe6fbe79e2f0682ac27b6ea1a0c417 Mon Sep 17 00:00:00 2001
From: huliguo <2023611923@qq.com>
Date: 星期三, 30 七月 2025 20:42:02 +0800
Subject: [PATCH] bug修改

---
 ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/LotteryEventServiceImpl.java |   19 +++++++++++--------
 ruoyi-modules/ruoyi-goods/src/main/resources/mapper/lottery/LotteryEventMapper.xml                        |    2 +-
 ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/miniapp/AppLotteryEventController.java |   12 ++++++------
 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java          |    3 +++
 4 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/miniapp/AppLotteryEventController.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/miniapp/AppLotteryEventController.java
index 2e5fbda..a4cb5c4 100644
--- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/miniapp/AppLotteryEventController.java
+++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/miniapp/AppLotteryEventController.java
@@ -56,7 +56,7 @@
 	private IUserLotteryEventQuestionsAnswersService userLotteryEventQuestionsAnswersService;
 	
 	@Resource
-	private ILotteryEventQuestionsService lotteryEventServiceQuestionsService;
+	private ILotteryEventQuestionsService lotteryEventQuestionsService;
 	
 	@Resource
 	private ILotteryEventQuestionsAnswersService lotteryEventQuestionsAnswersService;
@@ -163,14 +163,14 @@
 		TUserLotteryEventQuestions questionsServiceOne = userLotteryEventQuestionsService.getOne(new QueryWrapper<TUserLotteryEventQuestions>().eq("lottery_event_id", dto.getId()).eq("user_id", userId));
 		LotteryEventQuestionsVo vo = new LotteryEventQuestionsVo();
 		vo.setId(dto.getId());
-		int count = lotteryEventServiceQuestionsService.count(new QueryWrapper<TLotteryEventQuestions>().eq("lottery_event_id", dto.getId()));
+		int count = lotteryEventQuestionsService.count(new QueryWrapper<TLotteryEventQuestions>().eq("lottery_event_id", dto.getId()));
 		vo.setTotal(count);
 		//没有答题,直接从第一题开始
 		if (null == questionsServiceOne) {
 			if (-1 == dto.getStepOrDown()) {
 				return R.fail("操作失败");
 			}
-			TLotteryEventQuestions questions = lotteryEventServiceQuestionsService.getOne(new QueryWrapper<TLotteryEventQuestions>().eq("lottery_event_id", dto.getId()).orderByAsc("sort").last(" limit 1"));
+			TLotteryEventQuestions questions = lotteryEventQuestionsService.getOne(new QueryWrapper<TLotteryEventQuestions>().eq("lottery_event_id", dto.getId()).orderByAsc("sort").last(" limit 1"));
 			vo.setCurrent(0);
 			vo.setName(questions.getName());
 			List<TLotteryEventQuestionsAnswers> list = lotteryEventQuestionsAnswersService.list(new QueryWrapper<TLotteryEventQuestionsAnswers>().eq("lottery_event_questions_id", questions.getId()));
@@ -197,7 +197,7 @@
 					current = count - 1;
 				}
 			}
-			List<TLotteryEventQuestions> list = lotteryEventServiceQuestionsService.list(new QueryWrapper<TLotteryEventQuestions>().eq("lottery_event_id", dto.getId()).orderByAsc("sort"));
+			List<TLotteryEventQuestions> list = lotteryEventQuestionsService.list(new QueryWrapper<TLotteryEventQuestions>().eq("lottery_event_id", dto.getId()).orderByAsc("sort"));
 			TLotteryEventQuestions lotteryEventQuestions = list.get(current);
 			vo.setCurrent(current);
 			vo.setName(lotteryEventQuestions.getName());
@@ -224,7 +224,7 @@
 	@PostMapping("/answerQuestion")
 	@ApiOperation(value = "答题操作【2.0】", tags = "抽奖活动")
 	public R answerQuestion(@RequestBody AnswerQuestionDto dto) {
-		List<TLotteryEventQuestions> list = lotteryEventServiceQuestionsService.list(new QueryWrapper<TLotteryEventQuestions>().eq("lottery_event_id", dto.getId()).orderByAsc("sort"));
+		List<TLotteryEventQuestions> list = lotteryEventQuestionsService.list(new QueryWrapper<TLotteryEventQuestions>().eq("lottery_event_id", dto.getId()).orderByAsc("sort"));
 		TLotteryEventQuestions lotteryEventQuestions = list.get(dto.getCurrent());
 		List<TLotteryEventQuestionsAnswers> list1 = lotteryEventQuestionsAnswersService.list(new QueryWrapper<TLotteryEventQuestionsAnswers>().eq("lottery_event_questions_id", lotteryEventQuestions.getId()));
 		TLotteryEventQuestionsAnswers lotteryEventQuestionsAnswers = list1.stream().filter(item -> item.getAnswers().equals(dto.getAnswer())).findAny().orElse(null);
@@ -288,7 +288,7 @@
 		questionsServiceOne.setStatus(2);
 		questionsServiceOne.setEndTime(LocalDateTime.now());
 		//计算正确率
-		int count = lotteryEventQuestionsAnswersService.count(new QueryWrapper<TLotteryEventQuestionsAnswers>().eq("lottery_event_id", id));
+		int count = lotteryEventQuestionsService.count(new QueryWrapper<TLotteryEventQuestions>().eq("lottery_event_id", id));
 		int right = userLotteryEventQuestionsAnswersService.count(new QueryWrapper<TUserLotteryEventQuestionsAnswers>().eq("lottery_event_id", id).eq("user_id", userId).eq("is_correct", 1));
 		BigDecimal multiply = new BigDecimal(right).divide(new BigDecimal(count), 4, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
 		questionsServiceOne.setCorrectAnswerRate(multiply);
diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/LotteryEventServiceImpl.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/LotteryEventServiceImpl.java
index 934697e..8d24e6a 100644
--- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/LotteryEventServiceImpl.java
+++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/LotteryEventServiceImpl.java
@@ -450,8 +450,10 @@
 		voList.forEach(x->{
 			if (null == x.getShopId()){
 				x.setCreateObject("平台创建");
+
 			}else {
 				//线下抽奖,获取门店名称
+				x.setActivityType(6);
 				if(map.containsKey(Long.valueOf(x.getShopId()))){
 					x.setCreateObject(map.get(Long.valueOf(x.getShopId())).getShopName());
 				}else {
@@ -476,13 +478,7 @@
 		}
 		MgtLotteryEventDetailVO vo = new MgtLotteryEventDetailVO();
 		BeanUtils.copyProperties(lotteryEvent, vo);
-		if (lotteryEvent.getActivityType()==6) {
-			//线下抽奖 取商户名称
-			Shop data = remoteShopService.getShop(Long.valueOf(lotteryEvent.getShopId())).getData();
-			if (null != data) {
-				vo.setShopName(data.getShopName());
-			}
-		}
+
 		if(lotteryEvent.getActivityType()==5){
 			//题干数据
 			List<TLotteryEventQuestions> questionsList = lotteryEventQuestionsService.getBaseMapper().selectList(new LambdaQueryWrapper<TLotteryEventQuestions>().eq(TLotteryEventQuestions::getLotteryEventId, lotteryEvent.getId()));
@@ -514,7 +510,14 @@
 				.eq(TLotteryEventPrize::getLotteryEventId, lotteryEvent.getId()));*/
 		List<TLotteryEventPrize> prizeList = lotteryEventPrizeService.getPrizeListByLotteryEventId(lotteryEvent.getId());
 		vo.setLotteryEventPrizeList(prizeList);
-		
+		if(null!=lotteryEvent.getShopId()){
+			vo.setActivityType(6);
+			//线下抽奖 取商户名称
+			Shop data = remoteShopService.getShop(Long.valueOf(lotteryEvent.getShopId())).getData();
+			if (null != data) {
+				vo.setShopName(data.getShopName());
+			}
+		}
 		return R.ok(vo);
 	}
 
diff --git a/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/lottery/LotteryEventMapper.xml b/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/lottery/LotteryEventMapper.xml
index 3ba830a..a994d1a 100644
--- a/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/lottery/LotteryEventMapper.xml
+++ b/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/lottery/LotteryEventMapper.xml
@@ -78,7 +78,7 @@
         <if test="null != dto.name and ''!= dto.name ">
             and `name` like concat('%',#{dto.name},'%')
         </if>
-        <if test="null != dto.activityType and  dto.activityType!=0 ">
+        <if test="null != dto.activityType and  dto.activityType!=0 and  dto.activityType!=6  ">
             and activity_type = #{dto.activityType}
         </if>
         <if test="dto.shopIds != null and dto.shopIds.size() > 0">
diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java
index 6710cea..31b8126 100644
--- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java
+++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java
@@ -4981,6 +4981,9 @@
             for (int i = 0; i < MgtMapIntTotalVoGoodsType.size(); i++) {
                 mgtMapIntTotalVo = new MgtMapIntTotalVo();
                 mgtMapBigTotalVo = new MgtMapBigTotalVo();
+                if(null == MgtMapIntTotalVoGoodsType.get(i).getMapKey()){
+                    continue;
+                }
                 mgtMapIntTotalVo.setMapValue(MgtMapIntTotalVoGoodsType.get(i).getMapValueFirst());
                 mgtMapBigTotalVo.setMapValue(MgtMapIntTotalVoGoodsType.get(i).getMapValueSecond());
                 if (MgtMapIntTotalVoGoodsType.get(i).getMapKey().equals("1")) {

--
Gitblit v1.7.1