From 3b3db9ecdc588bfaed9a5ca92b399b0525f43955 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期一, 11 三月 2024 15:49:23 +0800 Subject: [PATCH] 修改bug --- cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupCompetitorService.java | 4 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java | 27 ++ cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html | 17 + cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java | 17 ++ cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/account/UserIntegralChangesClient.java | 22 ++ cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java | 84 ++++++++++ cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupPaymentParticipantMapper.xml | 16 + 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-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupPaymentParticipantMapper.java | 5 cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup_info.js | 18 - cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml | 53 ++++++ cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java | 18 + 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 | 8 + cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java | 90 +++++++---- cloud-server-account/src/main/java/com/dsh/account/service/impl/UserIntegralChangesServiceImpl.java | 10 + cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupCompetitorMapper.java | 4 cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html | 17 + 19 files changed, 363 insertions(+), 76 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 98b3825..83b204e 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 @@ -914,6 +914,23 @@ } //====================================================== } + }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); } 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 48dcc85..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 @@ -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/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/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 27956c7..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 @@ -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/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 6682aac..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 @@ -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 f3c89ee..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; @@ -46,6 +50,9 @@ @Autowired private IWorldCupService worldCupService; + + @Resource + private UserIntegralChangesClient userIntegralChangesClient; @@ -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); @@ -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); } 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 cb4a6b4..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 @@ -14,6 +14,7 @@ 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; @@ -66,6 +67,9 @@ @Resource private AppUserClient appUserClient; + + @Resource + private WorldCupCompetitorMapper worldCupCompetitorMapper; @@ -334,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; } @@ -343,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 a5cce66..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; @@ -72,6 +74,9 @@ @Resource private GameClient gameClient; + + @Resource + private UserIntegralChangesClient userIntegralChangesClient; @@ -149,6 +154,12 @@ 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); @@ -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(); } 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-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