提交 d036300a authored 作者: zhangshuang's avatar zhangshuang

Merge branch 'develop' of git.yfzx.zjtys.com.cn:zhuangshuang/EncryptedFileSystem into develop

...@@ -19,5 +19,6 @@ public interface NoticeDao extends JpaRepository<Notice , Integer> { ...@@ -19,5 +19,6 @@ public interface NoticeDao extends JpaRepository<Notice , Integer> {
Page<Notice> findOutByReceiverAndType(String addressee, int type, Pageable pageable); Page<Notice> findOutByReceiverAndType(String addressee, int type, Pageable pageable);
Page<Notice> findOutByReceiverAndTypeAndStatus(String addressee, int type, int status, Pageable pageable); Page<Notice> findOutByReceiverAndTypeAndStatus(String addressee, int type, int status, Pageable pageable);
List<Notice> findOutByReceiverAndStatus(String receiver, int status); List<Notice> findOutByReceiverAndStatus(String receiver, int status);
Page<Notice> findOutBySenderAndTypeAndDeleted(String sender, int type, Pageable pageable, String deleted);
} }
...@@ -99,4 +99,12 @@ public class NoticeController { ...@@ -99,4 +99,12 @@ public class NoticeController {
return ResponseEntity.ok(noticeService.unreadNum(userId)); return ResponseEntity.ok(noticeService.unreadNum(userId));
} }
@GetMapping("/deleteDraft")
@ApiOperation(value = "删除草稿")
@ApiImplicitParam(name = "noticeId", value = "草稿编号", paramType = "query", required = true)
public ResponseEntity deleteDraft(int noticeId){
log.info("删除草稿");
return ResponseEntity.ok(noticeService.deleteDraft(noticeId));
}
} }
...@@ -63,4 +63,5 @@ public class Attention { ...@@ -63,4 +63,5 @@ public class Attention {
private Date updateTime; private Date updateTime;
} }
...@@ -136,6 +136,13 @@ public class Notice { ...@@ -136,6 +136,13 @@ public class Notice {
@Column(name = "receiver") @Column(name = "receiver")
private String receiver; private String receiver;
/**
* 是否删除
*/
@ApiModelProperty(value = "deleted", example = "", dataType = "String", name = "是否删除",notes = "没有删除0,已删除1")
@Column(name = "deleted")
private String deleted;
} }
...@@ -77,4 +77,11 @@ public interface NoticeService { ...@@ -77,4 +77,11 @@ public interface NoticeService {
* @return 已接收未读数量 * @return 已接收未读数量
*/ */
int unreadNum(String userId); int unreadNum(String userId);
/**
* 删除草稿
* @param noticeId 通知编号
* @return 成功true
*/
boolean deleteDraft(int noticeId);
} }
...@@ -68,6 +68,7 @@ public class NoticeServiceImpl implements NoticeService { ...@@ -68,6 +68,7 @@ public class NoticeServiceImpl implements NoticeService {
} }
notice.setAddressee(JSONObject.toJSONString(addresseeList)); notice.setAddressee(JSONObject.toJSONString(addresseeList));
notice.setDeleted("0");
noticeDao.save(notice); noticeDao.save(notice);
}else { }else {
...@@ -194,8 +195,8 @@ public class NoticeServiceImpl implements NoticeService { ...@@ -194,8 +195,8 @@ public class NoticeServiceImpl implements NoticeService {
notice.setStatus(1); notice.setStatus(1);
noticeDao.save(notice); noticeDao.save(notice);
UserDo userDo = userService.findById(userId); // 当前用户 UserDo userDo = userService.findById(userId); // 当前用户
String data = "[" +userDo.getUnit() + "][" + userDo.getDepartment() + "]的[" + userDo.getName() String data = "[" +userDo.getUnit() + "_" + userDo.getName()
+ "查看了关于[" + notice.getTitle() + "的通知"; + "]查看了《" + notice.getTitle() + "》";
efsLogUtil.addLog(new EfsLog(null, userDo.getId(), data, new Date())); efsLogUtil.addLog(new EfsLog(null, userDo.getId(), data, new Date()));
return notice; return notice;
...@@ -216,8 +217,11 @@ public class NoticeServiceImpl implements NoticeService { ...@@ -216,8 +217,11 @@ public class NoticeServiceImpl implements NoticeService {
//已接收 //已接收
// p = noticeDao.findOutByAddresseeLikeAndType("%"+user+"%", type, pageable); // p = noticeDao.findOutByAddresseeLikeAndType("%"+user+"%", type, pageable);
p = noticeDao.findOutByReceiverAndType(user, type,pageable); p = noticeDao.findOutByReceiverAndType(user, type,pageable);
}else if(type == 2){
//草稿
p = noticeDao.findOutBySenderAndTypeAndDeleted(user, type, pageable,"0");
}else { }else {
//已发送,草稿 //已发送
p = noticeDao.findOutBySenderAndType(user, type, pageable); p = noticeDao.findOutBySenderAndType(user, type, pageable);
} }
...@@ -298,5 +302,19 @@ public class NoticeServiceImpl implements NoticeService { ...@@ -298,5 +302,19 @@ public class NoticeServiceImpl implements NoticeService {
return noticeList.size(); return noticeList.size();
} }
@Override
public boolean deleteDraft(int noticeId) {
try {
Notice notice = noticeDao.findById(noticeId);
notice.setDeleted("1");
noticeDao.save(notice);
return true;
}catch (Exception e){
e.printStackTrace();
return false;
}
}
} }
...@@ -39,10 +39,10 @@ public class Job { ...@@ -39,10 +39,10 @@ public class Job {
// updateAtt(notice, days, 1); // updateAtt(notice, days, 1);
if (days <= 3.001 && days > 2.998 && notice.getLabel() != 1){ if (days <= 3.001 && days > 2.998 && notice.getLabel() != 1){
updateAtt(notice, 3, 1); updateAtt(notice, "3", 1);
} }
if(days <= 1.001 && days > 0.998 && notice.getLabel() != 2){ if(days <= 1.001 && days > 0.998 && notice.getLabel() != 2){
updateAtt(notice, 1, 2); updateAtt(notice, "1", 2);
} }
} }
...@@ -57,7 +57,7 @@ public class Job { ...@@ -57,7 +57,7 @@ public class Job {
* @param days 失效天数 * @param days 失效天数
* @param label 修改通知label 1为提醒过一次,2为提醒过两次 * @param label 修改通知label 1为提醒过一次,2为提醒过两次
*/ */
private void updateAtt(Notice notice, double days, int label){ private void updateAtt(Notice notice, String days, int label){
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() + "]的通知,没有查看";
...@@ -78,7 +78,7 @@ public class Job { ...@@ -78,7 +78,7 @@ public class Job {
// System.out.println(downLoadCounts); // System.out.println(downLoadCounts);
for(DownLoadCount downLoadCount:downLoadCounts){ for(DownLoadCount downLoadCount:downLoadCounts){
if(downLoadCount.getCount() == 0){ if(downLoadCount.getCount() == 0){
data = "您收到["+ notice.getUnit() + "][" + notice.getName() +"]的《" + notice.getTitle() + "》,有文件没有下载"; data = "您收到["+ notice.getUnit() + "_" + notice.getName() +"]的《" + notice.getTitle() + "》,有文件没有下载";
add(days, attention, data, notice, label); add(days, attention, data, notice, label);
} }
} }
...@@ -99,7 +99,7 @@ public class Job { ...@@ -99,7 +99,7 @@ public class Job {
* @param notice 通知实体 * @param notice 通知实体
* @param label 该通知提醒过几次 * @param label 该通知提醒过几次
*/ */
private void add(double days, Attention attention, String data, Notice notice, int label){ private void add(String days, Attention attention, String data, Notice notice, int label){
// int d = (int)Math.ceil(days); // int d = (int)Math.ceil(days);
data = data + ",还有" + days + "天失效。请尽快下载。"; data = data + ",还有" + days + "天失效。请尽快下载。";
attention.setData(data); attention.setData(data);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论