|
@@ -4,18 +4,25 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.MusicCompareRecordStat;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.MusicTag;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.EQueryOp;
|
|
|
import com.yonge.cooleshow.biz.dal.mapper.MusicCompareRecordStatMapper;
|
|
|
import com.yonge.cooleshow.biz.dal.service.MusicCompareRecordStatService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.MusicTagService;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.StatGroupWrapper;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.music.MusicCompareWrapper;
|
|
|
import com.yonge.toolset.mybatis.support.PageUtil;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -28,6 +35,9 @@ import java.util.Objects;
|
|
|
@Service
|
|
|
public class MusicCompareRecordStatServiceImp extends ServiceImpl<MusicCompareRecordStatMapper, MusicCompareRecordStat> implements MusicCompareRecordStatService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private MusicTagService musicTagService;
|
|
|
+
|
|
|
/**
|
|
|
* 曲目统计汇总信息
|
|
|
*
|
|
@@ -112,6 +122,36 @@ public class MusicCompareRecordStatServiceImp extends ServiceImpl<MusicCompareRe
|
|
|
// 用户曲目统计信息
|
|
|
List<MusicCompareWrapper.RecordInfo> recordInfos = getBaseMapper().selectMusicCompareRecordPage(page, query);
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(recordInfos)) {
|
|
|
+
|
|
|
+ List<String> collect = recordInfos.stream()
|
|
|
+ .filter(x -> StringUtils.isNotEmpty(x.getMusicTag()))
|
|
|
+ .flatMap(x -> Arrays.stream(x.getMusicTag().split(",")))
|
|
|
+ .distinct().collect(Collectors.toList());
|
|
|
+
|
|
|
+ Map<Long, String> tagNameMap = musicTagService.lambdaQuery()
|
|
|
+ .eq(MusicTag::getType, "MUSIC")
|
|
|
+ .in(MusicTag::getId, collect)
|
|
|
+ .list().stream()
|
|
|
+ .collect(Collectors.toMap(MusicTag::getId, MusicTag::getName, (o, n) -> n));
|
|
|
+
|
|
|
+ String tagName;
|
|
|
+ for (MusicCompareWrapper.RecordInfo item : recordInfos) {
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(item.getMusicTag())) {
|
|
|
+
|
|
|
+ List<Long> tagIds = Arrays.stream(item.getMusicTag().split(","))
|
|
|
+ .map(Long::parseLong).distinct().collect(Collectors.toList());
|
|
|
+
|
|
|
+ tagName = tagNameMap.entrySet().stream()
|
|
|
+ .filter(x -> tagIds.contains(x.getKey()))
|
|
|
+ .map(Map.Entry::getValue).collect(Collectors.joining(","));
|
|
|
+
|
|
|
+ item.setMusicTagName(tagName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return page.setRecords(recordInfos);
|
|
|
}
|
|
|
|