puzhibing
2024-03-06 ab20715db09a5e4888c19702f5f73ecdc4e55f15
添加方法
1个文件已添加
3个文件已修改
149 ■■■■■ 已修改文件
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/RegisteredPersonnel.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentParticipantService.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java
@@ -691,4 +691,16 @@
            out.close();
        }
    }
    /**
     * 获取已报名人员列表
     * @param registeredPersonnel
     * @return
     */
    @ResponseBody
    @PostMapping("/worldCup/getRegisteredPersonnel")
    public Map<String, Object> getRegisteredPersonnel(@RequestBody RegisteredPersonnel registeredPersonnel){
        return worldCupPaymentParticipantService.getRegisteredPersonnel(registeredPersonnel);
    }
}
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/RegisteredPersonnel.java
New file
@@ -0,0 +1,39 @@
package com.dsh.communityWorldCup.model;
import lombok.Data;
/**
 * @author zhibing.pu
 * @Date 2024/3/6 11:02
 */
@Data
public class RegisteredPersonnel {
    /**
     * 世界杯赛事id
     */
    private Integer id;
    /**
     * 姓名
     */
    private String name;
    /**
     * 电话号码
     */
    private String phone;
    /**
     * 身份证号
     */
    private String idcode;
    /**
     * 状态(1=正常,2=取消)
     */
    private Integer status;
    /**
     * 页码
     */
    private Integer offset;
    /**
     * 页条数
     */
    private Integer limit;
}
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentParticipantService.java
@@ -2,13 +2,11 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.dsh.communityWorldCup.entity.WorldCupPaymentParticipant;
import com.dsh.communityWorldCup.model.MyWorldCupInfo;
import com.dsh.communityWorldCup.model.MyWorldCupList;
import com.dsh.communityWorldCup.model.ParticipantVo;
import com.dsh.communityWorldCup.model.WorldCupListVo;
import com.dsh.communityWorldCup.model.*;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
import java.util.Map;
/**
 * @author zhibing.pu
@@ -49,4 +47,12 @@
     * @return
     */
    List<ParticipantVo> getParticipant(Integer uid);
    /**
     * 获取已报名人员列表
     * @param registeredPersonnel
     * @return
     */
    Map<String, Object> getRegisteredPersonnel(RegisteredPersonnel registeredPersonnel);
}
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java
@@ -244,4 +244,88 @@
        }
        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(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());
                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;
    }
}