|
@@ -327,17 +327,19 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
if(optional.isPresent()){
|
|
|
NoticeEntity entity = optional.get();
|
|
|
|
|
|
- if (entity.getNoticeStatus() != NoticeStatus.PUBLISHED) {
|
|
|
- throw new StatusException("501008", "只能撤回已经发送的消息");
|
|
|
+ if (entity.getNoticeStatus() != NoticeStatus.PUBLISHED && entity.getNoticeStatus() != NoticeStatus.TO_BE_PUBLISHED) {
|
|
|
+ throw new StatusException("501008", "只能撤回已发送或者待发送的消息");
|
|
|
} else {
|
|
|
//根据noticeId删除用户通知,改为更新是否已经撤回状态
|
|
|
//userNoticeRepo.deleteByNoticeId(id);
|
|
|
- userNoticeRepo.updateNoticeRecalledStatus(id);
|
|
|
+ if(entity.getNoticeStatus() != NoticeStatus.PUBLISHED){
|
|
|
+ //如果已发送更新用户通知状态
|
|
|
+ userNoticeRepo.updateNoticeRecalledStatus(id);
|
|
|
+ }
|
|
|
+ entity.setNoticeStatus(NoticeStatus.RECALLED);
|
|
|
+ entity.setUpdateTime(new Date());
|
|
|
+ noticeRepo.save(entity);
|
|
|
}
|
|
|
-
|
|
|
- entity.setNoticeStatus(NoticeStatus.RECALLED);
|
|
|
- entity.setUpdateTime(new Date());
|
|
|
- noticeRepo.save(entity);
|
|
|
} else {
|
|
|
throw new StatusException("501006", "找不到通知id为:" + id + "的数据");
|
|
|
}
|