|  | @@ -18,14 +18,13 @@ import com.yonge.toolset.base.util.StringUtil;
 | 
											
												
													
														|  |  import com.yonge.toolset.mybatis.dal.BaseDAO;
 |  |  import com.yonge.toolset.mybatis.dal.BaseDAO;
 | 
											
												
													
														|  |  import com.yonge.toolset.mybatis.service.impl.BaseServiceImpl;
 |  |  import com.yonge.toolset.mybatis.service.impl.BaseServiceImpl;
 | 
											
												
													
														|  |  import com.yonge.toolset.utils.collection.MapUtil;
 |  |  import com.yonge.toolset.utils.collection.MapUtil;
 | 
											
												
													
														|  | 
 |  | +import org.apache.commons.collections.CollectionUtils;
 | 
											
												
													
														|  |  import org.apache.commons.lang3.StringUtils;
 |  |  import org.apache.commons.lang3.StringUtils;
 | 
											
												
													
														|  |  import org.redisson.api.RedissonClient;
 |  |  import org.redisson.api.RedissonClient;
 | 
											
												
													
														|  |  import org.slf4j.Logger;
 |  |  import org.slf4j.Logger;
 | 
											
												
													
														|  |  import org.slf4j.LoggerFactory;
 |  |  import org.slf4j.LoggerFactory;
 | 
											
												
													
														|  |  import org.springframework.stereotype.Service;
 |  |  import org.springframework.stereotype.Service;
 | 
											
												
													
														|  |  import org.springframework.transaction.annotation.Transactional;
 |  |  import org.springframework.transaction.annotation.Transactional;
 | 
											
												
													
														|  | -import org.springframework.util.CollectionUtils;
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |  import javax.annotation.Resource;
 |  |  import javax.annotation.Resource;
 | 
											
												
													
														|  |  import java.util.*;
 |  |  import java.util.*;
 | 
											
												
													
														|  |  import java.util.concurrent.TimeUnit;
 |  |  import java.util.concurrent.TimeUnit;
 | 
											
										
											
												
													
														|  | @@ -72,7 +71,7 @@ public class SubjectServiceImpl extends BaseServiceImpl<Long, Subject> implement
 | 
											
												
													
														|  |      public PageInfo<Subject> queryPageTree(SubjectQueryInfo queryInfo) {
 |  |      public PageInfo<Subject> queryPageTree(SubjectQueryInfo queryInfo) {
 | 
											
												
													
														|  |          PageInfo<Subject> pageInfo = queryPage(queryInfo);
 |  |          PageInfo<Subject> pageInfo = queryPage(queryInfo);
 | 
											
												
													
														|  |          for (Subject subject : pageInfo.getRows()) {
 |  |          for (Subject subject : pageInfo.getRows()) {
 | 
											
												
													
														|  | -            subject = getTree(subject, queryInfo.getDelFlag());
 |  | 
 | 
											
												
													
														|  | 
 |  | +             getTree(subject, queryInfo.getDelFlag());
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          return pageInfo;
 |  |          return pageInfo;
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
										
											
												
													
														|  | @@ -393,25 +392,46 @@ public class SubjectServiceImpl extends BaseServiceImpl<Long, Subject> implement
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  | -    public PageInfo<SubjectWrapper.Subject> queryPage1(SubjectQueryInfo query) {
 |  | 
 | 
											
												
													
														|  | -        PageInfo<SubjectWrapper.Subject> pageInfo = new PageInfo<>(query.getPage(), query.getRows());
 |  | 
 | 
											
												
													
														|  | -        Map<String, Object> params = new HashMap<>();
 |  | 
 | 
											
												
													
														|  | -        MapUtil.populateMap(params, query);
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -        List<SubjectWrapper.Subject> dataList = null;
 |  | 
 | 
											
												
													
														|  | -        int count = subjectDao.findCount(params);
 |  | 
 | 
											
												
													
														|  | -        if (count > 0) {
 |  | 
 | 
											
												
													
														|  | -            pageInfo.setTotal(count);
 |  | 
 | 
											
												
													
														|  | -            params.put("offset", pageInfo.getOffset());
 |  | 
 | 
											
												
													
														|  | -            dataList = subjectDao.findPage(params);
 |  | 
 | 
											
												
													
														|  | -        }
 |  | 
 | 
											
												
													
														|  | -        if (count == 0) {
 |  | 
 | 
											
												
													
														|  | -            dataList = new ArrayList<>();
 |  | 
 | 
											
												
													
														|  | 
 |  | +    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);
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        pageInfo.setRows(dataList);
 |  | 
 | 
											
												
													
														|  | -        return pageInfo;
 |  | 
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      /***
 |  |      /***
 | 
											
												
													
														|  |       * 查询声部树
 |  |       * 查询声部树
 | 
											
												
													
														|  |       * @param: sub
 |  |       * @param: sub
 |