Browse Source

修复用户总分统计异常

Eric 2 years ago
parent
commit
6564932cec

+ 3 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ActivityEvaluationRecordServiceImpl.java

@@ -104,6 +104,7 @@ public class ActivityEvaluationRecordServiceImpl extends ServiceImpl<ActivityEva
                 // 用户当前声部所有评测数据,获取单曲最高进行加和计算为声部最高分
                 Map<Long, Double> highestScoreMap = records.stream()
                         .filter(x -> Optional.ofNullable(x.getScore()).orElse(0D) > 0)
+                        .filter(x -> Optional.ofNullable(x.getEvaluationId()).orElse(0L) > 0)
                         .collect(Collectors.groupingBy(ActivityEvaluationRecord::getEvaluationId,
                                 Collectors.mapping(ActivityEvaluationRecord::getScore, Collectors.toSet())))
                         .entrySet().stream()
@@ -115,6 +116,8 @@ public class ActivityEvaluationRecordServiceImpl extends ServiceImpl<ActivityEva
 
                 // 获取最高分的时间为每个单曲最高分的记录时间
                 Map<Long, Long> highestScoreTimeMap = records.stream()
+                        .filter(x -> Optional.ofNullable(x.getScore()).orElse(0D) > 0)
+                        .filter(x -> Optional.ofNullable(x.getEvaluationId()).orElse(0L) > 0)
                         .filter(x -> highestScoreMap.getOrDefault(x.getEvaluationId(), -1D).doubleValue() == x.getScore())
                         .collect(Collectors.groupingBy(ActivityEvaluationRecord::getEvaluationId, Collectors.mapping(x -> x.getCreateTime().getTime(), Collectors.toSet())))
                         .entrySet().stream()

+ 2 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ActivityEvaluationServiceImpl.java

@@ -240,7 +240,8 @@ public class ActivityEvaluationServiceImpl extends ServiceImpl<ActivityEvaluatio
             if (ActivityRankingMethodEnum.TOTAL_SCORE == activity.getRankingMethod()) {
 
                 Map<Long, Double> collect = Maps.newHashMap();
-                if (result.stream().anyMatch(x -> x.getJoin() == YesOrNoEnum.YES)) {
+                if (result.stream().anyMatch(x -> x.getJoin() == YesOrNoEnum.YES
+                        && Objects.nonNull(userId))) {
 
                     collect = getBaseMapper().selectSubjectMusicHighestScoreStat(activity.getId(), userId).stream()
                             .collect(Collectors.toMap(StatGroupWrapper::getId, StatGroupWrapper::getNumber, (o, n) -> n));

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ActivityPlanServiceImpl.java

@@ -509,7 +509,7 @@ public class ActivityPlanServiceImpl extends ServiceImpl<ActivityPlanDao, Activi
 
 
         // 评测活动曲目信息
-        if (ActivityTypeEnum.EVALUATION == activityPlan.getActivityType() && Objects.nonNull(userId)) {
+        if (ActivityTypeEnum.EVALUATION == activityPlan.getActivityType()) {
 
             // 活动曲目
             List<ActivityMusicVo> activityMusicVoList = activityEvaluationService.getActivityMusic(activityPlanId, userId);