Browse Source

Merge remote-tracking branch 'origin/wn' into ywx

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

+ 2
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/notice/NoticeClassMapper.java View File

29
 
29
 
30
     //获取所有需要处理的班级通知
30
     //获取所有需要处理的班级通知
31
     List<TNoticeClass> listAll();
31
     List<TNoticeClass> listAll();
32
+    //通知
33
+    TNoticeUser getNoticeClassInfo(@Param("studentid")Integer studentid);
32
 
34
 
33
     //获取通知班级学生
35
     //获取通知班级学生
34
     List<TNoticeUser> listClassStudent(@Param("classid") Integer classid);
36
     List<TNoticeUser> listClassStudent(@Param("classid") Integer classid);

+ 3
- 1
sapi/src/main/java/com/xhkjedu/sapi/mapper/notice/NoticeMapper.java View File

1
 package com.xhkjedu.sapi.mapper.notice;
1
 package com.xhkjedu.sapi.mapper.notice;
2
 
2
 
3
 import com.xhkjedu.base.TkMapper;
3
 import com.xhkjedu.base.TkMapper;
4
-import com.xhkjedu.sapi.model.system.TSchool;
5
 import com.xhkjedu.sapi.model.notice.TNotice;
4
 import com.xhkjedu.sapi.model.notice.TNotice;
5
+import com.xhkjedu.sapi.model.system.TSchool;
6
 import com.xhkjedu.sapi.vo.gradeclass.ClassVo;
6
 import com.xhkjedu.sapi.vo.gradeclass.ClassVo;
7
 import com.xhkjedu.sapi.vo.notice.NoticeUserVo;
7
 import com.xhkjedu.sapi.vo.notice.NoticeUserVo;
8
 import com.xhkjedu.sapi.vo.notice.NoticeVo;
8
 import com.xhkjedu.sapi.vo.notice.NoticeVo;
75
 
75
 
76
     //通知学校列表
76
     //通知学校列表
77
     List<TSchool> listSchool(Integer noticeid);
77
     List<TSchool> listSchool(Integer noticeid);
78
+
79
+    int deleteNotice(@Param("noticeid")Integer noticeid);
78
 }
80
 }

+ 4
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/notice/TNoticeClass.java View File

5
 
5
 
6
 import javax.persistence.Id;
6
 import javax.persistence.Id;
7
 import javax.persistence.Table;
7
 import javax.persistence.Table;
8
+import javax.persistence.Transient;
8
 
9
 
9
 /*
10
 /*
10
 * @Description 班级通知,学生个人通知
11
 * @Description 班级通知,学生个人通知
28
 
29
 
29
     //创建时间
30
     //创建时间
30
     private Integer createtime;
31
     private Integer createtime;
32
+
33
+    @Transient
34
+    private String noticetitle;
31
 }
35
 }

+ 21
- 7
sapi/src/main/java/com/xhkjedu/sapi/service/notice/NoticeService.java View File

227
         //获取需要处理的通知
227
         //获取需要处理的通知
228
         List<TNoticeClass> noticeClasses = noticeClassMapper.listAll();
228
         List<TNoticeClass> noticeClasses = noticeClassMapper.listAll();
229
         for (TNoticeClass noticeClass : noticeClasses) {
229
         for (TNoticeClass noticeClass : noticeClasses) {
230
-            List<TNoticeUser> noticeUsers = noticeClassMapper.listClassStudent(noticeClass.getClassid());
231
-            if (N_Utils.isListNotEmpty(noticeUsers)) {
232
-                for (TNoticeUser user : noticeUsers) {
233
-                    user.setNoticeid(noticeClass.getNoticeid());
234
-                    user.setReaded(1);
235
-                    user.setCreatetime(noticeClass.getCreatetime());
230
+            if(noticeClass.getNoticetitle().contains("作业退回")){
231
+                //说明是退回的作业
232
+                //获取用户所在班级信息
233
+                TNoticeUser noticeUser = noticeClassMapper.getNoticeClassInfo(noticeClass.getClassid());
234
+                if(noticeUser!=null){
235
+                    noticeUser.setNoticeid(noticeClass.getNoticeid());
236
+                    noticeUser.setReaded(1);
237
+                    noticeUser.setCreatetime(noticeClass.getCreatetime());
238
+                    noticeUserMapper.insert(noticeUser);
239
+                }else{
240
+                    noticeMapper.deleteNotice(noticeClass.getNoticeid());
241
+                }
242
+            }else{
243
+                List<TNoticeUser> noticeUsers = noticeClassMapper.listClassStudent(noticeClass.getClassid());
244
+                if (N_Utils.isListNotEmpty(noticeUsers)) {
245
+                    for (TNoticeUser user : noticeUsers) {
246
+                        user.setNoticeid(noticeClass.getNoticeid());
247
+                        user.setReaded(1);
248
+                        user.setCreatetime(noticeClass.getCreatetime());
249
+                    }
250
+                    noticeUserMapper.insertList(noticeUsers);
236
                 }
251
                 }
237
-                noticeUserMapper.insertList(noticeUsers);
238
             }
252
             }
239
         }
253
         }
240
     }
254
     }

+ 7
- 1
sapi/src/main/resources/mapper/notice/NoticeClassMapper.xml View File

16
 
16
 
17
     <!--获取所有发给班级的通知-->
17
     <!--获取所有发给班级的通知-->
18
     <select id="listAll" resultType="com.xhkjedu.sapi.model.notice.TNoticeClass">
18
     <select id="listAll" resultType="com.xhkjedu.sapi.model.notice.TNoticeClass">
19
-        select * from t_notice_class order by noticeid
19
+        select nc.*,n.noticetitle from t_notice_class nc left join t_notice n on nc.noticeid=n.noticeid
20
+        order by n.noticeid
21
+    </select>
22
+    <!--通知学生信息-->
23
+    <select id="getNoticeClassInfo" resultType="com.xhkjedu.sapi.model.notice.TNoticeUser">
24
+        select c.classid,c.gradeid,s.studentid as userid from t_class_student s left join t_class c on s.classid=c.classid
25
+        where s.studentid=#{studentid} and c.classtype=1 order by c.classid desc limit 1
20
     </select>
26
     </select>
21
 
27
 
22
     <!--获取通知班级学生-->
28
     <!--获取通知班级学生-->

+ 3
- 0
sapi/src/main/resources/mapper/notice/NoticeMapper.xml View File

124
         delete n.* from t_notice n left join t_notice_class nc on n.noticeid = nc.noticeid
124
         delete n.* from t_notice n left join t_notice_class nc on n.noticeid = nc.noticeid
125
         where nc.classid=#{classid}
125
         where nc.classid=#{classid}
126
     </delete>
126
     </delete>
127
+    <delete id="deleteNotice">
128
+        delete from t_notice where noticeid=#{noticeid}
129
+    </delete>
127
 </mapper>
130
 </mapper>

Loading…
Cancel
Save