Browse Source

教师端课堂报告返回章节名称

通知班级、科目拉下列表排序
tags/正式3.13.3
雍文秀 1 year ago
parent
commit
9aa5f52f05

+ 0
- 13
sapi/src/main/java/com/xhkjedu/sapi/controller/notice/NoticeController.java View File

185
         for (Map.Entry<Object, List<Map>> entry : gMap.entrySet()) {
185
         for (Map.Entry<Object, List<Map>> entry : gMap.entrySet()) {
186
             Map<String, Object> g = new LinkedHashMap<>();
186
             Map<String, Object> g = new LinkedHashMap<>();
187
             g.put("gradeid", entry.getKey());
187
             g.put("gradeid", entry.getKey());
188
-            //List<Map<Object, List<Map>>> subjectClass = new ArrayList<>();
189
-            /*List<Map> subjectClass = entry.getValue();
190
-            Map<String, List<Map>> collect = users.stream().collect(Collectors.groupingBy(m -> m.get("subjectid").toString() + m.get("classid")));
191
-            for (Map.Entry<String, List<Map>> uentry : collect.entrySet()) {
192
-                List<Map> value = uentry.getValue();
193
-                Map map = value.get(0);
194
-                Map sc = new LinkedHashMap();
195
-                sc.put("subjectid", map.get("subjectid"));
196
-                sc.put("classid", map.get("classid"));
197
-                sc.put("name", map.get("name"));
198
-                sc.put("users", value);
199
-                subjectClass.add(sc);
200
-            }*/
201
             g.put("subjectClass", entry.getValue());
188
             g.put("subjectClass", entry.getValue());
202
             grades.add(g);
189
             grades.add(g);
203
         }
190
         }

+ 21
- 8
sapi/src/main/java/com/xhkjedu/sapi/service/notice/NoticeService.java View File

9
 import com.xhkjedu.sapi.mapper.notice.*;
9
 import com.xhkjedu.sapi.mapper.notice.*;
10
 import com.xhkjedu.sapi.model.notice.TNoticeFile;
10
 import com.xhkjedu.sapi.model.notice.TNoticeFile;
11
 import com.xhkjedu.sapi.model.notice.TNotice;
11
 import com.xhkjedu.sapi.model.notice.TNotice;
12
+import com.xhkjedu.sapi.vo.notice.NoticeClassVo;
12
 import com.xhkjedu.utils.N_Utils;
13
 import com.xhkjedu.utils.N_Utils;
13
 import com.xhkjedu.sapi.vo.notice.NoticeVo;
14
 import com.xhkjedu.sapi.vo.notice.NoticeVo;
14
 import org.springframework.stereotype.Service;
15
 import org.springframework.stereotype.Service;
265
         List<TNoticeUser> users = noticeUserMapper.listSubjectAndClass(noticeid);
266
         List<TNoticeUser> users = noticeUserMapper.listSubjectAndClass(noticeid);
266
         List<Map<String, Integer>> grades = new ArrayList<>();
267
         List<Map<String, Integer>> grades = new ArrayList<>();
267
         List<Map<String, Object>> subjects = new ArrayList<>();
268
         List<Map<String, Object>> subjects = new ArrayList<>();
268
-        List<Map<String, Object>> classes = new ArrayList<>();
269
+        List<NoticeClassVo> classes = new ArrayList<>();
269
         for (TNoticeUser user : users) {
270
         for (TNoticeUser user : users) {
270
             String subjectid = user.getSubjectid();
271
             String subjectid = user.getSubjectid();
271
             Integer gradeid = user.getGradeid();
272
             Integer gradeid = user.getGradeid();
272
             Map<String, Integer> g = new LinkedHashMap<>();
273
             Map<String, Integer> g = new LinkedHashMap<>();
273
             g.put("gradeid", gradeid);
274
             g.put("gradeid", gradeid);
274
             grades.add(g);
275
             grades.add(g);
275
-            Map<String, Object> sc = new LinkedHashMap<>();
276
-            String username = user.getUsername();
276
+            String[] username = user.getUsername().split("_");
277
             if (N_Utils.isEmpty(subjectid)) {
277
             if (N_Utils.isEmpty(subjectid)) {
278
-                sc.put("gradeid", gradeid);
279
-                sc.put("classid", user.getClassid());
280
-                sc.put("classname", username);
281
-                classes.add(sc);
278
+                NoticeClassVo c = new NoticeClassVo();
279
+                c.setGradeid(gradeid);
280
+                c.setClassid(user.getClassid());
281
+                c.setClassname(username[0]);
282
+                String[] typeOrder = username[1].split("-");
283
+                c.setClasstype(N_Utils.str2Int(typeOrder[0]));
284
+                c.setClassorder(N_Utils.str2Int(typeOrder[1]));
285
+                classes.add(c);
282
             } else {
286
             } else {
287
+                Map<String, Object> sc = new LinkedHashMap<>();
283
                 sc.put("subjectid", subjectid);
288
                 sc.put("subjectid", subjectid);
284
-                sc.put("subjectname", username);
289
+                sc.put("subjectname", username[0]);
290
+                sc.put("subjectorder", username[1]);
285
                 subjects.add(sc);
291
                 subjects.add(sc);
286
             }
292
             }
287
         }
293
         }
