|
@@ -18,14 +18,13 @@ import com.yonge.toolset.base.util.StringUtil;
|
|
|
import com.yonge.toolset.mybatis.dal.BaseDAO;
|
|
|
import com.yonge.toolset.mybatis.service.impl.BaseServiceImpl;
|
|
|
import com.yonge.toolset.utils.collection.MapUtil;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.redisson.api.RedissonClient;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
-
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
@@ -72,7 +71,7 @@ public class SubjectServiceImpl extends BaseServiceImpl<Long, Subject> implement
|
|
|
public PageInfo<Subject> queryPageTree(SubjectQueryInfo queryInfo) {
|
|
|
PageInfo<Subject> pageInfo = queryPage(queryInfo);
|
|
|
for (Subject subject : pageInfo.getRows()) {
|
|
|
- subject = getTree(subject, queryInfo.getDelFlag());
|
|
|
+ getTree(subject, queryInfo.getDelFlag());
|
|
|
}
|
|
|
return pageInfo;
|
|
|
}
|
|
@@ -392,6 +391,47 @@ public class SubjectServiceImpl extends BaseServiceImpl<Long, Subject> implement
|
|
|
return records;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void convertSubject(List<Subject> subjectSelect) {
|
|
|
+ if(CollectionUtils.isNotEmpty(subjectSelect)){
|
|
|
+ for (Subject entity : subjectSelect) {
|
|
|
+ List<Subject> subjects = entity.getSubjects();
|
|
|
+ if(CollectionUtils.isNotEmpty(subjects)){
|
|
|
+ // 转map
|
|
|
+ Map<Long, Subject> subjectMap = subjects.stream().collect(Collectors.toMap(Subject::getCbsSubjectId, Function.identity(),(o1, o2)->o1));
|
|
|
+ // cbs声部ID集合
|
|
|
+ List<Long> cbsSubjectIds = subjects.stream().map(Subject::getCbsSubjectId).collect(Collectors.toList());
|
|
|
+ subjects = new ArrayList<>();
|
|
|
+ CbsSubjectWrapper.SubjectQuery subjectQuery = new CbsSubjectWrapper.SubjectQuery();
|
|
|
+ subjectQuery.setIds(cbsSubjectIds);
|
|
|
+ subjectQuery.setPage(1);
|
|
|
+ subjectQuery.setRows(cbsSubjectIds.size());
|
|
|
+ try {
|
|
|
+ com.microsvc.toolkit.common.response.paging.PageInfo<CbsSubjectWrapper.Subject> subjectPageInfo = musicFeignClientService.subjectPage(subjectQuery).feignData();
|
|
|
+ List<CbsSubjectWrapper.Subject> rows = subjectPageInfo.getRows();
|
|
|
+ if (org.apache.commons.collections.CollectionUtils.isNotEmpty(rows)) {
|
|
|
+ for (CbsSubjectWrapper.Subject row : rows) {
|
|
|
+ Subject subject = subjectMap.get(row.getId());
|
|
|
+ if (subject == null) {
|
|
|
+ log.warn("未查询到声部信息,id:{}", row.getId());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ subject.setCbsSubjectName(row.getName());
|
|
|
+ subject.setName(row.getName());
|
|
|
+ subject.setCode(row.getCode());
|
|
|
+ subjects.add(subject);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("调用音乐服务查询曲目详情失败", e);
|
|
|
+ }
|
|
|
+ entity.setSubjects(subjects);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/***
|
|
|
* 查询声部树
|
|
|
* @param: sub
|