|
|
@@ -724,31 +724,31 @@ public class GameScoreServiceImpl implements IGameScoreService {
|
|
|
}
|
|
|
|
|
|
// 然后按积分重新排序确定排名
|
|
|
- List<GameScoreVo> scoresWithPoints = queryList(new GameScoreBo() {{
|
|
|
- setEventId(eventId);
|
|
|
- setProjectId(projectId);
|
|
|
- }});
|
|
|
+// List<GameScoreVo> scoresWithPoints = queryList(new GameScoreBo() {{
|
|
|
+// setEventId(eventId);
|
|
|
+// setProjectId(projectId);
|
|
|
+// }});
|
|
|
|
|
|
// 按积分排序(降序,积分越高排名越靠前)
|
|
|
- List<GameScoreVo> sortedByPoints = scoresWithPoints.stream()
|
|
|
- .sorted((a, b) -> {
|
|
|
- Integer aPoints = a.getScorePoint() != null ? a.getScorePoint() : 0;
|
|
|
- Integer bPoints = b.getScorePoint() != null ? b.getScorePoint() : 0;
|
|
|
- return Integer.compare(bPoints, aPoints);
|
|
|
- })
|
|
|
- .toList();
|
|
|
+// List<GameScoreVo> sortedByPoints = scoresWithPoints.stream()
|
|
|
+// .sorted((a, b) -> {
|
|
|
+// Integer aPoints = a.getScorePoint() != null ? a.getScorePoint() : 0;
|
|
|
+// Integer bPoints = b.getScorePoint() != null ? b.getScorePoint() : 0;
|
|
|
+// return Integer.compare(bPoints, aPoints);
|
|
|
+// })
|
|
|
+// .toList();
|
|
|
|
|
|
// 更新排名(支持并列排名)
|
|
|
int currentRank = 1;
|
|
|
- for (int i = 0; i < sortedByPoints.size(); i++) {
|
|
|
- GameScoreVo score = sortedByPoints.get(i);
|
|
|
- int currentPoints = score.getScorePoint() != null ? score.getScorePoint() : 0;
|
|
|
+ for (int i = 0; i < sortedScores.size(); i++) {
|
|
|
+ GameScoreVo score = sortedScores.get(i);
|
|
|
+ BigDecimal currentPoints = score.getIndividualPerformance() != null ? score.getIndividualPerformance() : BigDecimal.ZERO;
|
|
|
|
|
|
- // 如果不是第一个,检查是否与前一个积分相同
|
|
|
+ // 如果不是第一个,检查是否与前一个成绩相同
|
|
|
if (i > 0) {
|
|
|
- int previousPoints = sortedByPoints.get(i - 1).getScorePoint() != null ?
|
|
|
- sortedByPoints.get(i - 1).getScorePoint() : 0;
|
|
|
- if (currentPoints != previousPoints) {
|
|
|
+ BigDecimal previousPoints = sortedScores.get(i - 1).getIndividualPerformance() != null ?
|
|
|
+ sortedScores.get(i - 1).getIndividualPerformance() : BigDecimal.ZERO;
|
|
|
+ if (!currentPoints.equals(previousPoints)) {
|
|
|
currentRank = i + 1;
|
|
|
}
|
|
|
}
|