浏览代码

扩展乐器

刘俊驰 5 月之前
父节点
当前提交
0dc229e183

+ 28 - 4
mec-application/src/main/java/com/ym/mec/student/controller/StudentManageController.java

@@ -9,6 +9,7 @@ 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;
@@ -31,10 +32,7 @@ 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 = "学生管理")
@@ -272,6 +270,32 @@ public class StudentManageController extends BaseController {
                 datas.put("instrumentId", StringUtils.join(instrumentIdsBySubjectId, ","));
             }
         }
+
+        // 扩展乐器
+        if (student.getExtSjectNamesMap() !=null && !student.getExtSjectNamesMap().isEmpty()) {
+            Set<Integer> integers = student.getExtSjectNamesMap().keySet();
+            for (Integer integer : integers) {
+                if ("5".equals(integer.toString())) {
+                    integers.add(6);
+                } else  if("122".equals(integer.toString())){
+                    integers.add(121);
+                    integers.add(113);
+                    integers.add(23);
+                }
+            }
+
+            List<Integer> instrumentIdsBySubjectId = instrumentService.getInstrumentIdsBySubjectId(StringUtils.join(integers,","));
+            Map<Integer, InstrumentWrapper.Instrument> mapByIds = instrumentService.getMapByIds(instrumentIdsBySubjectId);
+            Map<Integer,String> extInstrumentNamesMap = new HashMap<Integer, String>();
+            mapByIds.forEach((k,v)->{
+                if (v !=null) {
+                    extInstrumentNamesMap.put(k, v.getName());
+                }
+            });
+            student.setExtInstrumentNamesMap(extInstrumentNamesMap);
+        }
+
+
 		return succeed(datas);
 	}
 

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Student.java

@@ -79,6 +79,7 @@ public class Student extends SysUser {
 	private String extSubjectIds;
 	
 	private Map<Integer,String> extSjectNamesMap = new HashMap<Integer, String>();
+	private Map<Integer,String> extInstrumentNamesMap = new HashMap<Integer, String>();
 
 	@ApiModelProperty(value = "家长姓名")
 	private String parentName;
@@ -92,6 +93,13 @@ public class Student extends SysUser {
     @ApiModelProperty("IM绑定设备")
     private String imDeviceId;
 
+    public Map<Integer, String> getExtInstrumentNamesMap() {
+        return extInstrumentNamesMap;
+    }
+
+    public void setExtInstrumentNamesMap(Map<Integer, String> extInstrumentNamesMap) {
+        this.extInstrumentNamesMap = extInstrumentNamesMap;
+    }
 
     public String getImDeviceId() {
         return imDeviceId;