|  |  |  | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  | 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(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 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 (null == uid) { | 
|---|
|  |  |  | return ResultUtil.tokenErr(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | int numDigits = String.valueOf(editParticipant.getId()).length(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (numDigits == 9) { | 
|---|
|  |  |  | if (null != editParticipant.getIsStudent() && 0 == editParticipant.getIsStudent()) { | 
|---|
|  |  |  | Participant byId = participantService.getById(editParticipant.getId()); | 
|---|
|  |  |  | editParticipant.setName(byId.getName()); | 
|---|
|  |  |  | return participantService.editParticipant(uid, editParticipant); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | TStudent student = new TStudent(); | 
|---|
|  |  |  | student.setId(editParticipant.getId()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | TStudent student1 = studentClient.queryById(editParticipant.getId()); | 
|---|
|  |  |  | student.setName(student1.getName()); | 
|---|
|  |  |  | student.setName(editParticipant.getName()); | 
|---|
|  |  |  | student.setIdCard(editParticipant.getIdcard()); | 
|---|
|  |  |  | student.setHeadImg(editParticipant.getHeadImg()); | 
|---|
|  |  |  | if (editParticipant.getHeight() != null) { | 
|---|
|  |  |  | student.setHeight(Double.valueOf(editParticipant.getHeight())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (editParticipant.getWeight() != null) { | 
|---|
|  |  |  | student.setWeight(editParticipant.getWeight()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (ToolUtil.isNotEmpty(student.getName()) && ToolUtil.isNotEmpty(student.getIdCard())) { | 
|---|
|  |  |  | if (ToolUtil.isNotEmpty(editParticipant.getName()) && ToolUtil.isNotEmpty(student.getIdCard())) { | 
|---|
|  |  |  | Boolean aBoolean = JuHeUtil.idcardAuthentication(student.getIdCard(), student.getName()); | 
|---|
|  |  |  | if (!aBoolean) { | 
|---|
|  |  |  | return ResultUtil.error("身份证和姓名不匹配"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | student.setPhone(editParticipant.getPhone()); | 
|---|
|  |  |  | studentClient.updateAppUser(student); | 
|---|
|  |  |  | return ResultUtil.success(); | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ResultUtil delParticipant(Integer id) { | 
|---|
|  |  |  | public ResultUtil delParticipant(Integer id, Integer isStudent) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | Integer uid = tokenUtil.getUserIdFormRedis(); | 
|---|
|  |  |  | if (null == uid) { | 
|---|
|  |  |  | return ResultUtil.tokenErr(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return participantService.delParticipant(id); | 
|---|
|  |  |  | return participantService.delParticipant(id, isStudent); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | return ResultUtil.runErr(); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ResponseBody | 
|---|
|  |  |  | @PostMapping("/participant/getParticipant") | 
|---|
|  |  |  | public Participant getParticipant(@RequestBody Integer id){ | 
|---|
|  |  |  | public Participant getParticipant(@RequestBody Long id){ | 
|---|
|  |  |  | return participantService.getById(id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|