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 org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知管理控制器
|
* 通知管理控制器
|
||||||
|
@ -89,17 +88,6 @@ public class SysNoticeController {
|
||||||
return new SuccessResponseData<>(sysNoticeService.detail(sysNoticeRequest));
|
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));
|
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<>();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,4 +80,20 @@ public interface SysNoticeService extends IService<SysNotice> {
|
||||||
*/
|
*/
|
||||||
PageResult<SysNotice> findPage(SysNoticeRequest sysNoticeRequest);
|
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);
|
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
|
@Override
|
||||||
public List<SysNotice> findList(SysNoticeRequest sysNoticeRequest) {
|
public List<SysNotice> findList(SysNoticeRequest sysNoticeRequest) {
|
||||||
LambdaQueryWrapper<SysNotice> wrapper = this.createWrapper(sysNoticeRequest);
|
LambdaQueryWrapper<SysNotice> wrapper = this.createWrapper(sysNoticeRequest);
|
||||||
|
|
Loading…
Reference in New Issue