| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | |
| | | @ApiOperation(value = "获取参赛人员列表", tags = {"APP-赛事活动列表", "我的二维码", "人员管理", "APP-社区世界杯"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "isPre(1过滤)", name = "是否过滤未实名", required = true, dataType = "int") |
| | | }) |
| | | public ResultUtil<List<ParticipantVo>> queryParticipantList(Integer isPre) { |
| | | public ResultUtil<List<ParticipantVo>> queryParticipantList() { |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if (null == uid) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | System.err.println("查询人员列表"); |
| | | List<ParticipantVo> participantVos = participantService.queryParticipantList(uid); |
| | | if (isPre != null) { |
| | | // if (isPre != null) { |
| | | List<ParticipantVo> filteredParticipants = new ArrayList<>(); |
| | | |
| | | for (ParticipantVo participant : participantVos) { |
| | | if (participant.getIdcard() != null && !participant.getIdcard().isEmpty()) { |
| | | // if (participant.getIdcard() != null && !participant.getIdcard().isEmpty()) { |
| | | filteredParticipants.add(participant); |
| | | } |
| | | // } |
| | | } |
| | | return ResultUtil.success(filteredParticipants); |
| | | } |
| | | List<ParticipantVo> collect = filteredParticipants.stream().distinct().collect(Collectors.toList()); |
| | | return ResultUtil.success(collect); |
| | | // } |
| | | |
| | | return ResultUtil.success(participantVos); |
| | | // return ResultUtil.success(participantVos); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | if (!aBoolean) { |
| | | return ResultUtil.error("身份证和姓名不匹配"); |
| | | } |
| | | // 根据身份证号获取生日 |
| | | String birthday18 = extractBirthdayFromIdCard(student.getIdCard()); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | student.setBirthday(simpleDateFormat.parse(birthday18)); |
| | | } |
| | | student.setPhone(editParticipant.getPhone()); |
| | | studentClient.updateAppUser(student); |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | /** |
| | | * 根据身份证号码提取生日 |
| | | * @param idCard 身份证号码 |
| | | * @return 生日字符串 YYYY-MM-DD格式 |
| | | */ |
| | | public static String extractBirthdayFromIdCard(String idCard) { |
| | | if (idCard == null || idCard.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | String birthday; |
| | | if (idCard.length() == 18) { |
| | | // 18位身份证:截取第7-14位 |
| | | birthday = idCard.substring(6, 14); |
| | | } else if (idCard.length() == 15) { |
| | | // 15位身份证:截取第7-12位,并补上前缀"19" |
| | | birthday = "19" + idCard.substring(6, 12); |
| | | } else { |
| | | return null; |
| | | } |
| | | |
| | | // 格式化为YYYY-MM-DD格式 |
| | | return birthday.substring(0, 4) + "-" + |
| | | birthday.substring(4, 6) + "-" + |
| | | birthday.substring(6, 8); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/participant/delParticipant") |