提交 a671bad6 authored 作者: xc's avatar xc

xc

上级 72d26d15
...@@ -2,6 +2,7 @@ package com.zjty.efs.bus.service.impl; ...@@ -2,6 +2,7 @@ package com.zjty.efs.bus.service.impl;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.zjty.efs.bus.Dao.NoticeDao; import com.zjty.efs.bus.Dao.NoticeDao;
import com.zjty.efs.bus.entity.Addressee; import com.zjty.efs.bus.entity.Addressee;
import com.zjty.efs.bus.entity.Attention; import com.zjty.efs.bus.entity.Attention;
...@@ -72,6 +73,7 @@ public class NoticeServiceImpl implements NoticeService { ...@@ -72,6 +73,7 @@ public class NoticeServiceImpl implements NoticeService {
}else { }else {
List<Addressee> addresseeList2 = new ArrayList<>(); //接受者显示的接收列表 List<Addressee> addresseeList2 = new ArrayList<>(); //接受者显示的接收列表
Notice notice1 = transform(notice); //发送通知 Notice notice1 = transform(notice); //发送通知
notice1.setId(notice.getId());
String dataList = ""; String dataList = "";
List<UserDo> stringList = new ArrayList<>();//收件人列表 List<UserDo> stringList = new ArrayList<>();//收件人列表
for(String addressee:strings){ for(String addressee:strings){
...@@ -100,6 +102,7 @@ public class NoticeServiceImpl implements NoticeService { ...@@ -100,6 +102,7 @@ public class NoticeServiceImpl implements NoticeService {
String add2 = JSONObject.toJSONString(addresseeList2); String add2 = JSONObject.toJSONString(addresseeList2);
for (UserDo add:stringList){ for (UserDo add:stringList){
Notice notice2 = transform(notice); // 接收通知 Notice notice2 = transform(notice); // 接收通知
notice2.setAddressee(add2); notice2.setAddressee(add2);
notice2.setType(0); notice2.setType(0);
...@@ -108,13 +111,14 @@ public class NoticeServiceImpl implements NoticeService { ...@@ -108,13 +111,14 @@ public class NoticeServiceImpl implements NoticeService {
String data2 = "[" +add.getUnit() + "][" + add.getDepartment() + "]的[" + add.getName() String data2 = "[" +add.getUnit() + "][" + add.getDepartment() + "]的[" + add.getName()
+ "]收到了来自[" + userDo.getUnit() + "][" + userDo.getDepartment() + "]的[" + userDo.getName() + "]收到了来自[" + userDo.getUnit() + "][" + userDo.getDepartment() + "]的[" + userDo.getName()
+ "]关于[" + notice.getTitle() + "的通知"; + "]关于[" + notice.getTitle() + "]的通知";
Attention attention = new Attention(); Attention attention = new Attention();
attention.setStatus(0); attention.setStatus(0);
attention.setUpdateTime(new Date()); attention.setUpdateTime(new Date());
attention.setData(data2); attention.setData(data2);
attention.setUserId(add.getId()); attention.setUserId(add.getId());
attention.setNoticeId(notice2.getId());
attentionService.addAttention(attention); attentionService.addAttention(attention);
} }
...@@ -145,7 +149,7 @@ public class NoticeServiceImpl implements NoticeService { ...@@ -145,7 +149,7 @@ public class NoticeServiceImpl implements NoticeService {
private Notice transform(Notice notice){ private Notice transform(Notice notice){
Notice notice1 = new Notice(); Notice notice1 = new Notice();
notice1.setId(notice.getId()); // notice1.setId(notice.getId());
notice1.setTitle(notice.getTitle()); notice1.setTitle(notice.getTitle());
notice1.setAddressee(notice.getAddressee()); notice1.setAddressee(notice.getAddressee());
notice1.setDeadline(notice.getDeadline()); notice1.setDeadline(notice.getDeadline());
...@@ -159,6 +163,7 @@ public class NoticeServiceImpl implements NoticeService { ...@@ -159,6 +163,7 @@ public class NoticeServiceImpl implements NoticeService {
notice1.setUnit(notice.getUnit()); notice1.setUnit(notice.getUnit());
notice1.setName(notice.getName()); notice1.setName(notice.getName());
notice1.setLabel(notice.getLabel()); notice1.setLabel(notice.getLabel());
notice1.setReceiver(notice.getReceiver());
return notice1; return notice1;
} }
......
package com.zjty.efs.bus.util; package com.zjty.efs.bus.util;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.zjty.efs.bus.entity.Addressee;
import com.zjty.efs.bus.entity.Attention; import com.zjty.efs.bus.entity.Attention;
import com.zjty.efs.bus.entity.Notice; import com.zjty.efs.bus.entity.Notice;
import com.zjty.efs.bus.service.AttentionService; import com.zjty.efs.bus.service.AttentionService;
import com.zjty.efs.bus.service.NoticeService; import com.zjty.efs.bus.service.NoticeService;
import com.zjty.efs.ftp.base.response.ServerResponse;
import com.zjty.efs.ftp.entity.DownLoadCount; import com.zjty.efs.ftp.entity.DownLoadCount;
import com.zjty.efs.ftp.entity.DownLoadRequest; import com.zjty.efs.ftp.entity.DownLoadRequest;
import com.zjty.efs.ftp.service.DownLoadService; import com.zjty.efs.ftp.service.DownLoadService;
...@@ -16,11 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -16,11 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.Period;
import java.time.ZoneId;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -42,7 +33,7 @@ public class Job { ...@@ -42,7 +33,7 @@ public class Job {
for(Notice notice:noticeList){ for(Notice notice:noticeList){
Date endTime = notice.getDeadline(); Date endTime = notice.getDeadline();
//失效天数
double days = (endTime.getTime()-now.getTime())/(1000*3600*24.0); double days = (endTime.getTime()-now.getTime())/(1000*3600*24.0);
// System.out.println(days); // System.out.println(days);
...@@ -67,7 +58,6 @@ public class Job { ...@@ -67,7 +58,6 @@ public class Job {
* @param label 修改通知label 1为提醒过一次,2为提醒过两次 * @param label 修改通知label 1为提醒过一次,2为提醒过两次
*/ */
private void updateAtt(Notice notice, double days, int label){ private void updateAtt(Notice notice, double days, int label){
// System.out.println("--------------------定时------------------");
String data = ""; String data = "";
Attention attention = new Attention(); Attention attention = new Attention();
data = "您收到来自["+ notice.getUnit() + "][" + notice.getName() +"]标题为[" + notice.getTitle() + "]的通知,没有查看"; data = "您收到来自["+ notice.getUnit() + "][" + notice.getName() +"]标题为[" + notice.getTitle() + "]的通知,没有查看";
...@@ -114,10 +104,10 @@ public class Job { ...@@ -114,10 +104,10 @@ public class Job {
attention.setData(data); attention.setData(data);
attention.setNoticeId(notice.getId()); attention.setNoticeId(notice.getId());
String str = notice.getAddressee(); // String str = notice.getAddressee();
List<Addressee> addresseeList = JSONArray.parseArray(str,Addressee.class); // List<Addressee> addresseeList = JSONArray.parseArray(str,Addressee.class);
String userId = addresseeList.get(0).getId(); // String userId = addresseeList.get(0).getId();
attention.setUserId(userId); attention.setUserId(notice.getReceiver());
attention.setStatus(0); attention.setStatus(0);
attention.setUpdateTime(new Date()); attention.setUpdateTime(new Date());
attentionService.addAttention(attention); attentionService.addAttention(attention);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论