| | |
| | | package com.dsh.competition.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.competition.entity.Participant; |
| | | import com.dsh.competition.entity.UserCompetition; |
| | | import com.dsh.competition.feignclient.account.AppUserClient; |
| | | import com.dsh.competition.feignclient.account.StudentClient; |
| | | import com.dsh.competition.feignclient.account.model.AppUser; |
| | | import com.dsh.competition.feignclient.account.model.Student; |
| | | import com.dsh.competition.feignclient.account.model.TStudent; |
| | | import com.dsh.competition.model.AddParticipant; |
| | | import com.dsh.competition.model.EditParticipant; |
| | | import com.dsh.competition.model.ParticipantVo; |
| | | import com.dsh.competition.model.SaveParticipant; |
| | | import com.dsh.competition.service.IParticipantService; |
| | | import com.dsh.competition.service.UserCompetitionService; |
| | | import com.dsh.competition.util.JuHeUtil; |
| | | import com.dsh.competition.util.ResultUtil; |
| | | import com.dsh.competition.util.TokenUtil; |
| | | import com.dsh.competition.util.ToolUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private StudentClient studentClient; |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @ResponseBody |
| | | @PostMapping("/api/participant/editParticipant") |
| | | @ApiOperation(value = "编辑参赛人员", tags = {"APP-赛事活动列表", ""}) |
| | |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return participantService.editParticipant(uid, editParticipant); |
| | | int numDigits = String.valueOf(editParticipant.getId()).length(); |
| | | |
| | | |
| | | |
| | | if (numDigits==9){ |
| | | 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.setIdCard(editParticipant.getIdcard()); |
| | | 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())){ |
| | | Boolean aBoolean = JuHeUtil.idcardAuthentication(student.getIdCard(), student.getName()); |
| | | if(!aBoolean){ |
| | | return ResultUtil.error("身份证和姓名不匹配"); |
| | | } |
| | | } |
| | | |
| | | |
| | | student.setPhone(editParticipant.getPhone()); |
| | | studentClient.updateAppUser(student); |
| | | return ResultUtil.success(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | 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)); |
| | | } |
| | | } |