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

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

7
 import com.xhkjedu.sexam.model.exam.ESubjectInvigilate;
7
 import com.xhkjedu.sexam.model.exam.ESubjectInvigilate;
8
 import com.xhkjedu.sexam.model.notice.TMsg;
8
 import com.xhkjedu.sexam.model.notice.TMsg;
9
 import com.xhkjedu.sexam.model.notice.TNotice;
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
 import com.xhkjedu.sexam.service.exam.ESubjectInvigilateService;
11
 import com.xhkjedu.sexam.service.exam.ESubjectInvigilateService;
12
 import com.xhkjedu.sexam.service.notice.NoticeService;
12
 import com.xhkjedu.sexam.service.notice.NoticeService;
13
 import com.xhkjedu.sexam.vo.exam.EInVigilateVo;
13
 import com.xhkjedu.sexam.vo.exam.EInVigilateVo;
70
         Map s = eSubjectInvigilateService.getESubjectByEsId(esid);
70
         Map s = eSubjectInvigilateService.getESubjectByEsId(esid);
71
         Integer schoolid = (Integer) s.get("schoolid");
71
         Integer schoolid = (Integer) s.get("schoolid");
72
         String noticetitle = s.get("examname") + "-监考设置";
72
         String noticetitle = s.get("examname") + "-监考设置";
73
+        Integer gradeid = N_Utils.str2Int(s.get("gradeid").toString());
73
         for (ESubjectInvigilate ei : teachers) {
74
         for (ESubjectInvigilate ei : teachers) {
74
             Integer teacherid = ei.getTeacherid();
75
             Integer teacherid = ei.getTeacherid();
75
             if (N_Utils.isEmptyInteger(teacherid)) continue;
76
             if (N_Utils.isEmptyInteger(teacherid)) continue;
81
                 TNotice n = new TNotice();
82
                 TNotice n = new TNotice();
82
                 n.setNoticetitle(noticetitle);
83
                 n.setNoticetitle(noticetitle);
83
                 n.setNoticecontent(noticecontent);
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
                 noticeList.add(n);
90
                 noticeList.add(n);
88
             }
91
             }
