Quellcode durchsuchen

管乐迷曲目来源内容平台

zouxuan vor 1 Jahr
Ursprung
Commit
4f87abadcc

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Instrument.java

@@ -22,11 +22,11 @@ public class Instrument implements Serializable {
 
     @ApiModelProperty("主键ID,内容平台乐器ID")
     @TableId(value = "id_")
-    private Long id;
+    private Integer id;
 
     @ApiModelProperty("声部ID")
 	@TableField(value = "subject_id_")
-    private Long subjectId;
+    private Integer subjectId;
 
     @ApiModelProperty("横竖屏:1:竖 0:横")
 	@TableField(value = "orientation_")

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Subject.java

@@ -18,7 +18,7 @@ public class Subject {
 	private Integer id;
 
 	/**  */
-	private Long cbsSubjectId;
+	private Integer cbsSubjectId;
 	
 	/**  */
 	@ApiModelProperty(value = "科目名称",required = false)

+ 23 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectServiceImpl.java

@@ -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<>();