Ver código fonte

1、7697-站内信查询员工化

dongpo 6 meses atrás
pai
commit
f0011837be

+ 18 - 3
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyMessageController.java

@@ -65,8 +65,13 @@ public class NotifyMessageController {
     @GetMapping("/my-page")
     @Operation(summary = "获得我的站内信分页")
     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,
-                getLoginUserId(), UserTypeEnum.ADMIN.getValue());
+                loginEmployee.getId(), UserTypeEnum.MEMBER.getValue());
         return success(BeanUtils.toBean(pageResult, NotifyMessageRespVO.class));
     }
 
@@ -74,14 +79,24 @@ public class NotifyMessageController {
     @Operation(summary = "标记站内信为已读")
     @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
     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);
     }
 
     @PutMapping("/update-all-read")
     @Operation(summary = "标记所有站内信为已读")
     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);
     }