mirror of https://gitee.com/stylefeng/roses
【org】整理组织机构和职务代码
parent
66eed84d8a
commit
a0b68f165c
|
@ -1,6 +1,6 @@
|
|||
package cn.stylefeng.roses.kernel.system;
|
||||
|
||||
import cn.stylefeng.roses.kernel.system.pojo.organization.DataScopeResponse;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.organization.DataScopeDTO;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.role.response.SysRoleResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -26,6 +26,6 @@ public interface DataScopeApi {
|
|||
* @author majianguo
|
||||
* @date 2020/11/5 上午11:44
|
||||
*/
|
||||
DataScopeResponse getDataScope(Long userId, List<SysRoleResponse> sysRoles);
|
||||
DataScopeDTO getDataScope(Long userId, List<SysRoleResponse> sysRoles);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package cn.stylefeng.roses.kernel.system;
|
||||
|
||||
import cn.stylefeng.roses.kernel.system.pojo.organization.HrOrganizationResponse;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.organization.HrOrganizationDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -19,5 +19,6 @@ public interface OrganizationServiceApi {
|
|||
* @author liuhanqing
|
||||
* @date 2021/1/15 10:41
|
||||
*/
|
||||
List<HrOrganizationResponse> orgList();
|
||||
List<HrOrganizationDTO> orgList();
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package cn.stylefeng.roses.kernel.system.exception.enums;
|
||||
package cn.stylefeng.roses.kernel.system.exception.enums.organization;
|
||||
|
||||
import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
|
||||
import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum;
|
|
@ -1,4 +1,4 @@
|
|||
package cn.stylefeng.roses.kernel.system.exception.enums;
|
||||
package cn.stylefeng.roses.kernel.system.exception.enums.organization;
|
||||
|
||||
import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
|
||||
import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum;
|
|
@ -12,7 +12,7 @@ import java.util.Set;
|
|||
* @date 2020/11/6 11:30
|
||||
*/
|
||||
@Data
|
||||
public class DataScopeResponse {
|
||||
public class DataScopeDTO {
|
||||
|
||||
/**
|
||||
* 数据范围类型的响应结果
|
|
@ -11,7 +11,7 @@ import java.math.BigDecimal;
|
|||
* @date 2020/11/04 11:05
|
||||
*/
|
||||
@Data
|
||||
public class HrOrganizationResponse {
|
||||
public class HrOrganizationDTO {
|
||||
|
||||
/**
|
||||
* 主键
|
|
@ -1,4 +1,4 @@
|
|||
package cn.stylefeng.roses.kernel.system.pojo;
|
||||
package cn.stylefeng.roses.kernel.system.pojo.organization;
|
||||
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
|
||||
import cn.stylefeng.roses.kernel.validator.validators.status.StatusValue;
|
|
@ -6,7 +6,7 @@ import cn.stylefeng.roses.kernel.auth.api.enums.DataScopeTypeEnum;
|
|||
import cn.stylefeng.roses.kernel.auth.api.exception.AuthException;
|
||||
import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
|
||||
import cn.stylefeng.roses.kernel.system.exception.SystemModularException;
|
||||
import cn.stylefeng.roses.kernel.system.exception.enums.DataScopeExceptionEnum;
|
||||
import cn.stylefeng.roses.kernel.system.exception.enums.organization.DataScopeExceptionEnum;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
|
|
@ -40,18 +40,6 @@ public class HrOrganizationController {
|
|||
return new SuccessResponseData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑系统组织机构
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2020/11/04 11:05
|
||||
*/
|
||||
@PostResource(name = "编辑系统组织机构", path = "/hrOrganization/edit")
|
||||
public ResponseData edit(@RequestBody @Validated(HrOrganizationRequest.edit.class) HrOrganizationRequest hrOrganizationRequest) {
|
||||
hrOrganizationService.edit(hrOrganizationRequest);
|
||||
return new SuccessResponseData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除系统组织机构
|
||||
*
|
||||
|
@ -64,6 +52,18 @@ public class HrOrganizationController {
|
|||
return new SuccessResponseData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑系统组织机构
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2020/11/04 11:05
|
||||
*/
|
||||
@PostResource(name = "编辑系统组织机构", path = "/hrOrganization/edit")
|
||||
public ResponseData edit(@RequestBody @Validated(HrOrganizationRequest.edit.class) HrOrganizationRequest hrOrganizationRequest) {
|
||||
hrOrganizationService.edit(hrOrganizationRequest);
|
||||
return new SuccessResponseData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改组织机构状态
|
||||
*
|
||||
|
@ -110,18 +110,18 @@ public class HrOrganizationController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取全部系统组织机构树,用于新增,编辑时选择上级节点
|
||||
* 获取全部系统组织机构树(antd vue版本,用于新增,编辑组织机构时选择上级节点)
|
||||
*
|
||||
* @author chenjinlong
|
||||
* @date 2021/01/05 15:55
|
||||
*/
|
||||
@GetResource(name = "获取全部系统组织机构树", path = "/hrOrganization/tree")
|
||||
public ResponseData tree(HrOrganizationRequest hrOrganizationRequest) {
|
||||
return new SuccessResponseData(hrOrganizationService.tree(hrOrganizationRequest));
|
||||
return new SuccessResponseData(hrOrganizationService.treeAntdv(hrOrganizationRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部系统组织机构树,用于新增,编辑时选择上级节点
|
||||
* 获取全部系统组织机构树(layui版本,用于新增,编辑组织机构时选择上级节点)
|
||||
*
|
||||
* @author chenjinlong
|
||||
* @date 2021/01/05 15:55
|
||||
|
@ -132,7 +132,7 @@ public class HrOrganizationController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取zTree形式的组织机构树(用于角色配置数据范围类型,并且数据范围类型是指定组织机构时)(layui版本)
|
||||
* 获取组织机构树(用于角色配置数据范围类型,并且数据范围类型是指定组织机构时)(layui版本)
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2021/1/9 18:37
|
||||
|
@ -143,7 +143,7 @@ public class HrOrganizationController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取zTree形式的组织机构树(用于角色配置数据范围类型,并且数据范围类型是指定组织机构时)(antd vue版本)
|
||||
* 获取组织机构树(用于角色配置数据范围类型,并且数据范围类型是指定组织机构时)(antd vue版本)
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2021/1/9 18:37
|
||||
|
@ -154,5 +154,4 @@ public class HrOrganizationController {
|
|||
return new SuccessResponseData(zTreeNodes);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
|
|||
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.service.HrPositionService;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.HrPositionRequest;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.organization.HrPositionRequest;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
@ -39,18 +39,6 @@ public class HrPositionController {
|
|||
return new SuccessResponseData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑系统职位
|
||||
*
|
||||
* @author chenjinlong
|
||||
* @date 2020/11/04 11:07
|
||||
*/
|
||||
@PostResource(name = "编辑系统职位", path = "/hrPosition/edit")
|
||||
public ResponseData edit(@RequestBody @Validated(HrPositionRequest.edit.class) HrPositionRequest hrPositionRequest) {
|
||||
hrPositionService.edit(hrPositionRequest);
|
||||
return new SuccessResponseData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除系统职位
|
||||
*
|
||||
|
@ -63,6 +51,18 @@ public class HrPositionController {
|
|||
return new SuccessResponseData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑系统职位
|
||||
*
|
||||
* @author chenjinlong
|
||||
* @date 2020/11/04 11:07
|
||||
*/
|
||||
@PostResource(name = "编辑系统职位", path = "/hrPosition/edit")
|
||||
public ResponseData edit(@RequestBody @Validated(HrPositionRequest.edit.class) HrPositionRequest hrPositionRequest) {
|
||||
hrPositionService.edit(hrPositionRequest);
|
||||
return new SuccessResponseData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新职位状态
|
||||
*
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package cn.stylefeng.roses.kernel.system.modular.organization.factory;
|
||||
|
||||
import cn.stylefeng.roses.kernel.rule.tree.factory.node.DefaultTreeNode;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.entity.HrOrganization;
|
||||
|
||||
/**
|
||||
* Antdv的组织机构树组装
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2021/2/8 20:32
|
||||
*/
|
||||
public class AntdvOrganizationFactory {
|
||||
|
||||
/**
|
||||
* 实体转化为树节点
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2021/2/8 20:35
|
||||
*/
|
||||
public static DefaultTreeNode parseTreeNode(HrOrganization organizationList) {
|
||||
DefaultTreeNode orgTreeNode = new DefaultTreeNode();
|
||||
orgTreeNode.setId(String.valueOf(organizationList.getOrgId()));
|
||||
orgTreeNode.setPId(String.valueOf(organizationList.getOrgParentId()));
|
||||
orgTreeNode.setName(organizationList.getOrgName());
|
||||
orgTreeNode.setSort(organizationList.getOrgSort());
|
||||
return orgTreeNode;
|
||||
}
|
||||
|
||||
}
|
|
@ -13,7 +13,7 @@ import java.util.List;
|
|||
* @author chenjinlong
|
||||
* @date 2021/1/6 21:03
|
||||
*/
|
||||
public class OrganizationFactory {
|
||||
public class LayuiOrganizationFactory {
|
||||
|
||||
/**
|
||||
* 实体转换
|
|
@ -7,8 +7,8 @@ import cn.stylefeng.roses.kernel.system.RoleServiceApi;
|
|||
import cn.stylefeng.roses.kernel.system.UserOrgServiceApi;
|
||||
import cn.stylefeng.roses.kernel.system.UserServiceApi;
|
||||
import cn.stylefeng.roses.kernel.system.exception.SystemModularException;
|
||||
import cn.stylefeng.roses.kernel.system.exception.enums.DataScopeExceptionEnum;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.organization.DataScopeResponse;
|
||||
import cn.stylefeng.roses.kernel.system.exception.enums.organization.DataScopeExceptionEnum;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.organization.DataScopeDTO;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.role.response.SysRoleResponse;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.user.SysUserOrgResponse;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -41,10 +41,10 @@ public class DataScopeService implements DataScopeApi {
|
|||
private DbOperatorApi dbOperatorApi;
|
||||
|
||||
@Override
|
||||
public DataScopeResponse getDataScope(Long userId, List<SysRoleResponse> sysRoles) {
|
||||
public DataScopeDTO getDataScope(Long userId, List<SysRoleResponse> sysRoles) {
|
||||
|
||||
// 初始化返回结果
|
||||
DataScopeResponse dataScopeResponse = new DataScopeResponse();
|
||||
DataScopeDTO dataScopeResponse = new DataScopeDTO();
|
||||
Set<Long> userIds = new HashSet<>();
|
||||
Set<Long> organizationIds = new HashSet<>();
|
||||
|
||||
|
|
|
@ -29,15 +29,6 @@ public interface HrOrganizationService extends IService<HrOrganization>, Organiz
|
|||
*/
|
||||
void add(HrOrganizationRequest hrOrganizationRequest);
|
||||
|
||||
/**
|
||||
* 编辑系统组织机构
|
||||
*
|
||||
* @param hrOrganizationRequest 组织机构请求参数
|
||||
* @author fengshuonan
|
||||
* @date 2020/11/04 11:05
|
||||
*/
|
||||
void edit(HrOrganizationRequest hrOrganizationRequest);
|
||||
|
||||
/**
|
||||
* 删除系统组织机构
|
||||
*
|
||||
|
@ -47,6 +38,15 @@ public interface HrOrganizationService extends IService<HrOrganization>, Organiz
|
|||
*/
|
||||
void del(HrOrganizationRequest hrOrganizationRequest);
|
||||
|
||||
/**
|
||||
* 编辑系统组织机构
|
||||
*
|
||||
* @param hrOrganizationRequest 组织机构请求参数
|
||||
* @author fengshuonan
|
||||
* @date 2020/11/04 11:05
|
||||
*/
|
||||
void edit(HrOrganizationRequest hrOrganizationRequest);
|
||||
|
||||
/**
|
||||
* 修改组织机构状态
|
||||
*
|
||||
|
@ -86,19 +86,18 @@ public interface HrOrganizationService extends IService<HrOrganization>, Organiz
|
|||
*/
|
||||
List<HrOrganization> findList(HrOrganizationRequest hrOrganizationRequest);
|
||||
|
||||
|
||||
/**
|
||||
* 获取组织架构树
|
||||
* 获取全部系统组织机构树(antd vue版本,用于新增,编辑组织机构时选择上级节点)
|
||||
*
|
||||
* @param hrOrganizationRequest 查询参数
|
||||
* @return 系统组织机构树
|
||||
* @author fengshuonan
|
||||
* @date 2020/11/6 13:41
|
||||
*/
|
||||
List<DefaultTreeNode> tree(HrOrganizationRequest hrOrganizationRequest);
|
||||
List<DefaultTreeNode> treeAntdv(HrOrganizationRequest hrOrganizationRequest);
|
||||
|
||||
/**
|
||||
* 获取组织架构树
|
||||
* 获取全部系统组织机构树(layui版本,用于新增,编辑组织机构时选择上级节点)
|
||||
*
|
||||
* @param hrOrganizationRequest 查询参数
|
||||
* @return 系统组织机构树
|
||||
|
@ -107,16 +106,6 @@ public interface HrOrganizationService extends IService<HrOrganization>, Organiz
|
|||
*/
|
||||
List<LayuiOrganizationTreeNode> treeLayui(HrOrganizationRequest hrOrganizationRequest);
|
||||
|
||||
/**
|
||||
* 查询所有参数组织架构id集合的所有层级的父id,包含父级的父级等
|
||||
*
|
||||
* @param organizationIds 组织架构id集合
|
||||
* @return 被查询参数id集合的所有层级父级id,包含他们本身
|
||||
* @author fengshuonan
|
||||
* @date 2020/11/6 14:24
|
||||
*/
|
||||
Set<Long> findAllLevelParentIdsByOrganizations(Set<Long> organizationIds);
|
||||
|
||||
/**
|
||||
* 获取ztree形式的组织机构树(用于角色配置数据范围类型,并且数据范围类型是指定组织机构时)(layui版本)
|
||||
*
|
||||
|
@ -128,4 +117,14 @@ public interface HrOrganizationService extends IService<HrOrganization>, Organiz
|
|||
*/
|
||||
List<ZTreeNode> orgZTree(HrOrganizationRequest hrOrganizationRequest, boolean buildTree);
|
||||
|
||||
/**
|
||||
* 查询所有参数组织架构id集合的所有层级的父id,包含父级的父级等
|
||||
*
|
||||
* @param organizationIds 组织架构id集合
|
||||
* @return 被查询参数id集合的所有层级父级id,包含他们本身
|
||||
* @author fengshuonan
|
||||
* @date 2020/11/6 14:24
|
||||
*/
|
||||
Set<Long> findAllLevelParentIdsByOrganizations(Set<Long> organizationIds);
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package cn.stylefeng.roses.kernel.system.modular.organization.service;
|
|||
|
||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.entity.HrPosition;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.HrPositionRequest;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.organization.HrPositionRequest;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -81,4 +81,4 @@ public interface HrPositionService extends IService<HrPosition> {
|
|||
*/
|
||||
PageResult<HrPosition> findPage(HrPositionRequest hrPositionRequest);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,13 +24,14 @@ import cn.stylefeng.roses.kernel.system.RoleServiceApi;
|
|||
import cn.stylefeng.roses.kernel.system.UserOrgServiceApi;
|
||||
import cn.stylefeng.roses.kernel.system.UserServiceApi;
|
||||
import cn.stylefeng.roses.kernel.system.exception.SystemModularException;
|
||||
import cn.stylefeng.roses.kernel.system.exception.enums.OrganizationExceptionEnum;
|
||||
import cn.stylefeng.roses.kernel.system.exception.enums.organization.OrganizationExceptionEnum;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.entity.HrOrganization;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.factory.OrganizationFactory;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.factory.AntdvOrganizationFactory;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.factory.LayuiOrganizationFactory;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.mapper.HrOrganizationMapper;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.service.HrOrganizationService;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.organization.HrOrganizationDTO;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.organization.HrOrganizationRequest;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.organization.HrOrganizationResponse;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.organization.layui.LayuiOrganizationTreeNode;
|
||||
import cn.stylefeng.roses.kernel.system.util.DataScopeUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
@ -87,27 +88,6 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
|
|||
this.save(hrOrganization);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(HrOrganizationRequest hrOrganizationRequest) {
|
||||
|
||||
HrOrganization hrOrganization = this.queryOrganization(hrOrganizationRequest);
|
||||
Long id = hrOrganization.getOrgId();
|
||||
|
||||
// 校验数据范围
|
||||
DataScopeUtil.quickValidateDataScope(id);
|
||||
|
||||
BeanUtil.copyProperties(hrOrganizationRequest, hrOrganization);
|
||||
|
||||
// 填充parentIds
|
||||
this.fillParentIds(hrOrganization);
|
||||
|
||||
// 不能修改状态,用修改状态接口修改状态
|
||||
hrOrganization.setStatusFlag(null);
|
||||
|
||||
// 更新这条记录
|
||||
this.updateById(hrOrganization);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void del(HrOrganizationRequest hrOrganizationRequest) {
|
||||
|
@ -139,6 +119,27 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
|
|||
userServiceApi.deleteUserDataScopeListByOrgIdList(childIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(HrOrganizationRequest hrOrganizationRequest) {
|
||||
|
||||
HrOrganization hrOrganization = this.queryOrganization(hrOrganizationRequest);
|
||||
Long id = hrOrganization.getOrgId();
|
||||
|
||||
// 校验数据范围
|
||||
DataScopeUtil.quickValidateDataScope(id);
|
||||
|
||||
BeanUtil.copyProperties(hrOrganizationRequest, hrOrganization);
|
||||
|
||||
// 填充parentIds
|
||||
this.fillParentIds(hrOrganization);
|
||||
|
||||
// 不能修改状态,用修改状态接口修改状态
|
||||
hrOrganization.setStatusFlag(null);
|
||||
|
||||
// 更新这条记录
|
||||
this.updateById(hrOrganization);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(HrOrganizationRequest hrOrganizationRequest) {
|
||||
HrOrganization hrOrganization = this.queryOrganization(hrOrganizationRequest);
|
||||
|
@ -165,8 +166,106 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<HrOrganizationResponse> orgList() {
|
||||
public List<DefaultTreeNode> treeAntdv(HrOrganizationRequest hrOrganizationRequest) {
|
||||
// 定义返回结果
|
||||
List<DefaultTreeNode> treeNodeList = CollectionUtil.newArrayList();
|
||||
|
||||
// 组装节点
|
||||
List<HrOrganization> list = this.findListByDataScope(hrOrganizationRequest);
|
||||
for (HrOrganization hrOrganization : list) {
|
||||
DefaultTreeNode defaultTreeNode = AntdvOrganizationFactory.parseTreeNode(hrOrganization);
|
||||
treeNodeList.add(defaultTreeNode);
|
||||
}
|
||||
|
||||
// 构建树并返回
|
||||
return new DefaultTreeBuildFactory<DefaultTreeNode>().doTreeBuild(treeNodeList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LayuiOrganizationTreeNode> treeLayui(HrOrganizationRequest hrOrganizationRequest) {
|
||||
// 定义返回结果
|
||||
List<LayuiOrganizationTreeNode> treeNodeList = CollectionUtil.newArrayList();
|
||||
|
||||
// 组装节点
|
||||
List<HrOrganization> hrOrganizationList = this.findListByDataScope(hrOrganizationRequest);
|
||||
for (HrOrganization hrOrganization : hrOrganizationList) {
|
||||
LayuiOrganizationTreeNode treeNode = LayuiOrganizationFactory.parseOrganizationTreeNode(hrOrganization);
|
||||
treeNodeList.add(treeNode);
|
||||
}
|
||||
|
||||
// 构建树并返回
|
||||
return new DefaultTreeBuildFactory<LayuiOrganizationTreeNode>().doTreeBuild(treeNodeList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ZTreeNode> orgZTree(HrOrganizationRequest hrOrganizationRequest, boolean buildTree) {
|
||||
|
||||
// 获取角色id
|
||||
Long roleId = hrOrganizationRequest.getRoleId();
|
||||
|
||||
// 获取所有组织机构列表
|
||||
LambdaQueryWrapper<HrOrganization> wrapper = createWrapper(hrOrganizationRequest);
|
||||
List<HrOrganization> list = this.list(wrapper);
|
||||
List<ZTreeNode> zTreeNodes = LayuiOrganizationFactory.parseZTree(list);
|
||||
|
||||
// 获取角色目前绑定的组织机构范围
|
||||
List<Long> roleDataScopes = roleServiceApi.getRoleDataScopes(ListUtil.toList(roleId));
|
||||
|
||||
// 设置绑定的组织机构范围为已选则状态
|
||||
for (ZTreeNode zTreeNode : zTreeNodes) {
|
||||
if (roleDataScopes.contains(zTreeNode.getId())) {
|
||||
zTreeNode.setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (buildTree) {
|
||||
return new DefaultTreeBuildFactory<ZTreeNode>().doTreeBuild(zTreeNodes);
|
||||
} else {
|
||||
return zTreeNodes;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Long> findAllLevelParentIdsByOrganizations(Set<Long> organizationIds) {
|
||||
|
||||
// 定义返回结果
|
||||
Set<Long> allLevelParentIds = new HashSet<>(organizationIds);
|
||||
|
||||
// 查询出这些节点的pids字段
|
||||
LambdaQueryWrapper<HrOrganization> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(HrOrganization::getOrgId, organizationIds);
|
||||
queryWrapper.select(HrOrganization::getOrgPids);
|
||||
|
||||
List<HrOrganization> organizationList = this.list(queryWrapper);
|
||||
if (organizationList == null || organizationList.isEmpty()) {
|
||||
return allLevelParentIds;
|
||||
}
|
||||
|
||||
// 把所有的pids分割,并放入到set中
|
||||
for (HrOrganization hrOrganization : organizationList) {
|
||||
|
||||
// 获取pids值
|
||||
String pids = hrOrganization.getOrgPids();
|
||||
|
||||
// 去掉所有的左中括号
|
||||
pids = StrUtil.removeAll(pids, SymbolConstant.LEFT_SQUARE_BRACKETS);
|
||||
|
||||
// 去掉所有的右中括号
|
||||
pids = StrUtil.removeAll(pids, SymbolConstant.RIGHT_SQUARE_BRACKETS);
|
||||
|
||||
// 按逗号分割这个字符串,得到pid的数组
|
||||
String[] finalPidArray = pids.split(StrUtil.COMMA);
|
||||
|
||||
// 遍历这些值,放入到最终的set
|
||||
for (String pid : finalPidArray) {
|
||||
allLevelParentIds.add(Convert.toLong(pid));
|
||||
}
|
||||
}
|
||||
return allLevelParentIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HrOrganizationDTO> orgList() {
|
||||
|
||||
LambdaQueryWrapper<HrOrganization> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
|
@ -200,20 +299,109 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
|
|||
|
||||
// 根据排序升序排列,序号越小越在前
|
||||
queryWrapper.orderByAsc(HrOrganization::getOrgSort);
|
||||
|
||||
// 先实例化出Function接口
|
||||
Function<Object, HrOrganizationResponse> mapper = e -> {
|
||||
HrOrganizationResponse org = new HrOrganizationResponse();
|
||||
Function<Object, HrOrganizationDTO> mapper = e -> {
|
||||
HrOrganizationDTO org = new HrOrganizationDTO();
|
||||
HrOrganization hrOrg = (HrOrganization) e;
|
||||
BeanUtil.copyProperties(hrOrg, org);
|
||||
return org;
|
||||
};
|
||||
|
||||
// 返回数据
|
||||
List<HrOrganization> list = this.list(queryWrapper);
|
||||
List<HrOrganizationResponse> resultList = list.stream().filter(Objects::nonNull).map(mapper).collect(Collectors.toList());
|
||||
return resultList;
|
||||
return list.stream().filter(Objects::nonNull).map(mapper).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建组织架构的通用条件查询wrapper
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2020/11/6 10:16
|
||||
*/
|
||||
private LambdaQueryWrapper<HrOrganization> createWrapper(HrOrganizationRequest hrOrganizationRequest) {
|
||||
LambdaQueryWrapper<HrOrganization> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
// 查询未删除状态的
|
||||
queryWrapper.eq(HrOrganization::getDelFlag, YesOrNotEnum.N.getCode());
|
||||
|
||||
// 根据排序升序排列,序号越小越在前
|
||||
queryWrapper.orderByAsc(HrOrganization::getOrgSort);
|
||||
|
||||
if (ObjectUtil.isEmpty(hrOrganizationRequest)) {
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
String orgName = hrOrganizationRequest.getOrgName();
|
||||
String orgCode = hrOrganizationRequest.getOrgCode();
|
||||
Long orgParentId = hrOrganizationRequest.getOrgParentId();
|
||||
Long orgId = hrOrganizationRequest.getOrgId();
|
||||
|
||||
// 拼接组织机构名称条件
|
||||
queryWrapper.like(ObjectUtil.isNotEmpty(orgName), HrOrganization::getOrgName, orgName);
|
||||
|
||||
// 拼接组织机构编码条件
|
||||
queryWrapper.eq(ObjectUtil.isNotEmpty(orgCode), HrOrganization::getOrgCode, orgCode);
|
||||
|
||||
// 拼接父机构id查询条件
|
||||
if (ObjectUtil.isNotEmpty(orgParentId)) {
|
||||
queryWrapper.and(qw -> {
|
||||
qw.eq(HrOrganization::getOrgId, orgParentId).or().like(HrOrganization::getOrgPids, orgParentId);
|
||||
});
|
||||
}
|
||||
|
||||
// 拼接机构id查询条件
|
||||
queryWrapper.eq(ObjectUtil.isNotEmpty(orgId), HrOrganization::getOrgId, orgId);
|
||||
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取系统组织机构
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2020/11/04 11:05
|
||||
*/
|
||||
private HrOrganization queryOrganization(HrOrganizationRequest hrOrganizationRequest) {
|
||||
HrOrganization hrOrganization = this.getById(hrOrganizationRequest.getOrgId());
|
||||
if (ObjectUtil.isEmpty(hrOrganization)) {
|
||||
throw new SystemModularException(OrganizationExceptionEnum.CANT_FIND_ORG, hrOrganizationRequest.getOrgId());
|
||||
}
|
||||
return hrOrganization;
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充该节点的pIds
|
||||
* <p>
|
||||
* 如果pid是顶级节点,pids就是 [-1],
|
||||
* <p>
|
||||
* 如果pid不是顶级节点,pids就是父节点的pids + [pid] + ,
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2020/11/5 13:45
|
||||
*/
|
||||
private void fillParentIds(HrOrganization hrOrganization) {
|
||||
if (TreeConstants.DEFAULT_PARENT_ID.equals(hrOrganization.getOrgParentId())) {
|
||||
hrOrganization.setOrgPids(SymbolConstant.LEFT_SQUARE_BRACKETS + TreeConstants.DEFAULT_PARENT_ID + SymbolConstant.RIGHT_SQUARE_BRACKETS + SymbolConstant.COMMA);
|
||||
} else {
|
||||
// 获取父组织机构
|
||||
HrOrganizationRequest hrOrganizationRequest = new HrOrganizationRequest();
|
||||
hrOrganizationRequest.setOrgId(hrOrganization.getOrgId());
|
||||
HrOrganization parentOrganization = this.queryOrganization(hrOrganizationRequest);
|
||||
|
||||
// 设置本节点的父ids为 (上一个节点的pids + (上级节点的id) )
|
||||
hrOrganization.setOrgPids(
|
||||
parentOrganization.getOrgPids() + SymbolConstant.LEFT_SQUARE_BRACKETS + parentOrganization.getOrgId() + SymbolConstant.RIGHT_SQUARE_BRACKETS + SymbolConstant.COMMA);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据数据范围获取组织机构列表
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2021/2/8 20:22
|
||||
*/
|
||||
private List<HrOrganization> findListByDataScope(HrOrganizationRequest hrOrganizationRequest) {
|
||||
|
||||
LambdaQueryWrapper<HrOrganization> queryWrapper = this.createWrapper(hrOrganizationRequest);
|
||||
|
@ -238,169 +426,7 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
|
|||
queryWrapper.in(HrOrganization::getOrgId, allLevelParentIdsByOrganizations);
|
||||
}
|
||||
|
||||
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DefaultTreeNode> tree(HrOrganizationRequest hrOrganizationRequest) {
|
||||
// 定义返回结果
|
||||
List<DefaultTreeNode> treeNodeList = CollectionUtil.newArrayList();
|
||||
List<HrOrganization> list = this.findListByDataScope(hrOrganizationRequest);
|
||||
// 组装节点
|
||||
for (HrOrganization hrOrganization : list) {
|
||||
DefaultTreeNode orgTreeNode = new DefaultTreeNode();
|
||||
orgTreeNode.setId(String.valueOf(hrOrganization.getOrgId()));
|
||||
orgTreeNode.setPId(String.valueOf(hrOrganization.getOrgParentId()));
|
||||
orgTreeNode.setName(hrOrganization.getOrgName());
|
||||
orgTreeNode.setSort(hrOrganization.getOrgSort());
|
||||
treeNodeList.add(orgTreeNode);
|
||||
}
|
||||
// 构建树并返回
|
||||
return new DefaultTreeBuildFactory<DefaultTreeNode>().doTreeBuild(treeNodeList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LayuiOrganizationTreeNode> treeLayui(HrOrganizationRequest hrOrganizationRequest) {
|
||||
// 定义返回结果
|
||||
List<LayuiOrganizationTreeNode> treeNodeList = CollectionUtil.newArrayList();
|
||||
List<HrOrganization> hrOrganizationList = this.findListByDataScope(hrOrganizationRequest);
|
||||
hrOrganizationList.forEach(hrOrganization -> {
|
||||
LayuiOrganizationTreeNode treeNode = OrganizationFactory.parseOrganizationTreeNode(hrOrganization);
|
||||
treeNodeList.add(treeNode);
|
||||
});
|
||||
return new DefaultTreeBuildFactory<LayuiOrganizationTreeNode>().doTreeBuild(treeNodeList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Long> findAllLevelParentIdsByOrganizations(Set<Long> organizationIds) {
|
||||
|
||||
// 定义返回结果
|
||||
Set<Long> allLevelParentIds = new HashSet<>(organizationIds);
|
||||
|
||||
// 查询出这些节点的pids字段
|
||||
LambdaQueryWrapper<HrOrganization> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(HrOrganization::getOrgId, organizationIds);
|
||||
queryWrapper.select(HrOrganization::getOrgPids);
|
||||
|
||||
List<HrOrganization> organizationList = this.list(queryWrapper);
|
||||
if (organizationList == null || organizationList.isEmpty()) {
|
||||
return allLevelParentIds;
|
||||
}
|
||||
|
||||
// 把所有的pids分割,并放入到set中
|
||||
for (HrOrganization hrOrganization : organizationList) {
|
||||
|
||||
// 获取pids值
|
||||
String pids = hrOrganization.getOrgPids();
|
||||
// 去掉所有的左中括号
|
||||
pids = StrUtil.removeAll(pids, SymbolConstant.LEFT_SQUARE_BRACKETS);
|
||||
// 去掉所有的右中括号
|
||||
pids = StrUtil.removeAll(pids, SymbolConstant.RIGHT_SQUARE_BRACKETS);
|
||||
// 按逗号分割这个字符串,得到pid的数组
|
||||
String[] finalPidArray = pids.split(StrUtil.COMMA);
|
||||
|
||||
// 遍历这些值,放入到最终的set
|
||||
for (String pid : finalPidArray) {
|
||||
allLevelParentIds.add(Convert.toLong(pid));
|
||||
}
|
||||
}
|
||||
return allLevelParentIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ZTreeNode> orgZTree(HrOrganizationRequest hrOrganizationRequest, boolean buildTree) {
|
||||
|
||||
// 获取角色id
|
||||
Long roleId = hrOrganizationRequest.getRoleId();
|
||||
|
||||
// 获取所有组织机构列表
|
||||
LambdaQueryWrapper<HrOrganization> wrapper = createWrapper(hrOrganizationRequest);
|
||||
List<HrOrganization> list = this.list(wrapper);
|
||||
List<ZTreeNode> zTreeNodes = OrganizationFactory.parseZTree(list);
|
||||
|
||||
// 获取角色目前绑定的组织机构范围
|
||||
List<Long> roleDataScopes = roleServiceApi.getRoleDataScopes(ListUtil.toList(roleId));
|
||||
|
||||
// 设置绑定的组织机构范围为已选则状态
|
||||
for (ZTreeNode zTreeNode : zTreeNodes) {
|
||||
if (roleDataScopes.contains(zTreeNode.getId())) {
|
||||
zTreeNode.setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (buildTree) {
|
||||
return new DefaultTreeBuildFactory<ZTreeNode>().doTreeBuild(zTreeNodes);
|
||||
} else {
|
||||
return zTreeNodes;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建组织架构的通用条件查询wrapper
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2020/11/6 10:16
|
||||
*/
|
||||
private LambdaQueryWrapper<HrOrganization> createWrapper(HrOrganizationRequest hrOrganizationRequest) {
|
||||
LambdaQueryWrapper<HrOrganization> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
String orgName = hrOrganizationRequest.getOrgName();
|
||||
String orgCode = hrOrganizationRequest.getOrgCode();
|
||||
Long orgParentId = hrOrganizationRequest.getOrgParentId();
|
||||
Long orgId = hrOrganizationRequest.getOrgId();
|
||||
queryWrapper.like(ObjectUtil.isNotEmpty(orgName), HrOrganization::getOrgName, orgName);
|
||||
queryWrapper.eq(ObjectUtil.isNotEmpty(orgCode), HrOrganization::getOrgCode, orgCode);
|
||||
// 拼接机构id查询条件
|
||||
queryWrapper.eq(ObjectUtil.isNotEmpty(orgId), HrOrganization::getOrgId, orgId);
|
||||
// 拼接父机构id查询条件
|
||||
if (ObjectUtil.isNotEmpty(orgParentId)) {
|
||||
queryWrapper.and(qw -> {
|
||||
qw.eq(HrOrganization::getOrgId, orgParentId).or().like(HrOrganization::getOrgPids, orgParentId);
|
||||
});
|
||||
}
|
||||
// 查询未删除状态的
|
||||
queryWrapper.eq(HrOrganization::getDelFlag, YesOrNotEnum.N.getCode());
|
||||
// 根据排序升序排列,序号越小越在前
|
||||
queryWrapper.orderByAsc(HrOrganization::getOrgSort);
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取系统组织机构
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2020/11/04 11:05
|
||||
*/
|
||||
private HrOrganization queryOrganization(HrOrganizationRequest hrOrganizationRequest) {
|
||||
HrOrganization hrOrganization = this.getById(hrOrganizationRequest.getOrgId());
|
||||
if (ObjectUtil.isEmpty(hrOrganization)) {
|
||||
throw new SystemModularException(OrganizationExceptionEnum.CANT_FIND_ORG, hrOrganizationRequest.getOrgId());
|
||||
}
|
||||
return hrOrganization;
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充该节点的pIds
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2020/11/5 13:45
|
||||
*/
|
||||
private void fillParentIds(HrOrganization hrOrganization) {
|
||||
|
||||
// 如果是一级节点(一级节点的pid是0)
|
||||
if (hrOrganization.getOrgParentId().equals(TreeConstants.DEFAULT_PARENT_ID)) {
|
||||
// 设置一级节点的pid为[0],
|
||||
hrOrganization.setOrgPids(SymbolConstant.LEFT_SQUARE_BRACKETS + TreeConstants.DEFAULT_PARENT_ID + SymbolConstant.RIGHT_SQUARE_BRACKETS + SymbolConstant.COMMA);
|
||||
} else {
|
||||
// 获取父组织机构
|
||||
HrOrganization parentOrganization = this.getById(hrOrganization.getOrgParentId());
|
||||
|
||||
// 设置本节点的父ids为 (上一个节点的pids + (上级节点的id) )
|
||||
hrOrganization.setOrgPids(
|
||||
parentOrganization.getOrgPids() + SymbolConstant.LEFT_SQUARE_BRACKETS + parentOrganization.getOrgId() + SymbolConstant.RIGHT_SQUARE_BRACKETS + SymbolConstant.COMMA);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import cn.stylefeng.roses.kernel.system.exception.enums.PositionExceptionEnum;
|
|||
import cn.stylefeng.roses.kernel.system.modular.organization.entity.HrPosition;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.mapper.HrPositionMapper;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.service.HrPositionService;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.HrPositionRequest;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.organization.HrPositionRequest;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
@ -46,13 +46,6 @@ public class HrPositionServiceImpl extends ServiceImpl<HrPositionMapper, HrPosit
|
|||
this.save(sysPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(HrPositionRequest hrPositionRequest) {
|
||||
HrPosition sysPosition = this.querySysPositionById(hrPositionRequest);
|
||||
BeanUtil.copyProperties(hrPositionRequest, sysPosition);
|
||||
this.updateById(sysPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void del(HrPositionRequest hrPositionRequest) {
|
||||
HrPosition sysPosition = this.querySysPositionById(hrPositionRequest);
|
||||
|
@ -68,6 +61,13 @@ public class HrPositionServiceImpl extends ServiceImpl<HrPositionMapper, HrPosit
|
|||
this.updateById(sysPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(HrPositionRequest hrPositionRequest) {
|
||||
HrPosition sysPosition = this.querySysPositionById(hrPositionRequest);
|
||||
BeanUtil.copyProperties(hrPositionRequest, sysPosition);
|
||||
this.updateById(sysPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(HrPositionRequest hrPositionRequest) {
|
||||
HrPosition sysPosition = this.querySysPositionById(hrPositionRequest);
|
||||
|
@ -113,13 +113,22 @@ public class HrPositionServiceImpl extends ServiceImpl<HrPositionMapper, HrPosit
|
|||
/**
|
||||
* 实体构建 QueryWrapper
|
||||
*
|
||||
* @return
|
||||
* @author chenjinlong
|
||||
* @date 2021/2/2 10:17
|
||||
*/
|
||||
private LambdaQueryWrapper<HrPosition> createWrapper(HrPositionRequest hrPositionRequest) {
|
||||
LambdaQueryWrapper<HrPosition> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
// 查询未删除状态的
|
||||
queryWrapper.eq(HrPosition::getDelFlag, YesOrNotEnum.N.getCode());
|
||||
|
||||
// 根据排序升序排列,序号越小越在前
|
||||
queryWrapper.orderByAsc(HrPosition::getPositionSort);
|
||||
|
||||
if (ObjectUtil.isEmpty(hrPositionRequest)) {
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
Long positionId = hrPositionRequest.getPositionId();
|
||||
String positionName = hrPositionRequest.getPositionName();
|
||||
String positionCode = hrPositionRequest.getPositionCode();
|
||||
|
@ -129,13 +138,7 @@ public class HrPositionServiceImpl extends ServiceImpl<HrPositionMapper, HrPosit
|
|||
queryWrapper.like(StrUtil.isNotEmpty(positionName), HrPosition::getPositionName, positionName);
|
||||
queryWrapper.eq(StrUtil.isNotEmpty(positionCode), HrPosition::getPositionCode, positionCode);
|
||||
|
||||
// 查询未删除状态的
|
||||
queryWrapper.eq(HrPosition::getDelFlag, YesOrNotEnum.N.getCode());
|
||||
// 根据排序升序排列,序号越小越在前
|
||||
queryWrapper.orderByAsc(HrPosition::getPositionSort);
|
||||
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import cn.stylefeng.roses.kernel.auth.api.pojo.login.basic.SimpleUserInfo;
|
|||
import cn.stylefeng.roses.kernel.auth.api.prop.LoginUserPropExpander;
|
||||
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
|
||||
import cn.stylefeng.roses.kernel.system.modular.user.entity.SysUser;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.organization.DataScopeResponse;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.organization.DataScopeDTO;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.role.response.SysRoleResponse;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.user.SysUserOrgResponse;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.user.UserLoginInfoDTO;
|
||||
|
@ -37,7 +37,7 @@ public class UserLoginInfoFactory {
|
|||
*/
|
||||
public static UserLoginInfoDTO userLoginInfoDTO(SysUser sysUser,
|
||||
List<SysRoleResponse> roleResponseList,
|
||||
DataScopeResponse dataScopeResponse,
|
||||
DataScopeDTO dataScopeResponse,
|
||||
SysUserOrgResponse userOrgInfo,
|
||||
Set<String> resourceUrlsListByCodes,
|
||||
Set<String> roleButtonCodes) {
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.util.List;
|
|||
*/
|
||||
public interface SysUserDataScopeService extends IService<SysUserDataScope> {
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
|
|
|
@ -39,8 +39,8 @@ import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserDataScopeSer
|
|||
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserOrgService;
|
||||
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserRoleService;
|
||||
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserService;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.organization.DataScopeResponse;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.organization.HrOrganizationResponse;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.organization.DataScopeDTO;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.organization.HrOrganizationDTO;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.role.response.SysRoleResponse;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.user.*;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.user.request.OnlineUserRequest;
|
||||
|
@ -430,7 +430,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
List<SysRoleResponse> roleResponseList = roleServiceApi.getRolesByIds(roleIds);
|
||||
|
||||
// 3. 获取用户的数据范围
|
||||
DataScopeResponse dataScopeResponse = dataScopeApi.getDataScope(userId, roleResponseList);
|
||||
DataScopeDTO dataScopeResponse = dataScopeApi.getDataScope(userId, roleResponseList);
|
||||
|
||||
// 4. 获取用户的组织机构和职位信息
|
||||
SysUserOrgResponse userOrgInfo = sysUserOrgService.getUserOrgInfo(userId);
|
||||
|
@ -594,9 +594,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
public List<UserSelectTreeNode> userSelectTree(SysUserRequest sysUserRequest) {
|
||||
// 定义返回结果
|
||||
List<UserSelectTreeNode> treeNodeList = CollectionUtil.newArrayList();
|
||||
List<HrOrganizationResponse> orgList = organizationServiceApi.orgList();
|
||||
List<HrOrganizationDTO> orgList = organizationServiceApi.orgList();
|
||||
UserSelectTreeNode orgTreeNode;
|
||||
for (HrOrganizationResponse hrOrganization : orgList) {
|
||||
for (HrOrganizationDTO hrOrganization : orgList) {
|
||||
orgTreeNode = new UserSelectTreeNode();
|
||||
orgTreeNode.setId(String.valueOf(hrOrganization.getOrgId()));
|
||||
orgTreeNode.setPId(String.valueOf(hrOrganization.getOrgParentId()));
|
||||
|
|
Loading…
Reference in New Issue