From 51f34c714fc3c7a4551d349a918e7ce8fa7f63c2 Mon Sep 17 00:00:00 2001
From: 44323 <443237572@qq.com>
Date: 星期五, 08 三月 2024 18:04:56 +0800
Subject: [PATCH] Merge branch '2.0' of http://120.76.84.145:10101/gitblit/r/java/PlayPai into 2.0

---
 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java                   |   25 ++-
 cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupMapper.xml                                                    |    8 
 cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html                                        |    1 
 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java            |  118 ++++++++++++++++
 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentService.java                    |    9 +
 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java |    9 +
 cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupPaymentParticipantMapper.xml                                  |   18 ++
 cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java                                                  |    2 
 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupPaymentParticipantMapper.java            |    4 
 cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup_info.js                                        |   28 ++--
 cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml                                          |   28 ++-
 cloud-server-other/src/main/java/com/dsh/other/entity/TGame.java                                                               |    2 
 cloud-server-communityWorldCup/src/test/java/com/dsh/CommunityWorldCupApplicationTest.java                                     |   36 +++++
 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java                      |   47 +++++-
 cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js                                               |   16 +-
 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentParticipantService.java         |    4 
 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java         |    2 
 cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup.js                                             |    2 
 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/WorldCupRankVo.java                               |    2 
 cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html                                         |    1 
 cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_info.html                                        |    1 
 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/WorldCupListVo.java                               |    2 
 22 files changed, 306 insertions(+), 59 deletions(-)

diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java
index e266e7b..4a1769b 100644
--- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java
+++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java
@@ -149,12 +149,17 @@
             @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
     })
     public ResultUtil<WorldCupPeopleVo> getWorldCupPeople(WorldCupPeople worldCupPeople){
-        WorldCupPaymentParticipant worldCupPaymentParticipant = worldCupPaymentParticipantService.getById(worldCupPeople.getCode());
+        JSONObject jsonObject = JSON.parseObject(worldCupPeople.getCode());
+        Long id = jsonObject.getLong("id");
+        Integer isStudent = jsonObject.getInteger("isStudent");
+        if(0 == isStudent){
+            isStudent = 2;
+        }
+        WorldCupPaymentParticipant worldCupPaymentParticipant = worldCupPaymentParticipantService.getOne(new QueryWrapper<WorldCupPaymentParticipant>()
+                .eq("worldCupId", worldCupPeople.getWorldCupId()).eq("participantId", id).eq("participantType", isStudent)
+                .orderByDesc("createTime").last(" limit 0, 1"));
         if(null == worldCupPaymentParticipant){
             return ResultUtil.error("无效二维码");
-        }
-        if(worldCupPaymentParticipant.getWorldCupId().compareTo(worldCupPeople.getWorldCupId()) != 0){
-            return ResultUtil.error("报名失败,当前用户未报名当前比赛");
         }
         WorldCupPeopleVo worldCupPeopleVo = new WorldCupPeopleVo();
         worldCupPeopleVo.setId(worldCupPaymentParticipant.getId());
@@ -201,14 +206,13 @@
             return ResultUtil.error("二维码不正确");
         }
         Integer space_id = jsonObject.getInteger("space_id");
-        Site site = siteClient.getSite(space_id);
-        if(null == site){
+        Store store = storeClient.queryStoreById(space_id);
+        if(null == store){
             return ResultUtil.error("无法获取场地信息");
         }
-        Store store = storeClient.queryStoreById(site.getStoreId());
         Map<String, String> map = new HashMap<>();
         map.put("name", store.getName());
-        map.put("address", site.getName());
+        map.put("address", store.getAddress());
         return ResultUtil.success(map);
     }
 
@@ -391,7 +395,7 @@
     public List<WorldCupStore> getWorldCupStoreList(@RequestBody Integer storeId){
         List<WorldCup> worldCupList = worldCupService.list(new QueryWrapper<WorldCup>().in("status", Arrays.asList(1, 2)));
         List<Integer> collect = worldCupList.stream().map(WorldCup::getId).collect(Collectors.toList());
-        return worldCupStoreService.list(new QueryWrapper<WorldCupStore>().eq("storeId", storeId).in("worldCupId", collect));
+        return worldCupStoreService.list(new QueryWrapper<WorldCupStore>().eq("storeId", storeId).in("worldCupId", collect).eq("isOpen", 1));
     }
 
 
@@ -470,6 +474,17 @@
         return ResultUtil.success(myWorldCupInfo);
     }
 
