Explorar el Código

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

通知班级、科目拉下列表排序
tags/正式3.13.3
雍文秀 hace 1 año
padre
commit
9aa5f52f05

+ 0
- 13
sapi/src/main/java/com/xhkjedu/sapi/controller/notice/NoticeController.java Ver fichero

@@ -185,19 +185,6 @@ public class NoticeController {
185 185
         for (Map.Entry<Object, List<Map>> entry : gMap.entrySet()) {
186 186
             Map<String, Object> g = new LinkedHashMap<>();
187 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 188
             g.put("subjectClass", entry.getValue());
202 189
             grades.add(g);
203 190
         }

+ 21
- 8
sapi/src/main/java/com/xhkjedu/sapi/service/notice/NoticeService.java Ver fichero

@@ -9,6 +9,7 @@ import com.xhkjedu.sapi.model.notice.TNoticeUser;
9 9
 import com.xhkjedu.sapi.mapper.notice.*;
10 10
 import com.xhkjedu.sapi.model.notice.TNoticeFile;
11 11
 import com.xhkjedu.sapi.model.notice.TNotice;
12
+import com.xhkjedu.sapi.vo.notice.NoticeClassVo;
12 13
 import com.xhkjedu.utils.N_Utils;
13 14
 import com.xhkjedu.sapi.vo.notice.NoticeVo;
14 15
 import org.springframework.stereotype.Service;
@@ -265,27 +266,39 @@ public class NoticeService {
265 266
         List<TNoticeUser> users = noticeUserMapper.listSubjectAndClass(noticeid);
266 267
         List<Map<String, Integer>> grades = new ArrayList<>();
267 268
         List<Map<String, Object>> subjects = new ArrayList<>();
268
-        List<Map<String, Object>> classes = new ArrayList<>();
269
+        List<NoticeClassVo> classes = new ArrayList<>();
269 270
         for (TNoticeUser user : users) {
270 271
             String subjectid = user.getSubjectid();
271 272
             Integer gradeid = user.getGradeid();
272 273
             Map<String, Integer> g = new LinkedHashMap<>();
273 274
             g.put("gradeid", gradeid);
274 275
             grades.add(g);
275
-            Map<String, Object> sc = new LinkedHashMap<>();
276
-            String username = user.getUsername();
276
+            String[] username = user.getUsername().split("_");
277 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 286
             } else {
287
+                Map<String, Object> sc = new LinkedHashMap<>();
283 288
                 sc.put("subjectid", subjectid);
284
-                sc.put("subjectname", username);
289
+                sc.put("subjectname", username[0]);
290
+                sc.put("subjectorder", username[1]);
285 291
                 subjects.add(sc);
286 292
             }
287 293
         }
288 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 302
         map.put("grades", grades.stream().distinct().collect(Collectors.toList()));
290 303
         map.put("subjects", subjects.stream().distinct().collect(Collectors.toList()));
291 304
         map.put("classes", classes);

+ 21
- 0
sapi/src/main/java/com/xhkjedu/sapi/vo/notice/NoticeClassVo.java Ver fichero

@@ -0,0 +1,21 @@
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 Ver fichero

@@ -50,8 +50,8 @@
50 50
     <!--获取通知科目和班级-->
51 51
     <select id="listSubjectAndClass" resultType="com.xhkjedu.sapi.model.notice.TNoticeUser">
52 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 55
         from t_notice_user nu where noticeid=#{noticeid}
56 56
         group by nu.gradeid,nu.classid,nu.subjectid
57 57
     </select>

+ 3
- 0
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ReportRoomVo.java Ver fichero

@@ -57,4 +57,7 @@ public class ReportRoomVo {
57 57
 
58 58
     //视频列表
59 59
     private List<Map> videos;
60
+
61
+    //章节名称
62
+    private String directorname;
60 63
 }

+ 1
- 0
sclass/src/main/resources/mapper/classroom/ClassroomMapper.xml Ver fichero

@@ -396,6 +396,7 @@
396 396
         select r.roomname,r.classnum,r.realstunum,r.createtime,r.endtime,c.classname,c.gradeid,u.username createname
397 397
         ,(select count(*) from t_classroom_askteacher ct where ct.roomid=r.roomid and ct.asktype=20)asknum
398 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 400
         from t_classroom r left join t_class c on r.classid=c.classid
400 401
         left join t_user u on r.createid=u.userid
401 402
         where r.roomid=#{roomid}

Loading…
Cancelar
Guardar