|
@@ -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;
|
|
@@ -25,16 +26,11 @@ 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;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Api(tags = "学生管理")
|
|
@@ -266,12 +262,81 @@ 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, ","));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // 扩展乐器
|
|
|
+ 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.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 = 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 succeed(datas);
|
|
|
}
|
|
|
|