From 7501140cf637fef9629a80202907ed067c8a5a06 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期五, 08 三月 2024 20:07:45 +0800 Subject: [PATCH] 添加方法 --- cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupCompetitor.java | 2 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java | 52 ++++++++++++++++++-------- cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java | 4 +- cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/competition/ParticipantClient.java | 2 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentParticipantService.java | 2 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java | 24 ++++++------ cloud-server-competition/src/main/java/com/dsh/competition/controller/ParticipantController.java | 2 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupPaymentParticipant.java | 2 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java | 20 +++++++--- cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/EntrantRank.java | 2 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/ParticipantVo.java | 2 + cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupPaymentParticipantMapper.java | 2 12 files changed, 73 insertions(+), 43 deletions(-) diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java index 8281e5b..3d4bd37 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java @@ -171,11 +171,11 @@ return ResultUtil.error("无效二维码"); } WorldCupPeopleVo worldCupPeopleVo = new WorldCupPeopleVo(); - worldCupPeopleVo.setId(worldCupPaymentParticipant.getId()); + worldCupPeopleVo.setId(worldCupPaymentParticipant.getParticipantId()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); if(worldCupPaymentParticipant.getParticipantType() == 1){ //学员 - TStudent tStudent = studentClient.queryById(worldCupPaymentParticipant.getParticipantId()); + TStudent tStudent = studentClient.queryById(worldCupPaymentParticipant.getParticipantId().intValue()); worldCupPeopleVo.setName(tStudent.getName()); worldCupPeopleVo.setAge(null == tStudent.getBirthday() ? 0 : Integer.valueOf(sdf.format(new Date())) -Integer.valueOf(sdf.format(tStudent.getBirthday()))); worldCupPeopleVo.setAvatar(tStudent.getHeadImg()); diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupCompetitor.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupCompetitor.java index 93ecacc..ebe0e65 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupCompetitor.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupCompetitor.java @@ -44,7 +44,7 @@ * 参赛人id */ @TableField("participantId") - private Integer participantId; + private Long participantId; /** * 参赛方(1=蓝方,2=红方) */ diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupPaymentParticipant.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupPaymentParticipant.java index e5de0c6..b187cbf 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupPaymentParticipant.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupPaymentParticipant.java @@ -45,7 +45,7 @@ * 参赛人员id */ @TableField("participantId") - private Integer participantId; + private Long participantId; /** * 是否已参赛(0=否,1=是) */ diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/competition/ParticipantClient.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/competition/ParticipantClient.java index 64d6d09..4add468 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/competition/ParticipantClient.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/competition/ParticipantClient.java @@ -18,6 +18,6 @@ * @return */ @PostMapping("/participant/getParticipant") - Participant getParticipant(Integer id); + Participant getParticipant(Long id); } diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupPaymentParticipantMapper.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupPaymentParticipantMapper.java index 11c7eb5..27956c7 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupPaymentParticipantMapper.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupPaymentParticipantMapper.java @@ -23,7 +23,7 @@ * @return */ WorldCupPaymentParticipant getWorldCupPaymentParticipant(@Param("worldCupId") Integer worldCupId, @Param("participantType") Integer participantType, - @Param("participantId") Integer participantId); + @Param("participantId") Long participantId); /** diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/EntrantRank.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/EntrantRank.java index a934e07..990a78b 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/EntrantRank.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/EntrantRank.java @@ -12,7 +12,7 @@ @ApiModel public class EntrantRank { @ApiModelProperty(value = "参赛人id", required = true, dataType = "int") - private Integer id; + private Long id; @ApiModelProperty(value = "是否是学员", required = true, dataType = "int") private Integer isStudent; private Integer appUserId; diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/ParticipantVo.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/ParticipantVo.java index 833d212..23947d6 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/ParticipantVo.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/ParticipantVo.java @@ -15,6 +15,8 @@ private Integer id; @ApiModelProperty("姓名") private String name; + @ApiModelProperty("头像") + private String avatar; @ApiModelProperty("年龄") private Integer age; @ApiModelProperty("身份证号码") diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentParticipantService.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentParticipantService.java index 1667380..6682aac 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentParticipantService.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentParticipantService.java @@ -23,7 +23,7 @@ * @param participantId * @return */ - WorldCupPaymentParticipant getWorldCupPaymentParticipant(Integer worldCupId, Integer participantType, Integer participantId); + WorldCupPaymentParticipant getWorldCupPaymentParticipant(Integer worldCupId, Integer participantType, Long participantId); /** diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java index 88902cb..f3c89ee 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java @@ -65,7 +65,7 @@ entrantRankVo.setName(participant.getName()); }else{ //学员 - TStudent tStudent = studentClient.queryById(entrantRank.getId()); + TStudent tStudent = studentClient.queryById(entrantRank.getId().intValue()); entrantRankVo.setName(tStudent.getName()); } //全国排名---直接数据库分组查询后排序 @@ -164,7 +164,7 @@ for (int i = 0; i < lists.size(); i++) { Map<String, Object> map = lists.get(i); Integer participantType = Integer.valueOf(map.get("participantType").toString()); - Integer participantId = Integer.valueOf(map.get("participantId").toString()); + Long participantId = Long.valueOf(map.get("participantId").toString()); Integer appUserId = Integer.valueOf(map.get("appUserId").toString()); Integer totalSession = Integer.valueOf(map.get("totalSession").toString()); Double winRate = Double.valueOf(map.get("winRate").toString()); @@ -177,7 +177,7 @@ worldCupRankVo.setWinRate(winRate); //学员 if(participantType == 1){ - TStudent tStudent = studentClient.queryById(participantId); + TStudent tStudent = studentClient.queryById(participantId.intValue()); worldCupRankVo.setAvatar(tStudent.getHeadImg()); String name = tStudent.getName(); if(name.length() > 2){ @@ -223,7 +223,7 @@ worldCupRankVo.setWinRate(winRate); //学员 if(participantType == 1){ - TStudent tStudent = studentClient.queryById(participantId); + TStudent tStudent = studentClient.queryById(participantId.intValue()); worldCupRankVo.setAvatar(tStudent.getHeadImg()); String name = tStudent.getName(); if(name.length() > 2){ @@ -320,7 +320,7 @@ for (int i = 0; i < mapList.size(); i++) { Map<String, Object> map = mapList.get(i); Integer participantType = Integer.valueOf(map.get("participantType").toString()); - Integer participantId = Integer.valueOf(map.get("participantId").toString()); + Long participantId = Long.valueOf(map.get("participantId").toString()); Integer appUserId = Integer.valueOf(map.get("appUserId").toString()); Integer totalSession = Integer.valueOf(map.get("totalSession").toString()); Integer win = Integer.valueOf(map.get("win").toString()); @@ -329,7 +329,7 @@ AppUser appUser = appUserClient.getAppUser(appUserId); map.put("province", appUser.getProvince() + appUser.getCity()); if(1 == participantType){ - TStudent tStudent = studentClient.queryById(participantId); + TStudent tStudent = studentClient.queryById(participantId.intValue()); map.put("name", tStudent.getName()); map.put("phone", tStudent.getPhone()); }else{ @@ -365,7 +365,7 @@ for (int i = 0; i < mapList.size(); i++) { Map<String, Object> map = mapList.get(i); Integer participantType = Integer.valueOf(map.get("participantType").toString()); - Integer participantId = Integer.valueOf(map.get("participantId").toString()); + Long participantId = Long.valueOf(map.get("participantId").toString()); Integer appUserId = Integer.valueOf(map.get("appUserId").toString()); Integer totalSession = Integer.valueOf(map.get("totalSession").toString()); Integer win = Integer.valueOf(map.get("win").toString()); @@ -376,7 +376,7 @@ AppUser appUser = appUserClient.getAppUser(appUserId); map.put("province", appUser.getProvince() + appUser.getCity()); if(1 == participantType){ - TStudent tStudent = studentClient.queryById(participantId); + TStudent tStudent = studentClient.queryById(participantId.intValue()); if(ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1){ continue; } @@ -431,9 +431,9 @@ Map<String, Object> map = new HashMap<>(); map.put("id", cupCompetitor.getId()); Integer participantType = cupCompetitor.getParticipantType(); - Integer participantId = cupCompetitor.getParticipantId(); + Long participantId = cupCompetitor.getParticipantId(); if(1 == participantType){ - TStudent tStudent = studentClient.queryById(participantId); + TStudent tStudent = studentClient.queryById(participantId.intValue()); if(ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1){ continue; } @@ -535,12 +535,12 @@ List<Map<String, Object>> mapList = new ArrayList<>(); for (Map<String, Object> map : list) { Long participantType = Long.valueOf(map.get("participantType").toString()); - Integer participantId = Integer.valueOf(map.get("participantId").toString()); + Long participantId = Long.valueOf(map.get("participantId").toString()); Integer ourScore = Integer.valueOf(map.get("ourScore").toString()); Integer opponentScore = Integer.valueOf(map.get("opponentScore").toString()); Integer matchResult = Integer.valueOf(map.get("matchResult").toString()); if(1 == participantType){ - TStudent tStudent = studentClient.queryById(participantId); + TStudent tStudent = studentClient.queryById(participantId.intValue()); if(ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1){ continue; } diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java index 506e666..cb4a6b4 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java @@ -6,7 +6,9 @@ import com.dsh.communityWorldCup.entity.WorldCupPayment; import com.dsh.communityWorldCup.entity.WorldCupPaymentParticipant; import com.dsh.communityWorldCup.entity.WorldCupStore; +import com.dsh.communityWorldCup.feignclient.account.AppUserClient; import com.dsh.communityWorldCup.feignclient.account.StudentClient; +import com.dsh.communityWorldCup.feignclient.account.model.AppUser; import com.dsh.communityWorldCup.feignclient.account.model.TStudent; import com.dsh.communityWorldCup.feignclient.competition.ParticipantClient; import com.dsh.communityWorldCup.feignclient.competition.model.Participant; @@ -62,6 +64,9 @@ @Resource private StoreClient storeClient; + @Resource + private AppUserClient appUserClient; + @@ -73,7 +78,7 @@ * @return */ @Override - public WorldCupPaymentParticipant getWorldCupPaymentParticipant(Integer worldCupId, Integer participantType, Integer participantId) { + public WorldCupPaymentParticipant getWorldCupPaymentParticipant(Integer worldCupId, Integer participantType, Long participantId) { return this.baseMapper.getWorldCupPaymentParticipant(worldCupId, participantType, participantId); } @@ -134,11 +139,11 @@ List<WorldCupPaymentParticipant> list1 = this.list(new QueryWrapper<WorldCupPaymentParticipant>().eq("worldCupPaymentId", worldCupPaymentParticipant.getWorldCupPaymentId())); for (WorldCupPaymentParticipant wcpp : list1) { Integer participantType = wcpp.getParticipantType(); - Integer participantId = wcpp.getParticipantId(); + Long participantId = wcpp.getParticipantId(); ParticipantVo participantVo = new ParticipantVo(); //学员 if(1 == participantType){ - TStudent tStudent = studentClient.queryById(participantId); + TStudent tStudent = studentClient.queryById(participantId.intValue()); participantVo.setId(tStudent.getId()); participantVo.setName(tStudent.getName()); int age = Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tStudent.getBirthday())); @@ -214,13 +219,15 @@ List<WorldCupPaymentParticipant> list1 = this.list(new QueryWrapper<WorldCupPaymentParticipant>().in("worldCupPaymentId", collect)); for (WorldCupPaymentParticipant worldCupPaymentParticipant : list1) { Integer participantType = worldCupPaymentParticipant.getParticipantType(); - Integer participantId = worldCupPaymentParticipant.getParticipantId(); + Long participantId = worldCupPaymentParticipant.getParticipantId(); ParticipantVo participantVo = new ParticipantVo(); + AppUser appUser = appUserClient.getAppUser(worldCupPaymentParticipant.getAppUserId()); //学员 if(1 == participantType && !xy.contains(participantId)){ - TStudent tStudent = studentClient.queryById(participantId); + TStudent tStudent = studentClient.queryById(participantId.intValue()); participantVo.setId(tStudent.getId()); participantVo.setName(tStudent.getName()); + participantVo.setAvatar(tStudent.getHeadImg()); int age = Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tStudent.getBirthday())); participantVo.setAge(age); participantVo.setIdcard(tStudent.getIdCard()); @@ -233,6 +240,7 @@ Participant participant = participantClient.getParticipant(participantId); participantVo.setId(participant.getId()); participantVo.setName(participant.getName()); + participantVo.setAvatar(appUser.getHeadImg()); int age = Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(participant.getBirthday())); participantVo.setAge(age); participantVo.setIdcard(participant.getIdcard()); @@ -284,7 +292,7 @@ WorldCupPayment worldCupPayment = worldCupPaymentService.getById(on.getWorldCupPaymentId()); Map<String, Object> map1 = new HashMap<>(); if(on.getParticipantType() == 1){ - TStudent tStudent = studentClient.queryById(on.getParticipantId()); + TStudent tStudent = studentClient.queryById(on.getParticipantId().intValue()); if(ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1){ continue; } diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java index 5f772cb..a5cce66 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java @@ -131,7 +131,7 @@ List<Long> ids = new ArrayList<>(); for (int i = 0; i < jsonArray.size(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); - Integer id = jsonObject.getInteger("id"); + Long id = jsonObject.getLong("id"); Integer participantType = jsonObject.getInteger("participantType"); String type = jsonObject.getString("type"); WorldCupCompetitor worldCupCompetitor = new WorldCupCompetitor(); @@ -155,7 +155,7 @@ ids.add(worldCupCompetitor.getId()); //已参赛 // worldCupPaymentParticipant.setAlreadyEntered(1); - worldCupPaymentParticipantService.updateById(worldCupPaymentParticipant); +// worldCupPaymentParticipantService.updateById(worldCupPaymentParticipant); } //2、调起开启游戏的接口。 HashMap<String, String> map = new HashMap<>(); @@ -314,8 +314,14 @@ @Override public CheckPaymentMethodVo checkPaymentMethod(CheckPaymentMethod checkPaymentMethod) { WorldCup worldCup = this.getById(checkPaymentMethod.getId()); - JSONArray jsonArray = JSON.parseArray(checkPaymentMethod.getIds()); + String[] split = worldCup.getPayType().split(","); CheckPaymentMethodVo checkPaymentMethodVo = new CheckPaymentMethodVo(); + if(split.length == 1 && "0".equals(split[0])){ + checkPaymentMethodVo.setPaiCoin(0); + checkPaymentMethodVo.setClassHour(0); + return checkPaymentMethodVo; + } + JSONArray jsonArray = JSON.parseArray(checkPaymentMethod.getIds()); AppUser appUser = appUserClient.getAppUser(checkPaymentMethod.getUid()); BigDecimal multiply = new BigDecimal(jsonArray.size()).multiply(new BigDecimal(worldCup.getPaiCoin())); if(appUser.getPlayPaiCoins() < multiply.intValue()){ @@ -360,27 +366,33 @@ if(null == worldCup){ return ResultUtil.error("报名数据异常"); } - WorldCupPayment one = worldCupPaymentService.getOne(new QueryWrapper<WorldCupPayment>().eq("worldCupId", worldCup.getId()) - .eq("appUserId", paymentWorldCup.getUid()).eq("payStatus", 2).eq("state", 1)); - if(null != one){ - return ResultUtil.error("不能重复报名"); - } if(null != worldCup.getRegistrationClosingTime() && System.currentTimeMillis() > worldCup.getRegistrationClosingTime().getTime()){ return ResultUtil.error("报名时间已结束,无法完成报名"); } if(System.currentTimeMillis() > worldCup.getEndTime().getTime()){ return ResultUtil.error("世界杯赛事已结束,无法完成报名"); } + List<WorldCupPayment> list = worldCupPaymentService.list(new QueryWrapper<WorldCupPayment>().eq("worldCupId", worldCup.getId()).eq("appUserId", paymentWorldCup.getUid()) + .eq("payStatus", 2).eq("state", 1)); + List<Long> collect = list.stream().map(WorldCupPayment::getId).collect(Collectors.toList()); String ids = paymentWorldCup.getIds(); JSONArray jsonArray = JSON.parseArray(ids); SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); for (int i = 0; i < jsonArray.size(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); - Integer id = jsonObject.getInteger("id"); + Long id = jsonObject.getLong("id"); //是否是学员(0=否,1=是) Integer isStudent = jsonObject.getInteger("isStudent"); if(isStudent == 1){ - TStudent tStudent = studentClient.queryById(id); + TStudent tStudent = studentClient.queryById(id.intValue()); + if(collect.size() > 0){ + WorldCupPaymentParticipant one = worldCupPaymentParticipantService.getOne(new QueryWrapper<WorldCupPaymentParticipant>().eq("worldCupId", worldCup.getId()) + .eq("participantId", id).eq("participantType", isStudent == 0 ? 2 : 1).in("worldCupPaymentId", collect)); + if(null != one){ + return ResultUtil.error("【" + tStudent.getName() + "】已报过名了"); + } + } + if(worldCup.getStartAge() > (Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tStudent.getBirthday())))){ return ResultUtil.error("【" + tStudent.getName() + "】年龄不符合要求"); } @@ -389,6 +401,14 @@ } }else{ Participant participant = participantClient.getParticipant(id); + if(collect.size() > 0){ + WorldCupPaymentParticipant one = worldCupPaymentParticipantService.getOne(new QueryWrapper<WorldCupPaymentParticipant>().eq("worldCupId", worldCup.getId()) + .eq("participantId", id).eq("participantType", isStudent == 0 ? 2 : 1).in("worldCupPaymentId", collect)); + if(null != one){ + return ResultUtil.error("【" + participant.getName() + "】已报过名了"); + } + } + if(worldCup.getStartAge() > (Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(participant.getBirthday())))){ return ResultUtil.error("【" + participant.getName() + "】年龄不符合要求"); } @@ -468,7 +488,7 @@ JSONArray jsonArray = JSON.parseArray(ids); for (int i = 0; i < jsonArray.size(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); - Integer id = jsonObject.getInteger("id"); + Long id = jsonObject.getLong("id"); //是否是学员(0=否,1=是) Integer isStudent = jsonObject.getInteger("isStudent"); @@ -492,13 +512,13 @@ List<DeductionClassHour> list = new ArrayList<>(); for (int i = 0; i < jsonArray.size(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); - Integer id = jsonObject.getInteger("id"); + Long id = jsonObject.getLong("id"); //是否是学员(0=否,1=是) Integer isStudent = jsonObject.getInteger("isStudent"); if(0 == isStudent){ return ResultUtil.error("非学员无法使用课时报名"); } - List<CoursePackageOrderStudent> coursePackageOrderStudent = coursePackageOrderStudentClient.getCoursePackageOrderStudent(id); + List<CoursePackageOrderStudent> coursePackageOrderStudent = coursePackageOrderStudentClient.getCoursePackageOrderStudent(id.intValue()); int sum = coursePackageOrderStudent.stream().mapToInt(CoursePackageOrderStudent::getLaveClassHours).sum(); if(sum < worldCup.getClassHour()){ return ResultUtil.error("报名失败,课时不足,请续课!"); @@ -555,7 +575,7 @@ //添加报名明细 for (int i = 0; i < jsonArray.size(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); - Integer id = jsonObject.getInteger("id"); + Long id = jsonObject.getLong("id"); //是否是学员(0=否,1=是) Integer isStudent = jsonObject.getInteger("isStudent"); @@ -584,7 +604,7 @@ JSONArray jsonArray = JSON.parseArray(ids); for (int i = 0; i < jsonArray.size(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); - Integer id = jsonObject.getInteger("id"); + Long id = jsonObject.getLong("id"); //是否是学员(0=否,1=是) Integer isStudent = jsonObject.getInteger("isStudent"); @@ -622,7 +642,7 @@ JSONArray jsonArray = JSON.parseArray(ids); for (int i = 0; i < jsonArray.size(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); - Integer id = jsonObject.getInteger("id"); + Long id = jsonObject.getLong("id"); //是否是学员(0=否,1=是) Integer isStudent = jsonObject.getInteger("isStudent"); 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 ba756fc..d307cec 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 @@ -210,7 +210,7 @@ @ResponseBody @PostMapping("/participant/getParticipant") - public Participant getParticipant(@RequestBody Integer id){ + public Participant getParticipant(@RequestBody Long id){ return participantService.getById(id); } } -- Gitblit v1.7.1