From b28d69f6cba1a7aed03fd9c07a14693281f9a9a0 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期二, 12 三月 2024 14:16:22 +0800
Subject: [PATCH] 修改bug

---
 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java           |   10 ++++++++--
 cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupMapper.xml                                            |    2 +-
 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java |    4 ++--
 cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml                                  |    2 +-
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java
index 109a553..c4d585a 100644
--- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java
+++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java
@@ -81,7 +81,7 @@
         for (int i = 0; i < mapList.size(); i++) {
             Map<String, Object> map = mapList.get(i);
             Integer participantType = Integer.valueOf(map.get("participantType").toString());
-            Integer participantId = Integer.valueOf(map.get("participantId").toString());
+            Long participantId = Long.valueOf(map.get("participantId").toString());
             Integer num = Integer.valueOf(map.get("num").toString());
             if(null != participantId && participantId.equals(entrantRank.getId()) && participantType.equals(entrantRank.getIsStudent())){
                 entrantRankVo.setNationalRank(i + 1);
@@ -101,7 +101,7 @@
         for (int i = 0; i < mapList1.size(); i++) {
             Map<String, Object> map = mapList1.get(i);
             Integer participantType = Integer.valueOf(map.get("participantType").toString());
-            Integer participantId = Integer.valueOf(map.get("participantId").toString());
+            Long participantId = Long.valueOf(map.get("participantId").toString());
             Integer num = Integer.valueOf(map.get("num").toString());
             if(null != participantId && participantId.equals(entrantRank.getId()) && participantType.equals(entrantRank.getIsStudent())){
                 entrantRankVo.setCityRank(i + 1);
diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java
index 9c71445..1348a56 100644
--- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java
+++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java
@@ -165,6 +165,9 @@
 //            worldCupPaymentParticipant.setAlreadyEntered(1);
 //            worldCupPaymentParticipantService.updateById(worldCupPaymentParticipant);
         }
+        worldCup.setMatchNumber(worldCup.getMatchNumber() + 1);
+        this.updateById(worldCup);
+
         //2、调起开启游戏的接口。
         HashMap<String, String> map = new HashMap<>();
         map.put("sign", "0DB011836143EEE2C2E072967C9F4E4B");
@@ -249,7 +252,7 @@
             Collections.sort(worldCupList1, new Comparator<WorldCupListVo>() {
                 @Override
                 public int compare(WorldCupListVo o1, WorldCupListVo o2) {
-                    return o1.getDistance().compareTo(o2.getDistance()) * -1;
+                    return o1.getDistance().compareTo(o2.getDistance());
                 }
             });
         }
@@ -391,13 +394,16 @@
 
         String cupIds = paymentWorldCup.getIds();
         JSONArray jsonArray = JSON.parseArray(cupIds);
+        if(jsonArray.size() != 6){
+            return ResultUtil.error("参赛人数只能是6人");
+        }
         List<WorldCupPayment> payments = worldCupPaymentService.list(new QueryWrapper<WorldCupPayment>().eq("worldCupId", worldCup.getId())
                 .eq("payStatus", 2).eq("state", 1));
         List<Long> ids = payments.stream().map(WorldCupPayment::getId).collect(Collectors.toList());
         if(ids.size() > 0){
             int count = worldCupPaymentParticipantService.count(new QueryWrapper<WorldCupPaymentParticipant>().eq("worldCupId", worldCup.getId())
                     .eq("worldCupPaymentId", ids));
-            if((count + jsonArray.size()) >= worldCup.getMatchNumber()){
+            if((count + jsonArray.size()) >= worldCup.getMaxPeople()){
                 return ResultUtil.error("已超出最大报名人数");
             }
         }
diff --git a/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml b/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml
index f8ecc06..84f6154 100644
--- a/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml
+++ b/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml
@@ -13,7 +13,7 @@
             participantId,
             count(*) as num
             from t_world_cup_competitor
-            where DATE_FORMAT(NOW(), '%Y-%m-%d') = DATE_FORMAT(startTime, '%Y-%m-%d')
+            where DATE_FORMAT(NOW(), '%Y') = DATE_FORMAT(startTime, '%Y')
             <if test="null != appUserIds and appUserIds.size() > 0">
                 and appUserId in
                 <foreach collection="appUserIds" item="item" index="index" open="(" separator="," close=")">
diff --git a/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupMapper.xml b/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupMapper.xml
index ce40991..e12f737 100644
--- a/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupMapper.xml
+++ b/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupMapper.xml
@@ -41,7 +41,7 @@
             and a.name like CONCAT('%', #{item.content}, '%')
         </if>
         <if test="null != item.storeId">
-            and a.id in (select worldCupId from t_world_cup_store where storeId = #{item.storeId} and isOpen = 1)
+            and a.id in (select worldCupId from t_world_cup_store where storeId = #{item.storeId})
         </if>
         <if test="null != item.gender">
             and #{item.gender} = a.gender

--
Gitblit v1.7.1