|
@@ -65,8 +65,13 @@ public class NotifyMessageController {
|
|
@GetMapping("/my-page")
|
|
@GetMapping("/my-page")
|
|
@Operation(summary = "获得我的站内信分页")
|
|
@Operation(summary = "获得我的站内信分页")
|
|
public CommonResult<PageResult<NotifyMessageRespVO>> getMyMyNotifyMessagePage(@Valid NotifyMessageMyPageReqVO pageVO) {
|
|
public CommonResult<PageResult<NotifyMessageRespVO>> getMyMyNotifyMessagePage(@Valid NotifyMessageMyPageReqVO pageVO) {
|
|
|
|
+ Long loginUserId = getLoginUserId();
|
|
|
|
+ EmployeeRespDTO loginEmployee = employeeApi.getEmployeeByUserId(loginUserId);
|
|
|
|
+ if (loginEmployee == null) {
|
|
|
|
+ return success(PageResult.empty());
|
|
|
|
+ }
|
|
PageResult<NotifyMessageDO> pageResult = notifyMessageService.getMyMyNotifyMessagePage(pageVO,
|
|
PageResult<NotifyMessageDO> pageResult = notifyMessageService.getMyMyNotifyMessagePage(pageVO,
|
|
- getLoginUserId(), UserTypeEnum.ADMIN.getValue());
|
|
|
|
|
|
+ loginEmployee.getId(), UserTypeEnum.MEMBER.getValue());
|
|
return success(BeanUtils.toBean(pageResult, NotifyMessageRespVO.class));
|
|
return success(BeanUtils.toBean(pageResult, NotifyMessageRespVO.class));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -74,14 +79,24 @@ public class NotifyMessageController {
|
|
@Operation(summary = "标记站内信为已读")
|
|
@Operation(summary = "标记站内信为已读")
|
|
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
|
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
|
public CommonResult<Boolean> updateNotifyMessageRead(@RequestParam("ids") List<Long> ids) {
|
|
public CommonResult<Boolean> updateNotifyMessageRead(@RequestParam("ids") List<Long> ids) {
|
|
- notifyMessageService.updateNotifyMessageRead(ids, getLoginUserId(), UserTypeEnum.ADMIN.getValue());
|
|
|
|
|
|
+ Long loginUserId = getLoginUserId();
|
|
|
|
+ EmployeeRespDTO loginEmployee = employeeApi.getEmployeeByUserId(loginUserId);
|
|
|
|
+ if (loginEmployee == null) {
|
|
|
|
+ throw exception(EMPLOYEE_INFO_NOT_EXISTS);
|
|
|
|
+ }
|
|
|
|
+ notifyMessageService.updateNotifyMessageRead(ids, loginEmployee.getId(), UserTypeEnum.MEMBER.getValue());
|
|
return success(Boolean.TRUE);
|
|
return success(Boolean.TRUE);
|
|
}
|
|
}
|
|
|
|
|
|
@PutMapping("/update-all-read")
|
|
@PutMapping("/update-all-read")
|
|
@Operation(summary = "标记所有站内信为已读")
|
|
@Operation(summary = "标记所有站内信为已读")
|
|
public CommonResult<Boolean> updateAllNotifyMessageRead() {
|
|
public CommonResult<Boolean> updateAllNotifyMessageRead() {
|
|
- notifyMessageService.updateAllNotifyMessageRead(getLoginUserId(), UserTypeEnum.ADMIN.getValue());
|
|
|
|
|
|
+ Long loginUserId = getLoginUserId();
|
|
|
|
+ EmployeeRespDTO loginEmployee = employeeApi.getEmployeeByUserId(loginUserId);
|
|
|
|
+ if (loginEmployee == null) {
|
|
|
|
+ throw exception(EMPLOYEE_INFO_NOT_EXISTS);
|
|
|
|
+ }
|
|
|
|
+ notifyMessageService.updateAllNotifyMessageRead(loginEmployee.getId(), UserTypeEnum.MEMBER.getValue());
|
|
return success(Boolean.TRUE);
|
|
return success(Boolean.TRUE);
|
|
}
|
|
}
|
|
|
|
|