提交修改

This commit is contained in:
quyixiao 2020-09-23 11:22:40 +08:00
parent b4dc5b8210
commit d13dbdc42d
4 changed files with 31 additions and 19 deletions

View File

@ -19,6 +19,15 @@ import lombok.Data;
public class StaffEntity implements Serializable {
private static final long serialVersionUID = 1L;
public StaffEntity() {
}
public StaffEntity(Long id,String name) {
this.id = id;
this.name = name;
}
/**
* 自增主键
*/

View File

@ -24,7 +24,7 @@ public class FlowDto {
* 组织架构名称/部门名称
*/
private String departmentName;
private Long staffId;
private List list;
}

View File

@ -137,10 +137,11 @@ public class FlowManagerServiceImpl extends ServiceImpl<FlowManagerMapper, FlowM
for(StaffEntity staffEntity : staffEntities){
staffMap.put(staffEntity.getId(),staffEntity);
}
List<FlowDto> list = new ArrayList<>();
for (DepartmentsEntity d : parentDepartments) {
String realName = getRealName(departmentsStaffRelateEntityMap,staffMap,d.getDepartmentId(),singleRelateMap);
FlowDto entity = buildMenuEntity(d.getDepartmentId(),d.getDepartmentName() , "1", realName);
StaffEntity staff = getStaff(departmentsStaffRelateEntityMap,staffMap,d.getDepartmentId(),singleRelateMap);
FlowDto entity = buildMenuEntity(d.getDepartmentId(),d.getDepartmentName() , "1", staff.getName(),staff.getId());
List<FlowDto> childList = getMenuList(tDepartments, entity,departmentsStaffRelateEntityMap,staffMap,singleRelateMap);
entity.setList(childList);
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.setDepartmentId(departmentId);
flowDto.setDepartmentName(departmentName);
flowDto.setDepartmentParentId(parentId);
flowDto.setRealName(realName);
flowDto.setStaffId(staffId);
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) {
FlowInfo flowInfo = departmentsStaffRelateEntityMap.get(departmentId);
if (flowInfo != null) {
return doGetRealName(flowInfo.getParentDepartmentRelate(), staffMap);
return doGetStaff(flowInfo.getParentDepartmentRelate(), staffMap);
} 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) {
StaffEntity staffEntity = staffMap.get(departmentsStaffRelateEntity.getStaffId());
if (staffEntity != null) {
return staffEntity.getName();
return staffEntity;
}
}
return "";
return new StaffEntity(0l,"");
}
public List<FlowDto> getMenuList(List<DepartmentsEntity> tDepartments,FlowDto flowDto,
Map<String,FlowInfo> departmentsStaffRelateEntityMap, Map<Long ,StaffEntity> staffMap
,Map<String, DepartmentsStaffRelateEntity> singleRelateMap) {
Map<String, FlowInfo> departmentsStaffRelateEntityMap, Map<Long, StaffEntity> staffMap
, Map<String, DepartmentsStaffRelateEntity> singleRelateMap) {
List<FlowDto> flowDtos = new ArrayList<>();
for(DepartmentsEntity child : tDepartments) {
for (DepartmentsEntity child : tDepartments) {
if (child.getDepartmentParentId().equals(flowDto.getDepartmentId())) {
StaffEntity staff = getStaff(departmentsStaffRelateEntityMap, staffMap, child.getDepartmentId(), singleRelateMap);
FlowDto entity = buildMenuEntity(child.getDepartmentId(),
child.getDepartmentName(), flowDto.getDepartmentId(),
getRealName(departmentsStaffRelateEntityMap, staffMap, child.getDepartmentId(),singleRelateMap));
List<FlowDto> list = getMenuList(tDepartments, entity, departmentsStaffRelateEntityMap, staffMap,singleRelateMap);
child.getDepartmentName(), flowDto.getDepartmentId(), staff.getName(),staff.getId());
List<FlowDto> list = getMenuList(tDepartments, entity, departmentsStaffRelateEntityMap, staffMap, singleRelateMap);
if (CollectionUtils.isEmpty(list) || list.size() == 0) {
FlowInfo flowInfo = departmentsStaffRelateEntityMap.get(child.getDepartmentId());
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()) {
StaffEntity staffEntity = staffMap.get(dr.getStaffId());
FlowDto childEntiry = buildMenuEntity(dr.getDepartmentId() + "_" + dr.getStaffId(),
staffEntity != null ? staffEntity.getName() : "",
" ",
entity.getDepartmentId(),
"");
staffEntity.getName(),staff.getId());
list.add(childEntiry);
}
}

View File

@ -18,7 +18,7 @@
</select>
<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 id="getUserInfos" resultType="com.lz.modules.app.dto.UserDto">