288
         grades.sort(Comparator.comparing(m -> m.get("gradeid")));
294
         grades.sort(Comparator.comparing(m -> m.get("gradeid")));
295
+        subjects.sort(Comparator.comparing(m -> N_Utils.str2Int(m.get("subjectorder").toString())));
296
+        classes = classes.stream().sorted(
297
+                Comparator.comparingInt(NoticeClassVo::getGradeid)
298
+                          .thenComparing(NoticeClassVo::getClasstype)
299
+                          .thenComparing(NoticeClassVo::getClassorder)
300
+                          .thenComparing(NoticeClassVo::getClassname)
301
+        ).collect(Collectors.toList());
289
         map.put("grades", grades.stream().distinct().collect(Collectors.toList()));
302
         map.put("grades", grades.stream().distinct().collect(Collectors.toList()));
290
         map.put("subjects", subjects.stream().distinct().collect(Collectors.toList()));
303
         map.put("subjects", subjects.stream().distinct().collect(Collectors.toList()));
291
         map.put("classes", classes);
304
         map.put("classes", classes);

+ 21
- 0
sapi/src/main/java/com/xhkjedu/sapi/vo/notice/NoticeClassVo.java View File

1
+package com.xhkjedu.sapi.vo.notice;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class NoticeClassVo {
7
+    //年级id
8
+    private Integer gradeid;
9
+
10
+    //班级id
11
+    private Integer classid;
12
+
13
+    //班级名称
14
+    private String classname;
15
+
16
+    //班级类型
17
+    private Integer classtype;
18
+
19
+    //班级排序
20
+    private Integer classorder;
21
+}

+ 2
- 2
sapi/src/main/resources/mapper/notice/NoticeUserMapper.xml View File

50
     <!--获取通知科目和班级-->
50
     <!--获取通知科目和班级-->
51
     <select id="listSubjectAndClass" resultType="com.xhkjedu.sapi.model.notice.TNoticeUser">
51
     <select id="listSubjectAndClass" resultType="com.xhkjedu.sapi.model.notice.TNoticeUser">
52
         select nu.gradeid,nu.classid,nu.subjectid
52
         select nu.gradeid,nu.classid,nu.subjectid
53
-        ,if(nu.classid is not null,(select c.classname from t_class c where c.classid=nu.classid)
54
-            ,(select s.subjectname from t_subject s where s.subjectid=nu.subjectid))username
53
+        ,if(nu.classid is not null,(select concat(c.classname,'_',c.classtype,'-',c.classorder) from t_class c where c.classid=nu.classid)
54
+            ,(select concat(s.subjectname,'_',s.subjectorder) from t_subject s where s.subjectid=nu.subjectid))username
55
         from t_notice_user nu where noticeid=#{noticeid}
55
         from t_notice_user nu where noticeid=#{noticeid}
56
         group by nu.gradeid,nu.classid,nu.subjectid
56
         group by nu.gradeid,nu.classid,nu.subjectid
57
     </select>
57
     </select>

+ 3
- 0
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ReportRoomVo.java View File

57
 
57
 
58
     //视频列表
58
     //视频列表
59
     private List<Map> videos;
59
     private List<Map> videos;
60
+
61
+    //章节名称
62
+    private String directorname;
60
 }
63
 }

+ 1
- 0
sclass/src/main/resources/mapper/classroom/ClassroomMapper.xml View File

396
         select r.roomname,r.classnum,r.realstunum,r.createtime,r.endtime,c.classname,c.gradeid,u.username createname
396
         select r.roomname,r.classnum,r.realstunum,r.createtime,r.endtime,c.classname,c.gradeid,u.username createname
397
         ,(select count(*) from t_classroom_askteacher ct where ct.roomid=r.roomid and ct.asktype=20)asknum
397
         ,(select count(*) from t_classroom_askteacher ct where ct.roomid=r.roomid and ct.asktype=20)asknum
398
         ,(select count(*) from t_classroom_askteacher ct where ct.roomid=r.roomid and ct.asktype=21)callnum
398
         ,(select count(*) from t_classroom_askteacher ct where ct.roomid=r.roomid and ct.asktype=21)callnum
399
+        ,(select d.directorname from t_director d where r.directorid=d.directorid)directorname
399
         from t_classroom r left join t_class c on r.classid=c.classid
400
         from t_classroom r left join t_class c on r.classid=c.classid
400
         left join t_user u on r.createid=u.userid
401
         left join t_user u on r.createid=u.userid
401
         where r.roomid=#{roomid}
402
         where r.roomid=#{roomid}

Loading…
Cancel
Save