Просмотр исходного кода

考试通知完善

tags/正式3.13.3
雍文秀 1 год назад
Родитель
Сommit
628462571a

+ 13
- 10
sexam/src/main/java/com/xhkjedu/sexam/controller/exam/ESubjectInvigilateController.java Просмотреть файл

@@ -23,7 +23,6 @@ import org.springframework.web.bind.annotation.RestController;
23 23
 
24 24
 import javax.annotation.Resource;
25 25
 import java.util.ArrayList;
26
-import java.util.Arrays;
27 26
 import java.util.List;
28 27
 import java.util.Map;
29 28
 
@@ -71,23 +70,20 @@ public class ESubjectInvigilateController {
71 70
         Integer schoolid = (Integer) s.get("schoolid");
72 71
         String noticetitle = s.get("examname") + "-监考设置";
73 72
         Integer gradeid = N_Utils.str2Int(s.get("gradeid").toString());
73
+        String noticecontent = "【" + subjectname + "】";
74
+        if (N_Utils.isNotEmpty(s.get("sdate"))) {
75
+            noticecontent += s.get("sdate") + " " + s.get("begintime") + "-" + s.get("endtime") + "\n请在规定时间段监考";
76
+        }
77
+        List<TNoticeUser> users = new ArrayList<>();
74 78
         for (ESubjectInvigilate ei : teachers) {
75 79
             Integer teacherid = ei.getTeacherid();
76 80
             if (N_Utils.isEmptyInteger(teacherid)) continue;
77
-            String noticecontent = "【" + subjectname + "】";
78
-            if (N_Utils.isNotEmpty(s.get("sdate"))) {
79
-                noticecontent += s.get("sdate") + " " + s.get("begintime") + "-" + s.get("endtime") + "\n请在规定时间段监考";
80
-            }
81 81
             if (notice == 1) {
82
-                TNotice n = new TNotice();
83
-                n.setNoticetitle(noticetitle);
84
-                n.setNoticecontent(noticecontent);
85 82
                 TNoticeUser nt = new TNoticeUser();
86 83
                 nt.setUserid(teacherid);
87 84
                 nt.setGradeid(gradeid);
88 85
                 nt.setSubjectid(subjectid);
89
-                n.setUsers(Arrays.asList(nt));
90
-                noticeList.add(n);
86
+                users.add(nt);
91 87
             }
92 88
             if (msg == 1) {
93 89
                 TMsg m = new TMsg();
@@ -96,6 +92,13 @@ public class ESubjectInvigilateController {
96 92
                 msgList.add(m);
97 93
             }
98 94
         }
95
+        if (notice == 1) {
96
+            TNotice n = new TNotice();
97
+            n.setNoticetitle(noticetitle);
98
+            n.setNoticecontent(noticecontent);
99
+            n.setUsers(users);
100
+            noticeList.add(n);
101
+        }
99 102
         noticeService.batchSave(noticeList, msgList, schoolid, createid, 2);
100 103
         return new ResultVo(0, "设置成功");
101 104
     }

+ 13
- 10
sexam/src/main/java/com/xhkjedu/sexam/controller/paper/EPaperCorrectclassController.java Просмотреть файл

@@ -17,7 +17,6 @@ import org.springframework.web.bind.annotation.RestController;
17 17
 
18 18
 import javax.annotation.Resource;
19 19
 import java.util.ArrayList;
20
-import java.util.Arrays;
21 20
 import java.util.List;
22 21
 import java.util.Map;
23 22
 
@@ -64,23 +63,20 @@ public class EPaperCorrectclassController {
64 63
         String noticetitle = s.get("examname") + "-阅卷按班设置";
65 64
         Integer gradeid = N_Utils.str2Int(s.get("gradeid").toString());
66 65
         String subjectid = s.get("subjectid").toString();
66
+        String noticecontent = "【" + subjectname + "】";
67
+        if (N_Utils.isNotEmpty(s.get("sdate"))) {
68
+            noticecontent += s.get("sdate") + " " + s.get("begintime") + "-" + s.get("endtime") + "\n请在规定时间段阅卷";
69
+        }
70
+        List<TNoticeUser> users = new ArrayList<>();
67 71
         for (EPaperCorrectclass c : teachers) {
68 72
             Integer teacherid = c.getTeacherid();
69 73
             if (N_Utils.isEmptyInteger(teacherid)) continue;
70
-            String noticecontent = "【" + subjectname + "】";
71
-            if (N_Utils.isNotEmpty(s.get("sdate"))) {
72
-                noticecontent += s.get("sdate") + " " + s.get("begintime") + "-" + s.get("endtime") + "\n请在规定时间段阅卷";
73
-            }
74 74
             if (notice == 1) {
75
-                TNotice n = new TNotice();
76
-                n.setNoticetitle(noticetitle);
77
-                n.setNoticecontent(noticecontent);
78 75
                 TNoticeUser nt = new TNoticeUser();
79 76
                 nt.setUserid(teacherid);
80 77
                 nt.setGradeid(gradeid);
81 78
                 nt.setSubjectid(subjectid);
82
-                n.setUsers(Arrays.asList(nt));
83
-                noticeList.add(n);
79
+                users.add(nt);
84 80
             }
85 81
             if (msg == 1) {
86 82
                 TMsg m = new TMsg();
@@ -89,6 +85,13 @@ public class EPaperCorrectclassController {
89 85
                 msgList.add(m);
90 86
             }
91 87
         }
88
+        if (notice == 1) {
89
+            TNotice n = new TNotice();
90
+            n.setNoticetitle(noticetitle);
91
+            n.setNoticecontent(noticecontent);
92
+            n.setUsers(users);
93
+            noticeList.add(n);
94
+        }
92 95
         noticeService.batchSave(noticeList, msgList, schoolid, createid, 2);
93 96
         return new ResultVo(0, "设置成功");
94 97
     }

+ 13
- 10
sexam/src/main/java/com/xhkjedu/sexam/controller/paper/EPaperCorrectquestionController.java Просмотреть файл

@@ -18,7 +18,6 @@ import org.springframework.web.bind.annotation.RestController;
18 18
 
19 19
 import javax.annotation.Resource;
20 20
 import java.util.ArrayList;
21
-import java.util.Arrays;
22 21
 import java.util.List;
23 22
 import java.util.Map;
24 23
 
@@ -59,23 +58,20 @@ public class EPaperCorrectquestionController {
59 58
         String noticetitle = s.get("examname") + "-阅卷按题设置";
60 59
         Integer gradeid = N_Utils.str2Int(s.get("gradeid").toString());
61 60
         String subjectid = s.get("subjectid").toString();
61
+        String noticecontent = "【" + subjectname + "】";
62
+        if (N_Utils.isNotEmpty(s.get("sdate"))) {
63
+            noticecontent += s.get("sdate") + " " + s.get("begintime") + "-" + s.get("endtime") + "\n请在规定时间段阅卷";
64
+        }
65
+        List<TNoticeUser> users = new ArrayList<>();
62 66
         for (EPaperCorrectquestion q : teachers) {
63 67
             Integer teacherid = q.getTeacherid();
64 68
             if (N_Utils.isEmptyInteger(teacherid)) continue;
65
-            String noticecontent = "【" + subjectname + "】";
66
-            if (N_Utils.isNotEmpty(s.get("sdate"))) {
67
-                noticecontent += s.get("sdate") + " " + s.get("begintime") + "-" + s.get("endtime") + "\n请在规定时间段阅卷";
68
-            }
69 69
             if (notice == 1) {
70
-                TNotice n = new TNotice();
71
-                n.setNoticetitle(noticetitle);
72
-                n.setNoticecontent(noticecontent);
73 70
                 TNoticeUser nt = new TNoticeUser();
74 71
                 nt.setUserid(teacherid);
75 72
                 nt.setGradeid(gradeid);
76 73
                 nt.setSubjectid(subjectid);
77
-                n.setUsers(Arrays.asList(nt));
78
-                noticeList.add(n);
74
+                users.add(nt);
79 75
             }
80 76
             if (msg == 1) {
81 77
                 TMsg m = new TMsg();
@@ -84,6 +80,13 @@ public class EPaperCorrectquestionController {
84 80
                 msgList.add(m);
85 81
             }
86 82
         }
83
+        if (notice == 1) {
84
+            TNotice n = new TNotice();
85
+            n.setNoticetitle(noticetitle);
86
+            n.setNoticecontent(noticecontent);
87
+            n.setUsers(users);
88
+            noticeList.add(n);
89
+        }
87 90
         noticeService.batchSave(noticeList, msgList, schoolid, createid, 2);
88 91
         return new ResultVo(0, "设置成功");
89 92
     }

+ 13
- 19
sexam/src/main/java/com/xhkjedu/sexam/service/notice/NoticeService.java Просмотреть файл

@@ -132,40 +132,34 @@ public class NoticeService {
132 132
         Integer gradeid = examVo.getGradeid();
133 133
         try {
134 134
             List<TNotice> noticeList = new ArrayList<>();
135
-            List<TNoticeUser> stuList = new ArrayList<>();
136
-            List<TNoticeUser> teacherList = new ArrayList<>();
135
+            List<TNoticeUser> users = new ArrayList<>();
137 136
             List<TMsg> msgList = new ArrayList<>();
138 137
             String noticetitle = examname + "-考试公告";
139 138
             List<Map> classes = eClassMapper.listByExamId(examid);
140 139
             String classids = classes.stream().map(c -> c.get("classid").toString()).collect(Collectors.joining(","));
141 140
             List<UserVo> teachers = userMapper.listTeacherByClassIds(classids);//获取考试班级任教老师
142 141
             if (notice == 1) {
142
+                for (UserVo t : teachers) {
143
+                    TNoticeUser nt = new TNoticeUser();
144
+                    nt.setUserid(t.getUserid());
145
+                    nt.setGradeid(gradeid);
146
+                    nt.setSubjectid(t.getSubjectid());
147
+                    users.add(nt);
148
+                }
149
+
143 150
                 for (UserVo student : students) {
144 151
                     TNoticeUser nu = new TNoticeUser();
145 152
                     nu.setUserid(student.getUserid());
146 153
                     nu.setGradeid(gradeid);
147 154
                     nu.setClassid(student.getClassid());
148
-                    stuList.add(nu);
155
+                    users.add(nu);
149 156
                 }
150
-                TNotice n = new TNotice();
151
-                n.setNoticetitle(noticetitle);
152
-                n.setNoticecontent(examcomm);
153
-                n.setNoticetype(3);
154
-                n.setUsers(stuList);
155
-                noticeList.add(n);
156 157
 
157
-                for (UserVo t : teachers) {
158
-                    TNoticeUser nt = new TNoticeUser();
159
-                    nt.setUserid(t.getUserid());
160
-                    nt.setGradeid(gradeid);
161
-                    nt.setSubjectid(t.getSubjectid());
162
-                    teacherList.add(nt);
163
-                }
164 158
                 TNotice n2 = new TNotice();
165 159
                 n2.setNoticetitle(noticetitle);
166 160
                 n2.setNoticecontent(examcomm);
167
-                n2.setNoticetype(2);
168
-                n2.setUsers(teacherList);
161
+                n2.setNoticetype(1);
162
+                n2.setUsers(users);
169 163
                 noticeList.add(n2);
170 164
             }
171 165
             if (msg == 1) {
@@ -220,7 +214,7 @@ public class NoticeService {
220 214
                     nteacherList.addAll(cteachers);
221 215
                 });
222 216
 
223
-                if (N_Utils.isListNotEmpty(nteacherList)) noticeUserMapper.insertList(teacherList);//通知教师关联信息
217
+                if (N_Utils.isListNotEmpty(nteacherList)) noticeUserMapper.insertList(users);//通知教师关联信息
224 218
             }
225 219
 
226 220
             if (N_Utils.isListNotEmpty(msgList)) {//短信

Загрузка…
Отмена
Сохранить