|
@@ -1,20 +1,14 @@
|
1
|
1
|
package com.xhkjedu.sapi.service.notice;
|
2
|
2
|
|
3
|
|
-import com.xhkjedu.sapi.mapper.notice.NoticeClassMapper;
|
4
|
|
-import com.xhkjedu.sapi.mapper.notice.NoticeMapper;
|
5
|
|
-import com.xhkjedu.sapi.mapper.notice.NoticeSchoolMapper;
|
6
|
|
-import com.xhkjedu.sapi.mapper.notice.NoticeUserMapper;
|
7
|
|
-import com.xhkjedu.sapi.model.system.TSchool;
|
|
3
|
+import com.xhkjedu.sapi.mapper.notice.*;
|
|
4
|
+import com.xhkjedu.sapi.model.notice.TNoticeFile;
|
8
|
5
|
import com.xhkjedu.sapi.model.notice.TNotice;
|
9
|
6
|
import com.xhkjedu.utils.N_Utils;
|
10
|
|
-import com.xhkjedu.sapi.vo.gradeclass.ClassVo;
|
11
|
|
-import com.xhkjedu.sapi.vo.notice.NoticeUserVo;
|
12
|
7
|
import com.xhkjedu.sapi.vo.notice.NoticeVo;
|
13
|
8
|
import org.springframework.stereotype.Service;
|
14
|
9
|
|
15
|
10
|
import javax.annotation.Resource;
|
16
|
|
-import java.util.ArrayList;
|
17
|
|
-import java.util.List;
|
|
11
|
+import java.util.*;
|
18
|
12
|
|
19
|
13
|
/**
|
20
|
14
|
* @author ywx
|
|
@@ -31,7 +25,7 @@ public class NoticeService {
|
31
|
25
|
@Resource
|
32
|
26
|
private NoticeUserMapper noticeUserMapper;
|
33
|
27
|
@Resource
|
34
|
|
- private NoticeSchoolMapper noticeSchoolMapper;
|
|
28
|
+ private NoticeFileMapper noticeFileMapper;
|
35
|
29
|
|
36
|
30
|
//添加
|
37
|
31
|
public Integer save(TNotice model) {
|
|
@@ -43,6 +37,15 @@ public class NoticeService {
|
43
|
37
|
//添加通知对象
|
44
|
38
|
saveNoticeObj(model);
|
45
|
39
|
|
|
40
|
+ //通知附件
|
|
41
|
+ List<TNoticeFile> files = model.getFiles();
|
|
42
|
+ if (N_Utils.isListNotEmpty(files)) {
|
|
43
|
+ Integer noticeid = model.getNoticeid();
|
|
44
|
+ for (TNoticeFile file : files) {
|
|
45
|
+ file.setNoticeid(noticeid);
|
|
46
|
+ }
|
|
47
|
+ noticeFileMapper.insertList(files);
|
|
48
|
+ }
|
46
|
49
|
return model.getId();
|
47
|
50
|
}
|
48
|
51
|
|
|
@@ -66,20 +69,21 @@ public class NoticeService {
|
66
|
69
|
noticeUserMapper.batchSave(model);
|
67
|
70
|
}
|
68
|
71
|
|
69
|
|
- if (N_Utils.isListEmpty(model.getSchools())) {//兼容以前添加单个学校模式
|
|
72
|
+ /*if (N_Utils.isListEmpty(model.getSchools())) {//兼容以前添加单个学校模式
|
70
|
73
|
List<TSchool> schools = new ArrayList<>();
|
71
|
74
|
TSchool s = new TSchool();
|
72
|
75
|
s.setSchoolid(model.getSchoolid());
|
73
|
76
|
schools.add(s);
|
74
|
77
|
model.setSchools(schools);
|
75
|
78
|
}
|
76
|
|
- noticeSchoolMapper.batchSave(model);//通知学校关联信息
|
|
79
|
+ noticeSchoolMapper.batchSave(model);//通知学校关联信息*/
|
77
|
80
|
}
|
78
|
81
|
|
79
|
82
|
//获取详情
|
80
|
83
|
public TNotice findById(Integer noticeid) {
|
81
|
84
|
TNotice notice = noticeMapper.findById(noticeid);
|
82
|
|
- Integer noticetype = notice.getNoticetype();
|
|
85
|
+ notice.setFiles(noticeFileMapper.listByNoticeId(noticeid));
|
|
86
|
+ /*Integer noticetype = notice.getNoticetype();
|
83
|
87
|
if (noticetype == 1) {
|
84
|
88
|
List<ClassVo> classes = noticeMapper.listClass(noticeid);
|
85
|
89
|
notice.setClasses(classes);
|
|
@@ -89,7 +93,7 @@ public class NoticeService {
|
89
|
93
|
} else {
|
90
|
94
|
List<TSchool> schools = noticeMapper.listSchool(noticeid);
|
91
|
95
|
notice.setSchools(schools);
|
92
|
|
- }
|
|
96
|
+ }*/
|
93
|
97
|
return notice;
|
94
|
98
|
}
|
95
|
99
|
|
|
@@ -129,6 +133,7 @@ public class NoticeService {
|
129
|
133
|
**/
|
130
|
134
|
public TNotice reade(Integer noticeid, Integer createid) {
|
131
|
135
|
TNotice notice = noticeMapper.findById2(noticeid);
|
|
136
|
+ notice.setFiles(noticeFileMapper.listByNoticeId(noticeid));
|
132
|
137
|
noticeUserMapper.reade(noticeid, createid, N_Utils.getSecondTimestamp());
|
133
|
138
|
return notice;
|
134
|
139
|
}
|
|
@@ -159,4 +164,15 @@ public class NoticeService {
|
159
|
164
|
public List<NoticeVo> listNoticeStuWeb(TNotice notice) {
|
160
|
165
|
return noticeMapper.listNoticeForStuWeb(notice);
|
161
|
166
|
}
|
|
167
|
+
|
|
168
|
+ /**
|
|
169
|
+ * @Description 通知对象
|
|
170
|
+ * @Date 2023/12/18 16:26
|
|
171
|
+ * @Author YWX
|
|
172
|
+ * @Param [noticeid]
|
|
173
|
+ * @Return java.util.List<java.util.Map>
|
|
174
|
+ **/
|
|
175
|
+ public List<Map> listUser(Integer noticeid) {
|
|
176
|
+ return noticeUserMapper.listByNoticeId(noticeid);
|
|
177
|
+ }
|
162
|
178
|
}
|