From 7501140cf637fef9629a80202907ed067c8a5a06 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期五, 08 三月 2024 20:07:45 +0800
Subject: [PATCH] 添加方法

---
 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java |  109 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 104 insertions(+), 5 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 11d20b5..cb4a6b4 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,7 +6,9 @@
 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;
@@ -62,6 +64,9 @@
     @Resource
     private StoreClient storeClient;
 
+    @Resource
+    private AppUserClient appUserClient;
+
 
 
 
@@ -73,7 +78,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 +139,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 +219,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 +240,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());
@@ -244,4 +252,95 @@
         }
         return datas;
     }
+
+
+    /**
+     * 获取 已报名人员列表
+     * @param registeredPersonnel
+     * @return
+     */
+    @Override
+    public Map<String, Object> getRegisteredPersonnel(RegisteredPersonnel registeredPersonnel) {
+        Integer id = registeredPersonnel.getId();
+        String idcode = registeredPersonnel.getIdcode();
+        String name = registeredPersonnel.getName();
+        String phone = registeredPersonnel.getPhone();
+        Integer status = registeredPersonnel.getStatus();
+        Integer offset = registeredPersonnel.getOffset();
+        Integer limit = registeredPersonnel.getLimit();
+        QueryWrapper<WorldCupPayment> queryWrapper = new QueryWrapper<WorldCupPayment>()
+                .eq("worldCupId", id).eq("state", 1);
+        if(null == status){
+            queryWrapper.in("payStatus", Arrays.asList(2, 3));
+        }else if(status == 1){
+            queryWrapper.eq("payStatus", 2);
+        }else{
+            queryWrapper.eq("payStatus", 3);
+        }
+        List<WorldCupPayment> list = worldCupPaymentService.list(queryWrapper);
+        List<Long> collect = list.stream().map(WorldCupPayment::getId).collect(Collectors.toList());
+        Map<String, Object> map = new HashMap<>();
+        if(collect.size() == 0){
+            map.put("rows", new ArrayList<>());
+            map.put("total", 0);
+            return map;
+        }
+        List<WorldCupPaymentParticipant> list1 = this.list(new QueryWrapper<WorldCupPaymentParticipant>().in("worldCupPaymentId", collect));
+        List<Map<String, Object>> list2 = new ArrayList<>();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
+        for (WorldCupPaymentParticipant on : list1) {
+            WorldCupPayment worldCupPayment = worldCupPaymentService.getById(on.getWorldCupPaymentId());
+            Map<String, Object> map1 = new HashMap<>();
+            if(on.getParticipantType() == 1){
+                TStudent tStudent = studentClient.queryById(on.getParticipantId().intValue());
+                if(ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1){
+                    continue;
+                }
+                if(ToolUtil.isNotEmpty(phone) && tStudent.getPhone().indexOf(phone) == -1){
+                    continue;
+                }
+                if(ToolUtil.isNotEmpty(idcode) && tStudent.getIdCard().indexOf(idcode) == -1){
+                    continue;
+                }
+                map1.put("id", tStudent.getId());
+                map1.put("isStudent", 1);
+                map1.put("name", tStudent.getName());
+                map1.put("gender", tStudent.getSex() == 1 ? "男" : "女");
+                map1.put("age", Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tStudent.getBirthday())));
+                map1.put("phone", tStudent.getPhone());
+                map1.put("idcard", tStudent.getIdCard());
+                map1.put("state", worldCupPayment.getPayStatus() - 1);
+            }else{
+                Participant participant = participantClient.getParticipant(on.getParticipantId());
+                if(ToolUtil.isNotEmpty(name) && participant.getName().indexOf(name) == -1){
+                    continue;
+                }
+                if(ToolUtil.isNotEmpty(phone) && participant.getPhone().indexOf(phone) == -1){
+                    continue;
+                }
+                if(ToolUtil.isNotEmpty(idcode) && participant.getIdcard().indexOf(idcode) == -1){
+                    continue;
+                }
+                map1.put("id", participant.getId());
+                map1.put("isStudent", 0);
+                map1.put("name", participant.getName());
+                map1.put("gender", participant.getGender() == 1 ? "男" : "女");
+                map1.put("age", Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(participant.getBirthday())));
+                map1.put("phone", participant.getPhone());
+                map1.put("idcard", participant.getIdcard());
+                map1.put("state", worldCupPayment.getPayStatus() - 1);
+            }
+            list2.add(map1);
+        }
+
+        limit += offset;
+        map.put("rows", list2.subList(offset, list2.size() >= limit ? limit : list.size()));
+        map.put("total", list2.size());
+        return map;
+    }
+
+    @Override
+    public int getCount(Integer worldCupId, List<Long> worldCupPaymentId) {
+        return this.baseMapper.getCount(worldCupId, worldCupPaymentId);
+    }
 }

--
Gitblit v1.7.1