89
             if (msg == 1) {
92
             if (msg == 1) {

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

3
 import com.xhkjedu.annotation.Action;
3
 import com.xhkjedu.annotation.Action;
4
 import com.xhkjedu.sexam.model.notice.TMsg;
4
 import com.xhkjedu.sexam.model.notice.TMsg;
5
 import com.xhkjedu.sexam.model.notice.TNotice;
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
 import com.xhkjedu.sexam.model.paper.EPaperCorrectclass;
7
 import com.xhkjedu.sexam.model.paper.EPaperCorrectclass;
8
 import com.xhkjedu.sexam.service.notice.NoticeService;
8
 import com.xhkjedu.sexam.service.notice.NoticeService;
9
 import com.xhkjedu.sexam.service.paper.EPaperCorrectclassService;
9
 import com.xhkjedu.sexam.service.paper.EPaperCorrectclassService;
62
         Map s = ePaperCorrectclassService.getESubjectByEpId(epid);
62
         Map s = ePaperCorrectclassService.getESubjectByEpId(epid);
63
         Integer schoolid = (Integer) s.get("schoolid");
63
         Integer schoolid = (Integer) s.get("schoolid");
64
         String noticetitle = s.get("examname") + "-阅卷按班设置";
64
         String noticetitle = s.get("examname") + "-阅卷按班设置";
65
+        Integer gradeid = N_Utils.str2Int(s.get("gradeid").toString());
66
+        String subjectid = s.get("subjectid").toString();
65
         for (EPaperCorrectclass c : teachers) {
67
         for (EPaperCorrectclass c : teachers) {
66
             Integer teacherid = c.getTeacherid();
68
             Integer teacherid = c.getTeacherid();
67
             if (N_Utils.isEmptyInteger(teacherid)) continue;
69
             if (N_Utils.isEmptyInteger(teacherid)) continue;
73
                 TNotice n = new TNotice();
75
                 TNotice n = new TNotice();
74
                 n.setNoticetitle(noticetitle);
76
                 n.setNoticetitle(noticetitle);
75
                 n.setNoticecontent(noticecontent);
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
                 noticeList.add(n);
83
                 noticeList.add(n);
80
             }
84
             }
81
             if (msg == 1) {
85
             if (msg == 1) {

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

3
 import com.xhkjedu.annotation.Action;
3
 import com.xhkjedu.annotation.Action;
4
 import com.xhkjedu.sexam.model.notice.TMsg;
4
 import com.xhkjedu.sexam.model.notice.TMsg;
5
 import com.xhkjedu.sexam.model.notice.TNotice;
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
 import com.xhkjedu.sexam.model.paper.EPaper;
7
 import com.xhkjedu.sexam.model.paper.EPaper;
8
 import com.xhkjedu.sexam.model.paper.EPaperCorrectquestion;
8
 import com.xhkjedu.sexam.model.paper.EPaperCorrectquestion;
9
 import com.xhkjedu.sexam.service.notice.NoticeService;
9
 import com.xhkjedu.sexam.service.notice.NoticeService;
57
         Map s = ePaperCorrectquestionService.getESubjectByEpId(epid);
57
         Map s = ePaperCorrectquestionService.getESubjectByEpId(epid);
58
         Integer schoolid = (Integer) s.get("schoolid");
58
         Integer schoolid = (Integer) s.get("schoolid");
59
         String noticetitle = s.get("examname") + "-阅卷按题设置";
59
         String noticetitle = s.get("examname") + "-阅卷按题设置";
60
+        Integer gradeid = N_Utils.str2Int(s.get("gradeid").toString());
61
+        String subjectid = s.get("subjectid").toString();
60
         for (EPaperCorrectquestion q : teachers) {
62
         for (EPaperCorrectquestion q : teachers) {
61
             Integer teacherid = q.getTeacherid();
63
             Integer teacherid = q.getTeacherid();
62
             if (N_Utils.isEmptyInteger(teacherid)) continue;
64
             if (N_Utils.isEmptyInteger(teacherid)) continue;
68
                 TNotice n = new TNotice();
70
                 TNotice n = new TNotice();
69
                 n.setNoticetitle(noticetitle);
71
                 n.setNoticetitle(noticetitle);
70
                 n.setNoticecontent(noticecontent);
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
                 noticeList.add(n);
78
                 noticeList.add(n);
75
             }
79
             }
76
             if (msg == 1) {
80
             if (msg == 1) {

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

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

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
 
44
 
45
     @Transient
45
     @Transient
46
     //教师id集合
46
     //教师id集合
47
-    private List<TNoticeTeacher> teachers = new ArrayList<>();
47
+    private List<TNoticeUser> users = new ArrayList<>();
48
 
48
 
49
     @Transient
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
 
8
 
9
 @Table(name = "t_notice_user")
9
 @Table(name = "t_notice_user")
10
 @Data
10
 @Data
11
-public class TNoticeTeacher extends BaseBean {
11
+public class TNoticeUser extends BaseBean {
12
     @Id
12
     @Id
13
     //通知用户表
13
     //通知用户表
14
     private Integer nuid;
14
     private Integer nuid;
17
     private Integer noticeid;
17
     private Integer noticeid;
18
 
18
 
19
     //用户id
19
     //用户id
20
-    private Integer teacherid;
20
+    private Integer userid;
21
 
21
 
22
     //是否查看0未查看1已查看
22
     //是否查看0未查看1已查看
23
     private Integer readed;
23
     private Integer readed;
25
     //查看时间
25
     //查看时间
26
     private Integer readtime;
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
     private Integer createtime;
38
     private Integer createtime;
30
 
39
 

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

33
     @Resource
33
     @Resource
34
     private NoticeMapper noticeMapper;
34
     private NoticeMapper noticeMapper;
35
     @Resource
35
     @Resource
36
-    private NoticeTeacherMapper noticeTeacherMapper;
37
-    @Resource
38
-    private NoticeClassMapper noticeClassMapper;
39
-    @Resource
40
-    private NoticeSchoolMapper noticeSchoolMapper;
36
+    private NoticeUserMapper noticeUserMapper;
41
     @Resource
37
     @Resource
42
     private MsgMapper msgMapper;
38
     private MsgMapper msgMapper;
43
     @Resource
39
     @Resource
61
                 });
57
                 });
62
                 noticeMapper.insertList(noticeList);
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
                 noticeList.forEach(n -> {
61
                 noticeList.forEach(n -> {
68
                     Integer noticeid = n.getId();
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
                     teachers.forEach(t -> {
64
                     teachers.forEach(t -> {
71
                         t.setNoticeid(noticeid);
65
                         t.setNoticeid(noticeid);
72
                         t.setReaded(0);
66
                         t.setReaded(0);
74
                         t.setSchoolid(schoolid);
68
                         t.setSchoolid(schoolid);
75
                     });
69
                     });
76
                     teacherList.addAll(teachers);
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
             if (N_Utils.isListNotEmpty(msgList)) {//短信
76
             if (N_Utils.isListNotEmpty(msgList)) {//短信
105
                         msgs.add(msg);
82
                         msgs.add(msg);
106
                     }
83
                     }
107
                 } else {//通知对象2老师
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
                     List<UserVo> users = userMapper.listPhoneByUserIds(userids);//根据用户ids查找手机号
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
                         String userphone = u.getUserphone();
89
                         String userphone = u.getUserphone();
114
                         if (N_Utils.isEmpty(userphone)) continue;
90
                         if (N_Utils.isEmpty(userphone)) continue;
115
                         TMsg m = msgMap.get(u.getUserid());
91
                         TMsg m = msgMap.get(u.getUserid());
122
                     msgMapper.insertList(msgs);//短信保存到数据库
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
                             , LinkedHashMap::new, Collectors.toList()));
103
                             , LinkedHashMap::new, Collectors.toList()));
128
                     for (Map.Entry<String, List<TMsg>> entry : mcollect.entrySet()) {
104
                     for (Map.Entry<String, List<TMsg>> entry : mcollect.entrySet()) {
129
                         List<TMsg> list = entry.getValue();
105
                         List<TMsg> list = entry.getValue();
131
                         for (int i = 0; i < list.size(); i += pageSize) {
107
                         for (int i = 0; i < list.size(); i += pageSize) {
132
                             ZtMsgVo vo = new ZtMsgVo();
108
                             ZtMsgVo vo = new ZtMsgVo();
133
                             String userphone = list.stream().skip(i).limit(pageSize)
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
                             vo.setMobile(userphone);
111
                             vo.setMobile(userphone);
136
                             vo.setContent(msgtxt);
112
                             vo.setContent(msgtxt);
137
                             SMSSender.sendSms(vo);
113
                             SMSSender.sendSms(vo);
140
                 }
116
                 }
141
             }
117
             }
142
         } catch (Exception e) {
118
         } catch (Exception e) {
143
-            log.error("批量添加通知和短信失败", e.getMessage());
119
+            log.error("批量添加通知和短信失败:{}", e.getMessage());
144
         }
120
         }
145
     }
121
     }
