From acad524bfb7f376c09ff8e6600fab207780156e1 Mon Sep 17 00:00:00 2001 From: 44323 <443237572@qq.com> Date: 星期四, 23 十一月 2023 18:46:05 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/PlayPai --- cloud-server-competition/src/main/java/com/dsh/competition/service/impl/ParticipantServiceImpl.java | 62 +++++++++++++++++++------------ 1 files changed, 38 insertions(+), 24 deletions(-) diff --git a/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/ParticipantServiceImpl.java b/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/ParticipantServiceImpl.java index f312365..2d1d64e 100644 --- a/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/ParticipantServiceImpl.java +++ b/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/ParticipantServiceImpl.java @@ -96,30 +96,12 @@ public List<ParticipantVo> queryParticipantList(Integer uid) throws Exception { //拿到学员列表 List<TStudent> tStudents = studentClient.queryStudentList(uid); + + List<ParticipantVo> listVo1 = new ArrayList<>(); + //利用HashMap去重身份证 LinkedHashMap<String,ParticipantVo> linkedHashMap =new LinkedHashMap<>(); SimpleDateFormat sdf_year = new SimpleDateFormat("yyyy"); - for (TStudent tStudent : tStudents) { - ParticipantVo participantVo = new ParticipantVo(); - participantVo.setId(tStudent.getId()); - participantVo.setName(tStudent.getName()); - participantVo.setIdcard(tStudent.getIdCard()); - Integer age = Integer.valueOf(sdf_year.format(new Date())) - Integer.valueOf(sdf_year.format(tStudent.getBirthday())); - participantVo.setAge(age); - Integer integer = coursePackagePaymentClient.queryResidueClassHour(tStudent.getId()); - participantVo.setResidueClassHour(integer); - participantVo.setPhone(tStudent.getPhone()); - participantVo.setHeight(tStudent.getHeight().intValue()); - participantVo.setWeight(tStudent.getWeight()); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - if(null != tStudent.getBirthday()){ - String format = sdf.format(tStudent.getBirthday()); - participantVo.setBirthday(format); - } - participantVo.setGender(tStudent.getSex()); - participantVo.setIsStudent(1); - linkedHashMap.put(tStudent.getIdCard(),participantVo); - } @@ -156,15 +138,47 @@ participantVo.setBirthday(format); } participantVo.setGender(participant.getGender()); - + if (participant.getIdcard()==null|| participant.getIdcard().isEmpty()){ + listVo1.add(participantVo); + continue; + } linkedHashMap.put(participant.getIdcard(),participantVo); - listVo.add(participantVo); +// listVo.add(participantVo); + + } + + for (TStudent tStudent : tStudents) { + ParticipantVo participantVo = new ParticipantVo(); + participantVo.setId(tStudent.getId()); + participantVo.setName(tStudent.getName()); + participantVo.setIdcard(tStudent.getIdCard()); + Integer age = Integer.valueOf(sdf_year.format(new Date())) - Integer.valueOf(sdf_year.format(tStudent.getBirthday())); + participantVo.setAge(age); + Integer integer = coursePackagePaymentClient.queryResidueClassHour(tStudent.getId()); + participantVo.setResidueClassHour(integer); + participantVo.setPhone(tStudent.getPhone()); + participantVo.setHeight(tStudent.getHeight().intValue()); + participantVo.setWeight(tStudent.getWeight()); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + if(null != tStudent.getBirthday()){ + String format = sdf.format(tStudent.getBirthday()); + participantVo.setBirthday(format); + } + participantVo.setGender(tStudent.getSex()); + participantVo.setIsStudent(1); + if (tStudent.getIdCard()==null|| tStudent.getIdCard().isEmpty()){ + listVo1.add(participantVo); + continue; + } + linkedHashMap.put(tStudent.getIdCard(),participantVo); } + listVo1.addAll(linkedHashMap.values()); - List<ParticipantVo> listVo1 = new ArrayList<>(linkedHashMap.values()); + +// List<ParticipantVo> listVo1 = new ArrayList<>(linkedHashMap.values()); return listVo1; -- Gitblit v1.7.1