同步锦浪云模块

This commit is contained in:
2025-08-28 16:20:23 +08:00
parent 563588b835
commit 1bc2743dc7
14 changed files with 537 additions and 38 deletions

View File

@ -38,6 +38,16 @@ public class SysDept extends TenantEntity {
*/
private Long parentId;
/**
* 项目ID
*/
private Long projectId;
/**
* 分包公司ID
*/
private Long contractorId;
/**
* 部门名称
*/
@ -85,9 +95,19 @@ public class SysDept extends TenantEntity {
private String ancestors;
/**
* 子菜单
* 是否隐藏0隐藏 1显示
*/
@TableField(exist = false)
private List<SysDept> children = new ArrayList<>();
private String isShow;
/**
* 部门类型
*/
private String deptType;
// /**
// * 子菜单
// */
// @TableField(exist = false)
// private List<SysDept> children = new ArrayList<>();
}

View File

@ -1,10 +1,7 @@
package org.dromara.system.domain.bo;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import jakarta.validation.constraints.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.mybatis.core.domain.BaseEntity;
@ -31,6 +28,21 @@ public class SysDeptBo extends BaseEntity {
*/
private Long parentId;
/**
* 项目id
*/
private Long projectId;
/**
* 项目部门项目id
*/
private Long rowProjectId;
/**
* 分包公司ID
*/
private Long contractorId;
/**
* 部门名称
*/
@ -74,8 +86,19 @@ public class SysDeptBo extends BaseEntity {
private String status;
/**
* 归属部门id部门树
* 是否隐藏0隐藏 1显示
*/
private Long belongDeptId;
@Pattern(regexp = "^[01]$", message = "isShow字段值必须是0或1")
private String isShow;
/**
* 部门类型
*/
@NotBlank(message = "部门类型不能为空")
private String deptType;
// /**
// * 归属部门id部门树
// */
// private Long belongDeptId;
}

View File

@ -6,6 +6,8 @@ import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
//import org.dromara.contractor.domain.vo.SubContractorVo;
//import org.dromara.project.domain.vo.project.BusProjectVo;
import org.dromara.system.domain.SysDept;
import java.io.Serial;
@ -43,6 +45,31 @@ public class SysDeptVo implements Serializable {
*/
private String parentName;
/**
* 父部门信息
*/
private SysDeptVo parent;
/**
* 项目id
*/
private Long projectId;
/**
* 分包公司ID
*/
private Long contractorId;
/**
* 未绑定项目信息
*/
// private List<BusProjectVo> projectList;
//
// /**
// * 未绑定分包信息
// */
// private List<SubContractorVo> contractorList;
/**
* 祖级列表
*/
@ -95,15 +122,22 @@ public class SysDeptVo implements Serializable {
@ExcelDictFormat(dictType = "sys_normal_disable")
private String status;
/**
* 部门类型
*/
@ExcelProperty(value = "部门类型", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_dept_type")
private String deptType;
/**
* 创建时间
*/
@ExcelProperty(value = "创建时间")
private Date createTime;
/**
* 子菜单
*/
private List<SysDept> children = new ArrayList<>();
// /**
// * 子菜单
// */
// private List<SysDept> children = new ArrayList<>();
}

View File

@ -105,7 +105,7 @@ public class RemoteTaskAssigneeServiceImpl implements RemoteTaskAssigneeService
Map<String, Object> params = bo.getParams();
params.put("beginTime", taskQuery.getBeginTime());
params.put("endTime", taskQuery.getEndTime());
bo.setBelongDeptId(Convert.toLong(taskQuery.getGroupId()));
// bo.setBelongDeptId(Convert.toLong(taskQuery.getGroupId()));
TableDataInfo<SysDeptVo> page = deptService.selectPageDeptList(bo, pageQuery);
// 使用封装的字段映射方法进行转换
List<RemoteTaskAssigneeVo.TaskHandler> handlers = RemoteTaskAssigneeVo.convertToHandlerList(page.getRows(),

View File

@ -19,10 +19,12 @@ import org.dromara.common.mybatis.helper.DataBaseHelper;
import org.dromara.common.redis.utils.CacheUtils;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.system.domain.SysDept;
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.vo.SysDeptVo;
import org.dromara.system.domain.vo.SysPostVo;
import org.dromara.system.mapper.SysDeptMapper;
import org.dromara.system.mapper.SysRoleMapper;
import org.dromara.system.mapper.SysUserMapper;
@ -37,6 +39,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 部门管理 服务实现
@ -90,7 +94,6 @@ public class SysDeptServiceImpl implements ISysDeptService {
}
private LambdaQueryWrapper<SysDept> buildQueryWrapper(SysDeptBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<SysDept> lqw = Wrappers.lambdaQuery();
lqw.eq(SysDept::getDelFlag, SystemConstants.NORMAL);
lqw.eq(ObjectUtil.isNotNull(bo.getDeptId()), SysDept::getDeptId, bo.getDeptId());
@ -98,22 +101,37 @@ public class SysDeptServiceImpl implements ISysDeptService {
lqw.like(StringUtils.isNotBlank(bo.getDeptName()), SysDept::getDeptName, bo.getDeptName());
lqw.like(StringUtils.isNotBlank(bo.getDeptCategory()), SysDept::getDeptCategory, bo.getDeptCategory());
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysDept::getStatus, bo.getStatus());
lqw.between(params.get("beginTime") != null && params.get("endTime") != null,
SysDept::getCreateTime, params.get("beginTime"), params.get("endTime"));
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysDept::getStatus, bo.getStatus());
lqw.eq(StringUtils.isNotBlank(bo.getIsShow()), SysDept::getIsShow, bo.getIsShow());
lqw.eq(StringUtils.isNotBlank(bo.getDeptType()), SysDept::getDeptType, bo.getDeptType());
lqw.orderByAsc(SysDept::getAncestors);
lqw.orderByAsc(SysDept::getParentId);
lqw.orderByAsc(SysDept::getOrderNum);
lqw.orderByAsc(SysDept::getDeptId);
if (ObjectUtil.isNotNull(bo.getBelongDeptId())) {
//部门树搜索
lqw.and(x -> {
Long parentId = bo.getBelongDeptId();
List<SysDept> deptList = baseMapper.selectListByParentId(parentId);
List<Long> deptIds = StreamUtils.toList(deptList, SysDept::getDeptId);
deptIds.add(parentId);
x.in(SysDept::getDeptId, deptIds);
});
}
// Map<String, Object> params = bo.getParams();
// LambdaQueryWrapper<SysDept> lqw = Wrappers.lambdaQuery();
// lqw.eq(SysDept::getDelFlag, SystemConstants.NORMAL);
// lqw.eq(ObjectUtil.isNotNull(bo.getDeptId()), SysDept::getDeptId, bo.getDeptId());
// lqw.eq(ObjectUtil.isNotNull(bo.getParentId()), SysDept::getParentId, bo.getParentId());
// lqw.like(StringUtils.isNotBlank(bo.getDeptName()), SysDept::getDeptName, bo.getDeptName());
// lqw.like(StringUtils.isNotBlank(bo.getDeptCategory()), SysDept::getDeptCategory, bo.getDeptCategory());
// lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysDept::getStatus, bo.getStatus());
// lqw.between(params.get("beginTime") != null && params.get("endTime") != null,
// SysDept::getCreateTime, params.get("beginTime"), params.get("endTime"));
// lqw.orderByAsc(SysDept::getAncestors);
// lqw.orderByAsc(SysDept::getParentId);
// lqw.orderByAsc(SysDept::getOrderNum);
// lqw.orderByAsc(SysDept::getDeptId);
// if (ObjectUtil.isNotNull(bo.getBelongDeptId())) {
// //部门树搜索
// lqw.and(x -> {
// Long parentId = bo.getBelongDeptId();
// List<SysDept> deptList = baseMapper.selectListByParentId(parentId);
// List<Long> deptIds = StreamUtils.toList(deptList, SysDept::getDeptId);
// deptIds.add(parentId);
// x.in(SysDept::getDeptId, deptIds);
// });
// }
return lqw;
}
@ -128,19 +146,98 @@ public class SysDeptServiceImpl implements ISysDeptService {
if (CollUtil.isEmpty(depts)) {
return CollUtil.newArrayList();
}
return TreeBuildUtils.buildMultiRoot(
depts,
SysDeptVo::getDeptId,
SysDeptVo::getParentId,
(node, treeNode) -> treeNode
.setId(node.getDeptId())
.setParentId(node.getParentId())
.setName(node.getDeptName())
.setWeight(node.getOrderNum())
.putExtra("disabled", SystemConstants.DISABLE.equals(node.getStatus()))
);
// 获取当前列表中每一个节点的parentId然后在列表中查找是否有id与其parentId对应若无对应则表明此时节点列表中该节点在当前列表中属于顶级节点
List<Tree<Long>> treeList = CollUtil.newArrayList();
for (SysDeptVo d : depts) {
Long parentId = d.getParentId();
SysDeptVo sysDeptVo = StreamUtils.findFirst(depts, it -> it.getDeptId().longValue() == parentId);
if (ObjectUtil.isNull(sysDeptVo)) {
List<Tree<Long>> trees = TreeBuildUtils.build(depts, parentId, (dept, tree) -> {
tree.setId(dept.getDeptId())
.setParentId(dept.getParentId())
.setName(dept.getDeptName())
.setWeight(dept.getOrderNum())
.putExtra("disabled", SystemConstants.DISABLE.equals(dept.getStatus()));
tree.putExtra("deptType", dept.getDeptType());
}
);
Tree<Long> tree = StreamUtils.findFirst(trees, it -> it.getId().longValue() == d.getDeptId());
treeList.add(tree);
}
}
return treeList;
// if (CollUtil.isEmpty(depts)) {
// return CollUtil.newArrayList();
// }
// return TreeBuildUtils.buildMultiRoot(
// depts,
// SysDeptVo::getDeptId,
// SysDeptVo::getParentId,
// (node, treeNode) -> treeNode
// .setId(node.getDeptId())
// .setParentId(node.getParentId())
// .setName(node.getDeptName())
// .setWeight(node.getOrderNum())
// .putExtra("disabled", SystemConstants.DISABLE.equals(node.getStatus()))
// );
}
//TODO 同步xinnengyuan的service
// /**
// * 构建前端所需要下拉树结构
// *
// * @param projectId 项目id
// * @return 下拉树结构列表
// */
// @Override
// public List<Tree<Long>> buildDeptTreeByProjectId(Long projectId) {
// SysDept dept = baseMapper.selectOne(
// new LambdaQueryWrapper<>(SysDept.class)
// .eq(SysDept::getProjectId, projectId)
// .eq(SysDept::getDeptType, SysDeptTypeEnum.PROJECT.getCode())
// .eq(SysDept::getStatus, SystemConstants.NORMAL)
// );
// if (dept == null) {
// return List.of();
// }
// List<Long> deptIds = Stream.concat(
// Arrays.stream(dept.getAncestors().split(","))
// .filter(StringUtils::isNotBlank)
// .map(Long::parseLong),
// Stream.of(dept.getDeptId())
// ).toList();
// List<SysDeptVo> deptVoList = baseMapper.selectVoByIds(deptIds);
// List<SysPostVo> postVos = postMapper.selectVoList(
// new LambdaQueryWrapper<>(SysPost.class)
// .in(SysPost::getDeptId, deptIds)
// .eq(SysPost::getStatus, SystemConstants.NORMAL)
// );
// Map<Long, List<SysPostVo>> postVoMap = postVos.stream().collect(Collectors.groupingBy(SysPostVo::getDeptId));
// // 获取当前列表中每一个节点的parentId然后在列表中查找是否有id与其parentId对应若无对应则表明此时节点列表中该节点在当前列表中属于顶级节点
// List<Tree<Long>> treeList = CollUtil.newArrayList();
// for (SysDeptVo d : deptVoList) {
// Long parentId = d.getParentId();
// SysDeptVo sysDeptVo = StreamUtils.findFirst(deptVoList, it -> it.getDeptId().longValue() == parentId);
// if (ObjectUtil.isNull(sysDeptVo)) {
// List<Tree<Long>> trees = TreeBuildUtils.build(deptVoList, parentId, (deptVo, tree) -> {
// Long deptId = deptVo.getDeptId();
// tree.setId(deptId)
// .setParentId(deptVo.getParentId())
// .setName(deptVo.getDeptName())
// .setWeight(deptVo.getOrderNum())
// .putExtra("disabled", SystemConstants.DISABLE.equals(deptVo.getStatus()));
// tree.putExtra("deptType", deptVo.getDeptType());
// tree.putExtra("postVoList", postVoMap.get(deptId));
// }
// );
// Tree<Long> tree = StreamUtils.findFirst(trees, it -> it.getId().longValue() == d.getDeptId());
// treeList.add(tree);
// }
// }
// return treeList;
// }
/**
* 根据角色ID查询部门树信息
*