|
@@ -2,6 +2,7 @@ package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import com.google.common.collect.Sets;
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
@@ -124,6 +125,9 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
@Autowired
|
|
|
private MemberRankSettingService memberRankSettingService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private InstrumentService instrumentService;
|
|
|
+
|
|
|
@Override
|
|
|
public PageInfo<StudentManageListDto> findStudentsByOrganId(StudentManageQueryInfo queryInfo) {
|
|
|
PageInfo<StudentManageListDto> pageInfo = new PageInfo<StudentManageListDto>(queryInfo.getPage(), queryInfo.getRows());
|
|
@@ -1328,6 +1332,92 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
// 学员会员信息
|
|
|
datas.put("vipInfo", cloudTeacherOrderService.getEffectiveCloudTeacherOrder(Lists.newArrayList(student.getUserId())));
|
|
|
|
|
|
+
|
|
|
+ // 通过学生声部换乐器ID
|
|
|
+ if (StringUtils.isNotBlank(student.getSubjectIdList())) {
|
|
|
+ String subjectId = student.getSubjectIdList();
|
|
|
+ if ("5".equals(student.getSubjectIdList())) {
|
|
|
+ subjectId = "6";
|
|
|
+ } else if("122".equals(student.getSubjectIdList())){
|
|
|
+ subjectId = "122,121,113,23";
|
|
|
+ }
|
|
|
+ List<Integer> instrumentIdsBySubjectId = instrumentService.getInstrumentIdsBySubjectId(subjectId)
|
|
|
+ .stream().map(Instrument::getId).collect(Collectors.toList());
|
|
|
+ if (!CollectionUtils.isEmpty(instrumentIdsBySubjectId)) {
|
|
|
+ // 逗号隔开
|
|
|
+ datas.put("instrumentId", StringUtils.join(instrumentIdsBySubjectId, ","));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 扩展乐器
|
|
|
+ if (student.getExtSjectNamesMap() !=null && !student.getExtSjectNamesMap().isEmpty()) {
|
|
|
+ Set<Integer> integers = student.getExtSjectNamesMap().keySet();
|
|
|
+ Set<Integer> extInstrumentIds = Sets.newConcurrentHashSet();
|
|
|
+ for (Integer integer : integers) {
|
|
|
+ extInstrumentIds.add(integer);
|
|
|
+
|
|
|
+ if ("5".equals(integer.toString())) {
|
|
|
+ extInstrumentIds.add(6);
|
|
|
+ } else if("122".equals(integer.toString())){
|
|
|
+ extInstrumentIds.add(121);
|
|
|
+ extInstrumentIds.add(113);
|
|
|
+ extInstrumentIds.add(23);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 根据声部查询对应乐器信息
|
|
|
+ List<Instrument> instruments = instrumentService.getInstrumentIdsBySubjectId(StringUtils.join(extInstrumentIds, ","));
|
|
|
+ List<Map<String, Object>> extInstrumentNames = Lists.newArrayList();
|
|
|
+ if (!CollectionUtils.isEmpty(instruments)) {
|
|
|
+
|
|
|
+ Map<Integer, List<Instrument>> collect = instruments.stream().collect(Collectors.groupingBy(Instrument::getSubjectId, Collectors.toList()));
|
|
|
+ for (Map.Entry<Integer, String> entry : student.getExtSjectNamesMap().entrySet()) {
|
|
|
+
|
|
|
+ // 默认声部映射乐器ID
|
|
|
+ String instrumentIds = "";
|
|
|
+ if (collect.containsKey(entry.getKey())) {
|
|
|
+ instrumentIds = collect.get(entry.getKey()).stream()
|
|
|
+ .map(Instrument::getId).map(String::valueOf).collect(Collectors.joining(","));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 萨克斯乐器,对应中音萨克斯
|
|
|
+ if (entry.getKey() == 5 || entry.getKey() == 6) {
|
|
|
+
|
|
|
+ instrumentIds = collect.entrySet().stream()
|
|
|
+ .filter(x -> x.getKey() == 5 || x.getKey() == 6)
|
|
|
+ .flatMap(x -> x.getValue().stream())
|
|
|
+ .map(Instrument::getId)
|
|
|
+ .map(String::valueOf).collect(Collectors.joining(","));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 打击乐器,对应小军鼓,打击乐(键盘),打击乐(键盘+小鼓),打击乐
|
|
|
+ if (entry.getKey() == 122 || entry.getKey() == 121 || entry.getKey() == 113 || entry.getKey() == 23) {
|
|
|
+
|
|
|
+ instrumentIds = collect.entrySet().stream()
|
|
|
+ .filter(x -> x.getKey() == 122 || x.getKey() == 121 || x.getKey() == 113 || x.getKey() == 23)
|
|
|
+ .flatMap(x -> x.getValue().stream())
|
|
|
+ .map(Instrument::getId)
|
|
|
+ .map(String::valueOf).collect(Collectors.joining(","));
|
|
|
+ }
|
|
|
+ String finalInstrumentIds = instrumentIds;
|
|
|
+ extInstrumentNames.add(new HashMap<String, Object>(){{
|
|
|
+ put("subjectId", entry.getKey());
|
|
|
+ put("subjectName", entry.getValue());
|
|
|
+ put("instrumentIds", finalInstrumentIds);
|
|
|
+ }});
|
|
|
+ }
|
|
|
+
|
|
|
+ /*List<Integer> instrumentIdsBySubjectId = instruments.stream().map(Instrument::getId).collect(Collectors.toList());
|
|
|
+ Map<Integer, InstrumentWrapper.Instrument> mapByIds = instrumentService.getMapByIds(instrumentIdsBySubjectId);
|
|
|
+ mapByIds.forEach((k,v)->{
|
|
|
+ if (v !=null) {
|
|
|
+ extInstrumentNamesMap.put(k, v.getName());
|
|
|
+ }
|
|
|
+ });*/
|
|
|
+ }
|
|
|
+ student.setExtInstrumentNames(extInstrumentNames);
|
|
|
+ }
|
|
|
+
|
|
|
return student;
|
|
|
}
|
|
|
}
|