AI 违章工单等级关联角色

This commit is contained in:
lcj
2025-11-10 15:32:41 +08:00
parent 9d3c212856
commit b1b8ced0a8
19 changed files with 141 additions and 130 deletions

View File

@ -347,9 +347,6 @@ public class OthYs7DeviceImgServiceImpl extends ServiceImpl<OthYs7DeviceImgMappe
OssClient storage = OssFactory.instance();
for (OthYs7DeviceImg othYs7DeviceImg : list) {
storage.delete(othYs7DeviceImg.getUrl());
if (othYs7DeviceImg.getRecognizeUrl() != null) {
storage.delete(othYs7DeviceImg.getRecognizeUrl());
}
}
boolean result = this.removeBatchByIds(list);
if (!result) {

View File

@ -16,7 +16,7 @@ import org.dromara.common.web.core.BaseController;
import org.dromara.safety.domain.dto.violationlevel.HseViolationLevelCreateReq;
import org.dromara.safety.domain.dto.violationlevel.HseViolationLevelQueryReq;
import org.dromara.safety.domain.dto.violationlevel.HseViolationLevelUpdateReq;
import org.dromara.safety.domain.vo.violationlevel.HseViolationLevelByPostVo;
import org.dromara.safety.domain.vo.violationlevel.HseViolationLevelByRoleVo;
import org.dromara.safety.domain.vo.violationlevel.HseViolationLevelVo;
import org.dromara.safety.service.IHseViolationLevelService;
import org.springframework.validation.annotation.Validated;
@ -65,7 +65,7 @@ public class HseViolationLevelController extends BaseController {
*/
@SaCheckPermission("safety:violationLevel:query")
@GetMapping("/{id}")
public R<HseViolationLevelByPostVo> getInfo(@NotNull(message = "主键不能为空")
public R<HseViolationLevelByRoleVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(hseViolationLevelService.queryById(id));
}

View File

@ -9,14 +9,14 @@ import java.io.Serial;
import java.io.Serializable;
/**
* 等级与岗位关联对象 hse_violation_level_post
* 等级与角色关联对象 hse_violation_level_role
*
* @author lilemy
* @date 2025-06-20
*/
@Data
@TableName("hse_violation_level_post")
public class HseViolationLevelPost implements Serializable {
@TableName("hse_violation_level_role")
public class HseViolationLevelRole implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@ -28,8 +28,8 @@ public class HseViolationLevelPost implements Serializable {
private Long level;
/**
* 岗位
* 角色
*/
private Long post;
private Long role;
}

View File

@ -40,10 +40,10 @@ public class HseViolationLevelCreateReq implements Serializable {
private String riskType;
/**
* 岗位
* 角色
*/
@NotNull(message = "岗位不能为空")
private List<Long> postIdList;
@NotNull(message = "角色不能为空")
private List<Long> roleIdList;
/**
* 违章类型(多个逗号分隔)

View File

@ -39,9 +39,9 @@ public class HseViolationLevelUpdateReq implements Serializable {
private String riskType;
/**
* 岗位
* 角色
*/
private List<Long> postIdList;
private List<Long> roleIdList;
/**
* 违章类型(多个逗号分隔)

View File

@ -1,7 +1,7 @@
package org.dromara.safety.domain.vo.violationlevel;
import lombok.Data;
import org.dromara.system.domain.vo.SysPostVo;
import org.dromara.system.domain.vo.SysRoleVo;
import java.io.Serial;
import java.io.Serializable;
@ -13,7 +13,7 @@ import java.util.List;
* @date 2025/6/20 14:22
*/
@Data
public class HseViolationLevelByPostVo implements Serializable {
public class HseViolationLevelByRoleVo implements Serializable {
@Serial
private static final long serialVersionUID = -5927532440663249467L;
@ -56,6 +56,6 @@ public class HseViolationLevelByPostVo implements Serializable {
/**
* 岗位
*/
private List<SysPostVo> postList;
private List<SysRoleVo> roleList;
}

View File

@ -1,25 +1,25 @@
package org.dromara.safety.domain.vo.violationlevelpost;
package org.dromara.safety.domain.vo.violationlevelrole;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.safety.domain.HseViolationLevelPost;
import org.dromara.safety.domain.HseViolationLevelRole;
import java.io.Serial;
import java.io.Serializable;
/**
* 等级与岗位关联视图对象 hse_violation_level_post
* 等级与岗位关联视图对象 hse_violation_level_role
*
* @author lilemy
* @date 2025-06-20
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = HseViolationLevelPost.class)
public class HseViolationLevelPostVo implements Serializable {
@AutoMapper(target = HseViolationLevelRole.class)
public class HseViolationLevelRoleVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@ -31,9 +31,9 @@ public class HseViolationLevelPostVo implements Serializable {
private Long level;
/**
* 岗位
* 角色
*/
@ExcelProperty(value = "岗位")
private Long post;
@ExcelProperty(value = "角色")
private Long role;
}

View File

@ -1,15 +0,0 @@
package org.dromara.safety.mapper;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.safety.domain.HseViolationLevelPost;
import org.dromara.safety.domain.vo.violationlevelpost.HseViolationLevelPostVo;
/**
* 等级与岗位关联Mapper接口
*
* @author lilemy
* @date 2025-06-20
*/
public interface HseViolationLevelPostMapper extends BaseMapperPlus<HseViolationLevelPost, HseViolationLevelPostVo> {
}

View File

@ -0,0 +1,15 @@
package org.dromara.safety.mapper;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.safety.domain.HseViolationLevelRole;
import org.dromara.safety.domain.vo.violationlevelrole.HseViolationLevelRoleVo;
/**
* 等级与角色关联Mapper接口
*
* @author lilemy
* @date 2025-06-20
*/
public interface HseViolationLevelRoleMapper extends BaseMapperPlus<HseViolationLevelRole, HseViolationLevelRoleVo> {
}

View File

@ -1,13 +0,0 @@
package org.dromara.safety.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.dromara.safety.domain.HseViolationLevelPost;
/**
* 等级与岗位关联Service接口
*
* @author lilemy
* @date 2025-06-20
*/
public interface IHseViolationLevelPostService extends IService<HseViolationLevelPost> {
}

View File

@ -0,0 +1,13 @@
package org.dromara.safety.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.dromara.safety.domain.HseViolationLevelRole;
/**
* 等级与角色关联Service接口
*
* @author lilemy
* @date 2025-06-20
*/
public interface IHseViolationLevelRoleService extends IService<HseViolationLevelRole> {
}

View File

@ -9,7 +9,7 @@ import org.dromara.safety.domain.HseViolationLevel;
import org.dromara.safety.domain.dto.violationlevel.HseViolationLevelCreateReq;
import org.dromara.safety.domain.dto.violationlevel.HseViolationLevelQueryReq;
import org.dromara.safety.domain.dto.violationlevel.HseViolationLevelUpdateReq;
import org.dromara.safety.domain.vo.violationlevel.HseViolationLevelByPostVo;
import org.dromara.safety.domain.vo.violationlevel.HseViolationLevelByRoleVo;
import org.dromara.safety.domain.vo.violationlevel.HseViolationLevelVo;
import java.util.Collection;
@ -29,7 +29,7 @@ public interface IHseViolationLevelService extends IService<HseViolationLevel> {
* @param id 主键
* @return 违章等级
*/
HseViolationLevelByPostVo queryById(Long id);
HseViolationLevelByRoleVo queryById(Long id);
/**
* 分页查询违章等级列表
@ -79,7 +79,7 @@ public interface IHseViolationLevelService extends IService<HseViolationLevel> {
* @param violationLevel 违章等级对象
* @return 违章等级视图对象
*/
HseViolationLevelByPostVo getByPostVo(HseViolationLevel violationLevel);
HseViolationLevelByRoleVo getByPostVo(HseViolationLevel violationLevel);
/**
* 获取违章等级视图对象

View File

@ -1,19 +0,0 @@
package org.dromara.safety.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.dromara.safety.domain.HseViolationLevelPost;
import org.dromara.safety.mapper.HseViolationLevelPostMapper;
import org.dromara.safety.service.IHseViolationLevelPostService;
import org.springframework.stereotype.Service;
/**
* 等级与岗位关联Service业务层处理
*
* @author lilemy
* @date 2025-06-20
*/
@Service
public class HseViolationLevelPostServiceImpl extends ServiceImpl<HseViolationLevelPostMapper, HseViolationLevelPost>
implements IHseViolationLevelPostService {
}

View File

@ -0,0 +1,19 @@
package org.dromara.safety.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.dromara.safety.domain.HseViolationLevelRole;
import org.dromara.safety.mapper.HseViolationLevelRoleMapper;
import org.dromara.safety.service.IHseViolationLevelRoleService;
import org.springframework.stereotype.Service;
/**
* 等级与角色关联Service业务层处理
*
* @author lilemy
* @date 2025-06-20
*/
@Service
public class HseViolationLevelRoleServiceImpl extends ServiceImpl<HseViolationLevelRoleMapper, HseViolationLevelRole>
implements IHseViolationLevelRoleService {
}

View File

@ -11,21 +11,20 @@ import org.dromara.common.core.utils.ObjectUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.project.service.IBusProjectService;
import org.dromara.safety.constant.HseSafetyConstant;
import org.dromara.safety.domain.HseViolationLevel;
import org.dromara.safety.domain.HseViolationLevelPost;
import org.dromara.safety.domain.HseViolationLevelRole;
import org.dromara.safety.domain.dto.violationlevel.HseViolationLevelCreateReq;
import org.dromara.safety.domain.dto.violationlevel.HseViolationLevelQueryReq;
import org.dromara.safety.domain.dto.violationlevel.HseViolationLevelUpdateReq;
import org.dromara.safety.domain.vo.violationlevel.HseViolationLevelByPostVo;
import org.dromara.safety.domain.vo.violationlevel.HseViolationLevelByRoleVo;
import org.dromara.safety.domain.vo.violationlevel.HseViolationLevelVo;
import org.dromara.safety.mapper.HseViolationLevelMapper;
import org.dromara.safety.service.IHseViolationLevelPostService;
import org.dromara.safety.service.IHseViolationLevelRoleService;
import org.dromara.safety.service.IHseViolationLevelService;
import org.dromara.system.domain.vo.SysPostVo;
import org.dromara.system.mapper.SysPostMapper;
import org.dromara.system.domain.vo.SysRoleVo;
import org.dromara.system.mapper.SysRoleMapper;
import org.dromara.system.service.ISysDictDataService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@ -48,10 +47,10 @@ public class HseViolationLevelServiceImpl extends ServiceImpl<HseViolationLevelM
private IBusProjectService projectService;
@Resource
private IHseViolationLevelPostService violationLevelPostService;
private IHseViolationLevelRoleService violationLevelPostService;
@Resource
private SysPostMapper postMapper;
private SysRoleMapper roleMapper;
@Resource
private ISysDictDataService dictDataService;
@ -63,7 +62,7 @@ public class HseViolationLevelServiceImpl extends ServiceImpl<HseViolationLevelM
* @return 违章等级
*/
@Override
public HseViolationLevelByPostVo queryById(Long id) {
public HseViolationLevelByRoleVo queryById(Long id) {
HseViolationLevel violationLevel = this.getById(id);
if (violationLevel == null) {
throw new ServiceException("违章等级信息不存在", HttpStatus.NOT_FOUND);
@ -118,9 +117,9 @@ public class HseViolationLevelServiceImpl extends ServiceImpl<HseViolationLevelM
BeanUtils.copyProperties(req, violationLevel);
// 校验参数
validEntityBeforeSave(violationLevel, true);
List<Long> postIdList = req.getPostIdList();
if (CollUtil.isEmpty(postIdList)) {
throw new ServiceException("岗位不能为空", HttpStatus.BAD_REQUEST);
List<Long> roleIdList = req.getRoleIdList();
if (CollUtil.isEmpty(roleIdList)) {
throw new ServiceException("角色不能为空", HttpStatus.BAD_REQUEST);
}
// 判断违章等级或风险等级是否存在
List<HseViolationLevel> existList = this.lambdaQuery()
@ -168,16 +167,16 @@ public class HseViolationLevelServiceImpl extends ServiceImpl<HseViolationLevelM
throw new ServiceException("新增违章等级失败", HttpStatus.ERROR);
}
Long id = violationLevel.getId();
// 新增岗位与违章等级关联
List<HseViolationLevelPost> postList = postIdList.stream().map(postId -> {
HseViolationLevelPost violationLevelPost = new HseViolationLevelPost();
// 新增角色与违章等级关联
List<HseViolationLevelRole> roleList = roleIdList.stream().map(roleId -> {
HseViolationLevelRole violationLevelPost = new HseViolationLevelRole();
violationLevelPost.setLevel(id);
violationLevelPost.setPost(postId);
violationLevelPost.setRole(roleId);
return violationLevelPost;
}).toList();
boolean saveRelevancy = violationLevelPostService.saveBatch(postList);
boolean saveRelevancy = violationLevelPostService.saveBatch(roleList);
if (!saveRelevancy) {
throw new ServiceException("新增岗位与违章等级关联失败,数据库异常", HttpStatus.ERROR);
throw new ServiceException("新增角色与违章等级关联失败,数据库异常", HttpStatus.ERROR);
}
return id;
}
@ -251,42 +250,42 @@ public class HseViolationLevelServiceImpl extends ServiceImpl<HseViolationLevelM
}
}
}
List<Long> postIdList = req.getPostIdList();
if (CollUtil.isNotEmpty(postIdList)) {
List<Long> roleIdList = req.getRoleIdList();
if (CollUtil.isNotEmpty(roleIdList)) {
List<Long> oldPostIdList = violationLevelPostService.lambdaQuery()
.eq(HseViolationLevelPost::getLevel, id)
.select(HseViolationLevelPost::getPost)
.list().stream().map(HseViolationLevelPost::getPost).toList();
.eq(HseViolationLevelRole::getLevel, id)
.select(HseViolationLevelRole::getRole)
.list().stream().map(HseViolationLevelRole::getRole).toList();
// 转换为 Set
Set<Long> newSet = new HashSet<>(postIdList);
Set<Long> newSet = new HashSet<>(roleIdList);
Set<Long> oldSet = new HashSet<>(oldPostIdList);
// 需要添加的岗位ID在 new 中有,但在 old 中没有)
// 需要添加的角色ID在 new 中有,但在 old 中没有)
Set<Long> needAdd = new HashSet<>(newSet);
needAdd.removeAll(oldSet);
// 需要删除的岗位ID在 old 中有,但在 new 中没有)
// 需要删除的角色ID在 old 中有,但在 new 中没有)
Set<Long> needDelete = new HashSet<>(oldSet);
needDelete.removeAll(newSet);
// 执行新增
if (CollUtil.isNotEmpty(needAdd)) {
List<HseViolationLevelPost> addList = needAdd.stream().map(postId -> {
HseViolationLevelPost item = new HseViolationLevelPost();
List<HseViolationLevelRole> addList = needAdd.stream().map(roleId -> {
HseViolationLevelRole item = new HseViolationLevelRole();
item.setLevel(id);
item.setPost(postId);
item.setRole(roleId);
return item;
}).toList();
boolean result = violationLevelPostService.saveBatch(addList);
if (!result) {
throw new ServiceException("新增岗位与违章等级关联失败,数据库异常", HttpStatus.ERROR);
throw new ServiceException("新增角色与违章等级关联失败,数据库异常", HttpStatus.ERROR);
}
}
// 执行删除
if (CollUtil.isNotEmpty(needDelete)) {
boolean remove = violationLevelPostService.lambdaUpdate()
.eq(HseViolationLevelPost::getLevel, id)
.in(HseViolationLevelPost::getPost, needDelete)
.eq(HseViolationLevelRole::getLevel, id)
.in(HseViolationLevelRole::getRole, needDelete)
.remove();
if (!remove) {
throw new ServiceException("删除岗位与违章等级关联失败,数据库异常", HttpStatus.ERROR);
throw new ServiceException("删除角色与违章等级关联失败,数据库异常", HttpStatus.ERROR);
}
}
}
@ -339,19 +338,19 @@ public class HseViolationLevelServiceImpl extends ServiceImpl<HseViolationLevelM
* @return 违章等级视图对象
*/
@Override
public HseViolationLevelByPostVo getByPostVo(HseViolationLevel violationLevel) {
HseViolationLevelByPostVo vo = new HseViolationLevelByPostVo();
public HseViolationLevelByRoleVo getByPostVo(HseViolationLevel violationLevel) {
HseViolationLevelByRoleVo vo = new HseViolationLevelByRoleVo();
if (violationLevel == null) {
return vo;
}
BeanUtils.copyProperties(violationLevel, vo);
List<HseViolationLevelPost> levelPostList = violationLevelPostService.lambdaQuery()
.eq(HseViolationLevelPost::getLevel, violationLevel.getId())
List<HseViolationLevelRole> levelPostList = violationLevelPostService.lambdaQuery()
.eq(HseViolationLevelRole::getLevel, violationLevel.getId())
.list();
if (CollUtil.isNotEmpty(levelPostList)) {
List<Long> postIdList = levelPostList.stream().map(HseViolationLevelPost::getPost).toList();
List<SysPostVo> postList = postMapper.selectVoByIds(postIdList);
vo.setPostList(postList);
List<Long> roleList = levelPostList.stream().map(HseViolationLevelRole::getRole).toList();
List<SysRoleVo> postList = roleMapper.selectVoByIds(roleList);
vo.setRoleList(postList);
}
return vo;
}

View File

@ -23,7 +23,7 @@ import org.dromara.project.domain.BusProjectTeamMember;
import org.dromara.project.service.IBusProjectTeamMemberService;
import org.dromara.safety.domain.HseRecognizeRecord;
import org.dromara.safety.domain.HseViolationLevel;
import org.dromara.safety.domain.HseViolationLevelPost;
import org.dromara.safety.domain.HseViolationLevelRole;
import org.dromara.safety.domain.HseViolationRecord;
import org.dromara.safety.domain.dto.violationrecord.*;
import org.dromara.safety.domain.enums.HseSafetyInspectionReviewTypeEnum;
@ -31,7 +31,7 @@ import org.dromara.safety.domain.enums.HseSafetyInspectionStatusEnum;
import org.dromara.safety.domain.vo.violationrecord.HseViolationRecordVo;
import org.dromara.safety.mapper.HseViolationRecordMapper;
import org.dromara.safety.service.IHseRecognizeRecordService;
import org.dromara.safety.service.IHseViolationLevelPostService;
import org.dromara.safety.service.IHseViolationLevelRoleService;
import org.dromara.safety.service.IHseViolationLevelService;
import org.dromara.safety.service.IHseViolationRecordService;
import org.dromara.system.domain.vo.SysUserVo;
@ -69,7 +69,7 @@ public class HseViolationRecordServiceImpl extends ServiceImpl<HseViolationRecor
private IHseRecognizeRecordService recognizeRecordService;
@Resource
private IHseViolationLevelPostService violationLevelPostService;
private IHseViolationLevelRoleService violationLevelPostService;
@Resource
private IBusProjectTeamMemberService projectTeamMemberService;
@ -209,11 +209,11 @@ public class HseViolationRecordServiceImpl extends ServiceImpl<HseViolationRecor
}
// 通知对应人员
Set<Long> levelIds = violationRecordList.stream().map(HseViolationRecord::getLevelId).collect(Collectors.toSet());
List<HseViolationLevelPost> levelPostList = violationLevelPostService.lambdaQuery()
.in(HseViolationLevelPost::getLevel, levelIds)
List<HseViolationLevelRole> levelRoleList = violationLevelPostService.lambdaQuery()
.in(HseViolationLevelRole::getLevel, levelIds)
.list();
List<Long> postIdList = levelPostList.stream().map(HseViolationLevelPost::getPost).distinct().toList();
List<SysUserVo> userVoList = userService.selectUserListByPostList(postIdList);
List<Long> roleIdList = levelRoleList.stream().map(HseViolationLevelRole::getRole).distinct().toList();
List<SysUserVo> userVoList = userService.selectUserListByPostList(roleIdList);
if (CollUtil.isNotEmpty(userVoList)) {
// 通过 sse 向指定用户发送通知
Set<Long> userIds = userVoList.stream().map(SysUserVo::getUserId).collect(Collectors.toSet());
@ -222,7 +222,7 @@ public class HseViolationRecordServiceImpl extends ServiceImpl<HseViolationRecor
for (HseViolationRecord violationRecord : violationRecordList) {
SeeMessageContentDto seeMessageContentDto = new SeeMessageContentDto();
seeMessageContentDto.setType(sseProperties.getViolationRecord());
seeMessageContentDto.setContent("您有一份重要的违章需要处理!工单号为:" + violationRecord.getId());
seeMessageContentDto.setContent("您有一份重要的违章工单需要处理!工单号为:" + violationRecord.getId());
messageDto.setMessage(JSONUtil.toJsonStr(seeMessageContentDto));
messageDto.setProjectId(violationRecord.getProjectId());
SseMessageUtils.publishMessage(messageDto);
@ -348,6 +348,7 @@ public class HseViolationRecordServiceImpl extends ServiceImpl<HseViolationRecor
lqw.ge(HseViolationRecord::getViolationTime, startOfDay)
.lt(HseViolationRecord::getViolationTime, startOfNextDay);
}
lqw.orderByDesc(HseViolationRecord::getCreateTime);
return lqw;
}

View File

@ -7,6 +7,8 @@ import lombok.Data;
import org.dromara.common.core.constant.SystemConstants;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.system.domain.SysRole;
import java.io.Serial;
@ -55,6 +57,12 @@ public class SysRoleVo implements Serializable {
@ExcelProperty(value = "部门")
private Long deptId;
/**
* 部门名称
*/
@Translation(type = TransConstant.DEPT_ID_TO_NAME, mapper = "deptId")
private String deptName;
/**
* 显示顺序
*/

View File

@ -26,11 +26,10 @@ import org.dromara.system.domain.SysPost;
import org.dromara.system.domain.SysRole;
import org.dromara.system.domain.SysUser;
import org.dromara.system.domain.bo.SysDeptBo;
import org.dromara.system.domain.bo.SysRoleBo;
import org.dromara.system.domain.dto.role.ConPerSysRoleDto;
import org.dromara.system.domain.enums.SysDeptTypeEnum;
import org.dromara.system.domain.vo.SysDeptVo;
import org.dromara.system.domain.vo.SysPostVo;
import org.dromara.system.domain.vo.SysRoleVo;
import org.dromara.system.mapper.SysDeptMapper;
import org.dromara.system.mapper.SysPostMapper;
import org.dromara.system.mapper.SysRoleMapper;
@ -157,6 +156,13 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
.eq(SysPost::getStatus, SystemConstants.NORMAL)
);
Map<Long, List<SysPostVo>> postVoMap = postVos.stream().collect(Collectors.groupingBy(SysPostVo::getDeptId));
List<SysRoleVo> roleVos = roleMapper.selectVoList(
new LambdaQueryWrapper<>(SysRole.class)
.in(SysRole::getDeptId, deptVoList.stream().map(SysDeptVo::getDeptId).collect(Collectors.toSet()))
.eq(SysRole::getStatus, SystemConstants.NORMAL)
.eq(SysRole::getDelFlag, SystemConstants.NORMAL)
);
Map<Long, List<SysRoleVo>> roleVoMap = roleVos.stream().collect(Collectors.groupingBy(SysRoleVo::getDeptId));
// 获取当前列表中每一个节点的parentId然后在列表中查找是否有id与其parentId对应若无对应则表明此时节点列表中该节点在当前列表中属于顶级节点
List<Tree<Long>> treeList = CollUtil.newArrayList();
for (SysDeptVo d : deptVoList) {
@ -172,6 +178,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
.putExtra("disabled", SystemConstants.DISABLE.equals(deptVo.getStatus()));
tree.putExtra("deptType", deptVo.getDeptType());
tree.putExtra("postVoList", postVoMap.get(deptId));
tree.putExtra("roleVoList", roleVoMap.get(deptId));
}
);
Tree<Long> tree = StreamUtils.findFirst(trees, it -> it.getId().longValue() == d.getDeptId());
@ -433,7 +440,6 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
}*/
return insert;
}
@ -541,7 +547,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
@Override
public String selectDeptNameById(Long id) {
SysDept sysDept = baseMapper.selectById(id);
return sysDept != null ?sysDept.getDeptName():"";
return sysDept != null ? sysDept.getDeptName() : "";
}
/**

View File

@ -2,6 +2,6 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.safety.mapper.HseViolationLevelPostMapper">
<mapper namespace="org.dromara.safety.mapper.HseViolationLevelRoleMapper">
</mapper>