|
@@ -1,7 +1,8 @@
|
|
|
package com.ym.mec.student.controller;
|
|
|
|
|
|
+import com.beust.jcommander.internal.Lists;
|
|
|
+import com.google.common.collect.Sets;
|
|
|
import com.microsvc.toolkit.middleware.oss.wrapper.OssWrapper;
|
|
|
-import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.CloudTeacherOrderDao;
|
|
|
import com.ym.mec.biz.dal.dto.CashAccountDetail;
|
|
@@ -9,7 +10,6 @@ import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.ClientEnum;
|
|
|
import com.ym.mec.biz.dal.page.SysSuggestionQueryInfo;
|
|
|
import com.ym.mec.biz.dal.wrapper.ImGroupWrapper;
|
|
|
-import com.ym.mec.biz.dal.wrapper.InstrumentWrapper;
|
|
|
import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.biz.service.im.ImGroupCoreService;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
@@ -26,9 +26,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.MediaType;
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
@@ -264,7 +262,8 @@ public class StudentManageController extends BaseController {
|
|
|
} else if("122".equals(student.getSubjectIdList())){
|
|
|
subjectId = "122,121,113,23";
|
|
|
}
|
|
|
- List<Integer> instrumentIdsBySubjectId = instrumentService.getInstrumentIdsBySubjectId(subjectId);
|
|
|
+ List<Integer> instrumentIdsBySubjectId = instrumentService.getInstrumentIdsBySubjectId(subjectId)
|
|
|
+ .stream().map(Instrument::getId).collect(Collectors.toList());
|
|
|
if (CollectionUtils.isNotEmpty(instrumentIdsBySubjectId)) {
|
|
|
// 逗号隔开
|
|
|
datas.put("instrumentId", StringUtils.join(instrumentIdsBySubjectId, ","));
|
|
@@ -274,27 +273,70 @@ public class StudentManageController extends BaseController {
|
|
|
// 扩展乐器
|
|
|
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())) {
|
|
|
- integers.add(6);
|
|
|
+ extInstrumentIds.add(6);
|
|
|
} else if("122".equals(integer.toString())){
|
|
|
- integers.add(121);
|
|
|
- integers.add(113);
|
|
|
- integers.add(23);
|
|
|
+ extInstrumentIds.add(121);
|
|
|
+ extInstrumentIds.add(113);
|
|
|
+ extInstrumentIds.add(23);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- List<Integer> instrumentIdsBySubjectId = instrumentService.getInstrumentIdsBySubjectId(StringUtils.join(integers,","));
|
|
|
- if (CollectionUtils.isNotEmpty(instrumentIdsBySubjectId)) {
|
|
|
+ // 根据声部查询对应乐器信息
|
|
|
+ List<Instrument> instruments = instrumentService.getInstrumentIdsBySubjectId(StringUtils.join(extInstrumentIds, ","));
|
|
|
+ List<Map<String, Object>> extInstrumentNames = Lists.newArrayList();
|
|
|
+ if (CollectionUtils.isNotEmpty(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);
|
|
|
- Map<Integer, String> extInstrumentNamesMap = new HashMap<Integer, String>();
|
|
|
- mapByIds.forEach((k, v) -> {
|
|
|
- if (v != null) {
|
|
|
+ mapByIds.forEach((k,v)->{
|
|
|
+ if (v !=null) {
|
|
|
extInstrumentNamesMap.put(k, v.getName());
|
|
|
}
|
|
|
- });
|
|
|
- student.setExtInstrumentNamesMap(extInstrumentNamesMap);
|
|
|
+ });*/
|
|
|
}
|
|
|
+ student.setExtInstrumentNames(extInstrumentNames);
|
|
|
}
|
|
|
|
|
|
|