feat(service): 新增质量通知业务逻辑实现

- 实现质量通知的新增,支持手动选择用户和附件上传
- 实现质量通知编辑,支持用户和附件的更新与维护
- 实现质量通知删除,删除通知及其关联用户和附件
- 实现分页查询质量通知列表并进行名称翻译
- 实现质量通知详情查询,包括通知内容、用户列表及附件
- 添加启用/禁用质量通知功能,支持状态更新和日志记录
- 添加私有方法保存通知用户关联,确保数据一致性
- 添加私有方法翻译通知目标类型和启用状态为易读名称
This commit is contained in:
曹鹏飞 2026-04-21 17:50:10 +08:00
parent 756bfae8d9
commit 187929a838
1 changed files with 29 additions and 0 deletions

View File

@ -275,6 +275,35 @@ public class QualityNotificationControllerService {
// 通知对象类型名称 // 通知对象类型名称
if (vo.getTargetType() != null) { if (vo.getTargetType() != null) {
vo.setTargetTypeName(vo.getTargetType() == 1 ? "全部" : "手动选择"); vo.setTargetTypeName(vo.getTargetType() == 1 ? "全部" : "手动选择");
if (vo.getTargetType() == 2) {
List<QmsQualityNotificationUser> users = notificationUserService.lambdaQuery()
.eq(QmsQualityNotificationUser::getNotificationId, vo.getId())
.list();
if (CollectionUtil.isNotEmpty(users)) {
List<Long> userIds = users.stream()
.map(QmsQualityNotificationUser::getUserId)
.collect(Collectors.toList());
List<User> userList = userService.listByIds(userIds);
List<QmsQualityNotificationUserVO> userVOs = new ArrayList<>();
for (QmsQualityNotificationUser nu : users) {
User user = userList.stream()
.filter(u -> u.getId().equals(nu.getUserId()))
.findFirst()
.orElse(null);
if (user != null) {
QmsQualityNotificationUserVO userVO = new QmsQualityNotificationUserVO();
userVO.setId(nu.getId());
userVO.setNotificationId(nu.getNotificationId());
userVO.setUserId(nu.getUserId());
userVO.setUserName(user.getUserName());
userVO.setUserCode(user.getUserCode());
userVOs.add(userVO);
}
}
vo.setUsers(userVOs);
}
}
} }
// 启用状态名称 // 启用状态名称
if (vo.getEnable() != null) { if (vo.getEnable() != null) {