From 2bdcf12109e62a731eb16e90b6e1c39a67853fb1 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期一, 13 十月 2025 18:46:53 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/OaNotificationController.java | 44 +++++++++++++++++++++-----------------------
1 files changed, 21 insertions(+), 23 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/OaNotificationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/OaNotificationController.java
index 3f36a01..74b8fe2 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/OaNotificationController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/OaNotificationController.java
@@ -8,23 +8,17 @@
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.entity.TDept;
import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.system.dto.SetDeptDTO;
-import com.ruoyi.system.model.OaApproval;
-import com.ruoyi.system.model.OaNotifationUser;
+import com.ruoyi.system.model.OaNotificationUser;
import com.ruoyi.system.model.OaNotification;
-import com.ruoyi.system.query.ApprovalListQuery;
import com.ruoyi.system.query.NotificationListQuery;
import com.ruoyi.system.service.*;
import com.ruoyi.system.vo.system.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
-import java.sql.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -40,7 +34,7 @@
* @since 2025-09-15
*/
@RestController
-@Api("消息通知")
+@Api(tags = "消息通知")
@RequestMapping("/oa-notification")
public class OaNotificationController {
@Resource
@@ -69,8 +63,8 @@
List<String> notificationIds = Arrays.asList(ids.split(","));
// 删除后 将已发送的消息通知一并删除
oaNotificationService.removeBatchByIds(notificationIds);
- oaNotifationUserService.remove(new LambdaQueryWrapper<OaNotifationUser>()
- .in(OaNotifationUser::getNotificationId,notificationIds));
+ oaNotifationUserService.remove(new LambdaQueryWrapper<OaNotificationUser>()
+ .in(OaNotificationUser::getNotificationId,notificationIds));
return R.ok();
}
@Log(title = "消息通知-新增消息", businessType = BusinessType.INSERT)
@@ -78,28 +72,28 @@
@PostMapping(value = "/add")
public R<Boolean> add( @RequestBody OaNotification dto) {
oaNotificationService.save(dto);
- ArrayList<OaNotifationUser> oaNotifationUsers = new ArrayList<>();
+ ArrayList<OaNotificationUser> oaNotificationUsers = new ArrayList<>();
// 发送消息通知
if (dto.getType()){
// 指定人员发送
Arrays.asList(dto.getUserIds().split(","))
.forEach(userId -> {
- OaNotifationUser oaNotifationUser = new OaNotifationUser();
- oaNotifationUser.setUserId(Integer.parseInt(userId));
- oaNotifationUser.setNotificationId(dto.getId());
- oaNotifationUsers.add(oaNotifationUser);
+ OaNotificationUser oaNotificationUser = new OaNotificationUser();
+ oaNotificationUser.setUserId(Integer.parseInt(userId));
+ oaNotificationUser.setNotificationId(dto.getId());
+ oaNotificationUsers.add(oaNotificationUser);
});
}else{
// 所有人发送
List<SysUser> sysUsers = sysUserService.selectAllList();
sysUsers.forEach(sysUser -> {
- OaNotifationUser oaNotifationUser = new OaNotifationUser();
- oaNotifationUser.setUserId(sysUser.getUserId().intValue());
- oaNotifationUser.setNotificationId(dto.getId());
- oaNotifationUsers.add(oaNotifationUser);
+ OaNotificationUser oaNotificationUser = new OaNotificationUser();
+ oaNotificationUser.setUserId(sysUser.getUserId().intValue());
+ oaNotificationUser.setNotificationId(dto.getId());
+ oaNotificationUsers.add(oaNotificationUser);
});
}
- oaNotifationUserService.saveBatch(oaNotifationUsers);
+ oaNotifationUserService.saveBatch(oaNotificationUsers);
return R.ok();
}
@ApiOperation(value = "消息通知详情")
@@ -111,7 +105,7 @@
StringBuilder deptName = new StringBuilder();
List<TDept> tDepts = deptService.list();
List<SysUser> sysUsers = sysUserService.selectAllList();
- List<OaNotifationUser> notifationUsers = oaNotifationUserService.lambdaQuery().eq(OaNotifationUser::getNotificationId, id)
+ List<OaNotificationUser> notifationUsers = oaNotifationUserService.lambdaQuery().eq(OaNotificationUser::getNotificationId, id)
.list();
Map<Integer, String> deptMap = tDepts.stream().collect(Collectors.toMap(TDept::getId, TDept::getDeptName));
Map<Long, SysUser> userMap = sysUsers.stream().collect(Collectors.toMap(SysUser::getUserId, e->e));
@@ -120,7 +114,11 @@
String orDefault = deptMap.getOrDefault(Integer.parseInt(deptId), "");
deptName.append(orDefault).append(",");
}
- notificationDetailVO.setDeptName(deptName.substring(0,deptName.length()-1));
+ if (deptName.length() > 0){
+ notificationDetailVO.setDeptName(deptName.substring(0,deptName.length()-1));
+ }else {
+ notificationDetailVO.setDeptName("");
+ }
List<NotificationDeptUserDetailVO> notificationUserVOS = new ArrayList<>();
List<Long> userIds = notifationUsers.stream().map(e -> e.getUserId().longValue()).collect(Collectors.toList());
if (!userIds.isEmpty()){
@@ -151,7 +149,7 @@
}
List<NotificationUserDetailVO> notificationUserDetailVOS = new ArrayList<>();
- for (OaNotifationUser notifationUser : notifationUsers) {
+ for (OaNotificationUser notifationUser : notifationUsers) {
NotificationUserDetailVO notificationUserDetailVO = new NotificationUserDetailVO();
BeanUtils.copyProperties(notifationUser, notificationUserDetailVO);
SysUser sysUser = userMap.get(notifationUser.getUserId().longValue());
--
Gitblit v1.7.1