146
 
122
 
154
         Integer examid = examVo.getExamid();
130
         Integer examid = examVo.getExamid();
155
         String examname = examVo.getExamname();
131
         String examname = examVo.getExamname();
156
         Integer schoolid = examVo.getSchoolid();
132
         Integer schoolid = examVo.getSchoolid();
133
+        Integer gradeid = examVo.getGradeid();
157
         try {
134
         try {
158
             List<TNotice> noticeList = new ArrayList<>();
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
             List<TMsg> msgList = new ArrayList<>();
138
             List<TMsg> msgList = new ArrayList<>();
162
             String noticetitle = examname + "-考试公告";
139
             String noticetitle = examname + "-考试公告";
163
             List<Map> classes = eClassMapper.listByExamId(examid);
140
             List<Map> classes = eClassMapper.listByExamId(examid);
164
             String classids = classes.stream().map(c -> c.get("classid").toString()).collect(Collectors.joining(","));
141
             String classids = classes.stream().map(c -> c.get("classid").toString()).collect(Collectors.joining(","));
165
             List<UserVo> teachers = userMapper.listTeacherByClassIds(classids);//获取考试班级任教老师
142
             List<UserVo> teachers = userMapper.listTeacherByClassIds(classids);//获取考试班级任教老师
166
             if (notice == 1) {
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
                 TNotice n = new TNotice();
151
                 TNotice n = new TNotice();
173
                 n.setNoticetitle(noticetitle);
152
                 n.setNoticetitle(noticetitle);
174
                 n.setNoticecontent(examcomm);
153
                 n.setNoticecontent(examcomm);
175
-                n.setNoticetype(1);
176
-                n.setClasses(classList);
154
+                n.setNoticetype(3);
155
+                n.setUsers(stuList);
177
                 noticeList.add(n);
156
                 noticeList.add(n);
178
 
157
 
179
                 for (UserVo t : teachers) {
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
                     teacherList.add(nt);
163
                     teacherList.add(nt);
183
                 }
164
                 }
184
                 TNotice n2 = new TNotice();
165
                 TNotice n2 = new TNotice();
185
                 n2.setNoticetitle(noticetitle);
166
                 n2.setNoticetitle(noticetitle);
186
                 n2.setNoticecontent(examcomm);
167
                 n2.setNoticecontent(examcomm);
187
                 n2.setNoticetype(2);
168
                 n2.setNoticetype(2);
188
-                n2.setTeachers(teacherList);
169
+                n2.setUsers(teacherList);
189
                 noticeList.add(n2);
170
                 noticeList.add(n2);
190
             }
171
             }
