From ceacc612529f38c632d85d91bb5309baa5ebb82a Mon Sep 17 00:00:00 2001
From: 44323 <443237572@qq.com>
Date: 星期一, 11 三月 2024 16:04:54 +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/WorldCupPaymentParticipantServiceImpl.java |  104 ++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 97 insertions(+), 7 deletions(-)

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 506e666..8538ff5 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
@@ -6,12 +6,15 @@
 import com.dsh.communityWorldCup.entity.WorldCupPayment;
 import com.dsh.communityWorldCup.entity.WorldCupPaymentParticipant;
 import com.dsh.communityWorldCup.entity.WorldCupStore;
+import com.dsh.communityWorldCup.feignclient.account.AppUserClient;
 import com.dsh.communityWorldCup.feignclient.account.StudentClient;
+import com.dsh.communityWorldCup.feignclient.account.model.AppUser;
 import com.dsh.communityWorldCup.feignclient.account.model.TStudent;
 import com.dsh.communityWorldCup.feignclient.competition.ParticipantClient;
 import com.dsh.communityWorldCup.feignclient.competition.model.Participant;
 import com.dsh.communityWorldCup.feignclient.other.StoreClient;
 import com.dsh.communityWorldCup.feignclient.other.model.Store;
+import com.dsh.communityWorldCup.mapper.WorldCupCompetitorMapper;
 import com.dsh.communityWorldCup.mapper.WorldCupPaymentParticipantMapper;
 import com.dsh.communityWorldCup.model.MyWorldCupInfo;
 import com.dsh.communityWorldCup.model.MyWorldCupList;
@@ -62,6 +65,12 @@
     @Resource
     private StoreClient storeClient;
 
+    @Resource
+    private AppUserClient appUserClient;
+
+    @Resource
+    private WorldCupCompetitorMapper worldCupCompetitorMapper;
+
 
 
 
@@ -73,7 +82,7 @@
      * @return
      */
     @Override
-    public WorldCupPaymentParticipant getWorldCupPaymentParticipant(Integer worldCupId, Integer participantType, Integer participantId) {
+    public WorldCupPaymentParticipant getWorldCupPaymentParticipant(Integer worldCupId, Integer participantType, Long participantId) {
         return this.baseMapper.getWorldCupPaymentParticipant(worldCupId, participantType, participantId);
     }
 
@@ -134,11 +143,11 @@
         List<WorldCupPaymentParticipant> list1 = this.list(new QueryWrapper<WorldCupPaymentParticipant>().eq("worldCupPaymentId", worldCupPaymentParticipant.getWorldCupPaymentId()));
         for (WorldCupPaymentParticipant wcpp : list1) {
             Integer participantType = wcpp.getParticipantType();
-            Integer participantId = wcpp.getParticipantId();
+            Long participantId = wcpp.getParticipantId();
             ParticipantVo participantVo = new ParticipantVo();
             //学员
             if(1 == participantType){
-                TStudent tStudent = studentClient.queryById(participantId);
+                TStudent tStudent = studentClient.queryById(participantId.intValue());
                 participantVo.setId(tStudent.getId());
                 participantVo.setName(tStudent.getName());
                 int age = Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tStudent.getBirthday()));
@@ -214,13 +223,15 @@
             List<WorldCupPaymentParticipant> list1 = this.list(new QueryWrapper<WorldCupPaymentParticipant>().in("worldCupPaymentId", collect));
             for (WorldCupPaymentParticipant worldCupPaymentParticipant : list1) {
                 Integer participantType = worldCupPaymentParticipant.getParticipantType();
-                Integer participantId = worldCupPaymentParticipant.getParticipantId();
+                Long participantId = worldCupPaymentParticipant.getParticipantId();
                 ParticipantVo participantVo = new ParticipantVo();
+                AppUser appUser = appUserClient.getAppUser(worldCupPaymentParticipant.getAppUserId());
                 //学员
                 if(1 == participantType && !xy.contains(participantId)){
-                    TStudent tStudent = studentClient.queryById(participantId);
+                    TStudent tStudent = studentClient.queryById(participantId.intValue());
                     participantVo.setId(tStudent.getId());
                     participantVo.setName(tStudent.getName());
+                    participantVo.setAvatar(tStudent.getHeadImg());
                     int age = Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tStudent.getBirthday()));
                     participantVo.setAge(age);
                     participantVo.setIdcard(tStudent.getIdCard());
@@ -233,6 +244,7 @@
                     Participant participant = participantClient.getParticipant(participantId);
                     participantVo.setId(participant.getId());
                     participantVo.setName(participant.getName());
+                    participantVo.setAvatar(appUser.getHeadImg());
                     int age = Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(participant.getBirthday()));
                     participantVo.setAge(age);
                     participantVo.setIdcard(participant.getIdcard());
