Browse Source

考试通知完善

tags/正式3.13.3
雍文秀 1 year ago
parent
commit
628462571a

+ 13
- 10
sexam/src/main/java/com/xhkjedu/sexam/controller/exam/ESubjectInvigilateController.java View File

23
 
23
 
24
 import javax.annotation.Resource;
24
 import javax.annotation.Resource;
25
 import java.util.ArrayList;
25
 import java.util.ArrayList;
26
-import java.util.Arrays;
27
 import java.util.List;
26
 import java.util.List;
28
 import java.util.Map;
27
 import java.util.Map;
29
 
28
 
71
         Integer schoolid = (Integer) s.get("schoolid");
70
         Integer schoolid = (Integer) s.get("schoolid");
72
         String noticetitle = s.get("examname") + "-监考设置";
71
         String noticetitle = s.get("examname") + "-监考设置";
73
         Integer gradeid = N_Utils.str2Int(s.get("gradeid").toString());
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
         for (ESubjectInvigilate ei : teachers) {
78
         for (ESubjectInvigilate ei : teachers) {
75
             Integer teacherid = ei.getTeacherid();
79
             Integer teacherid = ei.getTeacherid();
76
             if (N_Utils.isEmptyInteger(teacherid)) continue;
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
             if (notice == 1) {
81
             if (notice == 1) {
82
-                TNotice n = new TNotice();
83
-                n.setNoticetitle(noticetitle);
84
-                n.setNoticecontent(noticecontent);
85
                 TNoticeUser nt = new TNoticeUser();
82
                 TNoticeUser nt = new TNoticeUser();
86
                 nt.setUserid(teacherid);
83
                 nt.setUserid(teacherid);
87
                 nt.setGradeid(gradeid);
84
                 nt.setGradeid(gradeid);
88
                 nt.setSubjectid(subjectid);
85
                 nt.setSubjectid(subjectid);
89
-                n.setUsers(Arrays.asList(nt));
90
-                noticeList.add(n);
86
+                users.add(nt);
91
             }
87
             }
92
             if (msg == 1) {
88
             if (msg == 1) {
93
                 TMsg m = new TMsg();
89
                 TMsg m = new TMsg();
96
                 msgList.add(m);
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
         noticeService.batchSave(noticeList, msgList, schoolid, createid, 2);
102
         noticeService.batchSave(noticeList, msgList, schoolid, createid, 2);
100
         return new ResultVo(0, "设置成功");
103
         return new ResultVo(0, "设置成功");
101
     }
104
     }

+ 13
- 10
sexam/src/main/java/com/xhkjedu/sexam/controller/paper/EPaperCorrectclassController.java View File

17
 
17
 
18
 import javax.annotation.Resource;
18
 import javax.annotation.Resource;
19
 import java.util.ArrayList;
19
 import java.util.ArrayList;
20
-import java.util.Arrays;
21
 import java.util.List;
20
 import java.util.List;
22
 import java.util.Map;
21
 import java.util.Map;
23
 
22
 
64
         String noticetitle = s.get("examname") + "-阅卷按班设置";
63
         String noticetitle = s.get("examname") + "-阅卷按班设置";
65
         Integer gradeid = N_Utils.str2Int(s.get("gradeid").toString());
64
         Integer gradeid = N_Utils.str2Int(s.get("gradeid").toString());
66
         String subjectid = s.get("subjectid").toString();
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
         for (EPaperCorrectclass c : teachers) {
71
         for (EPaperCorrectclass c : teachers) {
68
             Integer teacherid = c.getTeacherid();
72
             Integer teacherid = c.getTeacherid();
69
             if (N_Utils.isEmptyInteger(teacherid)) continue;
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
             if (notice == 1) {
74
             if (notice == 1) {
75
-                TNotice n = new TNotice();
76
-                n.setNoticetitle(noticetitle);
77
-                n.setNoticecontent(noticecontent);
78
                 TNoticeUser nt = new TNoticeUser();
75
                 TNoticeUser nt = new TNoticeUser();
79
                 nt.setUserid(teacherid);
76
                 nt.setUserid(teacherid);
80
                 nt.setGradeid(gradeid);
77
                 nt.setGradeid(gradeid);
81
                 nt.setSubjectid(subjectid);
78
                 nt.setSubjectid(subjectid);
82
-                n.setUsers(Arrays.asList(nt));
83
-                noticeList.add(n);
79
+                users.add(nt);
84
             }
80
             }
85
             if (msg == 1) {
81
             if (msg == 1) {
86
                 TMsg m = new TMsg();
82
                 TMsg m = new TMsg();
89
                 msgList.add(m);
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
         noticeService.batchSave(noticeList, msgList, schoolid, createid, 2);
95
         noticeService.batchSave(noticeList, msgList, schoolid, createid, 2);
93
         return new ResultVo(0, "设置成功");
96
         return new ResultVo(0, "设置成功");
94
     }
97
     }

+ 13
- 10
sexam/src/main/java/com/xhkjedu/sexam/controller/paper/EPaperCorrectquestionController.java View File

18
 
18
 
19
 import javax.annotation.Resource;
19
 import javax.annotation.Resource;
20
 import java.util.ArrayList;
20
 import java.util.ArrayList;
21
-import java.util.Arrays;
22
 import java.util.List;
21
 import java.util.List;
23
 import java.util.Map;
22
 import java.util.Map;
24
 
23
 
59
         String noticetitle = s.get("examname") + "-阅卷按题设置";
58
         String noticetitle = s.get("examname") + "-阅卷按题设置";
60
         Integer gradeid = N_Utils.str2Int(s.get("gradeid").toString());
59
         Integer gradeid = N_Utils.str2Int(s.get("gradeid").toString());
61
         String subjectid = s.get("subjectid").toString();
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
         for (EPaperCorrectquestion q : teachers) {
66
         for (EPaperCorrectquestion q : teachers) {
63
             Integer teacherid = q.getTeacherid();
67
             Integer teacherid = q.getTeacherid();
64
             if (N_Utils.isEmptyInteger(teacherid)) continue;
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
             if (notice == 1) {
69
             if (notice == 1) {
70
-                TNotice n = new TNotice();
71
-                n.setNoticetitle(noticetitle);
72
-                n.setNoticecontent(noticecontent);
73
                 TNoticeUser nt = new TNoticeUser();
70
                 TNoticeUser nt = new TNoticeUser();
74
                 nt.setUserid(teacherid);
71
                 nt.setUserid(teacherid);
75
                 nt.setGradeid(gradeid);
72
                 nt.setGradeid(gradeid);
76
                 nt.setSubjectid(subjectid);
73
                 nt.setSubjectid(subjectid);
77
-                n.setUsers(Arrays.asList(nt));
78
-                noticeList.add(n);
74
+                users.add(nt);
79
             }
75
             }
80
             if (msg == 1) {
76
             if (msg == 1) {
81
                 TMsg m = new TMsg();
77
                 TMsg m = new TMsg();
84
                 msgList.add(m);
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
         noticeService.batchSave(noticeList, msgList, schoolid, createid, 2);
90
         noticeService.batchSave(noticeList, msgList, schoolid, createid, 2);
88
         return new ResultVo(0, "设置成功");
91
         return new ResultVo(0, "设置成功");
89
     }
92
     }

+ 13
- 19
sexam/src/main/java/com/xhkjedu/sexam/service/notice/NoticeService.java View File

132
         Integer gradeid = examVo.getGradeid();
132
         Integer gradeid = examVo.getGradeid();
133
         try {
133
         try {
134
             List<TNotice> noticeList = new ArrayList<>();
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
             List<TMsg> msgList = new ArrayList<>();
136
             List<TMsg> msgList = new ArrayList<>();
138
             String noticetitle = examname + "-考试公告";
137
             String noticetitle = examname + "-考试公告";
139
             List<Map> classes = eClassMapper.listByExamId(examid);
138
             List<Map> classes = eClassMapper.listByExamId(examid);
140
             String classids = classes.stream().map(c -> c.get("classid").toString()).collect(Collectors.joining(","));
139
             String classids = classes.stream().map(c -> c.get("classid").toString()).collect(Collectors.joining(","));
141
             List<UserVo> teachers = userMapper.listTeacherByClassIds(classids);//获取考试班级任教老师
140
             List<UserVo> teachers = userMapper.listTeacherByClassIds(classids);//获取考试班级任教老师
142
             if (notice == 1) {
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
                 for (UserVo student : students) {
150
                 for (UserVo student : students) {
144
                     TNoticeUser nu = new TNoticeUser();
151
                     TNoticeUser nu = new TNoticeUser();
145
                     nu.setUserid(student.getUserid());
152
                     nu.setUserid(student.getUserid());
146
                     nu.setGradeid(gradeid);
153
                     nu.setGradeid(gradeid);
147
                     nu.setClassid(student.getClassid());
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
                 TNotice n2 = new TNotice();
158
                 TNotice n2 = new TNotice();
165
                 n2.setNoticetitle(noticetitle);
159
                 n2.setNoticetitle(noticetitle);
166
                 n2.setNoticecontent(examcomm);
160
                 n2.setNoticecontent(examcomm);
167
-                n2.setNoticetype(2);
168
-                n2.setUsers(teacherList);
161
+                n2.setNoticetype(1);
162
+                n2.setUsers(users);
169
                 noticeList.add(n2);
163
                 noticeList.add(n2);
170
             }
164
             }
171
             if (msg == 1) {
165
             if (msg == 1) {
220
                     nteacherList.addAll(cteachers);
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
             if (N_Utils.isListNotEmpty(msgList)) {//短信
220
             if (N_Utils.isListNotEmpty(msgList)) {//短信

Loading…
Cancel
Save