From b27efc697f2f81e0d0f247a2708e58af52a5df9b Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 23 十月 2025 15:14:33 +0800
Subject: [PATCH] bug修改,后台新增修改用户积分
---
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java | 223 ++++++++++++++++++++++++++++---------------------------
1 files changed, 113 insertions(+), 110 deletions(-)
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 6ec3abd..df83a2d 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
@@ -60,9 +60,6 @@
private StudentHonorClient studentHonorClient;
-
-
-
/**
* 获取参赛人员名次信息
* @param entrantRank
@@ -71,11 +68,11 @@
@Override
public EntrantRankVo getEntrantRank(EntrantRank entrantRank) {
EntrantRankVo entrantRankVo = new EntrantRankVo();
- if(entrantRank.getIsStudent() == 0){
+ if (entrantRank.getIsStudent() == 0) {
//参赛人员
Participant participant = participantClient.getParticipant(entrantRank.getId());
entrantRankVo.setName(participant.getName());
- }else{
+ } else {
//学员
TStudent tStudent = studentClient.queryById(entrantRank.getId().intValue());
entrantRankVo.setName(tStudent.getName());
@@ -88,7 +85,7 @@
Integer participantType = Integer.valueOf(map.get("participantType").toString());
Long participantId = Long.valueOf(map.get("participantId").toString());
Integer num = Integer.valueOf(map.get("num").toString());
- if(null != participantId && participantId.equals(entrantRank.getId()) && participantType.equals(entrantRank.getIsStudent())){
+ if (null != participantId && participantId.equals(entrantRank.getId()) && participantType.equals(entrantRank.getIsStudent())) {
entrantRankVo.setNationalRank(i + 1);
}
}
@@ -108,30 +105,30 @@
Integer participantType = Integer.valueOf(map.get("participantType").toString());
Long participantId = Long.valueOf(map.get("participantId").toString());
Integer num = Integer.valueOf(map.get("num").toString());
- if(null != participantId && participantId.equals(entrantRank.getId()) && participantType.equals(entrantRank.getIsStudent())){
+ if (null != participantId && participantId.equals(entrantRank.getId()) && participantType.equals(entrantRank.getIsStudent())) {
entrantRankVo.setCityRank(i + 1);
}
}
QueryWrapper<WorldCupCompetitor> wrapper = new QueryWrapper<>();
- if(entrantRank.getIsStudent() == 0){
+ if (entrantRank.getIsStudent() == 0) {
wrapper.eq("participantType", 2);
- }else{
+ } else {
wrapper.eq("participantType", 1);
}
int win = this.count(wrapper.eq("participantId", entrantRank.getId()).in("matchResult", Arrays.asList(0, 1)));
entrantRankVo.setWin(win);
wrapper = new QueryWrapper<>();
- if(entrantRank.getIsStudent() == 0){
+ if (entrantRank.getIsStudent() == 0) {
wrapper.eq("participantType", 2);
- }else{
+ } else {
wrapper.eq("participantType", 1);
}
int lose = this.count(wrapper.eq("participantId", entrantRank.getId()).eq("matchResult", -1));
entrantRankVo.setLose(lose);
- if((win + lose) == 0){
+ if ((win + lose) == 0) {
entrantRankVo.setWinRate(0D);
- }else{
+ } else {
entrantRankVo.setWinRate(new BigDecimal(win).divide(new BigDecimal(win + lose), new MathContext(4, RoundingMode.HALF_EVEN)).multiply(new BigDecimal(100)).doubleValue());
}
return entrantRankVo;
@@ -167,13 +164,13 @@
public List<WorldCupRankVo> getWorldCupRank(WorldCupRank worldCupRank) {
worldCupRank.setIsStudent(worldCupRank.getIsStudent() == 0 ? 2 : 1);
List<Integer> appUserIds = null;
- if(worldCupRank.getRadius() == 2){
+ if (worldCupRank.getRadius() == 2) {
AppUser appUser = appUserClient.getAppUser(worldCupRank.getAppUserId());
appUserIds = appUserClient.getAppUserIds(appUser.getCityCode());
}
String sTime = null;
String eTime = null;
- if(ToolUtil.isNotEmpty(worldCupRank.getTime())){
+ if (ToolUtil.isNotEmpty(worldCupRank.getTime())) {
sTime = worldCupRank.getTime().split(" - ")[0] + " 00:00:00";
eTime = worldCupRank.getTime().split(" - ")[1] + " 23:59:59";
}
@@ -183,7 +180,7 @@
//未负的数据
List<Map<String, Object>> lists1 = this.baseMapper.getWorldCupRank1(worldCupRank, appUserIds, sTime, eTime);
-
+
List<Map<String, Object>> mapList = new ArrayList<>();
for (int i = 0; i < lists.size(); i++) {
Map<String, Object> map = lists.get(i);
@@ -196,38 +193,34 @@
Integer loseIntegral = Integer.valueOf(null == map.get("loseIntegral") ? "0" : map.get("loseIntegral").toString());
Integer participationIntegral = Integer.valueOf(null == map.get("participationIntegral") ? "0" : map.get("participationIntegral").toString());
//学员
- if(participantType == 1){
+ if (participantType == 1) {
TStudent tStudent = studentClient.queryById(participantId.intValue());
- if(tStudent.getState() != 1){
+ if (tStudent.getState() != 1) {
continue;
}
}
//参赛人员
- if(participantType == 2){
+ if (participantType == 2) {
Participant participant = participantClient.getParticipant(participantId);
- if(participant.getState() != 1){
+ if (participant.getState() != 1) {
continue;
}
}
map.put("totalSession", num);
- map.put("totalIntegral", winIntegral+drawIntegral+loseIntegral+participationIntegral);
+ map.put("totalIntegral", winIntegral + drawIntegral + loseIntegral + participationIntegral);
map.put("winRate", "0");
for (Map<String, Object> objectMap : lists1) {
Integer participantType1 = Integer.valueOf(objectMap.get("participantType").toString());
Long participantId1 = Long.valueOf(objectMap.get("participantId").toString());
Integer appUserId1 = Integer.valueOf(objectMap.get("appUserId").toString());
Integer num1 = Integer.valueOf(null == objectMap.get("num") ? "0" : objectMap.get("num").toString());
- if(participantType.compareTo(participantType1) == 0 && participantId.compareTo(participantId1) == 0 && appUserId.compareTo(appUserId1) == 0){
+ if (participantType.compareTo(participantType1) == 0 && participantId.compareTo(participantId1) == 0 && appUserId.compareTo(appUserId1) == 0) {
map.put("winRate", new BigDecimal(num1).divide(new BigDecimal(num), new MathContext(4, RoundingMode.HALF_EVEN)).multiply(new BigDecimal(100)).doubleValue());
break;
}
}
mapList.add(map);
}
-
-
-
-
// if(worldCupRank.getSort() == 1){
@@ -247,7 +240,6 @@
// });
// }
-
List<WorldCupRankVo> list = new ArrayList<>();
for (int i = 0; i < mapList.size(); i++) {
Map<String, Object> map = mapList.get(i);
@@ -259,77 +251,78 @@
Double winRate = Double.valueOf(map.get("winRate").toString());
//自己排名在20内的标识
boolean b = false;
- if(i <= 19){
+ if (i <= 19) {
WorldCupRankVo worldCupRankVo = new WorldCupRankVo();
worldCupRankVo.setRank(i + 1);
worldCupRankVo.setIntegral(totalIntegral);
worldCupRankVo.setTotalSession(totalSession);
worldCupRankVo.setWinRate(winRate);
//学员
- if(participantType == 1){
+ if (participantType == 1) {
TStudent tStudent = studentClient.queryById(participantId.intValue());
worldCupRankVo.setAvatar(tStudent.getHeadImg());
String name = tStudent.getName();
- if(name.length() > 2){
+ if (name.length() > 2) {
name = name.charAt(0) + "*" + name.substring(2);
- }else{
+ } else {
name = name.charAt(0) + "*";
}
worldCupRankVo.setName(name);
}
//参赛人员
- if(participantType == 2){
+ if (participantType == 2) {
Participant participant = participantClient.getParticipant(participantId);
worldCupRankVo.setAvatar(participant.getHeadImg());
String name = participant.getName();
- if(name.length() > 2){
+ if (name.length() > 2) {
name = name.charAt(0) + "*" + name.substring(2);
- }else{
+ } else {
name = name.charAt(0) + "*";
}
worldCupRankVo.setName(name);
}
- if(worldCupRank.getIsStudent().compareTo(participantType) == 0 && worldCupRank.getId().compareTo(participantId) == 0){
+ if (worldCupRank.getIsStudent().compareTo(participantType) == 0 && worldCupRank.getId().compareTo(participantId) == 0) {
worldCupRankVo.setOneself(1);
b = true;
- }else{
+ } else {
worldCupRankVo.setOneself(0);
}
list.add(worldCupRankVo);
}
//排名20内,且包含自己直接返回
- if(i == 19 && b){
+ if (i == 19 && b) {
break;
}
+
//排名前20的数据添加完成后且包含自己,需要将自己找出来后添加到21位
- if(i > 19 && !b){
- if(worldCupRank.getIsStudent().compareTo(participantType) == 0 && worldCupRank.getId().compareTo(participantId) == 0){
+ if (i > 19 && !b) {
+ if (worldCupRank.getIsStudent().compareTo(participantType) == 0 && worldCupRank.getId().compareTo(participantId) == 0) {
WorldCupRankVo worldCupRankVo = new WorldCupRankVo();
worldCupRankVo.setRank(i + 1);
worldCupRankVo.setTotalSession(totalSession);
worldCupRankVo.setWinRate(winRate);
//学员
- if(participantType == 1){
+ if (participantType == 1) {
TStudent tStudent = studentClient.queryById(participantId.intValue());
worldCupRankVo.setAvatar(tStudent.getHeadImg());
String name = tStudent.getName();
- if(name.length() > 2){
+ if (name.length() > 2) {
name = name.charAt(0) + "*" + name.substring(2);
- }else{
+ } else {
name = name.charAt(0) + "*";
}
worldCupRankVo.setName(name);
}
//参赛人员
- if(participantType == 2){
+ if (participantType == 2) {
Participant participant = participantClient.getParticipant(participantId);
worldCupRankVo.setAvatar(participant.getHeadImg());
String name = participant.getName();
- if(name.length() > 2){
+ if (name.length() > 2) {
name = name.charAt(0) + "*" + name.substring(2);
- }else{
+ } else {
name = name.charAt(0) + "*";
}
worldCupRankVo.setName(name);
@@ -342,7 +335,18 @@
}
}
// 排序
- list= list.stream().sorted(Comparator.comparing(WorldCupRankVo::getIntegral).reversed().thenComparing(WorldCupRankVo::getTotalSession).reversed().thenComparing(WorldCupRankVo::getWinRate).reversed()).collect(Collectors.toList());
+ list = list.stream()
+ .filter(Objects::nonNull)
+ .sorted(Comparator.comparing(WorldCupRankVo::getIntegral, Comparator.nullsLast(Comparator.reverseOrder()))
+ .thenComparing(WorldCupRankVo::getTotalSession, Comparator.nullsLast(Comparator.reverseOrder()))
+ .thenComparing(WorldCupRankVo::getWinRate, Comparator.nullsLast(Comparator.reverseOrder())))
+ .collect(Collectors.toList());
+ int a = 1;
+ for (WorldCupRankVo worldCupRankVo : list) {
+ worldCupRankVo.setRank(a);
+ a++;
+ }
+
return list;
}
@@ -358,7 +362,7 @@
JSONObject jsonObject = JSON.parseObject(custom);
Integer gameType = jsonObject.getInteger("gameType");
//智慧球场比赛
- if(2 == gameType){
+ if (2 == gameType) {
return;
}
List<Long> ids = jsonObject.getJSONArray("ids").toJavaList(Long.class);
@@ -369,7 +373,7 @@
for (WorldCupCompetitor worldCupCompetitor : worldCupCompetitors) {
worldCupCompetitor.setWorldCupId(null);
//蓝方
- if(worldCupCompetitor.getParticipant() == 1){
+ if (worldCupCompetitor.getParticipant() == 1) {
worldCupCompetitor.setMatchResult(blue_score.compareTo(red_score));
worldCupCompetitor.setOurScore(blue_score);
worldCupCompetitor.setOpponentScore(red_score);
@@ -377,7 +381,7 @@
worldCupCompetitor.setWinIntegral(0);
worldCupCompetitor.setDrawIntegral(0);
worldCupCompetitor.setLoseIntegral(0);
- if(null != worldCup.getWinIntegral() && 0 < worldCup.getWinIntegral() && blue_score.compareTo(red_score) > 0){
+ if (null != worldCup.getWinIntegral() && 0 < worldCup.getWinIntegral() && blue_score.compareTo(red_score) > 0) {
worldCupCompetitor.setWinIntegral(worldCup.getWinIntegral());
//增加积分明细
SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo();
@@ -385,7 +389,7 @@
vo.setIntegral(worldCup.getWinIntegral());
vo.setType(7);
userIntegralChangesClient.saveUserIntegralChanges(vo);
- }else if(null != worldCup.getDrawIntegral() && 0 < worldCup.getDrawIntegral() && blue_score.compareTo(red_score) == 0){
+ } else if (null != worldCup.getDrawIntegral() && 0 < worldCup.getDrawIntegral() && blue_score.compareTo(red_score) == 0) {
worldCupCompetitor.setDrawIntegral(worldCup.getDrawIntegral());
//增加积分明细
SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo();
@@ -393,7 +397,7 @@
vo.setIntegral(worldCup.getDrawIntegral());
vo.setType(9);
userIntegralChangesClient.saveUserIntegralChanges(vo);
- }else if(null != worldCup.getLoseIntegral() && 0 < worldCup.getLoseIntegral() && blue_score.compareTo(red_score) < 0){
+ } else if (null != worldCup.getLoseIntegral() && 0 < worldCup.getLoseIntegral() && blue_score.compareTo(red_score) < 0) {
worldCupCompetitor.setDrawIntegral(worldCup.getLoseIntegral());
//增加积分明细
SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo();
@@ -404,7 +408,7 @@
}
}
//红方
- if(worldCupCompetitor.getParticipant() == 2){
+ if (worldCupCompetitor.getParticipant() == 2) {
worldCupCompetitor.setMatchResult(red_score.compareTo(blue_score));
worldCupCompetitor.setOurScore(red_score);
worldCupCompetitor.setOpponentScore(blue_score);
@@ -412,7 +416,7 @@
worldCupCompetitor.setWinIntegral(0);
worldCupCompetitor.setDrawIntegral(0);
worldCupCompetitor.setLoseIntegral(0);
- if(null != worldCup.getWinIntegral() && 0 < worldCup.getWinIntegral() && red_score.compareTo(blue_score) > 0){
+ if (null != worldCup.getWinIntegral() && 0 < worldCup.getWinIntegral() && red_score.compareTo(blue_score) > 0) {
worldCupCompetitor.setWinIntegral(worldCup.getWinIntegral());
//增加积分明细
SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo();
@@ -420,7 +424,7 @@
vo.setIntegral(worldCup.getWinIntegral());
vo.setType(7);
userIntegralChangesClient.saveUserIntegralChanges(vo);
- }else if(null != worldCup.getDrawIntegral() && 0 < worldCup.getDrawIntegral() && blue_score.compareTo(red_score) == 0){
+ } else if (null != worldCup.getDrawIntegral() && 0 < worldCup.getDrawIntegral() && blue_score.compareTo(red_score) == 0) {
worldCupCompetitor.setDrawIntegral(worldCup.getDrawIntegral());
//增加积分明细
SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo();
@@ -428,7 +432,7 @@
vo.setIntegral(worldCup.getDrawIntegral());
vo.setType(9);
userIntegralChangesClient.saveUserIntegralChanges(vo);
- }else if(null != worldCup.getLoseIntegral() && 0 < worldCup.getLoseIntegral() && blue_score.compareTo(red_score) < 0){
+ } else if (null != worldCup.getLoseIntegral() && 0 < worldCup.getLoseIntegral() && blue_score.compareTo(red_score) < 0) {
worldCupCompetitor.setDrawIntegral(worldCup.getLoseIntegral());
//增加积分明细
SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo();
@@ -439,7 +443,7 @@
}
}
}
- }catch (Exception e){
+ } catch (Exception e) {
e.printStackTrace();
}
@@ -449,7 +453,7 @@
for (WorldCupCompetitor worldCupCompetitor : worldCupCompetitors) {
Integer appUserId = worldCupCompetitor.getAppUserId();
//常胜将军
- if(1 == worldCupCompetitor.getMatchResult()){
+ if (1 == worldCupCompetitor.getMatchResult()) {
int count = this.count(new QueryWrapper<WorldCupCompetitor>().eq("appUserId", appUserId).eq("matchResult", 1));
StudentHonor studentHonor = new StudentHonor();
studentHonor.setAppUserId(appUserId);
@@ -484,12 +488,12 @@
String time = worldCupRecords.getTime();
String sTime = null;
String eTime = null;
- if(ToolUtil.isNotEmpty(time)){
+ if (ToolUtil.isNotEmpty(time)) {
sTime = time.split(" - ")[0] + " 00:00:00";
eTime = time.split(" - ")[1] + " 23:59:59";
}
- List<Map<String, Object>> mapList = this.baseMapper.worldCupRecordsList(worldCupRecords, appUserIds,sTime,eTime);
- List<Map<String, Object>> mapList1 = this.baseMapper.worldCupRecordsList1(worldCupRecords, appUserIds,sTime,eTime);
+ List<Map<String, Object>> mapList = this.baseMapper.worldCupRecordsList(worldCupRecords, appUserIds, sTime, eTime);
+ List<Map<String, Object>> mapList1 = this.baseMapper.worldCupRecordsList1(worldCupRecords, appUserIds, sTime, eTime);
List<Map<String, Object>> list = new ArrayList<>();
int row_num = 0;
for (int i = 0; i < mapList.size(); i++) {
@@ -499,16 +503,16 @@
Integer appUserId = Integer.valueOf(map.get("appUserId").toString());
Integer num = Integer.valueOf(null == map.get("num") ? "0" : map.get("num").toString());
//学员
- if(participantType == 1){
+ if (participantType == 1) {
TStudent tStudent = studentClient.queryById(participantId.intValue());
- if(tStudent.getState() != 1){
+ if (tStudent.getState() != 1) {
continue;
}
}
//参赛人员
- if(participantType == 2){
+ if (participantType == 2) {
Participant participant = participantClient.getParticipant(participantId);
- if(participant.getState() != 1){
+ if (participant.getState() != 1) {
continue;
}
}
@@ -520,7 +524,7 @@
Long participantId1 = Long.valueOf(objectMap.get("participantId").toString());
Integer appUserId1 = Integer.valueOf(objectMap.get("appUserId").toString());
Integer num1 = Integer.valueOf(null == objectMap.get("num") ? "0" : objectMap.get("num").toString());
- if(participantType.compareTo(participantType1) == 0 && participantId.compareTo(participantId1) == 0 && appUserId.compareTo(appUserId1) == 0){
+ if (participantType.compareTo(participantType1) == 0 && participantId.compareTo(participantId1) == 0 && appUserId.compareTo(appUserId1) == 0) {
map.put("winRate", new BigDecimal(num1).divide(new BigDecimal(num), new MathContext(4, RoundingMode.HALF_EVEN)).multiply(new BigDecimal(100)).doubleValue());
map.put("win", num1);
break;
@@ -531,16 +535,16 @@
map.put("lose", lose);
AppUser appUser = appUserClient.getAppUser(appUserId);
map.put("province", appUser.getProvince() + appUser.getCity());
- if(1 == participantType){
+ if (1 == participantType) {
TStudent tStudent = studentClient.queryById(participantId.intValue());
- if(tStudent.getState() != 1){
+ if (tStudent.getState() != 1) {
continue;
}
map.put("name", tStudent.getName());
map.put("phone", ToolUtil.isNotEmpty(tStudent.getPhone()) ? tStudent.getPhone() : appUser.getPhone());
- }else{
+ } else {
Participant participant = participantClient.getParticipant(participantId);
- if(participant.getState() != 1){
+ if (participant.getState() != 1) {
continue;
}
map.put("name", participant.getName());
@@ -556,7 +560,7 @@
return Double.valueOf(o1.get("totalSession").toString()).compareTo(Double.valueOf(o2.get("totalSession").toString())) * -1;
}
});
-
+
Integer offset = worldCupRecords.getOffset();
Integer limit = worldCupRecords.getLimit();
limit += offset;
@@ -593,30 +597,30 @@
map.put("participantId", participantId);
AppUser appUser = appUserClient.getAppUser(appUserId);
map.put("province", appUser.getProvince() + appUser.getCity());
- if(1 == participantType){
+ if (1 == participantType) {
TStudent tStudent = studentClient.queryById(participantId.intValue());
- if(ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1){
+ if (ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1) {
continue;
}
- if(ToolUtil.isNotEmpty(phone) && (ToolUtil.isEmpty(tStudent.getPhone()) ? appUser.getPhone() : tStudent.getPhone()).indexOf(phone) == -1){
+ if (ToolUtil.isNotEmpty(phone) && (ToolUtil.isEmpty(tStudent.getPhone()) ? appUser.getPhone() : tStudent.getPhone()).indexOf(phone) == -1) {
continue;
}
- if(ToolUtil.isNotEmpty(idcard) && tStudent.getIdCard().indexOf(idcard) == -1){
+ if (ToolUtil.isNotEmpty(idcard) && tStudent.getIdCard().indexOf(idcard) == -1) {
continue;
}
map.put("name", tStudent.getName());
map.put("phone", ToolUtil.isEmpty(tStudent.getPhone()) ? appUser.getPhone() : tStudent.getPhone());
map.put("idcard", tStudent.getIdCard());
- }else{
+ } else {
Participant participant = participantClient.getParticipant(participantId);
- if(ToolUtil.isNotEmpty(name) && participant.getName().indexOf(name) == -1){
+ if (ToolUtil.isNotEmpty(name) && participant.getName().indexOf(name) == -1) {
continue;
}
- if(ToolUtil.isNotEmpty(phone) && (ToolUtil.isNotEmpty(participant.getPhone()) ? participant.getPhone() : appUser.getPhone()).indexOf(phone) == -1){
+ if (ToolUtil.isNotEmpty(phone) && (ToolUtil.isNotEmpty(participant.getPhone()) ? participant.getPhone() : appUser.getPhone()).indexOf(phone) == -1) {
continue;
}
- if(ToolUtil.isNotEmpty(idcard) && participant.getIdcard().indexOf(idcard) == -1){
+ if (ToolUtil.isNotEmpty(idcard) && participant.getIdcard().indexOf(idcard) == -1) {
continue;
}
@@ -652,23 +656,23 @@
for (WorldCupCompetitor cupCompetitor : list) {
Map<String, Object> map = new HashMap<>();
map.put("id", cupCompetitor.getId().toString());
- if(1 == participantType){
+ if (1 == participantType) {
TStudent tStudent = studentClient.queryById(participantId.intValue());
- if(ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1){
+ if (ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1) {
continue;
}
map.put("name", tStudent.getName());
- }else{
+ } else {
Participant participant = participantClient.getParticipant(participantId);
- if(ToolUtil.isNotEmpty(name) && participant.getName().indexOf(name) == -1){
+ if (ToolUtil.isNotEmpty(name) && participant.getName().indexOf(name) == -1) {
continue;
}
map.put("name", participant.getName());
}
map.put("startTime", sdf.format(cupCompetitor.getStartTime()));
map.put("score", cupCompetitor.getOurScore() + ":" + cupCompetitor.getOpponentScore());
- map.put("matchResult", cupCompetitor.getMatchResult() == 1 ? "胜" : cupCompetitor.getMatchResult() == 0 ? "平" : "负");
+ map.put("matchResult", cupCompetitor.getMatchResult() == 1 ? "胜" : (cupCompetitor.getMatchResult() == 0 ? "平" : "负"));
map.put("blue", cupCompetitor.getParticipant() == 1 ? cupCompetitor.getOurScore() : cupCompetitor.getOpponentScore());
map.put("red", cupCompetitor.getParticipant() == 2 ? cupCompetitor.getOurScore() : cupCompetitor.getOpponentScore());
mapList.add(map);
@@ -695,7 +699,7 @@
WorldCup worldCup = worldCupService.getById(blueList.get(0).getWorldCupId());
for (WorldCupCompetitor cupCompetitor : blueList) {
//如果之前输了,现在赢了,需要增加积分
- if(cupCompetitor.getMatchResult() == -1 && (blue.compareTo(red) > 0 )){
+ if (cupCompetitor.getMatchResult() == -1 && (blue.compareTo(red) > 0)) {
//先扣除
SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo();
vo.setAppUserId(cupCompetitor.getAppUserId());
@@ -715,7 +719,7 @@
cupCompetitor.setLoseIntegral(0);
}
// 输 -> 平
- if(cupCompetitor.getMatchResult() == -1 && (blue.compareTo(red) == 0 )){
+ if (cupCompetitor.getMatchResult() == -1 && (blue.compareTo(red) == 0)) {
//先扣除
SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo();
vo1.setAppUserId(cupCompetitor.getAppUserId());
@@ -736,7 +740,7 @@
cupCompetitor.setLoseIntegral(0);
}
//如果之前赢了,现在输了,需要扣减积分
- if(cupCompetitor.getMatchResult() == 1 && blue.compareTo(red) < 0){
+ if (cupCompetitor.getMatchResult() == 1 && blue.compareTo(red) < 0) {
//先扣除
SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo();
vo1.setAppUserId(cupCompetitor.getAppUserId());
@@ -757,7 +761,7 @@
cupCompetitor.setLoseIntegral(worldCup.getLoseIntegral());
}
//如果之前赢了,现在平了,需要扣减积分
- if(cupCompetitor.getMatchResult() == 1 && blue.compareTo(red) == 0){
+ if (cupCompetitor.getMatchResult() == 1 && blue.compareTo(red) == 0) {
//先扣除
SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo();
vo1.setAppUserId(cupCompetitor.getAppUserId());
@@ -778,7 +782,7 @@
cupCompetitor.setDrawIntegral(worldCup.getDrawIntegral());
}
//如果之前平了,现在输了,需要扣减积分
- if(cupCompetitor.getMatchResult() == 0 && blue.compareTo(red) < 0){
+ if (cupCompetitor.getMatchResult() == 0 && blue.compareTo(red) < 0) {
//先扣除
SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo();
vo1.setAppUserId(cupCompetitor.getAppUserId());
@@ -798,7 +802,7 @@
cupCompetitor.setLoseIntegral(worldCup.getLoseIntegral());
}
//如果之前平了,现在赢了,需要扣减积分
- if(cupCompetitor.getMatchResult() == 0 && blue>red){
+ if (cupCompetitor.getMatchResult() == 0 && blue > red) {
//先扣除
SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo();
vo1.setAppUserId(cupCompetitor.getAppUserId());
@@ -827,7 +831,7 @@
.eq("participant", 2).eq("worldCupId", worldCupCompetitor.getWorldCupId()));
for (WorldCupCompetitor cupCompetitor : redList) {
//如果之前输了,现在赢/了,需要增加积分
- if(cupCompetitor.getMatchResult() == -1 && (red.compareTo(blue) > 0)){
+ if (cupCompetitor.getMatchResult() == -1 && (red.compareTo(blue) > 0)) {
//先扣除
SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo();
vo1.setAppUserId(cupCompetitor.getAppUserId());
@@ -847,7 +851,7 @@
cupCompetitor.setLoseIntegral(0);
}
//如果之前输了,现在平了,需要增加积分
- if(cupCompetitor.getMatchResult() == -1 && ( red.compareTo(blue) == 0)){
+ if (cupCompetitor.getMatchResult() == -1 && (red.compareTo(blue) == 0)) {
//先扣除
SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo();
vo1.setAppUserId(cupCompetitor.getAppUserId());
@@ -867,7 +871,7 @@
cupCompetitor.setLoseIntegral(0);
}
//如果之前赢了,现在输了,需要扣减积分
- if(cupCompetitor.getMatchResult() == 1 && red.compareTo(blue) < 0){
+ if (cupCompetitor.getMatchResult() == 1 && red.compareTo(blue) < 0) {
//先扣除
SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo();
@@ -880,7 +884,7 @@
//增加积分明细
SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo();
vo.setAppUserId(cupCompetitor.getAppUserId());
- vo.setIntegral(worldCup.getLoseIntegral() );
+ vo.setIntegral(worldCup.getLoseIntegral());
vo.setType(7);
userIntegralChangesClient.saveUserIntegralChanges(vo);
@@ -889,7 +893,7 @@
cupCompetitor.setLoseIntegral(worldCup.getLoseIntegral());
}
//如果之前赢了,现在平了,需要扣减积分
- if(cupCompetitor.getMatchResult() == 1 && red.compareTo(blue) ==0){
+ if (cupCompetitor.getMatchResult() == 1 && red.compareTo(blue) == 0) {
//先扣除
SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo();
@@ -902,7 +906,7 @@
//增加积分明细
SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo();
vo.setAppUserId(cupCompetitor.getAppUserId());
- vo.setIntegral(worldCup.getDrawIntegral() );
+ vo.setIntegral(worldCup.getDrawIntegral());
vo.setType(7);
userIntegralChangesClient.saveUserIntegralChanges(vo);
@@ -911,7 +915,7 @@
cupCompetitor.setDrawIntegral(worldCup.getDrawIntegral());
}
//如果之前平了,现在输了,需要扣减积分
- if(cupCompetitor.getMatchResult() == 0 && red.compareTo(blue) < 0){
+ if (cupCompetitor.getMatchResult() == 0 && red.compareTo(blue) < 0) {
//先扣除
SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo();
vo1.setAppUserId(cupCompetitor.getAppUserId());
@@ -932,7 +936,7 @@
cupCompetitor.setLoseIntegral(worldCup.getLoseIntegral());
}
//如果之前平了,现在赢了,需要扣减积分
- if(cupCompetitor.getMatchResult() == 0 && red.compareTo(blue) >0){
+ if (cupCompetitor.getMatchResult() == 0 && red.compareTo(blue) > 0) {
//先扣除
SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo();
vo1.setAppUserId(cupCompetitor.getAppUserId());
@@ -964,7 +968,7 @@
for (WorldCupCompetitor wcc : worldCupCompetitors) {
Integer appUserId = wcc.getAppUserId();
//常胜将军
- if(1 == wcc.getMatchResult()){
+ if (1 == wcc.getMatchResult()) {
int count = this.count(new QueryWrapper<WorldCupCompetitor>().eq("appUserId", appUserId).eq("matchResult", 1));
StudentHonor studentHonor = new StudentHonor();
studentHonor.setAppUserId(appUserId);
@@ -1000,21 +1004,21 @@
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){
+ if (1 == participantType) {
TStudent tStudent = studentClient.queryById(participantId.intValue());
- if(ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1){
+ if (ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1) {
continue;
}
map.put("userName", tStudent.getName());
- }else{
+ } else {
Participant participant = participantClient.getParticipant(participantId);
- if(ToolUtil.isNotEmpty(name) && participant.getName().indexOf(name) == -1){
+ if (ToolUtil.isNotEmpty(name) && participant.getName().indexOf(name) == -1) {
continue;
}
map.put("userName", participant.getName());
}
map.put("score", ourScore + ":" + opponentScore);
- map.put("matchResult", matchResult == 1 ? "胜" : matchResult == 0 ? "平" :"负");
+ map.put("matchResult", matchResult == 1 ? "胜" : matchResult == 0 ? "平" : "负");
mapList.add(map);
}
Map<String, Object> map = new HashMap<>();
@@ -1046,8 +1050,7 @@
@Override
public List<WorldCupCodeListVo> getWorldCupCodeListId(Integer worldCupId) {
List<WorldCupCompetitor> worldCupCompetitors = this.baseMapper.selectList(new LambdaQueryWrapper<WorldCupCompetitor>().eq(WorldCupCompetitor::getWorldCupId, worldCupId)
- .and(w->w.isNull(WorldCupCompetitor::getEndTime).or(s->s.le(WorldCupCompetitor::getStartTime, new Date()).ge(WorldCupCompetitor::getEndTime, new Date()))))
- ;
+ .and(w -> w.isNull(WorldCupCompetitor::getEndTime).or(s -> s.le(WorldCupCompetitor::getStartTime, new Date()).ge(WorldCupCompetitor::getEndTime, new Date()))));
List<WorldCupCodeListVo> worldCupCodeListVos = new ArrayList<>();
// worldCupCompetitors 通过code分组
@@ -1065,10 +1068,10 @@
TStudent tStudent = studentClient.queryById(competitor.getParticipantId().intValue());
userVo.setUserName(tStudent.getName());
userVo.setAvatar(tStudent.getHeadImg());
- // 当前日期和生日计算年龄
+ // 当前日期和生日计算年龄
Date birthday = tStudent.getBirthday();
- if(birthday!=null){
+ if (birthday != null) {
int age = now.getYear() - birthday.getYear();
userVo.setAge(age);
}
@@ -1083,10 +1086,10 @@
TStudent tStudent = studentClient.queryById(competitor.getParticipantId().intValue());
userVo.setUserName(tStudent.getName());
userVo.setAvatar(tStudent.getHeadImg());
- // 当前日期和生日计算年龄
+ // 当前日期和生日计算年龄
Date birthday = tStudent.getBirthday();
- if(birthday!=null){
+ if (birthday != null) {
int age = now.getYear() - birthday.getYear();
userVo.setAge(age);
}
@@ -1099,7 +1102,7 @@
Integer worldCupId1 = value.get(0).getWorldCupId();
WorldCup byId = worldCupService.getById(worldCupId1);
worldCupCodeListVo.setWorldCupId(worldCupId1);
- if(byId!=null){
+ if (byId != null) {
worldCupCodeListVo.setName(byId.getName());
}
List<Long> collect = value.stream().map(WorldCupCompetitor::getId).collect(Collectors.toList());
--
Gitblit v1.7.1