【8.0.5】【notice】更新发送和撤回通知的接口

pull/60/head
fengshuonan 2024-01-12 17:23:04 +08:00
parent f468cf359f
commit 1d1bb0e0bf
3 changed files with 66 additions and 14 deletions

View File

@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
*
@ -89,17 +88,6 @@ public class SysNoticeController {
return new SuccessResponseData<>(sysNoticeService.detail(sysNoticeRequest));
}
/**
*
*
* @author fengshuonan
* @since 2024/01/12 16:06
*/
@GetResource(name = "获取通知管理列表", path = "/sysNotice/list")
public ResponseData<List<SysNotice>> list(SysNoticeRequest sysNoticeRequest) {
return new SuccessResponseData<>(sysNoticeService.findList(sysNoticeRequest));
}
/**
*
*
@ -111,4 +99,28 @@ public class SysNoticeController {
return new SuccessResponseData<>(sysNoticeService.findPage(sysNoticeRequest));
}
/**
*
*
* @author fengshuonan
* @since 2024/01/12 16:06
*/
@PostResource(name = "发送通知", path = "/sysNotice/publishNotice")
public ResponseData<?> publishNotice(@RequestBody @Validated(BaseRequest.detail.class) SysNoticeRequest sysNoticeRequest) {
this.sysNoticeService.publishNotice(sysNoticeRequest);
return new SuccessResponseData<>();
}
/**
*
*
* @author fengshuonan
* @since 2024/01/12 16:06
*/
@PostResource(name = "撤回通知", path = "/sysNotice/retractNotice")
public ResponseData<?> retractNotice(@RequestBody @Validated(BaseRequest.detail.class) SysNoticeRequest sysNoticeRequest) {
this.sysNoticeService.retractNotice(sysNoticeRequest);
return new SuccessResponseData<>();
}
}

View File

@ -63,7 +63,7 @@ public interface SysNoticeService extends IService<SysNotice> {
/**
*
*
* @param sysNoticeRequest
* @param sysNoticeRequest
* @return List<SysNotice>
* @author fengshuonan
* @since 2024/01/12 16:06
@ -73,11 +73,27 @@ public interface SysNoticeService extends IService<SysNotice> {
/**
*
*
* @param sysNoticeRequest
* @param sysNoticeRequest
* @return PageResult<SysNotice>
* @author fengshuonan
* @since 2024/01/12 16:06
*/
PageResult<SysNotice> findPage(SysNoticeRequest sysNoticeRequest);
/**
*
*
* @author fengshuonan
* @since 2024-01-12 17:15
*/
void publishNotice(SysNoticeRequest sysNoticeRequest);
/**
*
*
* @author fengshuonan
* @since 2024-01-12 17:16
*/
void retractNotice(SysNoticeRequest sysNoticeRequest);
}

View File

@ -97,6 +97,30 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
return PageResultFactory.createPageResult(pageList);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void publishNotice(SysNoticeRequest sysNoticeRequest) {
// 1. 修改当前通知的状态改为已发布
SysNotice sysNotice = this.querySysNotice(sysNoticeRequest);
sysNotice.setPublishStatus(NoticePublishStatusEnum.ALREADY.getCode());
this.updateById(sysNotice);
// 2. 发送通知给接收人
}
@Override
@Transactional(rollbackFor = Exception.class)
public void retractNotice(SysNoticeRequest sysNoticeRequest) {
// 1. 修改当前通知的状态改为未发布
SysNotice sysNotice = this.querySysNotice(sysNoticeRequest);
sysNotice.setPublishStatus(NoticePublishStatusEnum.NOT_PUBLISH.getCode());
this.updateById(sysNotice);
// 2. 调用撤回接口,将已发送的消息全都撤回
}
@Override
public List<SysNotice> findList(SysNoticeRequest sysNoticeRequest) {
LambdaQueryWrapper<SysNotice> wrapper = this.createWrapper(sysNoticeRequest);