|
@@ -2,6 +2,7 @@ package com.yonge.cooleshow.biz.dal.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.extension.service.additional.update.impl.LambdaUpdateChainWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
@@ -381,6 +382,73 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
|
|
|
// 统计单曲归属专辑数
|
|
|
updateMusicAlbumNumInfo(records);
|
|
|
+
|
|
|
+ // 声部
|
|
|
+
|
|
|
+ List<Long> collect = records.stream().map(MusicSheetVo::getMusicSubject)
|
|
|
+ .filter(StringUtils::isNotEmpty)
|
|
|
+ .map(Long::parseLong)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<Subject> subjectList = subjectService.findBySubjectByIdList(collect);
|
|
|
+ if (CollectionUtils.isNotEmpty(subjectList)) {
|
|
|
+ Map<Long, String> subjectMap = subjectList.stream()
|
|
|
+ .collect(Collectors.toMap(Subject::getId, Subject::getName));
|
|
|
+ for (MusicSheetVo record : records) {
|
|
|
+ if (StringUtils.isNotEmpty(record.getMusicSubject())) {
|
|
|
+ record.setSubjectNames(subjectMap.get(Long.parseLong(record.getMusicSubject())));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 标签
|
|
|
+
|
|
|
+ collect = records.stream().map(MusicSheetVo::getMusicTag)
|
|
|
+ .filter(StringUtils::isNotEmpty)
|
|
|
+ .flatMap(s -> Arrays.stream(s.split(",")))
|
|
|
+ .filter(StringUtils::isNotEmpty)
|
|
|
+ .map(Long::parseLong)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<MusicTag> list = musicTagService.lambdaQuery()
|
|
|
+ .in(MusicTag::getId, collect)
|
|
|
+ .eq(MusicTag::getDelFlag, 0)
|
|
|
+ .eq(MusicTag::getState, 1)
|
|
|
+ .list();
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ Map<Long, String> tagMap = list.stream()
|
|
|
+ .collect(Collectors.toMap(MusicTag::getId, MusicTag::getName));
|
|
|
+ for (MusicSheetVo record : records) {
|
|
|
+ if (StringUtils.isNotEmpty(record.getMusicTag())) {
|
|
|
+
|
|
|
+ List<Long> tagIdList = Arrays.stream(record.getMusicTag().split(","))
|
|
|
+ .filter(StringUtils::isNotEmpty)
|
|
|
+ .map(Long::parseLong)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ String tagNames = tagIdList.stream().map(tagMap::get).collect(Collectors.joining(","));
|
|
|
+ record.setSubjectNames(tagNames);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 是否关注
|
|
|
+ if (query.getStudentId() != null) {
|
|
|
+ List<Long> musicIdList = records.stream().map(MusicSheetVo::getId).collect(Collectors.toList());
|
|
|
+ List<MusicFavorite> musicFavoriteList = musicFavoriteService.lambdaQuery()
|
|
|
+ .eq(MusicFavorite::getUserId, query.getStudentId())
|
|
|
+ .eq(MusicFavorite::getClientType, query.getClientType())
|
|
|
+ .in(MusicFavorite::getMusicSheetId, musicIdList)
|
|
|
+ .list();
|
|
|
+ if (CollectionUtils.isNotEmpty(musicFavoriteList)) {
|
|
|
+ Set<Long> set = musicFavoriteList.stream()
|
|
|
+ .map(MusicFavorite::getMusicSheetId)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ for (MusicSheetVo record : records) {
|
|
|
+ record.setFavorite(set.contains(record.getId())?YesOrNoEnum.YES:YesOrNoEnum.NO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/*if(query.getMyself() != null && query.getMyself() == false){//首页
|