From 61bbd595ee2bc3c67b40878894dcc07174c6eea6 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期二, 24 九月 2024 10:15:30 +0800 Subject: [PATCH] 玩湃微信商户分账 --- cloud-server-competition/src/main/java/com/dsh/competition/controller/ParticipantController.java | 91 +++++++++++++++++++++++---------------------- 1 files changed, 47 insertions(+), 44 deletions(-) diff --git a/cloud-server-competition/src/main/java/com/dsh/competition/controller/ParticipantController.java b/cloud-server-competition/src/main/java/com/dsh/competition/controller/ParticipantController.java index 2494018..95e7551 100644 --- a/cloud-server-competition/src/main/java/com/dsh/competition/controller/ParticipantController.java +++ b/cloud-server-competition/src/main/java/com/dsh/competition/controller/ParticipantController.java @@ -43,46 +43,51 @@ @Autowired private TokenUtil tokenUtil; + @Resource + private StudentClient studentClient; + + @Autowired + private UserCompetitionService userCompetitionService; + + @ResponseBody @PostMapping("/api/participant/addParticipant") - @ApiOperation(value = "添加参赛人员", tags = {"APP-赛事活动列表", ""}) + @ApiOperation(value = "添加参赛人员【2.0】", tags = {"APP-赛事活动列表", "人员管理"}) @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) - public ResultUtil addParticipant(AddParticipant addParticipant){ + public ResultUtil addParticipant(AddParticipant addParticipant) { try { Integer uid = tokenUtil.getUserIdFormRedis(); - if(null == uid){ + if (null == uid) { return ResultUtil.tokenErr(); } return participantService.addParticipant(uid, addParticipant); - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); return ResultUtil.runErr(); } } - - @ResponseBody @PostMapping("/api/participant/queryParticipantList") - @ApiOperation(value = "获取参赛人员列表", tags = {"APP-赛事活动列表", ""}) + @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(Integer isPre) { try { Integer uid = tokenUtil.getUserIdFormRedis(); - if(null == uid){ + 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) { @@ -90,11 +95,11 @@ filteredParticipants.add(participant); } } - return ResultUtil.success(filteredParticipants); + return ResultUtil.success(filteredParticipants); } return ResultUtil.success(participantVos); - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); return ResultUtil.runErr(); } @@ -103,52 +108,44 @@ - @Resource - private StudentClient studentClient; - - @Resource - private AppUserClient appUserClient; @ResponseBody @PostMapping("/api/participant/editParticipant") - @ApiOperation(value = "编辑参赛人员", tags = {"APP-赛事活动列表", ""}) + @ApiOperation(value = "编辑参赛人员", tags = {"APP-赛事活动列表", "人员管理"}) @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) - public ResultUtil editParticipant(EditParticipant editParticipant){ + public ResultUtil editParticipant(EditParticipant editParticipant) { try { Integer uid = tokenUtil.getUserIdFormRedis(); - if(null == uid){ + if (null == uid) { return ResultUtil.tokenErr(); } int numDigits = String.valueOf(editParticipant.getId()).length(); - - if (numDigits==9){ + if (numDigits == 9) { Participant byId = participantService.getById(editParticipant.getId()); editParticipant.setName(byId.getName()); return participantService.editParticipant(uid, editParticipant); - } - else { + } else { TStudent student = new TStudent(); student.setId(editParticipant.getId()); - TStudent student1 = studentClient.queryById(editParticipant.getId()); + TStudent student1 = studentClient.queryById(editParticipant.getId()); student.setName(student1.getName()); student.setIdCard(editParticipant.getIdcard()); - if (editParticipant.getHeight()!=null) { + student.setHeadImg(editParticipant.getHeadImg()); + if (editParticipant.getHeight() != null) { student.setHeight(Double.valueOf(editParticipant.getHeight())); } - - if (editParticipant.getWeight()!=null) { + if (editParticipant.getWeight() != null) { student.setWeight(editParticipant.getWeight()); } - - if(ToolUtil.isNotEmpty(student.getName()) && ToolUtil.isNotEmpty(student.getIdCard())){ + if (ToolUtil.isNotEmpty(student.getName()) && ToolUtil.isNotEmpty(student.getIdCard())) { Boolean aBoolean = JuHeUtil.idcardAuthentication(student.getIdCard(), student.getName()); - if(!aBoolean){ + if (!aBoolean) { return ResultUtil.error("身份证和姓名不匹配"); } } @@ -158,28 +155,27 @@ studentClient.updateAppUser(student); return ResultUtil.success(); } - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); return ResultUtil.runErr(); } } - @ResponseBody @PostMapping("/api/participant/delParticipant") - @ApiOperation(value = "删除参赛人员", tags = {"APP-赛事活动列表", ""}) + @ApiOperation(value = "删除参赛人员", tags = {"APP-赛事活动列表", "人员管理"}) @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){ + if (null == uid) { return ResultUtil.tokenErr(); } - return participantService.delParticipant(id); - }catch (Exception e){ + return participantService.delParticipant(id, isStudent); + } catch (Exception e) { e.printStackTrace(); return ResultUtil.runErr(); } @@ -188,25 +184,32 @@ /** * 保存学员后同步参赛人员信息 + * * @param saveParticipant */ @ResponseBody @PostMapping("/participant/saveParticipant") - public void saveParticipant(@RequestBody SaveParticipant saveParticipant){ + public void saveParticipant(@RequestBody SaveParticipant saveParticipant) { try { participantService.saveParticipant(saveParticipant); - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } } - @Autowired - private UserCompetitionService userCompetitionService; + @ResponseBody @PostMapping("/participant/counts") - public Integer counts(@RequestBody Integer stuId){ - return userCompetitionService.count(new QueryWrapper<UserCompetition>().eq("participantId",stuId)); + public Integer counts(@RequestBody Integer stuId) { + return userCompetitionService.count(new QueryWrapper<UserCompetition>().eq("participantId", stuId)); + } + + + @ResponseBody + @PostMapping("/participant/getParticipant") + public Participant getParticipant(@RequestBody Long id){ + return participantService.getById(id); } } -- Gitblit v1.7.1