191
             if (msg == 1) {
172
             if (msg == 1) {
192
                 String msgtxt = noticetitle + "\n" + ExamUtil.htmlRemoveTag(examcomm);
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
                 for (String userphone : userphones) {
181
                 for (String userphone : userphones) {
196
                     TMsg m = new TMsg();
182
                     TMsg m = new TMsg();
197
                     m.setMsgtxt(msgtxt);
183
                     m.setMsgtxt(msgtxt);
198
                     m.setUserphone(userphone);
184
                     m.setUserphone(userphone);
199
                     msgList.add(m);
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
                 for (String userphone : userphones) {
195
                 for (String userphone : userphones) {
204
                     TMsg m = new TMsg();
196
                     TMsg m = new TMsg();
205
                     m.setMsgtxt(msgtxt);
197
                     m.setMsgtxt(msgtxt);
217
                 });
209
                 });
218
                 noticeMapper.insertList(noticeList);
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
                 noticeList.forEach(n -> {
213
                 noticeList.forEach(n -> {
224
                     Integer noticeid = n.getId();
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
                     cteachers.forEach(t -> {
216
                     cteachers.forEach(t -> {
227
                         t.setNoticeid(noticeid);
217
                         t.setNoticeid(noticeid);
228
                         t.setReaded(0);
218
                         t.setReaded(0);
230
                         t.setSchoolid(schoolid);
220
                         t.setSchoolid(schoolid);
231
                     });
221
                     });
232
                     nteacherList.addAll(cteachers);
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
             if (N_Utils.isListNotEmpty(msgList)) {//短信
228
             if (N_Utils.isListNotEmpty(msgList)) {//短信
262
                     msgMapper.insertList(msgs);//短信保存到数据库
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
                             , LinkedHashMap::new, Collectors.toList()));
240
                             , LinkedHashMap::new, Collectors.toList()));
268
                     for (Map.Entry<String, List<TMsg>> entry : mcollect.entrySet()) {
241
                     for (Map.Entry<String, List<TMsg>> entry : mcollect.entrySet()) {
269
                         List<TMsg> list = entry.getValue();
242
                         List<TMsg> list = entry.getValue();
271
                         for (int i = 0; i < list.size(); i += pageSize) {
244
                         for (int i = 0; i < list.size(); i += pageSize) {
272
                             ZtMsgVo vo = new ZtMsgVo();
245
                             ZtMsgVo vo = new ZtMsgVo();
273
                             String userphone = list.stream().skip(i).limit(pageSize)
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
                             vo.setMobile(userphone);
248
                             vo.setMobile(userphone);
276
                             vo.setContent(msgtxt);
249
                             vo.setContent(msgtxt);
277
                             SMSSender.sendSms(vo);
250
                             SMSSender.sendSms(vo);
280
                 }
253
                 }
281
             }
254
             }
282
         } catch (Exception e) {
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
 
21
 
22
     //学校id
22
     //学校id
23
     private Integer schoolid;
23
     private Integer schoolid;
24
+    
25
+    //年级id
26
+    private Integer gradeid;
24
 
27
 
25
     //考试名称
28
     //考试名称
26
     private String examname;
29
     private String examname;

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

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

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

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

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
     </select>
73
     </select>
74
     <!--根据试卷id获取考试科目基本信息-->
74
     <!--根据试卷id获取考试科目基本信息-->
75
     <select id="getESubjectByEpId" resultType="java.util.Map">
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
         from e_paper ep left join e_subject es on ep.esid = es.esid
77
         from e_paper ep left join e_subject es on ep.esid = es.esid
78
         left join e_base eb on es.examid = eb.examid
78
         left join e_base eb on es.examid = eb.examid
79
         where ep.epid=#{epid}
79
         where ep.epid=#{epid}

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

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

Loading…
Cancel
Save