|
@@ -1,6 +1,9 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
+import com.dayaedu.cbs.openfeign.client.MusicFeignClientService;
|
|
|
import com.dayaedu.cbs.openfeign.client.SubjectFeignClientService;
|
|
|
+import com.dayaedu.cbs.openfeign.wrapper.musicInstrument.CbsMusicalInstrumentWrapper;
|
|
|
+import com.microsvc.toolkit.common.response.template.R;
|
|
|
import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
|
|
|
import com.ym.mec.biz.dal.dao.SubjectDao;
|
|
|
import com.ym.mec.biz.dal.dao.SubjectGoodsMapperDao;
|
|
@@ -18,6 +21,7 @@ import com.ym.mec.biz.dal.wrapper.SubjectWrapper;
|
|
|
import com.ym.mec.biz.service.InstrumentService;
|
|
|
import com.ym.mec.biz.service.SubjectService;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
+import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
@@ -43,7 +47,7 @@ public class SubjectServiceImpl extends BaseServiceImpl<Integer, Subject> implem
|
|
|
@Resource
|
|
|
private InstrumentService instrumentService;
|
|
|
@Resource
|
|
|
- private SubjectFeignClientService subjectFeignClientService;
|
|
|
+ private MusicFeignClientService musicFeignClientService;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Integer, Subject> getDAO() {
|
|
@@ -221,13 +225,26 @@ public class SubjectServiceImpl extends BaseServiceImpl<Integer, Subject> implem
|
|
|
pageInfo.setTotal(count);
|
|
|
params.put("offset", pageInfo.getOffset());
|
|
|
dataList = subjectDao.queryPageByIdOrName(params);
|
|
|
- List<Integer> subjectIds = dataList.stream().map(e -> e.getId()).collect(Collectors.toList());
|
|
|
+ List<Integer> subjectIds = dataList.stream().map(Subject::getId).collect(Collectors.toList());
|
|
|
List<Instrument> list = instrumentService.lambdaQuery().in(Instrument::getSubjectId, subjectIds).list();
|
|
|
- List<Long> instrumentIds = list.stream().map(e -> e.getId()).collect(Collectors.toList());
|
|
|
- com.dayaedu.cbs.openfeign.wrapper.subject.SubjectWrapper.SubjectQuery query = new com.dayaedu.cbs.openfeign.wrapper.subject.SubjectWrapper.SubjectQuery();
|
|
|
- query.getMusicalInstrumentIdList(StringUtils.join(instrumentIds, ","));
|
|
|
+ List<Integer> instrumentIds = list.stream().map(Instrument::getId).collect(Collectors.toList());
|
|
|
+ CbsMusicalInstrumentWrapper.MusicalInstrumentQuery query = new CbsMusicalInstrumentWrapper.MusicalInstrumentQuery();
|
|
|
+ query.setIds(instrumentIds);
|
|
|
query.setPage(1);
|
|
|
- subjectFeignClientService.page()
|
|
|
+ query.setRows(instrumentIds.size());
|
|
|
+ R<com.microsvc.toolkit.common.response.paging.PageInfo<CbsMusicalInstrumentWrapper.MusicalInstrumentQueryDto>> infoR = musicFeignClientService.musicalInstrumentPage(query);
|
|
|
+ if (infoR.getCode() != 200){
|
|
|
+ throw new BizException("调用内容平台失败 : {}",infoR.getMessage());
|
|
|
+ }
|
|
|
+ List<CbsMusicalInstrumentWrapper.MusicalInstrumentQueryDto> rows = infoR.getData().getRows();
|
|
|
+ Map<Integer,CbsMusicalInstrumentWrapper.MusicalInstrumentQueryDto> map = rows.stream()
|
|
|
+ .collect(Collectors.toMap(CbsMusicalInstrumentWrapper.MusicalInstrumentQueryDto::getSubjectId, Function.identity()));
|
|
|
+ for (Subject subject : dataList) {
|
|
|
+ CbsMusicalInstrumentWrapper.MusicalInstrumentQueryDto dto = map.get(subject.getCbsSubjectId());
|
|
|
+ if (dto != null) {
|
|
|
+ subject.setInstitutionName(dto.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if (count == 0) {
|
|
|
dataList = new ArrayList<>();
|