+    @ResponseBody
+    @PostMapping("/api/worldCup/cancelMyWorldCup")
+    @ApiOperation(value = "取消已报名的世界杯【2.0】", tags = {"APP-个人中心"})
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "列表中的id", required = true, dataType = "String"),
+            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+    })
+    public ResultUtil cancelMyWorldCup(String id){
+        return worldCupPaymentService.cancelMyWorldCup(id);
+    }
+
 
 
 
@@ -493,8 +508,18 @@
             @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
     })
     public ResultUtil<List<WorldCupRankVo>> getWorldCupRank(WorldCupRank worldCupRank){
-        List<WorldCupRankVo> worldCupRank1 = worldCupCompetitorService.getWorldCupRank(worldCupRank);
-        return ResultUtil.success(worldCupRank1);
+        try {
+            Integer uid = tokenUtil.getUserIdFormRedis();
+            if(null == uid){
+                return ResultUtil.tokenErr();
+            }
+            worldCupRank.setAppUserId(uid);
+            List<WorldCupRankVo> worldCupRank1 = worldCupCompetitorService.getWorldCupRank(worldCupRank);
+            return ResultUtil.success(worldCupRank1);
+        }catch (Exception e){
+            e.printStackTrace();
+            return ResultUtil.runErr();
+        }
     }
 
 
diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupPaymentParticipantMapper.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupPaymentParticipantMapper.java
index ec5aed5..11c7eb5 100644
--- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupPaymentParticipantMapper.java
+++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupPaymentParticipantMapper.java
@@ -32,4 +32,8 @@
      * @return
      */
     List<WorldCupListVo> getMyWorldCupList(@Param("item") MyWorldCupList myWorldCupList);
+
+
+
+    int getCount(@Param("worldCupId") Integer worldCupId, @Param("worldCupPaymentId")List<Long> worldCupPaymentId);
 }
diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/WorldCupListVo.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/WorldCupListVo.java
index 8df60d3..2c13147 100644
--- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/WorldCupListVo.java
+++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/WorldCupListVo.java
@@ -28,6 +28,8 @@
     private String content;
     @ApiModelProperty("热度")
     private Integer heat;
+    @ApiModelProperty("比赛状态(1=未开始,2=已开始,3=已结束,4=已取消)")
+    private Integer status;
     private Double distance;
     private String lon;
     private String lat;
diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/WorldCupRankVo.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/WorldCupRankVo.java
index e506669..1197a74 100644
--- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/WorldCupRankVo.java
+++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/WorldCupRankVo.java
@@ -11,6 +11,8 @@
 @Data
 @ApiModel
 public class WorldCupRankVo {
+    @ApiModelProperty("排名")
+    private Integer rank;
     @ApiModelProperty("姓名")
     private String name;
     @ApiModelProperty("头像")
diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentParticipantService.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentParticipantService.java
index 8ca453c..1667380 100644
--- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentParticipantService.java
+++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentParticipantService.java
@@ -3,6 +3,7 @@
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.dsh.communityWorldCup.entity.WorldCupPaymentParticipant;
 import com.dsh.communityWorldCup.model.*;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.web.bind.annotation.RequestBody;
 
 import java.util.List;
@@ -55,4 +56,7 @@
      * @return
      */
     Map<String, Object> getRegisteredPersonnel(RegisteredPersonnel registeredPersonnel);
+
+
+    int getCount(Integer worldCupId, List<Long> worldCupPaymentId);
 }
diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentService.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentService.java
index 521ff8d..af9c49a 100644
--- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentService.java
+++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentService.java
@@ -2,10 +2,19 @@
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.dsh.communityWorldCup.entity.WorldCupPayment;
+import com.dsh.communityWorldCup.util.ResultUtil;
 
 /**
  * @author zhibing.pu
  * @Date 2024/2/22 14:22
  */
 public interface IWorldCupPaymentService extends IService<WorldCupPayment> {
+
+
+    /**
+     * 取消已报名的世界杯
+     * @param id
+     * @return
+     */
+    ResultUtil cancelMyWorldCup(String id);
 }
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 3b339fb..88902cb 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
@@ -172,6 +172,7 @@
             boolean b = false;
             if(i <= 19){
                 WorldCupRankVo worldCupRankVo = new WorldCupRankVo();
+                worldCupRankVo.setRank(i + 1);
                 worldCupRankVo.setTotalSession(totalSession);
                 worldCupRankVo.setWinRate(winRate);
                 //学员
@@ -217,6 +218,7 @@
             if(i > 19 && !b){
                 if(worldCupRank.getIsStudent().equals(participantType) && worldCupRank.getId().equals(participantId)){
                     WorldCupRankVo worldCupRankVo = new WorldCupRankVo();
+                    worldCupRankVo.setRank(i + 1);
                     worldCupRankVo.setTotalSession(totalSession);
                     worldCupRankVo.setWinRate(winRate);
                     //学员
diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java
index 3fb28d0..506e666 100644
--- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java
+++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java
@@ -262,7 +262,9 @@
         Integer limit = registeredPersonnel.getLimit();
         QueryWrapper<WorldCupPayment> queryWrapper = new QueryWrapper<WorldCupPayment>()
                 .eq("worldCupId", id).eq("state", 1);
-        if(status == 1){
+        if(null == status){
+            queryWrapper.in("payStatus", Arrays.asList(2, 3));
+        }else if(status == 1){
             queryWrapper.eq("payStatus", 2);
         }else{
             queryWrapper.eq("payStatus", 3);
@@ -328,4 +330,9 @@
         map.put("total", list2.size());
         return map;
     }
+
+    @Override
+    public int getCount(Integer worldCupId, List<Long> worldCupPaymentId) {
+        return this.baseMapper.getCount(worldCupId, worldCupPaymentId);
+    }
 }
diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java
index e3501fd..8789d3c 100644
--- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java
+++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java
@@ -1,10 +1,32 @@
 package com.dsh.communityWorldCup.service.impl;
 
+import com.alibaba.fastjson.JSON;
+import com.alipay.api.AlipayApiException;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.dsh.communityWorldCup.entity.WorldCup;
 import com.dsh.communityWorldCup.entity.WorldCupPayment;
+import com.dsh.communityWorldCup.entity.WorldCupPaymentParticipant;
+import com.dsh.communityWorldCup.feignclient.account.AppUserClient;
+import com.dsh.communityWorldCup.feignclient.account.model.AppUser;
+import com.dsh.communityWorldCup.feignclient.course.CoursePackageOrderStudentClient;
+import com.dsh.communityWorldCup.feignclient.course.model.CoursePackageOrderStudent;
 import com.dsh.communityWorldCup.mapper.WorldCupPaymentMapper;
+import com.dsh.communityWorldCup.model.DeductionClassHourList;
+import com.dsh.communityWorldCup.service.IWorldCupPaymentParticipantService;
 import com.dsh.communityWorldCup.service.IWorldCupPaymentService;
+import com.dsh.communityWorldCup.service.IWorldCupService;
+import com.dsh.communityWorldCup.util.PayMoneyUtil;
+import com.dsh.communityWorldCup.util.ResultUtil;
+import net.bytebuddy.asm.Advice;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author zhibing.pu
@@ -12,4 +34,100 @@
  */
 @Service
 public class WorldCupPaymentServiceImpl extends ServiceImpl<WorldCupPaymentMapper, WorldCupPayment> implements IWorldCupPaymentService {
+
+    @Autowired
+    private IWorldCupPaymentParticipantService worldCupPaymentParticipantService;
+
+    @Autowired
+    private IWorldCupService worldCupService;
+
+    @Autowired
+    private PayMoneyUtil payMoneyUtil;
+
+    @Resource
+    private AppUserClient appUserClient;
+
+    @Resource
+    private CoursePackageOrderStudentClient coursePackageOrderStudentClient;
+
+
+
+
+    /**
+     * 取消已报名的世界杯
+     * @param id
+     * @return
+     */
+    @Override
+    public ResultUtil cancelMyWorldCup(String id) {
+        WorldCupPaymentParticipant worldCupPaymentParticipant = worldCupPaymentParticipantService.getById(id);
+        WorldCupPayment worldCupPayment = this.getById(worldCupPaymentParticipant.getWorldCupPaymentId());
+        WorldCup worldCup = worldCupService.getById(worldCupPayment.getWorldCupId());
+        //开始前一天不能取消
+        if(worldCup.getStartTime().getTime() < System.currentTimeMillis() + 86400000L){
+            return ResultUtil.error("世界杯快开始了,不能取消");
+        }
+        //开始处理退款
+        //免费
+        if(worldCupPayment.getPayType() == 0){
+            worldCupPayment.setRefundOrderNo("");
+            worldCupPayment.setRefundTime(new Date());
+            worldCupPayment.setPayStatus(3);
+            this.updateById(worldCupPayment);
+            return ResultUtil.success();
+        }
+        List<WorldCupPaymentParticipant> list1 = worldCupPaymentParticipantService.list(new QueryWrapper<WorldCupPaymentParticipant>()
+                .eq("worldCupPaymentId", worldCupPayment.getId()).eq("alreadyEntered", 0));
+        BigDecimal multiply = worldCupPayment.getUnitPrice().multiply(new BigDecimal(list1.size()));
+        //微信支付
+        if(worldCupPayment.getPayType() == 1){
+            Map<String, String> map = payMoneyUtil.wxRefund(worldCupPayment.getPayOrderNo(), worldCupPayment.getCode(),
+                    worldCupPayment.getAmount().toString(), multiply.toString(), "/base/worldCup/wxRefundWorldCupCallback");
+            if(!"SUCCESS".equals(map.get("return_code"))){
+                System.err.println("-------------微信退款失败---------");
+                System.err.println(map.get("return_msg"));
+                return ResultUtil.error("微信退款失败");
+            }
+        }
+        //支付宝支付
+        if(worldCupPayment.getPayType() == 2){
+            Map<String, String> map = null;
+            try {
+                map = payMoneyUtil.aliRefund(worldCupPayment.getPayOrderNo(), multiply.toString());
+            } catch (AlipayApiException e) {
+                throw new RuntimeException(e);
+            }
+            if("10000".equals(map.get("code"))){
+                String trade_no = map.get("trade_no");
+                worldCupPayment.setRefundTime(new Date());
+                worldCupPayment.setRefundOrderNo(trade_no);
+                worldCupPayment.setPayStatus(3);
+                this.updateById(worldCupPayment);
+            }
+        }
+        //玩湃币支付
+        if(worldCupPayment.getPayType() == 3){
+            Integer appUserId = worldCupPayment.getAppUserId();
+            AppUser appUser = appUserClient.getAppUser(appUserId);
+            appUser.setPlayPaiCoins(appUser.getPlayPaiCoins() + multiply.intValue());
+            appUserClient.updateAppUser(appUser);
+            worldCupPayment.setRefundTime(new Date());
+            worldCupPayment.setRefundOrderNo("");
+            worldCupPayment.setPayStatus(3);
+            this.updateById(worldCupPayment);
+        }
+        //课时支付
+        if(worldCupPayment.getPayType() == 4){
+            for (WorldCupPaymentParticipant worldCupPaymentParticipant1 : list1) {
+                String content = worldCupPaymentParticipant1.getContent();
+                DeductionClassHourList deductionClassHourList = JSON.parseObject(content, DeductionClassHourList.class);
+                coursePackageOrderStudentClient.backspaceClassHour(deductionClassHourList);
+            }
+            worldCupPayment.setRefundTime(new Date());
+            worldCupPayment.setRefundOrderNo("");
+            worldCupPayment.setPayStatus(3);
+            this.updateById(worldCupPayment);
+        }
+        return ResultUtil.success();
+    }
 }
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 9aab809..228103e 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
@@ -154,13 +154,13 @@
             worldCupCompetitorService.save(worldCupCompetitor);
             ids.add(worldCupCompetitor.getId());
             //已参赛
-            worldCupPaymentParticipant.setAlreadyEntered(1);
+//            worldCupPaymentParticipant.setAlreadyEntered(1);
             worldCupPaymentParticipantService.updateById(worldCupPaymentParticipant);
         }
         //2、调起开启游戏的接口。
         HashMap<String, String> map = new HashMap<>();
         map.put("sign", "0DB011836143EEE2C2E072967C9F4E4B");
-        map.put("space_id", tGame.getSiteId() + "");
+        map.put("space_id", tGame.getStoreId() + "");
         map.put("red_sutu_id", tGame.getRed());
         map.put("blue_sutu_id", tGame.getBlue());
         map.put("api_url", "http://221.182.45.100:56666/communityWorldCup/base/worldCup/endWorldCupCallback");
@@ -198,10 +198,6 @@
      */
     @Override
     public List<WorldCupListVo> getWorldCupList(WorldCupList worldCupList) {
-        //没有筛选门店,默认使用当前门店
-        if(null == worldCupList.getStoreId()){
-            worldCupList.setStoreId(worldCupList.getStoreId());
-        }
         List<WorldCupListVo> worldCupList1 = this.baseMapper.getWorldCupList(worldCupList);
         for (WorldCupListVo worldCupListVo : worldCupList1) {
             Integer id = Integer.valueOf(worldCupListVo.getId());
@@ -355,6 +351,11 @@
         WorldCup worldCup = this.getById(paymentWorldCup.getId());
         if(null == worldCup){
             return ResultUtil.error("报名数据异常");
+        }
+        WorldCupPayment one = worldCupPaymentService.getOne(new QueryWrapper<WorldCupPayment>().eq("worldCupId", worldCup.getId())
+                .eq("appUserId", paymentWorldCup.getUid()).eq("payStatus", 2).eq("state", 1));
+        if(null != one){
+            return ResultUtil.error("不能重复报名");
         }
         if(null != worldCup.getRegistrationClosingTime() && System.currentTimeMillis() > worldCup.getRegistrationClosingTime().getTime()){
             return ResultUtil.error("报名时间已结束,无法完成报名");
@@ -672,6 +673,13 @@
                     .eq("worldCupPaymentId", worldCupPaymentId).eq("alreadyEntered", 0));
             WorldCupPayment worldCupPayment = worldCupPaymentService.getById(worldCupPaymentId);
             BigDecimal multiply = worldCupPayment.getUnitPrice().multiply(new BigDecimal(list1.size()));
+            //免费
+            if(worldCupPayment.getPayType() == 0){
+                worldCupPayment.setRefundOrderNo("");
+                worldCupPayment.setRefundTime(new Date());
+                worldCupPayment.setPayStatus(3);
+                worldCupPaymentService.updateById(worldCupPayment);
+            }
             //微信支付
             if(worldCupPayment.getPayType() == 1){
                 Map<String, String> map = payMoneyUtil.wxRefund(worldCupPayment.getPayOrderNo(), worldCupPayment.getCode(),
@@ -766,12 +774,11 @@
             if(collect.size() == 0){
                 stringObjectMap.put("applicants", 0);
             }else{
-                int count1 = worldCupPaymentParticipantService.count(new QueryWrapper<WorldCupPaymentParticipant>()
-                        .eq("worldCupId", id).in("worldCupPaymentId", collect)
-                        .groupBy("worldCupPaymentId, participantType"));
+                int count1 = worldCupPaymentParticipantService.getCount(id, collect);
                 stringObjectMap.put("applicants", count1);
             }
         }
+        map.put("rows", mapList);
         int count = this.baseMapper.worldCupGameStatisticsCount(worldCupGameStatistics);
         map.put("total", count);
         return map;
diff --git a/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml b/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml
index e037ed4..63b9516 100644
--- a/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml
+++ b/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml
@@ -3,7 +3,11 @@
 <mapper namespace="com.dsh.communityWorldCup.mapper.WorldCupCompetitorMapper">
 
     <select id="getNumberOfGamesRanked" resultType="map">
-        select * from (
+        select
+        aa.participantType,
+        aa.participantId,
+        aa.num
+        from (
             select
             CASE WHEN participantType = 2 THEN 0 ELSE 1 END as participantType,
             participantId,
@@ -40,13 +44,19 @@
 
 
     <select id="getWorldCupRank" resultType="java.util.Map">
-        select * from (
+        select
+        aa.participantType,
+        aa.participantId,
+        aa.appUserId,
+        aa.winRate,
+        aa.totalSession
+        from (
             select
             a.participantType,
             a.participantId,
             a.appUserId,
-            a.num as totalSession,
-            (ifnull(b.num, 0) / a.num * 100) as winRate
+            ifnull(a.num, 0) as totalSession,
+            (ifnull(b.num, 0) / ifnull(a.num, 0) * 100) as winRate
             from (
                 select
                 participantType,
@@ -56,7 +66,7 @@
                 from t_world_cup_competitor
                 where 1 = 1
                 <if test="null != item.year">
-                    and DATE_FORMAT(a.startTime, '%Y') = #{item.year}
+                    and DATE_FORMAT(startTime, '%Y') = #{item.year}
                 </if>
                 <if test="null != appUserIds and appUserIds.size() > 0">
                     and appUserId in
@@ -75,7 +85,7 @@
                 from t_world_cup_competitor
                 where matchResult = 1
                 <if test="null != item.year">
-                    and DATE_FORMAT(a.startTime, '%Y') = #{item.year}
+                    and DATE_FORMAT(startTime, '%Y') = #{item.year}
                 </if>
                 <if test="null != appUserIds and appUserIds.size() > 0">
                     and appUserId in
@@ -143,11 +153,11 @@
 
 
     <select id="worldCupRecordsListCount" resultType="int">
-        select count(*) from {
+        select count(*) from (
             select
             participantType,
             participantId,
-            appUserId,
+            appUserId
             from t_world_cup_competitor
             where 1 = 1
             <if test="null != appUserIds and appUserIds.size() > 0">
@@ -157,7 +167,7 @@
                 </foreach>
             </if>
             group by participantType, participantId, appUserId
-        } as aa
+        ) as aa
     </select>
 
 
diff --git a/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupMapper.xml b/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupMapper.xml
index a295f55..b8ffd67 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.worldCupId in (select worldCupId from t_world_cup_store where storeId = #{item.storeId})
+            and a.id in (select worldCupId from t_world_cup_store where storeId = #{item.storeId} and isOpen = 1)
         </if>
         <if test="null != item.gender">
             and #{item.gender} = a.gender
@@ -92,10 +92,10 @@
             and `name` like CONCAT('%', #{item.name}, '%')
         </if>
         <if test="null != item.startTime and '' != item.startTime">
-            and DATE_FORMAT(startTime, '%Y-%m-%d') &gt;= #{item.startTime}
+            and DATE_FORMAT(startTime, '%Y-%m-%d') = #{item.startTime}
         </if>
         <if test="null != item.endTime and '' != item.endTime">
-            and DATE_FORMAT(endTime, '%Y-%m-%d') &lt;= #{item.endTime}
+            and DATE_FORMAT(endTime, '%Y-%m-%d') = #{item.endTime}
         </if>
         <if test="null != item.status">
             and status= #{item.status}
@@ -130,7 +130,7 @@
         a.id,
         a.`name`,
         DATE_FORMAT(a.startTime, '%Y.%m.%d %H:%i') as startTime,
-        DATE_FORMAT(a.endTime, '%Y.%m.%d %H:%i') as endTime,
+        DATE_FORMAT(a.endTime, '%Y.%m.%d %H:%i') as endTime
         from t_world_cup a
         where 1 = 1
         <if test="null != item.name and '' != item.name">
diff --git a/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupPaymentParticipantMapper.xml b/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupPaymentParticipantMapper.xml
index 0d15c3b..84ba1d5 100644
--- a/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupPaymentParticipantMapper.xml
+++ b/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupPaymentParticipantMapper.xml
@@ -25,7 +25,8 @@
         c.intro as content,
         c.lon,
         c.lat,
-        c.basePeople as heat
+        c.basePeople as heat,
+        c.status
         from t_world_cup_payment_participant a
         left join t_world_cup_payment b on (a.worldCupPaymentId = b.id)
         left join t_world_cup c on (b.worldCupId = c.id)
@@ -35,4 +36,19 @@
         </if>
         order by b.createTime desc limit #{item.pageNo}, #{item.pageSize}
     </select>
+
+
+
+    <select id="getCount" resultType="int">
+        select count(*) from (
+          select
+          worldCupPaymentId,
+          participantType
+          from t_world_cup_payment_participant1 where worldCupId = #{worldCupId} and worldCupPaymentId in
+          <foreach collection="worldCupPaymentId" item="item" index="index" open="(" separator="," close=")">
+              #{item}
+          </foreach>
+          group by worldCupPaymentId, participantType
+        ) as aa
+    </select>
 </mapper>
\ No newline at end of file
diff --git a/cloud-server-communityWorldCup/src/test/java/com/dsh/CommunityWorldCupApplicationTest.java b/cloud-server-communityWorldCup/src/test/java/com/dsh/CommunityWorldCupApplicationTest.java
new file mode 100644
index 0000000..43d26e2
--- /dev/null
+++ b/cloud-server-communityWorldCup/src/test/java/com/dsh/CommunityWorldCupApplicationTest.java
@@ -0,0 +1,36 @@
+//package com.dsh;
+//
+//import com.dsh.communityWorldCup.model.WorldCupRank;
+//import com.dsh.communityWorldCup.model.WorldCupRankVo;
+//import com.dsh.communityWorldCup.service.IWorldCupCompetitorService;
+//import org.junit.Test;
+//import org.junit.runner.RunWith;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.boot.test.context.SpringBootTest;
+//import org.springframework.test.context.junit4.SpringRunner;
+//
+//import java.util.List;
+//
+///**
+// * @author zhibing.pu
+// * @date 2024/3/8 16:42
+// */
+//@RunWith(SpringRunner.class)
+//@SpringBootTest
+//public class CommunityWorldCupApplicationTest {
+//
+//    @Autowired
+//    private IWorldCupCompetitorService worldCupCompetitorService;
+//
+//
+//    @Test
+//    public void test(){
+//        WorldCupRank worldCupRank = new WorldCupRank();
+//        worldCupRank.setAppUserId(129);
+//        worldCupRank.setSort(2);
+//        worldCupRank.setIsStudent(0);
+//        worldCupRank.setRadius(1);
+//        List<WorldCupRankVo> worldCupRank1 = worldCupCompetitorService.getWorldCupRank(worldCupRank);
+//    }
+//
+//}
diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html
index 4036fde..33d19cc 100644
--- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html
+++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html
@@ -20,6 +20,7 @@
   <div class="ibox-content">
     <div class="form-horizontal" id="userInfoForm">
       <input type="hidden" id="id" value="">
+	    <input type="hidden" id="page", value='add'>
       <div class="row">
         <div class="form-group">
           <label class="col-sm-3 control-label">*比赛名称:</label>
diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html
index ff95132..5890a5a 100644
--- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html
+++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html
@@ -21,6 +21,7 @@
     <div class="form-horizontal" id="userInfoForm">
       <input type="hidden" id="id" value="${item.id}">
       <input type="hidden" id="storeInfo", value='${stores}'>
+	    <input type="hidden" id="page", value='edit'>
       <div class="row">
         <div class="form-group">
           <label class="col-sm-3 control-label">*比赛名称:</label>
diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_info.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_info.html
index 5943704..d5737b1 100644
--- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_info.html
+++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_info.html
@@ -21,6 +21,7 @@
     <div class="form-horizontal" id="userInfoForm">
       <input type="hidden" id="id" value="${item.id}">
       <input type="hidden" id="storeInfo", value='${stores}'>
+	    <input type="hidden" id="page", value='info'>
       <div class="row">
         <div class="form-group">
           <label class="col-sm-3 control-label">*比赛名称:</label>
diff --git a/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js b/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js
index 4694b30..a08a483 100644
--- a/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js
+++ b/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js
@@ -269,12 +269,12 @@
                 if (res.code == 200) {
                     Feng.success("删除成功");
                     layer.closeAll();
-                    Referee.table.refresh();
+                    Referee.search();
                 } else {
                     Feng.error(res.msg);
                 }
             }, function (data) {
-                Feng.error("添加失败!" + data.responseJSON.message + "!");
+                Feng.error("删除失败!" + data.responseJSON.message + "!");
             });
             ajax.setData({
                 'id': Referee.seItem.id,
@@ -296,14 +296,14 @@
         var operation = function(){
             var ajax = new $ax(Feng.ctxPath + "/referee/updateState", function (res) {
                 if (res.code == 200) {
-                    Feng.success("删除成功");
+                    Feng.success("解冻成功");
                     layer.closeAll();
-                    Referee.table.refresh();
+                    Referee.search();
                 } else {
                     Feng.error(res.msg);
                 }
             }, function (data) {
-                Feng.error("添加失败!" + data.responseJSON.message + "!");
+                Feng.error("解冻失败!" + data.responseJSON.message + "!");
             });
             ajax.setData({
                 'id': Referee.seItem.id,
@@ -323,14 +323,14 @@
         var operation = function(){
             var ajax = new $ax(Feng.ctxPath + "/referee/updateState", function (res) {
                 if (res.code == 200) {
-                    Feng.success("删除成功");
+                    Feng.success("冻结成功");
                     layer.closeAll();
-                    Referee.table.refresh();
+                    Referee.search();
                 } else {
                     Feng.error(res.msg);
                 }
             }, function (data) {
-                Feng.error("添加失败!" + data.responseJSON.message + "!");
+                Feng.error("冻结失败!" + data.responseJSON.message + "!");
             });
             ajax.setData({
                 'id': Referee.seItem.id,
diff --git a/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup.js b/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup.js
index 92d5ee9..9d178fe 100644
--- a/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup.js
+++ b/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup.js
@@ -14,7 +14,7 @@
     return [
         {field: 'selectItem', checkbox: true},
         {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
-        {title: '比赛名字', field: 'name', visible: true, align: 'center', valign: 'middle',width:'20%',},
+        {title: '比赛名称', field: 'name', visible: true, align: 'center', valign: 'middle',width:'20%',},
         {title: '开始时间', field: 'startTime', visible: true, align: 'center', valign: 'middle',},
         {title: '结束时间', field: 'endTime', visible: true, align: 'center', valign: 'middle'},
         {title: '报名条件', field: 'age', visible: true, align: 'center', valign: 'middle',
diff --git a/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup_info.js b/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup_info.js
index ab0fe5c..9e9d079 100644
--- a/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup_info.js
+++ b/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup_info.js
@@ -46,9 +46,6 @@
     let coverImg = $('#coverImg').val();
     let homeBackdropImg = $('#homeBackdropImg').val();
     let content = editor.getContent();
-    if("" == registrationClosingTime){
-        registrationClosingTime = null;
-    }
     if(null == name || '' == name){
         Feng.error("请填写有效的比赛名称");
         return
@@ -146,7 +143,7 @@
         'name': name,
         'startTime': new Date(startTime + " 00:00:00"),
         'endTime': new Date(endTime + " 23:59:59"),
-        'registrationClosingTime': (null != registrationClosingTime && '' != registrationClosingTime ? new Date(registrationClosingTime + " 23:59:59") : registrationClosingTime),
+        'registrationClosingTime': (null != registrationClosingTime && '' != registrationClosingTime ? new Date(registrationClosingTime + " 23:59:59") : null),
         'startAge': startAge,
         'endAge': endAge,
         'gender': gender,
@@ -174,7 +171,7 @@
         if (res.code==200){
             Feng.success("添加成功!");
             WorldCupInfo.close();
-            window.parent.WorldCup.refresh();
+            window.parent.WorldCup.search();
         }else{
             Feng.error(res.msg);
         }
@@ -212,9 +209,6 @@
     let coverImg = $('#coverImg').val();
     let homeBackdropImg = $('#homeBackdropImg').val();
     let content = editor.getContent();
-    if("" == registrationClosingTime){
-        registrationClosingTime = null;
-    }
     if(null == name || '' == name){
         Feng.error("请填写有效的比赛名称");
         return
@@ -313,7 +307,7 @@
         'name': name,
         'startTime': new Date(startTime + " 00:00:00"),
         'endTime': new Date(endTime + " 23:59:59"),
-        'registrationClosingTime': (null != registrationClosingTime && '' != registrationClosingTime ? new Date(registrationClosingTime + " 23:59:59") : registrationClosingTime),
+        'registrationClosingTime': (null != registrationClosingTime && '' != registrationClosingTime ? new Date(registrationClosingTime + " 23:59:59") : null),
         'startAge': startAge,
         'endAge': endAge,
         'gender': gender,
@@ -341,7 +335,7 @@
         if (res.code==200){
             Feng.success("编辑成功!");
             WorldCupInfo.close();
-            window.parent.WorldCup.refresh();
+            window.parent.WorldCup.search();
         }else{
             Feng.error(res.msg);
         }
@@ -547,12 +541,18 @@
 
 WorldCupInfo.initStore = function (){
     let html = '';
+    let page = $('#page').val();
     for (let i = 0; i < WorldCupInfo.stores.length; i++) {
         let item = WorldCupInfo.stores[i];
-        html += '<tr><td>' + item.province + '</td><td>' + (typeof item.operator == "undefined" ? "" : item.operator) + '</td><td>' + item.name + '</td><td><button style="height: 30px;\n' +
-            '    line-height: 30px;\n' +
-            '    font-size: 14px;\n' +
-            '    width: 50px" onclick="WorldCupInfo.delStore(' + item.id + ')">删除</button></td></tr>'
+        html += '<tr><td>' + item.province + '</td><td>' + (typeof item.operator == "undefined" ? "" : item.operator) + '</td><td>' + item.name + '</td>';
+        if("info" != page){
+            html += '<td><button style="height: 30px;\n' +
+                    '    line-height: 30px;\n' +
+                    '    font-size: 14px;\n' +
+                    '    width: 50px" onclick="WorldCupInfo.delStore(' + item.id + ')">删除</button></td></tr>'
+        }else{
+            html += '</tr>';
+        }
     }
     $('#stores tbody').html(html);
 }
diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
index bf02cc6..d4259cd 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
@@ -171,7 +171,7 @@
 
 
     @RequestMapping("/base/site/listBooks")
-    public List<SiteBooking> listBooks(@RequestParam("id") Integer id) {
+    public List<SiteBooking> listBooks(@RequestBody Integer id) {
         List<SiteBooking> siteId = siteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", id));
         return siteId;
     }
diff --git a/cloud-server-other/src/main/java/com/dsh/other/entity/TGame.java b/cloud-server-other/src/main/java/com/dsh/other/entity/TGame.java
index 67acf05..c65e1d6 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/entity/TGame.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/entity/TGame.java
@@ -80,7 +80,9 @@
      * 红方id
      */
     private String red;
+    @TableField(exist=false)
     private String blueName;
+    @TableField(exist=false)
     private String redName;
 
     private Integer state;

--
Gitblit v1.7.1