提交修改
This commit is contained in:
parent
b4dc5b8210
commit
d13dbdc42d
@ -19,6 +19,15 @@ import lombok.Data;
|
|||||||
public class StaffEntity implements Serializable {
|
public class StaffEntity implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public StaffEntity() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public StaffEntity(Long id,String name) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自增主键
|
* 自增主键
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -24,7 +24,7 @@ public class FlowDto {
|
|||||||
* 组织架构名称/部门名称
|
* 组织架构名称/部门名称
|
||||||
*/
|
*/
|
||||||
private String departmentName;
|
private String departmentName;
|
||||||
|
private Long staffId;
|
||||||
private List list;
|
private List list;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -137,10 +137,11 @@ public class FlowManagerServiceImpl extends ServiceImpl<FlowManagerMapper, FlowM
|
|||||||
for(StaffEntity staffEntity : staffEntities){
|
for(StaffEntity staffEntity : staffEntities){
|
||||||
staffMap.put(staffEntity.getId(),staffEntity);
|
staffMap.put(staffEntity.getId(),staffEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<FlowDto> list = new ArrayList<>();
|
List<FlowDto> list = new ArrayList<>();
|
||||||
for (DepartmentsEntity d : parentDepartments) {
|
for (DepartmentsEntity d : parentDepartments) {
|
||||||
String realName = getRealName(departmentsStaffRelateEntityMap,staffMap,d.getDepartmentId(),singleRelateMap);
|
StaffEntity staff = getStaff(departmentsStaffRelateEntityMap,staffMap,d.getDepartmentId(),singleRelateMap);
|
||||||
FlowDto entity = buildMenuEntity(d.getDepartmentId(),d.getDepartmentName() , "1", realName);
|
FlowDto entity = buildMenuEntity(d.getDepartmentId(),d.getDepartmentName() , "1", staff.getName(),staff.getId());
|
||||||
List<FlowDto> childList = getMenuList(tDepartments, entity,departmentsStaffRelateEntityMap,staffMap,singleRelateMap);
|
List<FlowDto> childList = getMenuList(tDepartments, entity,departmentsStaffRelateEntityMap,staffMap,singleRelateMap);
|
||||||
entity.setList(childList);
|
entity.setList(childList);
|
||||||
list.add(entity);
|
list.add(entity);
|
||||||
@ -149,46 +150,48 @@ public class FlowManagerServiceImpl extends ServiceImpl<FlowManagerMapper, FlowM
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public FlowDto buildMenuEntity(String departmentId, String departmentName, String parentId, String realName) {
|
public FlowDto buildMenuEntity(String departmentId, String departmentName, String parentId, String realName,Long staffId) {
|
||||||
FlowDto flowDto = new FlowDto();
|
FlowDto flowDto = new FlowDto();
|
||||||
flowDto.setDepartmentId(departmentId);
|
flowDto.setDepartmentId(departmentId);
|
||||||
flowDto.setDepartmentName(departmentName);
|
flowDto.setDepartmentName(departmentName);
|
||||||
flowDto.setDepartmentParentId(parentId);
|
flowDto.setDepartmentParentId(parentId);
|
||||||
flowDto.setRealName(realName);
|
flowDto.setRealName(realName);
|
||||||
|
flowDto.setStaffId(staffId);
|
||||||
return flowDto;
|
return flowDto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getRealName(Map<String, FlowInfo> departmentsStaffRelateEntityMap, Map<Long, StaffEntity> staffMap, String departmentId
|
public StaffEntity getStaff(Map<String, FlowInfo> departmentsStaffRelateEntityMap, Map<Long, StaffEntity> staffMap, String departmentId
|
||||||
, Map<String, DepartmentsStaffRelateEntity> singleRelateMap) {
|
, Map<String, DepartmentsStaffRelateEntity> singleRelateMap) {
|
||||||
FlowInfo flowInfo = departmentsStaffRelateEntityMap.get(departmentId);
|
FlowInfo flowInfo = departmentsStaffRelateEntityMap.get(departmentId);
|
||||||
if (flowInfo != null) {
|
if (flowInfo != null) {
|
||||||
return doGetRealName(flowInfo.getParentDepartmentRelate(), staffMap);
|
return doGetStaff(flowInfo.getParentDepartmentRelate(), staffMap);
|
||||||
} else {
|
} else {
|
||||||
return doGetRealName(singleRelateMap.get(departmentId), staffMap);
|
return doGetStaff(singleRelateMap.get(departmentId), staffMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String doGetRealName(DepartmentsStaffRelateEntity departmentsStaffRelateEntity, Map<Long, StaffEntity> staffMap) {
|
public StaffEntity doGetStaff(DepartmentsStaffRelateEntity departmentsStaffRelateEntity, Map<Long, StaffEntity> staffMap) {
|
||||||
if (departmentsStaffRelateEntity != null) {
|
if (departmentsStaffRelateEntity != null) {
|
||||||
StaffEntity staffEntity = staffMap.get(departmentsStaffRelateEntity.getStaffId());
|
StaffEntity staffEntity = staffMap.get(departmentsStaffRelateEntity.getStaffId());
|
||||||
if (staffEntity != null) {
|
if (staffEntity != null) {
|
||||||
return staffEntity.getName();
|
return staffEntity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return new StaffEntity(0l,"");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FlowDto> getMenuList(List<DepartmentsEntity> tDepartments,FlowDto flowDto,
|
public List<FlowDto> getMenuList(List<DepartmentsEntity> tDepartments,FlowDto flowDto,
|
||||||
Map<String,FlowInfo> departmentsStaffRelateEntityMap, Map<Long ,StaffEntity> staffMap
|
Map<String, FlowInfo> departmentsStaffRelateEntityMap, Map<Long, StaffEntity> staffMap
|
||||||
,Map<String, DepartmentsStaffRelateEntity> singleRelateMap) {
|
, Map<String, DepartmentsStaffRelateEntity> singleRelateMap) {
|
||||||
List<FlowDto> flowDtos = new ArrayList<>();
|
List<FlowDto> flowDtos = new ArrayList<>();
|
||||||
for(DepartmentsEntity child : tDepartments) {
|
for (DepartmentsEntity child : tDepartments) {
|
||||||
if (child.getDepartmentParentId().equals(flowDto.getDepartmentId())) {
|
if (child.getDepartmentParentId().equals(flowDto.getDepartmentId())) {
|
||||||
|
StaffEntity staff = getStaff(departmentsStaffRelateEntityMap, staffMap, child.getDepartmentId(), singleRelateMap);
|
||||||
FlowDto entity = buildMenuEntity(child.getDepartmentId(),
|
FlowDto entity = buildMenuEntity(child.getDepartmentId(),
|
||||||
child.getDepartmentName(), flowDto.getDepartmentId(),
|
child.getDepartmentName(), flowDto.getDepartmentId(), staff.getName(),staff.getId());
|
||||||
getRealName(departmentsStaffRelateEntityMap, staffMap, child.getDepartmentId(),singleRelateMap));
|
|
||||||
List<FlowDto> list = getMenuList(tDepartments, entity, departmentsStaffRelateEntityMap, staffMap,singleRelateMap);
|
List<FlowDto> list = getMenuList(tDepartments, entity, departmentsStaffRelateEntityMap, staffMap, singleRelateMap);
|
||||||
if (CollectionUtils.isEmpty(list) || list.size() == 0) {
|
if (CollectionUtils.isEmpty(list) || list.size() == 0) {
|
||||||
FlowInfo flowInfo = departmentsStaffRelateEntityMap.get(child.getDepartmentId());
|
FlowInfo flowInfo = departmentsStaffRelateEntityMap.get(child.getDepartmentId());
|
||||||
if (flowInfo != null && CollectionUtils.isNotEmpty(flowInfo.getList()) && flowInfo.getList().size() > 0) {
|
if (flowInfo != null && CollectionUtils.isNotEmpty(flowInfo.getList()) && flowInfo.getList().size() > 0) {
|
||||||
@ -196,9 +199,9 @@ public class FlowManagerServiceImpl extends ServiceImpl<FlowManagerMapper, FlowM
|
|||||||
for (DepartmentsStaffRelateEntity dr : flowInfo.getList()) {
|
for (DepartmentsStaffRelateEntity dr : flowInfo.getList()) {
|
||||||
StaffEntity staffEntity = staffMap.get(dr.getStaffId());
|
StaffEntity staffEntity = staffMap.get(dr.getStaffId());
|
||||||
FlowDto childEntiry = buildMenuEntity(dr.getDepartmentId() + "_" + dr.getStaffId(),
|
FlowDto childEntiry = buildMenuEntity(dr.getDepartmentId() + "_" + dr.getStaffId(),
|
||||||
staffEntity != null ? staffEntity.getName() : "",
|
" ",
|
||||||
entity.getDepartmentId(),
|
entity.getDepartmentId(),
|
||||||
"");
|
staffEntity.getName(),staff.getId());
|
||||||
list.add(childEntiry);
|
list.add(childEntiry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryByUserName" resultType="com.lz.modules.sys.entity.SysUserEntity">
|
<select id="queryByUserName" resultType="com.lz.modules.sys.entity.SysUserEntity">
|
||||||
select * from sys_user where username = #{username}
|
select * from sys_user where username = #{username} or mobile = #{username} limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getUserInfos" resultType="com.lz.modules.app.dto.UserDto">
|
<select id="getUserInfos" resultType="com.lz.modules.app.dto.UserDto">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user