提交 3c4f2521 authored 作者: xc's avatar xc

xc

上级 580e15d6
...@@ -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;
}
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论