Browse Source

增加曲目评测难度

Eric 2 years ago
parent
commit
a21cd10c9e

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

@@ -534,6 +534,26 @@ public class ActivityPlanServiceImpl extends ServiceImpl<ActivityPlanDao, Activi
                 Map<String, List<ActivityMusicVo>> collect = activityMusicVoList.stream()
                         .collect(Collectors.groupingBy(x -> x.getSubjectId().split(",")[0]));
 
+                // 曲目难度
+                Map<Integer, String> difficultyMap = Maps.newHashMap();
+                difficultyMap.put(0, "BEGINNER");
+                difficultyMap.put(1, "ADVANCED");
+                difficultyMap.put(2, "PERFORMER");
+                // FIXME:临时增加声部曲目难度字段
+                for (Map.Entry<String, List<ActivityMusicVo>> entry : collect.entrySet()) {
+
+                    int index = 0;
+                    for (ActivityMusicVo item : entry.getValue()) {
+
+                        if (StringUtils.isEmpty(item.getEvaluationDifficulty())) {
+
+                            item.setEvaluationDifficulty(difficultyMap.getOrDefault(index, "PERFORMER"));
+                        }
+
+                        index += 1;
+                    }
+                }
+
                 // 计算声部评测最高分
                 Map<String, ActivityRankingVo> highestScoreMap = Maps.newConcurrentMap();
                 collect.entrySet().parallelStream().forEach(item -> {

+ 11 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/ActivityMusicVo.java

@@ -56,6 +56,9 @@ public class ActivityMusicVo {
     @ApiModelProperty("曲目图片")
     private String musicImage;
 
+    @ApiModelProperty("评测难度 BEGINNER 入门级 ADVANCED 进阶级 PERFORMER 大师级")
+    private String  evaluationDifficulty;
+
     public Long getUserId() {
         return userId;
     }
@@ -152,6 +155,14 @@ public class ActivityMusicVo {
         this.composer = composer;
     }
 
+    public String getEvaluationDifficulty() {
+        return evaluationDifficulty;
+    }
+
+    public void setEvaluationDifficulty(String evaluationDifficulty) {
+        this.evaluationDifficulty = evaluationDifficulty;
+    }
+
     public String getMusicImage() {
         return musicImage;
     }

+ 1 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/ActivityEvaluationMapper.xml

@@ -71,6 +71,7 @@
         ,s.name_ as musicSubject
         , ms.composer_ AS composer
         ,ae.id_ as evaluationId
+        , ae.evaluation_difficulty_ AS evaluationDifficulty
         ,(select if(count(1)>0,1,0) as `join` from activity_evaluation_record aer where aer.evaluation_id_ = ae.id_ and aer.user_id_ = #{userId}) as `join`
         from activity_evaluation ae
         left join music_sheet ms on ms.id_ = ae.music_sheet_id_