From ceacc612529f38c632d85d91bb5309baa5ebb82a Mon Sep 17 00:00:00 2001 From: 44323 <443237572@qq.com> Date: 星期一, 11 三月 2024 16:04:54 +0800 Subject: [PATCH] Merge branch '2.0' of http://120.76.84.145:10101/gitblit/r/java/PlayPai into 2.0 --- cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupCompetitor.java | 2 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupCompetitorService.java | 4 cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html | 17 cloud-server-competition/src/main/java/com/dsh/competition/controller/ParticipantController.java | 2 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java | 104 ++++++++ cloud-server-account/src/main/resources/mapper/RefereeMapper.xml | 4 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/account/model/SaveUserIntegralChangesVo.java | 23 ++ cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup_info.js | 18 - cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java | 22 + cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js | 2 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentParticipantService.java | 10 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java | 114 ++++++---- cloud-server-account/src/main/java/com/dsh/account/service/impl/UserIntegralChangesServiceImpl.java | 10 cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html | 17 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java | 87 ++++++- cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java | 58 ++-- cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/account/UserIntegralChangesClient.java | 22 ++ cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/EntrantRank.java | 2 cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupPaymentParticipantMapper.xml | 16 + cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupPaymentParticipantMapper.java | 7 cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml | 53 ++++ cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/competition/ParticipantClient.java | 2 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupPaymentParticipant.java | 2 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupCompetitorMapper.java | 4 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/ParticipantVo.java | 2 25 files changed, 456 insertions(+), 148 deletions(-) diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/UserIntegralChangesServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/UserIntegralChangesServiceImpl.java index 08e324e..881caf8 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/UserIntegralChangesServiceImpl.java +++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/UserIntegralChangesServiceImpl.java @@ -94,6 +94,16 @@ detail.setConsumeName("智慧球场开始游戏"); detail.setDetailsType(1); break; + case 6: + detail.setConsumeAmount("" + (userIntegralChange.getNewIntegral() - userIntegralChange.getOldIntegral())); + detail.setConsumeName("参与社区世界杯"); + detail.setDetailsType(2); + break; + case 7: + detail.setConsumeAmount("" + (userIntegralChange.getNewIntegral() - userIntegralChange.getOldIntegral())); + detail.setConsumeName("社区世界杯获胜"); + detail.setDetailsType(2); + break; default: break; } diff --git a/cloud-server-account/src/main/resources/mapper/RefereeMapper.xml b/cloud-server-account/src/main/resources/mapper/RefereeMapper.xml index 361fe3e..3e95913 100644 --- a/cloud-server-account/src/main/resources/mapper/RefereeMapper.xml +++ b/cloud-server-account/src/main/resources/mapper/RefereeMapper.xml @@ -22,7 +22,7 @@ and provinceCode = #{item.provinceCode} </if> <if test="null != item.cityCode and '' != item.cityCode"> - and provinceCode = #{cityCode} + and cityCode = #{cityCode} </if> order by createTime desc limit #{item.offset}, #{item.limit} </select> @@ -42,7 +42,7 @@ and provinceCode = #{item.provinceCode} </if> <if test="null != item.cityCode and '' != item.cityCode"> - and provinceCode = #{cityCode} + and cityCode = #{cityCode} </if> </select> </mapper> \ No newline at end of file diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java b/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java index 27f65ba..1a576bf 100644 --- a/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java +++ b/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java @@ -886,7 +886,7 @@ detailsResponse.setSid(collect); if (collect.size() > 0) { // 获取rid -// List<Integer> rid= stoClient.querySiteIdById(collect); +// List<Integer> rid= stoClient.querySiteIdById(collect); //detailsResponse.setRid(rid); // todo 修改区域id 临时 // 根据门店id 写死区域id 后续调整为门票指定多个区域 @@ -914,22 +914,22 @@ //====================================================== } }else{ - // todo 返回门店id 和场地id - // 查询指定场地 - List<PointsMerchandiseStore> list = pmdstoService.list(new LambdaQueryWrapper<PointsMerchandiseStore>() - .eq(PointsMerchandiseStore::getPointsMerchandiseId, merchandise.getId())); - // 门店 - ArrayList<Integer> list3 = new ArrayList<>(); - // 场地 - ArrayList<Integer> list4 = new ArrayList<>(); - for (PointsMerchandiseStore temp : list) { - Integer storeId = temp.getStoreId(); - Integer siteId = temp.getSiteId(); - list3.add(storeId); - list4.add(siteId); - } - detailsResponse.setRid(list4); - detailsResponse.setSid(list3); + // todo 返回门店id 和场地id + // 查询指定场地 + List<PointsMerchandiseStore> list = pmdstoService.list(new LambdaQueryWrapper<PointsMerchandiseStore>() + .eq(PointsMerchandiseStore::getPointsMerchandiseId, merchandise.getId())); + // 门店 + ArrayList<Integer> list3 = new ArrayList<>(); + // 场地 + ArrayList<Integer> list4 = new ArrayList<>(); + for (PointsMerchandiseStore temp : list) { + Integer storeId = temp.getStoreId(); + Integer siteId = temp.getSiteId(); + list3.add(storeId); + list4.add(siteId); + } + detailsResponse.setRid(list4); + detailsResponse.setSid(list3); } @@ -1803,19 +1803,19 @@ public Boolean addOther(@RequestBody String pam) { Boolean save = false; String[] split = pam.split("_"); - if (split.length > 2) { - if (StringUtils.hasLength(split[2])) { - for (String s : split[2].split(",")) { - PointsMerchandiseStore pointsMerchandiseStore = new PointsMerchandiseStore(); - pointsMerchandiseStore.setPointsMerchandiseId(Integer.valueOf(split[0])); - pointsMerchandiseStore.setSiteId(Integer.valueOf(s)); - Site site = siteClient.querySiteById(Integer.valueOf(s)); - pointsMerchandiseStore.setStoreId(site.getStoreId()); - save = pmdstoService.save(pointsMerchandiseStore); - } - // 这个门票是选择的场地 - return save; + if (split.length>2){ + if (StringUtils.hasLength(split[2])){ + for (String s : split[2].split(",")) { + PointsMerchandiseStore pointsMerchandiseStore = new PointsMerchandiseStore(); + pointsMerchandiseStore.setPointsMerchandiseId(Integer.valueOf(split[0])); + pointsMerchandiseStore.setSiteId(Integer.valueOf(s)); + Site site = siteClient.querySiteById(Integer.valueOf(s)); + pointsMerchandiseStore.setStoreId(site.getStoreId()); + save = pmdstoService.save(pointsMerchandiseStore); } + // 这个门票是选择的场地 + return save; + } } for (String s : split[1].split(",")) { PointsMerchandiseStore pointsMerchandiseStore = new PointsMerchandiseStore(); 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 e026a3f..e0b910f 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 @@ -180,11 +180,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()); @@ -413,7 +413,11 @@ public List<WorldCupStore> getWorldCupStoreList(@RequestBody Integer storeId){ List<WorldCup> worldCupList = worldCupService.list(new QueryWrapper<WorldCup>().in("status", Arrays.asList(1, 2))); List<Integer> collect = worldCupList.stream().map(WorldCup::getId).collect(Collectors.toList()); - return worldCupStoreService.list(new QueryWrapper<WorldCupStore>().eq("storeId", storeId).in("worldCupId", collect).eq("isOpen", 1)); + if(collect.size() == 0){ + return new ArrayList<>(); + } + return worldCupStoreService.list(new QueryWrapper<WorldCupStore>().eq("storeId", storeId).in("worldCupId", collect) + .eq("isOpen", 1)); } @@ -700,8 +704,8 @@ */ @ResponseBody @PostMapping("/base/worldCup/endWorldCupCallback") - public void endWorldCupCallback(String custom, Integer red_score, Integer blue){ - worldCupCompetitorService.endWorldCupCallback(custom, red_score, blue); + public void endWorldCupCallback(String custom, Integer red_score, Integer blue_score){ + worldCupCompetitorService.endWorldCupCallback(custom, red_score, blue_score); } @@ -806,6 +810,14 @@ } + @ResponseBody + @PostMapping("/worldCup/getUserGameRecordList") + public Map<String, Object> getUserGameRecordList(@RequestBody WorldCupGameStatisticsInfoList worldCupGameStatisticsInfoList){ + return worldCupPaymentParticipantService.getUserGameRecordList(worldCupGameStatisticsInfoList); + } + + + /** * 获取用户比赛记录明细 * @param userGameRecordList 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/account/UserIntegralChangesClient.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/account/UserIntegralChangesClient.java new file mode 100644 index 0000000..e95ded5 --- /dev/null +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/account/UserIntegralChangesClient.java @@ -0,0 +1,22 @@ +package com.dsh.communityWorldCup.feignclient.account; + +import com.dsh.communityWorldCup.feignclient.account.model.SaveUserIntegralChangesVo; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; + +/** + * @author zhibing.pu + * @date 2023/7/12 11:40 + */ +@FeignClient("mb-cloud-account") +public interface UserIntegralChangesClient { + + + /** + * 保存用户积分变动记录 + * + * @param vo + */ + @PostMapping("/userIntegralChanges/saveUserIntegralChanges") + void saveUserIntegralChanges(SaveUserIntegralChangesVo vo); +} diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/account/model/SaveUserIntegralChangesVo.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/account/model/SaveUserIntegralChangesVo.java new file mode 100644 index 0000000..a08dc96 --- /dev/null +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/account/model/SaveUserIntegralChangesVo.java @@ -0,0 +1,23 @@ +package com.dsh.communityWorldCup.feignclient.account.model; + +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/7/12 11:26 + */ +@Data +public class SaveUserIntegralChangesVo { + /** + * 用户id + */ + private Integer appUserId; + /** + * 积分类型(1=赠送积分,2=兑换商品,3=完成课后练习,4=观看教学视频,5=参与世界杯,6=世界杯获胜) + */ + private Integer type; + /** + * 积分 + */ + private Integer integral; +} 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/WorldCupCompetitorMapper.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupCompetitorMapper.java index db21514..bcd630c 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupCompetitorMapper.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupCompetitorMapper.java @@ -63,4 +63,8 @@ * @return */ List<Map<String, Object>> userGameRecordList(@Param("name") String name); + + + + Map<String, Object> getUserGameRecordList(@Param("participantType") Integer participantType, @Param("participantId") Long participantId); } 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..b1d8a6a 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 @@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Map; /** * @author zhibing.pu @@ -23,7 +24,7 @@ * @return */ WorldCupPaymentParticipant getWorldCupPaymentParticipant(@Param("worldCupId") Integer worldCupId, @Param("participantType") Integer participantType, - @Param("participantId") Integer participantId); + @Param("participantId") Long participantId); /** @@ -36,4 +37,8 @@ int getCount(@Param("worldCupId") Integer worldCupId, @Param("worldCupPaymentId")List<Long> worldCupPaymentId); + + + + List<Map<String, Object>> getUserGameRecordList(); } 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/IWorldCupCompetitorService.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupCompetitorService.java index 705a27b..e8d7e7b 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupCompetitorService.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupCompetitorService.java @@ -43,9 +43,9 @@ * 比赛结束后通知处理逻辑 * @param custom * @param red_score - * @param blue + * @param blue_score */ - void endWorldCupCallback(String custom, Integer red_score, Integer blue); + void endWorldCupCallback(String custom, Integer red_score, Integer blue_score); /** 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..a83170a 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); /** @@ -59,4 +59,12 @@ int getCount(Integer worldCupId, List<Long> worldCupPaymentId); + + + /** + * 获取用户列表 + * @param worldCupGameStatisticsInfoList + * @return + */ + Map<String, Object> getUserGameRecordList(WorldCupGameStatisticsInfoList worldCupGameStatisticsInfoList); } 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..84d093e 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 @@ -7,15 +7,19 @@ import com.dsh.communityWorldCup.entity.WorldCupCompetitor; import com.dsh.communityWorldCup.feignclient.account.AppUserClient; import com.dsh.communityWorldCup.feignclient.account.StudentClient; +import com.dsh.communityWorldCup.feignclient.account.UserIntegralChangesClient; import com.dsh.communityWorldCup.feignclient.account.model.AppUser; import com.dsh.communityWorldCup.feignclient.account.model.AppUserIdsByCityName; +import com.dsh.communityWorldCup.feignclient.account.model.SaveUserIntegralChangesVo; import com.dsh.communityWorldCup.feignclient.account.model.TStudent; import com.dsh.communityWorldCup.feignclient.competition.ParticipantClient; import com.dsh.communityWorldCup.feignclient.competition.model.Participant; import com.dsh.communityWorldCup.feignclient.other.StoreClient; import com.dsh.communityWorldCup.mapper.WorldCupCompetitorMapper; +import com.dsh.communityWorldCup.mapper.WorldCupPaymentParticipantMapper; import com.dsh.communityWorldCup.model.*; import com.dsh.communityWorldCup.service.IWorldCupCompetitorService; +import com.dsh.communityWorldCup.service.IWorldCupPaymentParticipantService; import com.dsh.communityWorldCup.service.IWorldCupService; import com.dsh.communityWorldCup.util.ToolUtil; import org.springframework.beans.factory.annotation.Autowired; @@ -47,6 +51,9 @@ @Autowired private IWorldCupService worldCupService; + @Resource + private UserIntegralChangesClient userIntegralChangesClient; + @@ -65,7 +72,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 +171,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 +184,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 +230,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){ @@ -261,43 +268,60 @@ * 比赛结束后通知处理逻辑 * @param custom 开始比赛接口上传的自定义参数 * @param red_score 红方分数 - * @param blue 蓝方分数 + * @param blue_score 蓝方分数 */ @Override - public void endWorldCupCallback(String custom, Integer red_score, Integer blue) { + public void endWorldCupCallback(String custom, Integer red_score, Integer blue_score) { List<Long> ids = JSON.parseArray(custom, Long.class); List<WorldCupCompetitor> worldCupCompetitors = this.listByIds(ids); - WorldCupCompetitor worldCupCompetitor1 = worldCupCompetitors.get(0); - WorldCup worldCup = worldCupService.getById(worldCupCompetitor1.getWorldCupId()); - for (WorldCupCompetitor worldCupCompetitor : worldCupCompetitors) { - //蓝方 - if(worldCupCompetitor.getParticipant() == 1){ - worldCupCompetitor.setMatchResult(blue.compareTo(red_score)); - worldCupCompetitor.setOurScore(blue); - worldCupCompetitor.setOpponentScore(red_score); - worldCupCompetitor.setEndTime(new Date()); - worldCupCompetitor.setWinIntegral(0); - if(null != worldCup.getWinIntegral() && 0 < worldCup.getWinIntegral() && blue.compareTo(red_score) >= 0){ - worldCupCompetitor.setWinIntegral(worldCup.getWinIntegral()); - AppUser appUser = appUserClient.getAppUser(worldCupCompetitor.getAppUserId()); - appUser.setIntegral(appUser.getIntegral() + worldCup.getWinIntegral()); - appUserClient.updateAppUser(appUser); + try { + WorldCupCompetitor worldCupCompetitor1 = worldCupCompetitors.get(0); + WorldCup worldCup = worldCupService.getById(worldCupCompetitor1.getWorldCupId()); + for (WorldCupCompetitor worldCupCompetitor : worldCupCompetitors) { + worldCupCompetitor.setWorldCupId(null); + //蓝方 + if(worldCupCompetitor.getParticipant() == 1){ + worldCupCompetitor.setMatchResult(blue_score.compareTo(red_score)); + worldCupCompetitor.setOurScore(blue_score); + worldCupCompetitor.setOpponentScore(red_score); + worldCupCompetitor.setEndTime(new Date()); + worldCupCompetitor.setWinIntegral(0); + if(null != worldCup.getWinIntegral() && 0 < worldCup.getWinIntegral() && blue_score.compareTo(red_score) >= 0){ + worldCupCompetitor.setWinIntegral(worldCup.getWinIntegral()); + AppUser appUser = appUserClient.getAppUser(worldCupCompetitor.getAppUserId()); + appUser.setIntegral(appUser.getIntegral() + worldCup.getWinIntegral()); + appUserClient.updateAppUser(appUser); + //增加积分明细 + SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); + vo.setAppUserId(appUser.getId()); + vo.setIntegral(worldCup.getWinIntegral()); + vo.setType(7); + userIntegralChangesClient.saveUserIntegralChanges(vo); + } + } + //红方 + if(worldCupCompetitor.getParticipant() == 2){ + worldCupCompetitor.setMatchResult(red_score.compareTo(blue_score)); + worldCupCompetitor.setOurScore(red_score); + worldCupCompetitor.setOpponentScore(blue_score); + worldCupCompetitor.setEndTime(new Date()); + worldCupCompetitor.setWinIntegral(0); + if(null != worldCup.getWinIntegral() && 0 < worldCup.getWinIntegral() && red_score.compareTo(blue_score) >= 0){ + worldCupCompetitor.setWinIntegral(worldCup.getWinIntegral()); + AppUser appUser = appUserClient.getAppUser(worldCupCompetitor.getAppUserId()); + appUser.setIntegral(appUser.getIntegral() + worldCup.getWinIntegral()); + appUserClient.updateAppUser(appUser); + //增加积分明细 + SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); + vo.setAppUserId(appUser.getId()); + vo.setIntegral(worldCup.getWinIntegral()); + vo.setType(7); + userIntegralChangesClient.saveUserIntegralChanges(vo); + } } } - //红方 - if(worldCupCompetitor.getParticipant() == 2){ - worldCupCompetitor.setMatchResult(red_score.compareTo(blue)); - worldCupCompetitor.setOurScore(red_score); - worldCupCompetitor.setOpponentScore(blue); - worldCupCompetitor.setEndTime(new Date()); - worldCupCompetitor.setWinIntegral(0); - if(null != worldCup.getWinIntegral() && 0 < worldCup.getWinIntegral() && red_score.compareTo(blue) >= 0){ - worldCupCompetitor.setWinIntegral(worldCup.getWinIntegral()); - AppUser appUser = appUserClient.getAppUser(worldCupCompetitor.getAppUserId()); - appUser.setIntegral(appUser.getIntegral() + worldCup.getWinIntegral()); - appUserClient.updateAppUser(appUser); - } - } + }catch (Exception e){ + e.printStackTrace(); } this.updateBatchById(worldCupCompetitors); @@ -320,7 +344,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 +353,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 +389,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 +400,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; } @@ -388,7 +412,7 @@ } map.put("name", tStudent.getName()); - map.put("phone", tStudent.getPhone()); + map.put("phone", ToolUtil.isEmpty(tStudent.getPhone()) ? appUser.getPhone() : tStudent.getPhone()); }else{ Participant participant = participantClient.getParticipant(participantId); if(ToolUtil.isNotEmpty(name) && participant.getName().indexOf(name) == -1){ @@ -402,7 +426,7 @@ } map.put("name", participant.getName()); - map.put("phone", participant.getPhone()); + map.put("phone", ToolUtil.isNotEmpty(participant.getPhone()) ? participant.getPhone() : appUser.getPhone()); } list.add(map); } @@ -431,9 +455,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 +559,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..8538ff5 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,12 +6,15 @@ 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; import com.dsh.communityWorldCup.feignclient.other.StoreClient; import com.dsh.communityWorldCup.feignclient.other.model.Store; +import com.dsh.communityWorldCup.mapper.WorldCupCompetitorMapper; import com.dsh.communityWorldCup.mapper.WorldCupPaymentParticipantMapper; import com.dsh.communityWorldCup.model.MyWorldCupInfo; import com.dsh.communityWorldCup.model.MyWorldCupList; @@ -62,6 +65,12 @@ @Resource private StoreClient storeClient; + @Resource + private AppUserClient appUserClient; + + @Resource + private WorldCupCompetitorMapper worldCupCompetitorMapper; + @@ -73,7 +82,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 +143,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 +223,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 +244,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 +296,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; } @@ -326,7 +338,7 @@ } limit += offset; - map.put("rows", list2.subList(offset, list2.size() >= limit ? limit : list.size())); + map.put("rows", list2.subList(offset, list2.size() >= limit ? limit : list2.size())); map.put("total", list2.size()); return map; } @@ -335,4 +347,82 @@ public int getCount(Integer worldCupId, List<Long> worldCupPaymentId) { return this.baseMapper.getCount(worldCupId, worldCupPaymentId); } + + + /** + * 获取用户列表 + * @param worldCupGameStatisticsInfoList + * @return + */ + @Override + public Map<String, Object> getUserGameRecordList(WorldCupGameStatisticsInfoList worldCupGameStatisticsInfoList) { + Map<String, Object> map1 = new HashMap<>(); + String name = worldCupGameStatisticsInfoList.getName(); + String phone = worldCupGameStatisticsInfoList.getPhone(); + String idcard = worldCupGameStatisticsInfoList.getIdcard(); + List<Map<String, Object>> mapList = this.baseMapper.getUserGameRecordList(); + List<Map<String, Object>> list = new ArrayList<>(); + for (int i = 0; i < mapList.size(); i++) { + Map<String, Object> map = mapList.get(i); + Integer participantType = Integer.valueOf(map.get("participantType").toString()); + Long participantId = Long.valueOf(map.get("participantId").toString()); + Integer appUserId = Integer.valueOf(map.get("appUserId").toString()); + Map<String, Object> userGameRecordList = worldCupCompetitorMapper.getUserGameRecordList(participantType, participantId); + Integer totalSession = 0; + Integer win = 0; + if(null != userGameRecordList){ + totalSession = Integer.valueOf(null != userGameRecordList.get("totalSession") ? userGameRecordList.get("totalSession").toString() : "0"); + win = Integer.valueOf(null != userGameRecordList.get("win") ? userGameRecordList.get("win").toString() : "0"); + }else{ + userGameRecordList = new HashMap<>(); + } + userGameRecordList.put("totalSession", totalSession); + userGameRecordList.put("win", win); + Integer lose = totalSession - win; + userGameRecordList.put("lose", lose); + userGameRecordList.put("winRate", totalSession == 0 ? 0 : win / totalSession * 100); + userGameRecordList.put("participantType", participantType); + userGameRecordList.put("participantId", participantId); + AppUser appUser = appUserClient.getAppUser(appUserId); + userGameRecordList.put("province", appUser.getProvince() + appUser.getCity()); + if(1 == participantType){ + TStudent tStudent = studentClient.queryById(participantId.intValue()); + if(ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1){ + continue; + } + if(ToolUtil.isNotEmpty(phone) && tStudent.getPhone().indexOf(phone) == -1){ + continue; + } + if(ToolUtil.isNotEmpty(idcard) && tStudent.getIdCard().indexOf(idcard) == -1){ + continue; + } + + userGameRecordList.put("name", tStudent.getName()); + userGameRecordList.put("phone", ToolUtil.isEmpty(tStudent.getPhone()) ? appUser.getPhone() : tStudent.getPhone()); + userGameRecordList.put("idcard", tStudent.getIdCard()); + }else{ + Participant participant = participantClient.getParticipant(participantId); + if(ToolUtil.isNotEmpty(name) && participant.getName().indexOf(name) == -1){ + continue; + } + if(ToolUtil.isNotEmpty(phone) && participant.getPhone().indexOf(phone) == -1){ + continue; + } + if(ToolUtil.isNotEmpty(idcard) && participant.getIdcard().indexOf(idcard) == -1){ + continue; + } + + userGameRecordList.put("name", participant.getName()); + userGameRecordList.put("phone", ToolUtil.isNotEmpty(participant.getPhone()) ? participant.getPhone() : appUser.getPhone()); + userGameRecordList.put("idcard", participant.getIdcard()); + } + list.add(userGameRecordList); + } + map1.put("total", list.size()); + Integer offset = worldCupGameStatisticsInfoList.getOffset(); + Integer limit = worldCupGameStatisticsInfoList.getLimit(); + limit += offset; + map1.put("rows", list.subList(offset, list.size() >= limit ? limit : list.size())); + return map1; + } } 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 228103e..15be0c6 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 @@ -9,7 +9,9 @@ import com.dsh.communityWorldCup.entity.*; import com.dsh.communityWorldCup.feignclient.account.AppUserClient; import com.dsh.communityWorldCup.feignclient.account.StudentClient; +import com.dsh.communityWorldCup.feignclient.account.UserIntegralChangesClient; import com.dsh.communityWorldCup.feignclient.account.model.AppUser; +import com.dsh.communityWorldCup.feignclient.account.model.SaveUserIntegralChangesVo; import com.dsh.communityWorldCup.feignclient.account.model.TStudent; import com.dsh.communityWorldCup.feignclient.competition.ParticipantClient; import com.dsh.communityWorldCup.feignclient.competition.model.Participant; @@ -73,6 +75,9 @@ @Resource private GameClient gameClient; + @Resource + private UserIntegralChangesClient userIntegralChangesClient; + @@ -131,7 +136,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(); @@ -149,13 +154,19 @@ AppUser appUser = appUserClient.getAppUser(worldCupCompetitor.getAppUserId()); appUser.setIntegral(appUser.getIntegral() + worldCup.getParticipationIntegral()); appUserClient.updateAppUser(appUser); + //增加积分明细 + SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); + vo.setAppUserId(appUser.getId()); + vo.setIntegral(worldCup.getParticipationIntegral()); + vo.setType(6); + userIntegralChangesClient.saveUserIntegralChanges(vo); } worldCupCompetitorService.save(worldCupCompetitor); ids.add(worldCupCompetitor.getId()); //已参赛 // worldCupPaymentParticipant.setAlreadyEntered(1); - worldCupPaymentParticipantService.updateById(worldCupPaymentParticipant); +// worldCupPaymentParticipantService.updateById(worldCupPaymentParticipant); } //2、调起开启游戏的接口。 HashMap<String, String> map = new HashMap<>(); @@ -166,7 +177,7 @@ map.put("api_url", "http://221.182.45.100:56666/communityWorldCup/base/worldCup/endWorldCupCallback"); map.put("custom", JSON.toJSONString(ids)); - String s = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/batterGame", map); + String s = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/quickStart", map); JSONObject jsonObject = JSONObject.parseObject(s); Integer code1 = jsonObject.getInteger("code"); String message = jsonObject.getString("message"); @@ -185,9 +196,17 @@ */ @Override public Integer getCompletedWorldCupTips(Integer uid) { - int count = worldCupCompetitorService.count(new QueryWrapper<WorldCupCompetitor>() - .eq("appUserId", uid).eq("tips", 0).isNotNull("endTime")); - return count; + List<WorldCupCompetitor> list = worldCupCompetitorService.list(new QueryWrapper<WorldCupCompetitor>() + .eq("appUserId", uid).eq("tips", 0).isNotNull("endTime") + .orderByDesc("endTime").last(" limit 0, 1")); + list.forEach(v->{ + v.setWorldCupId(null); + v.setTips(1); + }); + if(list.size() > 0){ + worldCupCompetitorService.updateBatchById(list); + } + return list.size(); } @@ -265,6 +284,14 @@ int count = worldCupPaymentParticipantService.count(new QueryWrapper<WorldCupPaymentParticipant>().in("worldCupPaymentId", collect)); heat += count; } + String infoImg = worldCupInfo.getInfoImg(); + JSONArray jsonArray1 = JSON.parseArray(infoImg); + String imgs = ""; + for (int i = 0; i < jsonArray1.size(); i++) { + String url = jsonArray1.getJSONObject(i).getString("url"); + imgs += url + ","; + } + worldCupInfo.setInfoImg(imgs.substring(0,imgs.length() - 1)); worldCupInfo.setHeat(heat); ArrayList<Map<String, Object>> objects = new ArrayList<>(); for (WorldCupStore worldCupStore : worldCupStores) { @@ -306,8 +333,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()){ @@ -352,27 +385,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() + "】年龄不符合要求"); } @@ -381,6 +420,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() + "】年龄不符合要求"); } @@ -460,7 +507,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"); @@ -484,13 +531,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("报名失败,课时不足,请续课!"); @@ -547,7 +594,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"); @@ -576,7 +623,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"); @@ -614,7 +661,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-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml b/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml index 63b9516..08488b7 100644 --- a/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml +++ b/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml @@ -173,7 +173,14 @@ <select id="worldCupGameStatisticsInfoList" resultType="map"> - select * from ( + select + aa.participantType, + aa.participantId, + aa.appUserId, + aa.totalSession, + aa.win, + aa.winRate + from ( select a.participantType, a.participantId, @@ -228,4 +235,48 @@ </if> order by a.startTime desc </select> + + + + <select id="getUserGameRecordList" resultType="map"> + select + a.participantType, + a.participantId, + a.appUserId, + a.num as totalSession, + ifnull(b.num, 0) as win, + (ifnull(b.num, 0) / a.num * 100) as winRate + from ( + select + participantType, + participantId, + appUserId, + count(*) as num + from t_world_cup_competitor + where 1 = 1 + <if test="null != participantType"> + and participantType = #{participantType} + </if> + <if test="null != participantId"> + and participantId = #{participantId} + </if> + group by participantType, participantId, appUserId + ) as a + left join ( + select + participantType, + participantId, + appUserId, + count(*) as num + from t_world_cup_competitor + where matchResult = 1 + <if test="null != participantType"> + and participantType = #{participantType} + </if> + <if test="null != participantId"> + and participantId = #{participantId} + </if> + group by participantType, participantId, appUserId + ) as b on (a.participantId = b.participantId and a.participantType = b.participantType) + </select> </mapper> \ No newline at end of file diff --git a/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupPaymentParticipantMapper.xml b/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupPaymentParticipantMapper.xml index 84ba1d5..c4e9636 100644 --- a/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupPaymentParticipantMapper.xml +++ b/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupPaymentParticipantMapper.xml @@ -42,13 +42,23 @@ <select id="getCount" resultType="int"> select count(*) from ( select - worldCupPaymentId, + participantId, participantType - from t_world_cup_payment_participant1 where worldCupId = #{worldCupId} and worldCupPaymentId in + from t_world_cup_payment_participant where worldCupId = #{worldCupId} and worldCupPaymentId in <foreach collection="worldCupPaymentId" item="item" index="index" open="(" separator="," close=")"> #{item} </foreach> - group by worldCupPaymentId, participantType + group by participantId, participantType ) as aa </select> + + + + <select id="getUserGameRecordList" resultType="map"> + select + participantType, + participantId, + appUserId + from t_world_cup_payment_participant group by participantType, participantId, appUserId + </select> </mapper> \ No newline at end of file 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); } } diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html index 33d19cc..be55692 100644 --- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html @@ -15,6 +15,9 @@ border: none; text-indent: 10px; } + .el-upload__input{ + display: none; + } </style> <div class="ibox float-e-margins"> <div class="ibox-content"> @@ -101,13 +104,13 @@ </div> </div> <div class="form-group"> - <label class="col-sm-3 control-label">*基础报名人数:</label> + <label class="col-sm-3 control-label">基础报名人数:</label> <div class="col-sm-3"> <input class="form-control" id="basePeople" type="number" min="0"> </div> </div> <div class="form-group"> - <label class="col-sm-3 control-label">*参赛可获积分:</label> + <label class="col-sm-3 control-label">参赛可获积分:</label> <div class="col-sm-3"> <input class="form-control" id="participationIntegral" type="number" min="0"> </div> @@ -131,7 +134,7 @@ <input type="hidden" id="latitude"/> </div> <div class="form-group"> - <label class="col-sm-3 control-label">参与赛点:</label> + <label class="col-sm-3 control-label">*参与赛点:</label> <div class="col-sm-7"> <button onclick="WorldCupInfo.openStore()">选择门店</button> </div> @@ -152,13 +155,13 @@ </div> </div> <div class="form-group"> - <label class="col-sm-3 control-label">赛事简介</label> + <label class="col-sm-3 control-label">*赛事简介</label> <div class="col-sm-7"> <textarea class="form-control" id="intro" style="height:200px"></textarea> </div> </div> <div class="form-group"> - <label class="col-sm-3 control-label head-scu-label">比赛封面图</label> + <label class="col-sm-3 control-label head-scu-label">*比赛封面图</label> <div class="col-sm-2"> <div id="coverImgPreId"> <div><img width="100px" height="100px" src="${ctxPath}/img/NoPIC.png"></div> @@ -170,7 +173,7 @@ </div> </div> <input type="hidden" id="coverImg" /> - <label class="col-sm-1 control-label">首页默认背景图</label> + <label class="col-sm-1 control-label">*首页默认背景图</label> <div class="col-sm-2"> <div id="homeBackdropImgPreId"> <div><img width="100px" height="100px" src="${ctxPath}/img/NoPIC.png"></div> @@ -204,7 +207,7 @@ </div> </div> <div class="form-group"> - <label class="col-sm-3 control-label">比赛详情</label> + <label class="col-sm-3 control-label">*比赛详情</label> <div class="col-sm-7" style="padding: 0px;"> <textarea id="content" style="height: 800px;width: 100%;"></textarea> </div> diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html index 5890a5a..c11509e 100644 --- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html @@ -15,6 +15,9 @@ border: none; text-indent: 10px; } + .el-upload__input{ + display: none; + } </style> <div class="ibox float-e-margins"> <div class="ibox-content"> @@ -102,13 +105,13 @@ </div> </div> <div class="form-group"> - <label class="col-sm-3 control-label">*基础报名人数:</label> + <label class="col-sm-3 control-label">基础报名人数:</label> <div class="col-sm-3"> <input class="form-control" id="basePeople" type="number" min="0" value="${item.basePeople}"> </div> </div> <div class="form-group"> - <label class="col-sm-3 control-label">*参赛可获积分:</label> + <label class="col-sm-3 control-label">参赛可获积分:</label> <div class="col-sm-3"> <input class="form-control" id="participationIntegral" type="number" min="0" value="${item.participationIntegral}"> </div> @@ -132,7 +135,7 @@ <input type="hidden" id="latitude" value="${item.lat}"/> </div> <div class="form-group"> - <label class="col-sm-3 control-label">参与赛点:</label> + <label class="col-sm-3 control-label">*参与赛点:</label> <div class="col-sm-7"> <button onclick="WorldCupInfo.openStore()">选择门店</button> </div> @@ -153,13 +156,13 @@ </div> </div> <div class="form-group"> - <label class="col-sm-3 control-label">赛事简介</label> + <label class="col-sm-3 control-label">*赛事简介</label> <div class="col-sm-7"> <textarea class="form-control" id="intro" style="height:200px">${item.intro}</textarea> </div> </div> <div class="form-group"> - <label class="col-sm-3 control-label head-scu-label">比赛封面图</label> + <label class="col-sm-3 control-label head-scu-label">*比赛封面图</label> <div class="col-sm-2"> <div id="coverImgPreId"> <div><img width="100px" height="100px" src="${item.coverImg}"></div> @@ -171,7 +174,7 @@ </div> </div> <input type="hidden" id="coverImg" value="${item.coverImg}"/> - <label class="col-sm-1 control-label">首页默认背景图</label> + <label class="col-sm-1 control-label">*首页默认背景图</label> <div class="col-sm-2"> <div id="homeBackdropImgPreId"> <div><img width="100px" height="100px" src="${item.homeBackdropImg}"></div> @@ -206,7 +209,7 @@ </div> </div> <div class="form-group"> - <label class="col-sm-3 control-label">比赛详情</label> + <label class="col-sm-3 control-label">*比赛详情</label> <div class="col-sm-7" style="padding: 0px;"> <textarea id="content" style="height: 800px;width: 100%;">${item.content}</textarea> </div> diff --git a/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js b/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js index a08a483..610e32b 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js @@ -376,7 +376,7 @@ Referee.search = function () { var queryData = {}; - queryData['userName'] = $("#name").val(); + queryData['name'] = $("#name").val(); queryData['phone'] =$("#phone").val(); queryData['provinceCode'] =$("#provinceCode").val(); queryData['cityCode'] =$("#cityCode").val(); diff --git a/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup_info.js b/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup_info.js index 9e9d079..c12f83f 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup_info.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup_info.js @@ -92,16 +92,13 @@ return } if(null == basePeople || '' == basePeople){ - Feng.error("请填写有效的基础报名人数"); - return + basePeople = 0; } if(null == participationIntegral || '' == participationIntegral){ - Feng.error("请填写有效的参赛可获积分"); - return + participationIntegral = 0; } if(null == winIntegral || '' == winIntegral){ - Feng.error("请填写有效的胜场可获积分"); - return + winIntegral = 0; } if(null == address || '' == address){ Feng.error("请填写有效的比赛地点"); @@ -255,16 +252,13 @@ return } if(null == basePeople || '' == basePeople){ - Feng.error("请填写有效的基础报名人数"); - return + basePeople = 0; } if(null == participationIntegral || '' == participationIntegral){ - Feng.error("请填写有效的参赛可获积分"); - return + participationIntegral = 0; } if(null == winIntegral || '' == winIntegral){ - Feng.error("请填写有效的胜场可获积分"); - return + winIntegral = 0; } if(null == address || '' == address){ Feng.error("请填写有效的比赛地点"); -- Gitblit v1.7.1