mirror of https://gitee.com/stylefeng/roses
【8.0.5】【notice】更新发送和撤回通知的接口
parent
f468cf359f
commit
1d1bb0e0bf
|
@ -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<>();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue