Browse Source

考试发送通知

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

+ 8
- 4
sexam/src/main/java/com/xhkjedu/sexam/controller/exam/EBaseController.java View File

@@ -9,7 +9,7 @@ import com.xhkjedu.sexam.model.exam.EClassStudent;
9 9
 import com.xhkjedu.sexam.model.exam.ESubject;
10 10
 import com.xhkjedu.sexam.model.notice.TMsg;
11 11
 import com.xhkjedu.sexam.model.notice.TNotice;
12
-import com.xhkjedu.sexam.model.notice.TNoticeTeacher;
12
+import com.xhkjedu.sexam.model.notice.TNoticeUser;
13 13
 import com.xhkjedu.sexam.service.exam.EBaseService;
14 14
 import com.xhkjedu.sexam.service.notice.NoticeService;
15 15
 import com.xhkjedu.sexam.service.report.EReportGenerateService;
@@ -102,6 +102,7 @@ public class EBaseController {
102 102
         List<TMsg> msgList = new ArrayList<>();
103 103
         String examname = eBaseService.getNameByExamId(examid);
104 104
         String noticetitle = examname + "-考试设置";
105
+        Integer gradeid = vo.getGradeid();
105 106
         for (ESubject s : subjects) {
106 107
             try {
107 108
                 N_Utils.validation(new Object[]{s.getSubjectid(), "科目id", 2});
@@ -116,9 +117,11 @@ public class EBaseController {
116 117
                     TNotice n = new TNotice();
117 118
                     n.setNoticetitle(noticetitle);
118 119
                     n.setNoticecontent(noticecontent);
119
-                    TNoticeTeacher nt = new TNoticeTeacher();
120
-                    nt.setTeacherid(teacherid);
121
-                    n.setTeachers(Arrays.asList(nt));
120
+                    TNoticeUser nt = new TNoticeUser();
121
+                    nt.setUserid(teacherid);
122
+                    nt.setGradeid(gradeid);
123
+                    nt.setSubjectid(s.getSubjectid());
124
+                    n.setUsers(Arrays.asList(nt));
122 125
                     noticeList.add(n);
123 126
                 }
124 127
                 if (msg == 1) {
@@ -224,6 +227,7 @@ public class EBaseController {
224 227
         vo.setSchoolid(schoolid);
225 228
         vo.setHandleid(createid);
226 229
         vo.setExamname(examname);
230
+        vo.setGradeid(exam.getGradeid());
227 231
         noticeService.batchSave2(vo, students);
228 232
         return new ResultVo(0, "发布成功");
229 233
     }

+ 7
- 4
sexam/src/main/java/com/xhkjedu/sexam/controller/exam/ESubjectInvigilateController.java View File

@@ -7,7 +7,7 @@ import com.xhkjedu.sexam.model.exam.ESubject;
7 7
 import com.xhkjedu.sexam.model.exam.ESubjectInvigilate;
8 8
 import com.xhkjedu.sexam.model.notice.TMsg;
9 9
 import com.xhkjedu.sexam.model.notice.TNotice;
10
-import com.xhkjedu.sexam.model.notice.TNoticeTeacher;
10
+import com.xhkjedu.sexam.model.notice.TNoticeUser;
11 11
 import com.xhkjedu.sexam.service.exam.ESubjectInvigilateService;
12 12
 import com.xhkjedu.sexam.service.notice.NoticeService;
13 13
 import com.xhkjedu.sexam.vo.exam.EInVigilateVo;
@@ -70,6 +70,7 @@ public class ESubjectInvigilateController {
70 70
         Map s = eSubjectInvigilateService.getESubjectByEsId(esid);
71 71
         Integer schoolid = (Integer) s.get("schoolid");
72 72
         String noticetitle = s.get("examname") + "-监考设置";
73
+        Integer gradeid = N_Utils.str2Int(s.get("gradeid").toString());
73 74
         for (ESubjectInvigilate ei : teachers) {
74 75
             Integer teacherid = ei.getTeacherid();
75 76
             if (N_Utils.isEmptyInteger(teacherid)) continue;
@@ -81,9 +82,11 @@ public class ESubjectInvigilateController {
81 82
                 TNotice n = new TNotice();
82 83
                 n.setNoticetitle(noticetitle);
83 84
                 n.setNoticecontent(noticecontent);
84
-                TNoticeTeacher nt = new TNoticeTeacher();
85
-                nt.setTeacherid(teacherid);
86
-                n.setTeachers(Arrays.asList(nt));
85
+                TNoticeUser nt = new TNoticeUser();
86
+                nt.setUserid(teacherid);
87
+                nt.setGradeid(gradeid);
88
+                nt.setSubjectid(subjectid);
89
+                n.setUsers(Arrays.asList(nt));
87 90
                 noticeList.add(n);
88 91
             }
89 92
             if (msg == 1) {

+ 8
- 4
sexam/src/main/java/com/xhkjedu/sexam/controller/paper/EPaperCorrectclassController.java View File

@@ -3,7 +3,7 @@ package com.xhkjedu.sexam.controller.paper;
3 3
 import com.xhkjedu.annotation.Action;
4 4
 import com.xhkjedu.sexam.model.notice.TMsg;
5 5
 import com.xhkjedu.sexam.model.notice.TNotice;
6
-import com.xhkjedu.sexam.model.notice.TNoticeTeacher;
6
+import com.xhkjedu.sexam.model.notice.TNoticeUser;
7 7
 import com.xhkjedu.sexam.model.paper.EPaperCorrectclass;
8 8
 import com.xhkjedu.sexam.service.notice.NoticeService;
9 9
 import com.xhkjedu.sexam.service.paper.EPaperCorrectclassService;
@@ -62,6 +62,8 @@ public class EPaperCorrectclassController {
62 62
         Map s = ePaperCorrectclassService.getESubjectByEpId(epid);
63 63
         Integer schoolid = (Integer) s.get("schoolid");
64 64
         String noticetitle = s.get("examname") + "-阅卷按班设置";
65
+        Integer gradeid = N_Utils.str2Int(s.get("gradeid").toString());
66
+        String subjectid = s.get("subjectid").toString();
65 67
         for (EPaperCorrectclass c : teachers) {
66 68
             Integer teacherid = c.getTeacherid();
67 69
             if (N_Utils.isEmptyInteger(teacherid)) continue;
@@ -73,9 +75,11 @@ public class EPaperCorrectclassController {
73 75
                 TNotice n = new TNotice();
74 76
                 n.setNoticetitle(noticetitle);
75 77
                 n.setNoticecontent(noticecontent);
76
-                TNoticeTeacher nt = new TNoticeTeacher();
77
-                nt.setTeacherid(teacherid);
78
-                n.setTeachers(Arrays.asList(nt));
78
+                TNoticeUser nt = new TNoticeUser();
79
+                nt.setUserid(teacherid);
80
+                nt.setGradeid(gradeid);
81
+                nt.setSubjectid(subjectid);
82
+                n.setUsers(Arrays.asList(nt));
79 83
                 noticeList.add(n);
80 84
             }
81 85
             if (msg == 1) {

+ 8
- 4
sexam/src/main/java/com/xhkjedu/sexam/controller/paper/EPaperCorrectquestionController.java View File

@@ -3,7 +3,7 @@ package com.xhkjedu.sexam.controller.paper;
3 3
 import com.xhkjedu.annotation.Action;
4 4
 import com.xhkjedu.sexam.model.notice.TMsg;
5 5
 import com.xhkjedu.sexam.model.notice.TNotice;
6
-import com.xhkjedu.sexam.model.notice.TNoticeTeacher;
6
+import com.xhkjedu.sexam.model.notice.TNoticeUser;
7 7
 import com.xhkjedu.sexam.model.paper.EPaper;
8 8
 import com.xhkjedu.sexam.model.paper.EPaperCorrectquestion;
9 9
 import com.xhkjedu.sexam.service.notice.NoticeService;
@@ -57,6 +57,8 @@ public class EPaperCorrectquestionController {
57 57
         Map s = ePaperCorrectquestionService.getESubjectByEpId(epid);
58 58
         Integer schoolid = (Integer) s.get("schoolid");
59 59
         String noticetitle = s.get("examname") + "-阅卷按题设置";
60
+        Integer gradeid = N_Utils.str2Int(s.get("gradeid").toString());
61
+        String subjectid = s.get("subjectid").toString();
60 62
         for (EPaperCorrectquestion q : teachers) {
61 63
             Integer teacherid = q.getTeacherid();
62 64
             if (N_Utils.isEmptyInteger(teacherid)) continue;
@@ -68,9 +70,11 @@ public class EPaperCorrectquestionController {
68 70
                 TNotice n = new TNotice();
69 71
                 n.setNoticetitle(noticetitle);
70 72
                 n.setNoticecontent(noticecontent);
71
-                TNoticeTeacher nt = new TNoticeTeacher();
72
-                nt.setTeacherid(teacherid);
73
-                n.setTeachers(Arrays.asList(nt));
73
+                TNoticeUser nt = new TNoticeUser();
74
+                nt.setUserid(teacherid);
75
+                nt.setGradeid(gradeid);
76
+                nt.setSubjectid(subjectid);
77
+                n.setUsers(Arrays.asList(nt));
74 78
                 noticeList.add(n);
75 79
             }
76 80
             if (msg == 1) {

+ 0
- 7
sexam/src/main/java/com/xhkjedu/sexam/mapper/notice/NoticeTeacherMapper.java View File

@@ -1,7 +0,0 @@
1
-package com.xhkjedu.sexam.mapper.notice;
2
-
3
-import com.xhkjedu.base.TkMapper;
4
-import com.xhkjedu.sexam.model.notice.TNoticeTeacher;
5
-
6
-public interface NoticeTeacherMapper extends TkMapper<TNoticeTeacher> {
7
-}

+ 7
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/notice/NoticeUserMapper.java View File

@@ -0,0 +1,7 @@
1
+package com.xhkjedu.sexam.mapper.notice;
2
+
3
+import com.xhkjedu.base.TkMapper;
4
+import com.xhkjedu.sexam.model.notice.TNoticeUser;
5
+
6
+public interface NoticeUserMapper extends TkMapper<TNoticeUser> {
7
+}

+ 1
- 1
sexam/src/main/java/com/xhkjedu/sexam/model/notice/TNotice.java View File

@@ -44,7 +44,7 @@ public class TNotice extends BaseBean {
44 44
 
45 45
     @Transient
46 46
     //教师id集合
47
-    private List<TNoticeTeacher> teachers = new ArrayList<>();
47
+    private List<TNoticeUser> users = new ArrayList<>();
48 48
 
49 49
     @Transient
50 50
     //开始时间

sexam/src/main/java/com/xhkjedu/sexam/model/notice/TNoticeTeacher.java → sexam/src/main/java/com/xhkjedu/sexam/model/notice/TNoticeUser.java View File

@@ -8,7 +8,7 @@ import javax.persistence.Table;
8 8
 
9 9
 @Table(name = "t_notice_user")
10 10
 @Data
11
-public class TNoticeTeacher extends BaseBean {
11
+public class TNoticeUser extends BaseBean {
12 12
     @Id
13 13
     //通知用户表
14 14
     private Integer nuid;
@@ -17,7 +17,7 @@ public class TNoticeTeacher extends BaseBean {
17 17
     private Integer noticeid;
18 18
 
19 19
     //用户id
20
-    private Integer teacherid;
20
+    private Integer userid;
21 21
 
22 22
     //是否查看0未查看1已查看
23 23
     private Integer readed;
@@ -25,6 +25,15 @@ public class TNoticeTeacher extends BaseBean {
25 25
     //查看时间
26 26
     private Integer readtime;
27 27
 
28
+    //年级id
29
+    private Integer gradeid;
30
+
31
+    //班级id
32
+    private Integer classid;
33
+
34
+    //科目id
35
+    private String subjectid;
36
+
28 37
     //创建时间
29 38
     private Integer createtime;
30 39
 

+ 49
- 76
sexam/src/main/java/com/xhkjedu/sexam/service/notice/NoticeService.java View File

@@ -33,11 +33,7 @@ public class NoticeService {
33 33
     @Resource
34 34
     private NoticeMapper noticeMapper;
35 35
     @Resource
36
-    private NoticeTeacherMapper noticeTeacherMapper;
37
-    @Resource
38
-    private NoticeClassMapper noticeClassMapper;
39
-    @Resource
40
-    private NoticeSchoolMapper noticeSchoolMapper;
36
+    private NoticeUserMapper noticeUserMapper;
41 37
     @Resource
42 38
     private MsgMapper msgMapper;
43 39
     @Resource
@@ -61,12 +57,10 @@ public class NoticeService {
61 57
                 });
62 58
                 noticeMapper.insertList(noticeList);
63 59
 
64
-                List<TNoticeTeacher> teacherList = new ArrayList<>();
65
-                List<TNoticeClass> classList = new ArrayList<>();
66
-                List<TNoticeSchool> schoolList = new ArrayList<>();
60
+                List<TNoticeUser> teacherList = new ArrayList<>();
67 61
                 noticeList.forEach(n -> {
68 62
                     Integer noticeid = n.getId();
69
-                    List<TNoticeTeacher> teachers = n.getTeachers().stream().distinct().collect(Collectors.toList());
63
+                    List<TNoticeUser> teachers = n.getUsers().stream().distinct().collect(Collectors.toList());
70 64
                     teachers.forEach(t -> {
71 65
                         t.setNoticeid(noticeid);
72 66
                         t.setReaded(0);
@@ -74,26 +68,9 @@ public class NoticeService {
74 68
                         t.setSchoolid(schoolid);
75 69
                     });
76 70
                     teacherList.addAll(teachers);
77
-
78
-                    List<TNoticeClass> classes = n.getClasses();
79
-                    classes.forEach(c -> {
80
-                        c.setNoticeid(noticeid);
81
-                        c.setCreateid(createid);
82
-                        c.setCreatetime(createtime);
83
-                    });
84
-                    classList.addAll(classes);
85
-
86
-                    TNoticeSchool ns = new TNoticeSchool();
87
-                    ns.setNoticeid(noticeid);
88
-                    ns.setSchoolid(schoolid);
89
-                    ns.setCreateid(createid);
90
-                    ns.setCreatetime(createtime);
91
-                    schoolList.add(ns);
92 71
                 });
93 72
 
94
-                if (N_Utils.isListNotEmpty(teacherList)) noticeTeacherMapper.insertList(teacherList);//通知教师关联信息
95
-                if (N_Utils.isListNotEmpty(classList)) noticeClassMapper.insertList(classList);//通知班级关联信息
96
-                if (N_Utils.isListNotEmpty(schoolList)) noticeSchoolMapper.insertList(schoolList);//通知学校关联信息
73
+                if (N_Utils.isListNotEmpty(teacherList)) noticeUserMapper.insertList(teacherList);//通知教师关联信息
97 74
             }
98 75
 
99 76
             if (N_Utils.isListNotEmpty(msgList)) {//短信
@@ -105,11 +82,10 @@ public class NoticeService {
105 82
                         msgs.add(msg);
106 83
                     }
107 84
                 } else {//通知对象2老师
108
-                    List<Integer> userids = msgList.stream().map(m -> m.getUserid()).distinct().collect(Collectors.toList());
85
+                    List<Integer> userids = msgList.stream().map(TMsg::getUserid).distinct().collect(Collectors.toList());
109 86
                     List<UserVo> users = userMapper.listPhoneByUserIds(userids);//根据用户ids查找手机号
110
-                    Map<Integer, TMsg> msgMap = msgList.stream().collect(Collectors.toMap(m -> m.getUserid(), m -> m));
111
-                    for (int i = 0; i < users.size(); i++) {
112
-                        UserVo u = users.get(i);
87
+                    Map<Integer, TMsg> msgMap = msgList.stream().collect(Collectors.toMap(TMsg::getUserid, m -> m));
88
+                    for (UserVo u : users) {
113 89
                         String userphone = u.getUserphone();
114 90
                         if (N_Utils.isEmpty(userphone)) continue;
115 91
                         TMsg m = msgMap.get(u.getUserid());
@@ -122,8 +98,8 @@ public class NoticeService {
122 98
                     msgMapper.insertList(msgs);//短信保存到数据库
123 99
 
124 100
                     //发短信
125
-                    Integer pageSize = 2000;//手机号,多个手机号为用半角 , 分开,如13899999999,13688888888(最多2000个,必填)
126
-                    Map<String, List<TMsg>> mcollect = msgs.stream().collect(Collectors.groupingBy(s -> s.getMsgtxt()
101
+                    int pageSize = 2000;//手机号,多个手机号为用半角 , 分开,如13899999999,13688888888(最多2000个,必填)
102
+                    Map<String, List<TMsg>> mcollect = msgs.stream().collect(Collectors.groupingBy(TMsg::getMsgtxt
127 103
                             , LinkedHashMap::new, Collectors.toList()));
128 104
                     for (Map.Entry<String, List<TMsg>> entry : mcollect.entrySet()) {
129 105
                         List<TMsg> list = entry.getValue();
@@ -131,7 +107,7 @@ public class NoticeService {
131 107
                         for (int i = 0; i < list.size(); i += pageSize) {
132 108
                             ZtMsgVo vo = new ZtMsgVo();
133 109
                             String userphone = list.stream().skip(i).limit(pageSize)
134
-                                    .map(s -> s.getUserphone()).collect(Collectors.joining(","));
110
+                                                   .map(TMsg::getUserphone).collect(Collectors.joining(","));
135 111
                             vo.setMobile(userphone);
136 112
                             vo.setContent(msgtxt);
137 113
                             SMSSender.sendSms(vo);
@@ -140,7 +116,7 @@ public class NoticeService {
140 116
                 }
141 117
             }
142 118
         } catch (Exception e) {
143
-            log.error("批量添加通知和短信失败", e.getMessage());
119
+            log.error("批量添加通知和短信失败:{}", e.getMessage());
144 120
         }
145 121
     }
146 122
 
@@ -154,52 +130,68 @@ public class NoticeService {
154 130
         Integer examid = examVo.getExamid();
155 131
         String examname = examVo.getExamname();
156 132
         Integer schoolid = examVo.getSchoolid();
133
+        Integer gradeid = examVo.getGradeid();
157 134
         try {
158 135
             List<TNotice> noticeList = new ArrayList<>();
159
-            List<TNoticeClass> classList = new ArrayList<>();
160
-            List<TNoticeTeacher> teacherList = new ArrayList<>();
136
+            List<TNoticeUser> stuList = new ArrayList<>();
137
+            List<TNoticeUser> teacherList = new ArrayList<>();
161 138
             List<TMsg> msgList = new ArrayList<>();
162 139
             String noticetitle = examname + "-考试公告";
163 140
             List<Map> classes = eClassMapper.listByExamId(examid);
164 141
             String classids = classes.stream().map(c -> c.get("classid").toString()).collect(Collectors.joining(","));
165 142
             List<UserVo> teachers = userMapper.listTeacherByClassIds(classids);//获取考试班级任教老师
166 143
             if (notice == 1) {
167
-                for (Map s : classes) {
168
-                    TNoticeClass nt = new TNoticeClass();
169
-                    nt.setClassid((Integer) s.get("classid"));
170
-                    classList.add(nt);
144
+                for (UserVo student : students) {
145
+                    TNoticeUser nu = new TNoticeUser();
146
+                    nu.setUserid(student.getUserid());
147
+                    nu.setGradeid(gradeid);
148
+                    nu.setClassid(student.getClassid());
149
+                    stuList.add(nu);
171 150
                 }
172 151
                 TNotice n = new TNotice();
173 152
                 n.setNoticetitle(noticetitle);
174 153
                 n.setNoticecontent(examcomm);
175
-                n.setNoticetype(1);
176
-                n.setClasses(classList);
154
+                n.setNoticetype(3);
155
+                n.setUsers(stuList);
177 156
                 noticeList.add(n);
178 157
 
179 158
                 for (UserVo t : teachers) {
180
-                    TNoticeTeacher nt = new TNoticeTeacher();
181
-                    nt.setTeacherid(t.getUserid());
159
+                    TNoticeUser nt = new TNoticeUser();
160
+                    nt.setUserid(t.getUserid());
161
+                    nt.setGradeid(gradeid);
162
+                    nt.setSubjectid(t.getSubjectid());
182 163
                     teacherList.add(nt);
183 164
                 }
184 165
                 TNotice n2 = new TNotice();
185 166
                 n2.setNoticetitle(noticetitle);
186 167
                 n2.setNoticecontent(examcomm);
187 168
                 n2.setNoticetype(2);
188
-                n2.setTeachers(teacherList);
169
+                n2.setUsers(teacherList);
189 170
                 noticeList.add(n2);
190 171
             }
191 172
             if (msg == 1) {
192 173
                 String msgtxt = noticetitle + "\n" + ExamUtil.htmlRemoveTag(examcomm);
193
-                List<String> userphones = students.stream().filter(s -> N_Utils.isNotEmpty(s.getUserphone()))
194
-                        .map(s -> s.getUserphone()).collect(Collectors.toList());
174
+                List<String> userphones = new ArrayList<>();
175
+                for (UserVo student : students) {
176
+                    if (N_Utils.isNotEmpty(student.getUserphone())) {
177
+                        String sUserphone = student.getUserphone();
178
+                        userphones.add(sUserphone);
179
+                    }
180
+                }
195 181
                 for (String userphone : userphones) {
196 182
                     TMsg m = new TMsg();
197 183
                     m.setMsgtxt(msgtxt);
198 184
                     m.setUserphone(userphone);
199 185
                     msgList.add(m);
200 186
                 }
201
-                userphones = teachers.stream().filter(s -> N_Utils.isNotEmpty(s.getUserphone()))
202
-                        .map(s -> s.getUserphone()).collect(Collectors.toList());
187
+                List<String> list = new ArrayList<>();
188
+                for (UserVo s : teachers) {
189
+                    String sUserphone = s.getUserphone();
190
+                    if (N_Utils.isNotEmpty(sUserphone)) {
191
+                        list.add(sUserphone);
192
+                    }
193
+                }
194
+                userphones = list;
203 195
                 for (String userphone : userphones) {
204 196
                     TMsg m = new TMsg();
205 197
                     m.setMsgtxt(msgtxt);
@@ -217,12 +209,10 @@ public class NoticeService {
217 209
                 });
218 210
                 noticeMapper.insertList(noticeList);
219 211
 
220
-                List<TNoticeTeacher> nteacherList = new ArrayList<>();
221
-                List<TNoticeClass> nclassList = new ArrayList<>();
222
-                List<TNoticeSchool> schoolList = new ArrayList<>();
212
+                List<TNoticeUser> nteacherList = new ArrayList<>();
223 213
                 noticeList.forEach(n -> {
224 214
                     Integer noticeid = n.getId();
225
-                    List<TNoticeTeacher> cteachers = n.getTeachers().stream().distinct().collect(Collectors.toList());
215
+                    List<TNoticeUser> cteachers = n.getUsers().stream().distinct().collect(Collectors.toList());
226 216
                     cteachers.forEach(t -> {
227 217
                         t.setNoticeid(noticeid);
228 218
                         t.setReaded(0);
@@ -230,26 +220,9 @@ public class NoticeService {
230 220
                         t.setSchoolid(schoolid);
231 221
                     });
232 222
                     nteacherList.addAll(cteachers);
233
-
234
-                    List<TNoticeClass> nclasses = n.getClasses();
235
-                    nclasses.forEach(c -> {
236
-                        c.setNoticeid(noticeid);
237
-                        c.setCreateid(createid);
238
-                        c.setCreatetime(createtime);
239
-                    });
240
-                    nclassList.addAll(nclasses);
241
-
242
-                    TNoticeSchool ns = new TNoticeSchool();
243
-                    ns.setNoticeid(noticeid);
244
-                    ns.setSchoolid(schoolid);
245
-                    ns.setCreateid(createid);
246
-                    ns.setCreatetime(createtime);
247
-                    schoolList.add(ns);
248 223
                 });
249 224
 
250
-                if (N_Utils.isListNotEmpty(nteacherList)) noticeTeacherMapper.insertList(teacherList);//通知教师关联信息
251
-                if (N_Utils.isListNotEmpty(nclassList)) noticeClassMapper.insertList(classList);//通知班级关联信息
252
-                if (N_Utils.isListNotEmpty(schoolList)) noticeSchoolMapper.insertList(schoolList);//通知学校关联信息
225
+                if (N_Utils.isListNotEmpty(nteacherList)) noticeUserMapper.insertList(teacherList);//通知教师关联信息
253 226
             }
254 227
 
255 228
             if (N_Utils.isListNotEmpty(msgList)) {//短信
@@ -262,8 +235,8 @@ public class NoticeService {
262 235
                     msgMapper.insertList(msgs);//短信保存到数据库
263 236
 
264 237
                     //发短信
265
-                    Integer pageSize = 2000;//手机号,多个手机号为用半角 , 分开,如13899999999,13688888888(最多2000个,必填)
266
-                    Map<String, List<TMsg>> mcollect = msgs.stream().collect(Collectors.groupingBy(s -> s.getMsgtxt()
238
+                    int pageSize = 2000;//手机号,多个手机号为用半角 , 分开,如13899999999,13688888888(最多2000个,必填)
239
+                    Map<String, List<TMsg>> mcollect = msgs.stream().collect(Collectors.groupingBy(TMsg::getMsgtxt
267 240
                             , LinkedHashMap::new, Collectors.toList()));
268 241
                     for (Map.Entry<String, List<TMsg>> entry : mcollect.entrySet()) {
269 242
                         List<TMsg> list = entry.getValue();
@@ -271,7 +244,7 @@ public class NoticeService {
271 244
                         for (int i = 0; i < list.size(); i += pageSize) {
272 245
                             ZtMsgVo vo = new ZtMsgVo();
273 246
                             String userphone = list.stream().skip(i).limit(pageSize)
274
-                                    .map(s -> s.getUserphone()).collect(Collectors.joining(","));
247
+                                                   .map(TMsg::getUserphone).collect(Collectors.joining(","));
275 248
                             vo.setMobile(userphone);
276 249
                             vo.setContent(msgtxt);
277 250
                             SMSSender.sendSms(vo);
@@ -280,7 +253,7 @@ public class NoticeService {
280 253
                 }
281 254
             }
282 255
         } catch (Exception e) {
283
-            log.error("批量添加通知和短信(发布考试用)失败", e.getMessage());
256
+            log.error("批量添加通知和短信(发布考试用)失败:{}", e.getMessage());
284 257
         }
285 258
     }
286 259
 }

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/vo/exam/ExamVo.java View File

@@ -21,6 +21,9 @@ public class ExamVo {
21 21
 
22 22
     //学校id
23 23
     private Integer schoolid;
24
+    
25
+    //年级id
26
+    private Integer gradeid;
24 27
 
25 28
     //考试名称
26 29
     private String examname;

+ 1
- 1
sexam/src/main/resources/mapper/exam/EBaseMapper.xml View File

@@ -120,7 +120,7 @@
120 120
     </select>
121 121
     <!--根据考试id获取状态和模式-->
122 122
     <select id="getExamStateAndMode" resultType="com.xhkjedu.sexam.vo.exam.EBaseVo">
123
-        select eb.examstate,eb.exammode
123
+        select eb.examstate,eb.exammode,eb.gradeid
124 124
         from e_base eb where eb.examid=#{examid}
125 125
     </select>
126 126
     <!--根据考试id获取显示排名-->

+ 0
- 12
sexam/src/main/resources/mapper/notice/NoticeTeacherMapper.xml View File

@@ -1,12 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8" ?>
2
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
-<mapper namespace="com.xhkjedu.sexam.mapper.notice.NoticeTeacherMapper">
4
-    <!--批量添加-->
5
-    <insert id="batchSave" parameterType="com.xhkjedu.sexam.model.notice.TNotice">
6
-        INSERT INTO t_notice_user (noticeid,teacherid,createtime,schoolid)
7
-        VALUES
8
-        <foreach collection ="notice.teachers" item="t" index= "index" separator =",">
9
-            (#{notice.noticeid},#{t.teacherid},#{notice.createtime},#{notice.schoolid})
10
-        </foreach>
11
-    </insert>
12
-</mapper>

+ 4
- 0
sexam/src/main/resources/mapper/notice/NoticeUserMapper.xml View File

@@ -0,0 +1,4 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sexam.mapper.notice.NoticeUserMapper">
4
+</mapper>

+ 1
- 1
sexam/src/main/resources/mapper/paper/EPaperMapper.xml View File

@@ -73,7 +73,7 @@
73 73
     </select>
74 74
     <!--根据试卷id获取考试科目基本信息-->
75 75
     <select id="getESubjectByEpId" resultType="java.util.Map">
76
-        select es.sdate,es.begintime,es.endtime,eb.examname,eb.schoolid
76
+        select es.sdate,es.begintime,es.endtime,eb.examname,eb.schoolid,eb.gradeid,es.subjectid
77 77
         from e_paper ep left join e_subject es on ep.esid = es.esid
78 78
         left join e_base eb on es.examid = eb.examid
79 79
         where ep.epid=#{epid}

+ 1
- 0
sexam/src/main/resources/mapper/system/UserMapper.xml View File

@@ -18,6 +18,7 @@
18 18
     <!--获取考试班级任教老师-->
19 19
     <select id="listTeacherByClassIds" resultType="com.xhkjedu.vo.system.UserVo">
20 20
         select u.userid,u.userphone
21
+        ,(select tp.subjectid from t_teacher_powersb tp where tp.teacherid=ct.teacherid limit 1)subjectid
21 22
         from t_class_teacher ct left join t_user u on ct.teacherid = u.userid
22 23
         where ct.classid in(${classids}) and u.userstate=1
23 24
         group by u.userid

Loading…
Cancel
Save