cloud-server-account/src/main/java/com/dsh/account/service/impl/UserIntegralChangesServiceImpl.java
@@ -104,6 +104,11 @@ detail.setConsumeName("社区世界杯获胜"); detail.setDetailsType(2); break; case 8: detail.setConsumeAmount("" + (userIntegralChange.getNewIntegral() - userIntegralChange.getOldIntegral())); detail.setConsumeName("社区世界杯调整比分"); detail.setDetailsType(1); break; default: break; } @@ -139,7 +144,7 @@ tauMapper.updateById(appUser); userIntegralChanges.setNewIntegral(appUser.getIntegral()); userIntegralChanges.setInsertTime(new Date()); userIntegralChanges.setCategory(1); userIntegralChanges.setCategory(vo.getIntegral() > 0 ? 1 : 2); userIntegralChanges.setRemark(vo.getRemark()); this.save(userIntegralChanges); } cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java
@@ -648,7 +648,10 @@ worldCup.setProvinceCode(provinceCode); worldCup.setCity(city.replace("市", "")); worldCup.setCityCode(cityCode); worldCupService.updateById(worldCup); WorldCup worldCup1 = worldCupService.getById(worldCup.getId()); worldCup.setCreateTime(worldCup1.getCreateTime()); worldCup.setMatchNumber(worldCup1.getMatchNumber()); worldCupService.updateWorldCupAll(worldCup); return worldCup.getId(); } cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupMapper.java
@@ -60,4 +60,11 @@ int worldCupGameStatisticsCount(@Param("item") WorldCupGameStatistics worldCupGameStatistics); /** * 修改所有参数 * @param worldCup */ void updateWorldCupAll(@Param("item") WorldCup worldCup); } cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupService.java
@@ -107,4 +107,11 @@ * @return */ Map<String, Object> worldCupGameStatistics(WorldCupGameStatistics worldCupGameStatistics); /** * 修改所有参数 * @param worldCup */ void updateWorldCupAll(WorldCup worldCup); } cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java
@@ -288,12 +288,9 @@ 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.setAppUserId(worldCupCompetitor.getAppUserId()); vo.setIntegral(worldCup.getWinIntegral()); vo.setType(7); userIntegralChangesClient.saveUserIntegralChanges(vo); @@ -308,12 +305,9 @@ 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.setAppUserId(worldCupCompetitor.getAppUserId()); vo.setIntegral(worldCup.getWinIntegral()); vo.setType(7); userIntegralChangesClient.saveUserIntegralChanges(vo); @@ -474,7 +468,7 @@ map.put("score", cupCompetitor.getOurScore().compareTo(cupCompetitor.getOpponentScore()) > 0 ? cupCompetitor.getOurScore() + ":" + cupCompetitor.getOpponentScore() : cupCompetitor.getOpponentScore() + ":" + cupCompetitor.getOurScore()); map.put("matchResult", cupCompetitor.getMatchResult() == 1 ? "胜" : "负"); map.put("matchResult", cupCompetitor.getMatchResult() == 1 ? "胜" : cupCompetitor.getMatchResult() == 0 ? "平" : "负"); mapList.add(map); } Map<String, Object> map = new HashMap<>(); @@ -494,23 +488,42 @@ Integer blue = changeScore.getBlue(); Integer red = changeScore.getRed(); WorldCupCompetitor worldCupCompetitor = this.getById(id); List<WorldCupCompetitor> blueList = this.list(new QueryWrapper<WorldCupCompetitor>().eq("code", worldCupCompetitor.getCode()).eq("participant", 1)); List<WorldCupCompetitor> blueList = this.list(new QueryWrapper<WorldCupCompetitor>().eq("code", worldCupCompetitor.getCode()) .eq("participant", 1)); WorldCup worldCup = worldCupService.getById(blueList.get(0).getWorldCupId()); for (WorldCupCompetitor cupCompetitor : blueList) { //如果之前输了,现在赢了,需要增加积分 if(cupCompetitor.getMatchResult() == -1 && blue.compareTo(red) > 0){ AppUser appUser = appUserClient.getAppUser(cupCompetitor.getAppUserId()); appUser.setIntegral(appUser.getIntegral() + worldCup.getWinIntegral()); appUserClient.updateAppUser(appUser); //如果之前输了,现在赢/平了,需要增加积分 if(cupCompetitor.getMatchResult() == -1 && (blue.compareTo(red) > 0 || blue.compareTo(red) == 0)){ //增加积分明细 SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); vo.setAppUserId(cupCompetitor.getAppUserId()); vo.setIntegral(worldCup.getWinIntegral()); vo.setType(7); userIntegralChangesClient.saveUserIntegralChanges(vo); cupCompetitor.setMatchResult(1); cupCompetitor.setWinIntegral(worldCup.getWinIntegral()); } //如果之前赢了,现在输了,需要扣减积分 if(cupCompetitor.getMatchResult() == 1 && blue.compareTo(red) < 0){ AppUser appUser = appUserClient.getAppUser(cupCompetitor.getAppUserId()); appUser.setIntegral(appUser.getIntegral() - worldCup.getWinIntegral()); appUserClient.updateAppUser(appUser); //增加积分明细 SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); vo.setAppUserId(cupCompetitor.getAppUserId()); vo.setIntegral(worldCup.getWinIntegral() * -1); vo.setType(8); userIntegralChangesClient.saveUserIntegralChanges(vo); cupCompetitor.setMatchResult(-1); cupCompetitor.setWinIntegral(0); } //如果之前平了,现在输了,需要扣减积分 if(cupCompetitor.getMatchResult() == 0 && blue.compareTo(red) < 0){ //增加积分明细 SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); vo.setAppUserId(cupCompetitor.getAppUserId()); vo.setIntegral(worldCup.getWinIntegral() * -1); vo.setType(8); userIntegralChangesClient.saveUserIntegralChanges(vo); cupCompetitor.setMatchResult(-1); cupCompetitor.setWinIntegral(0); @@ -522,20 +535,38 @@ List<WorldCupCompetitor> redList = this.list(new QueryWrapper<WorldCupCompetitor>().eq("code", worldCupCompetitor.getCode()).eq("participant", 2)); for (WorldCupCompetitor cupCompetitor : redList) { //如果之前输了,现在赢了,需要增加积分 if(cupCompetitor.getMatchResult() == -1 && red.compareTo(blue) > 0){ AppUser appUser = appUserClient.getAppUser(cupCompetitor.getAppUserId()); appUser.setIntegral(appUser.getIntegral() + worldCup.getWinIntegral()); appUserClient.updateAppUser(appUser); //如果之前输了,现在赢/平了,需要增加积分 if(cupCompetitor.getMatchResult() == -1 && (red.compareTo(blue) > 0 || red.compareTo(blue) == 0)){ //增加积分明细 SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); vo.setAppUserId(cupCompetitor.getAppUserId()); vo.setIntegral(worldCup.getWinIntegral()); vo.setType(7); userIntegralChangesClient.saveUserIntegralChanges(vo); cupCompetitor.setMatchResult(1); cupCompetitor.setWinIntegral(worldCup.getWinIntegral()); } //如果之前赢了,现在输了,需要扣减积分 if(cupCompetitor.getMatchResult() == 1 && red.compareTo(blue) < 0){ AppUser appUser = appUserClient.getAppUser(cupCompetitor.getAppUserId()); appUser.setIntegral(appUser.getIntegral() - worldCup.getWinIntegral()); appUserClient.updateAppUser(appUser); //增加积分明细 SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); vo.setAppUserId(cupCompetitor.getAppUserId()); vo.setIntegral(worldCup.getWinIntegral() * -1); vo.setType(8); userIntegralChangesClient.saveUserIntegralChanges(vo); cupCompetitor.setMatchResult(-1); cupCompetitor.setWinIntegral(0); } //如果之前平了,现在输了,需要扣减积分 if(cupCompetitor.getMatchResult() == 0 && red.compareTo(blue) < 0){ //增加积分明细 SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); vo.setAppUserId(cupCompetitor.getAppUserId()); vo.setIntegral(worldCup.getWinIntegral() * -1); vo.setType(8); userIntegralChangesClient.saveUserIntegralChanges(vo); cupCompetitor.setMatchResult(-1); cupCompetitor.setWinIntegral(0); @@ -579,7 +610,7 @@ map.put("score", ourScore.compareTo(opponentScore) > 0 ? ourScore + ":" + opponentScore : opponentScore + ":" + ourScore); map.put("matchResult", matchResult == 1 ? "胜" : "负"); map.put("matchResult", matchResult == 1 ? "胜" : matchResult == 0 ? "平" :"负"); mapList.add(map); } Map<String, Object> map = new HashMap<>(); cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java
@@ -32,6 +32,7 @@ import javax.annotation.Resource; import java.math.BigDecimal; import java.math.MathContext; import java.math.RoundingMode; import java.text.SimpleDateFormat; import java.util.*; @@ -380,7 +381,7 @@ userGameRecordList.put("win", win); Integer lose = totalSession - win; userGameRecordList.put("lose", lose); userGameRecordList.put("winRate", totalSession == 0 ? 0 : win / totalSession * 100); userGameRecordList.put("winRate", totalSession == 0 ? 0 : new BigDecimal(win).divide(new BigDecimal(totalSession), new MathContext(4, RoundingMode.HALF_EVEN)).multiply(new BigDecimal(100)).doubleValue()); userGameRecordList.put("participantType", participantType); userGameRecordList.put("participantId", participantId); AppUser appUser = appUserClient.getAppUser(appUserId); cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java
@@ -151,12 +151,9 @@ //添加参赛奖励 if(null != worldCup.getParticipationIntegral() && 0 < worldCup.getParticipationIntegral()){ worldCupCompetitor.setParticipationIntegral(worldCup.getParticipationIntegral()); AppUser appUser = appUserClient.getAppUser(worldCupCompetitor.getAppUserId()); appUser.setIntegral(appUser.getIntegral() + worldCup.getParticipationIntegral()); appUserClient.updateAppUser(appUser); //增加积分明细 SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); vo.setAppUserId(appUser.getId()); vo.setAppUserId(worldCupCompetitor.getAppUserId()); vo.setIntegral(worldCup.getParticipationIntegral()); vo.setType(6); userIntegralChangesClient.saveUserIntegralChanges(vo); @@ -391,11 +388,23 @@ if(System.currentTimeMillis() > worldCup.getEndTime().getTime()){ return ResultUtil.error("世界杯赛事已结束,无法完成报名"); } String cupIds = paymentWorldCup.getIds(); JSONArray jsonArray = JSON.parseArray(cupIds); List<WorldCupPayment> payments = worldCupPaymentService.list(new QueryWrapper<WorldCupPayment>().eq("worldCupId", worldCup.getId()) .eq("payStatus", 2).eq("state", 1)); List<Long> ids = payments.stream().map(WorldCupPayment::getId).collect(Collectors.toList()); if(ids.size() > 0){ int count = worldCupPaymentParticipantService.count(new QueryWrapper<WorldCupPaymentParticipant>().eq("worldCupId", worldCup.getId()) .eq("worldCupPaymentId", ids)); if((count + jsonArray.size()) >= worldCup.getMatchNumber()){ 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); @@ -404,6 +413,9 @@ Integer isStudent = jsonObject.getInteger("isStudent"); if(isStudent == 1){ TStudent tStudent = studentClient.queryById(id.intValue()); if(worldCup.getGender() != 0 && !tStudent.getSex().equals(worldCup.getGender())){ return ResultUtil.error("此比赛只能是" + (worldCup.getGender() == 1 ? "男" : "女") + "性参加"); } 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)); @@ -420,6 +432,9 @@ } }else{ Participant participant = participantClient.getParticipant(id); if(worldCup.getGender() != 0 && !participant.getGender().equals(worldCup.getGender())){ return ResultUtil.error("此比赛只能是" + (worldCup.getGender() == 1 ? "男" : "女") + "性参加"); } 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)); @@ -830,4 +845,13 @@ map.put("total", count); return map; } /** * 修改所有参数 * @param worldCup */ @Override public void updateWorldCupAll(WorldCup worldCup) { this.baseMapper.updateWorldCupAll(worldCup); } } cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml
@@ -64,7 +64,7 @@ appUserId, count(*) as num from t_world_cup_competitor where 1 = 1 where matchResult is not null <if test="null != item.year"> and DATE_FORMAT(startTime, '%Y') = #{item.year} </if> @@ -83,7 +83,7 @@ appUserId, count(*) as num from t_world_cup_competitor where matchResult = 1 where matchResult != -1 <if test="null != item.year"> and DATE_FORMAT(startTime, '%Y') = #{item.year} </if> @@ -122,7 +122,7 @@ appUserId, count(*) as num from t_world_cup_competitor where 1 = 1 where matchResult is not null <if test="null != appUserIds and appUserIds.size() > 0"> and appUserId in <foreach collection="appUserIds" item="iten" index="index" open="(" separator="," close=")"> @@ -138,7 +138,7 @@ appUserId, count(*) as num from t_world_cup_competitor where matchResult = 1 where matchResult != -1 <if test="null != appUserIds and appUserIds.size() > 0"> and appUserId in <foreach collection="appUserIds" item="iten" index="index" open="(" separator="," close=")"> @@ -159,7 +159,7 @@ participantId, appUserId from t_world_cup_competitor where 1 = 1 where matchResult is not null <if test="null != appUserIds and appUserIds.size() > 0"> and appUserId in <foreach collection="appUserIds" item="iten" index="index" open="(" separator="," close=")"> @@ -195,7 +195,7 @@ appUserId, count(*) as num from t_world_cup_competitor where 1 = 1 where matchResult is not null <if test="null != worldCupId"> and worldCupId = #{worldCupId} </if> @@ -208,7 +208,7 @@ appUserId, count(*) as num from t_world_cup_competitor where matchResult = 1 where matchResult != -1 <if test="null != worldCupId"> and worldCupId = #{worldCupId} </if> @@ -229,7 +229,7 @@ b.`name` from t_world_cup_competitor a left join t_world_cup b on (a.worldCupId = b.id) where 1 = 1 where matchResult is not null <if test="null != name and '' != name"> and b.name like CONCAT('%', #{name}, '%') </if> @@ -253,7 +253,7 @@ appUserId, count(*) as num from t_world_cup_competitor where 1 = 1 where matchResult is not null <if test="null != participantType"> and participantType = #{participantType} </if> @@ -269,7 +269,7 @@ appUserId, count(*) as num from t_world_cup_competitor where matchResult = 1 where matchResult != -1 <if test="null != participantType"> and participantType = #{participantType} </if> cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupMapper.xml
@@ -148,4 +148,13 @@ and a.`name` like CONCAT('%', #{item.name}, '%') </if> </select> <update id="updateWorldCupAll"> update t_world_cup set name = #{item.name}, startTime = #{item.startTime}, endTime = #{item.endTime}, registrationClosingTime = #{item.registrationClosingTime}, startAge = #{item.startAge}, endAge = #{item.endAge}, gender = #{item.gender}, payType = #{item.payType}, cash = #{item.cash}, paiCoin = #{item.paiCoin}, classHour = #{item.classHour}, maxPeople = #{item.maxPeople}, basePeople = #{item.basePeople}, participationIntegral = #{item.participationIntegral}, winIntegral = #{item.winIntegral}, province = #{item.province}, provinceCode = #{item.provinceCode}, city = #{item.city}, cityCode = #{item.cityCode}, address = #{item.address}, lon = #{item.lon}, lat = #{item.lat}, coverImg = #{item.coverImg}, homeBackdropImg = #{item.homeBackdropImg}, infoImg = #{item.infoImg}, intro = #{item.intro}, content = #{item.content}, status = #{item.status}, createTime = #{item.createTime}, matchNumber = #{item.matchNumber} where id = #{item.id} </update> </mapper> cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup_info.js
@@ -162,7 +162,7 @@ 'stores': JSON.stringify(WorldCupInfo.stores) } if(null != registrationClosingTime && '' != registrationClosingTime){ data.registrationClosingTime = registrationClosingTime; data.registrationClosingTime = new Date(registrationClosingTime + " 23:59:59"); } //提交信息 @@ -325,7 +325,7 @@ 'stores': JSON.stringify(WorldCupInfo.stores) } if(null != registrationClosingTime && '' != registrationClosingTime){ data.registrationClosingTime = registrationClosingTime; data.registrationClosingTime = new Date(registrationClosingTime + " 23:59:59"); } //提交信息 cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupGameStatisticsInfo.js
@@ -55,7 +55,7 @@ area: ['100%', '100%'], //宽高 fix: false, //不固定 maxmin: true, content: Feng.ctxPath + '/worldCupRecords/openWorldCupGameStatisticsListInfo?id=' + WorldCupGameStatisticsInfo.seItem.id content: Feng.ctxPath + '/worldCupRecords/openWorldCupGameStatisticsListInfo?participantId=' + WorldCupGameStatisticsInfo.seItem.participantId + "&participantType=" + WorldCupGameStatisticsInfo.seItem.participantType }); this.layerIndex = index; }