@@ -284,7 +296,7 @@
             WorldCupPayment worldCupPayment = worldCupPaymentService.getById(on.getWorldCupPaymentId());
             Map<String, Object> map1 = new HashMap<>();
             if(on.getParticipantType() == 1){
-                TStudent tStudent = studentClient.queryById(on.getParticipantId());
+                TStudent tStudent = studentClient.queryById(on.getParticipantId().intValue());
                 if(ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1){
                     continue;
                 }
@@ -326,7 +338,7 @@
         }
 
         limit += offset;
-        map.put("rows", list2.subList(offset, list2.size() >= limit ? limit : list.size()));
+        map.put("rows", list2.subList(offset, list2.size() >= limit ? limit : list2.size()));
         map.put("total", list2.size());
         return map;
     }
@@ -335,4 +347,82 @@
     public int getCount(Integer worldCupId, List<Long> worldCupPaymentId) {
         return this.baseMapper.getCount(worldCupId, worldCupPaymentId);
     }
+
+
+    /**
+     * 获取用户列表
+     * @param worldCupGameStatisticsInfoList
+     * @return
+     */
+    @Override
+    public Map<String, Object> getUserGameRecordList(WorldCupGameStatisticsInfoList worldCupGameStatisticsInfoList) {
+        Map<String, Object> map1 = new HashMap<>();
+        String name = worldCupGameStatisticsInfoList.getName();
+        String phone = worldCupGameStatisticsInfoList.getPhone();
+        String idcard = worldCupGameStatisticsInfoList.getIdcard();
+        List<Map<String, Object>> mapList = this.baseMapper.getUserGameRecordList();
+        List<Map<String, Object>> list = new ArrayList<>();
+        for (int i = 0; i < mapList.size(); i++) {
+            Map<String, Object> map = mapList.get(i);
+            Integer participantType = Integer.valueOf(map.get("participantType").toString());
+            Long participantId = Long.valueOf(map.get("participantId").toString());
+            Integer appUserId = Integer.valueOf(map.get("appUserId").toString());
+            Map<String, Object> userGameRecordList = worldCupCompetitorMapper.getUserGameRecordList(participantType, participantId);
+            Integer totalSession = 0;
+            Integer win = 0;
+            if(null != userGameRecordList){
+                totalSession = Integer.valueOf(null != userGameRecordList.get("totalSession") ? userGameRecordList.get("totalSession").toString() : "0");
+                win = Integer.valueOf(null != userGameRecordList.get("win") ? userGameRecordList.get("win").toString() : "0");
+            }else{
+                userGameRecordList = new HashMap<>();
+            }
+            userGameRecordList.put("totalSession", totalSession);
+            userGameRecordList.put("win", win);
+            Integer lose = totalSession - win;
+            userGameRecordList.put("lose", lose);
+            userGameRecordList.put("winRate", totalSession == 0 ? 0 : win / totalSession * 100);
+            userGameRecordList.put("participantType", participantType);
+            userGameRecordList.put("participantId", participantId);
+            AppUser appUser = appUserClient.getAppUser(appUserId);
+            userGameRecordList.put("province", appUser.getProvince() + appUser.getCity());
+            if(1 == participantType){
+                TStudent tStudent = studentClient.queryById(participantId.intValue());
+                if(ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1){
+                    continue;
+                }
+                if(ToolUtil.isNotEmpty(phone) && tStudent.getPhone().indexOf(phone) == -1){
+                    continue;
+                }
+                if(ToolUtil.isNotEmpty(idcard) && tStudent.getIdCard().indexOf(idcard) == -1){
+                    continue;
+                }
+
+                userGameRecordList.put("name", tStudent.getName());
+                userGameRecordList.put("phone", ToolUtil.isEmpty(tStudent.getPhone()) ? appUser.getPhone() : tStudent.getPhone());
+                userGameRecordList.put("idcard", tStudent.getIdCard());
+            }else{
+                Participant participant = participantClient.getParticipant(participantId);
+                if(ToolUtil.isNotEmpty(name) && participant.getName().indexOf(name) == -1){
+                    continue;
+                }
+                if(ToolUtil.isNotEmpty(phone) && participant.getPhone().indexOf(phone) == -1){
+                    continue;
+                }
+                if(ToolUtil.isNotEmpty(idcard) && participant.getIdcard().indexOf(idcard) == -1){
+                    continue;
+                }
+
+                userGameRecordList.put("name", participant.getName());
+                userGameRecordList.put("phone", ToolUtil.isNotEmpty(participant.getPhone()) ? participant.getPhone() : appUser.getPhone());
+                userGameRecordList.put("idcard", participant.getIdcard());
+            }
+            list.add(userGameRecordList);
+        }
+        map1.put("total", list.size());
+        Integer offset = worldCupGameStatisticsInfoList.getOffset();
+        Integer limit = worldCupGameStatisticsInfoList.getLimit();
+        limit += offset;
+        map1.put("rows", list.subList(offset, list.size() >= limit ? limit : list.size()));
+        return map1;
+    }
 }

--
Gitblit v1.7.1