Commit 42b3925f authored by cq990612's avatar cq990612

优化代码结构

parent 12d60b59
...@@ -226,8 +226,11 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -226,8 +226,11 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
dto.setManagerName(workUserService.getById(workProjectService.getById(dto.getProjectId()).getManagerId()).getName()); dto.setManagerName(workUserService.getById(workProjectService.getById(dto.getProjectId()).getManagerId()).getName());
} }
if (!typeIds.contains(type)) { if (!typeIds.contains(type)) {
/* dto.setManagerName(workUserService.getById(workTypeManagerService.getByDeptId(workUserService.getById(dto.getUserId()).getDeptId()).get(0).getManagerId()).getName());*/ Integer deptManagerId = workDeptService.getById(user.getDeptId()).getDeptManagerId();
dto.setManagerName(workUserService.getById(workDeptService.getById(user.getDeptId()).getDeptManagerId()).getName()); if (null != deptManagerId) {
dto.setManagerName(workUserService.getById(deptManagerId).getName());
}
} }
} }
// 设置状态 // 设置状态
...@@ -420,8 +423,10 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -420,8 +423,10 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
if (approvalDto.getWorkDay().compareTo(workTimeOrder.getWorkDay()) == 0) { if (approvalDto.getWorkDay().compareTo(workTimeOrder.getWorkDay()) == 0) {
WorkTimeOrderDto workTimeOrderDto = new WorkTimeOrderDto(); WorkTimeOrderDto workTimeOrderDto = new WorkTimeOrderDto();
BeanUtils.copyProperties(workTimeOrder, workTimeOrderDto); BeanUtils.copyProperties(workTimeOrder, workTimeOrderDto);
/* workTimeOrderDto.setManagerName(workUserService.getById(workTypeManagerService.getByDeptId(workTimeOrder.getDeptId()).get(0).getManagerId()).getName());*/ Integer deptManagerId = workDeptService.getById(user.getDeptId()).getDeptManagerId();
workTimeOrderDto.setManagerName(workUserService.getById(workDeptService.getById(user.getDeptId()).getDeptManagerId()).getName()); if (null != deptManagerId) {
workTimeOrderDto.setManagerName(workUserService.getById(deptManagerId).getName());
}
workTimeOrderDto.setUserName(workUserService.getById(workTimeOrderDto.getUserId()).getName()); workTimeOrderDto.setUserName(workUserService.getById(workTimeOrderDto.getUserId()).getName());
if (!CollectionUtils.isEmpty(typeIds)) { if (!CollectionUtils.isEmpty(typeIds)) {
if (typeIds.contains(workTimeOrder.getType())) { if (typeIds.contains(workTimeOrder.getType())) {
...@@ -643,8 +648,11 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -643,8 +648,11 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
// 1.获取当前用户的部门管理 // 1.获取当前用户的部门管理
Integer deptId = workUserService.getById(userId).getDeptId(); Integer deptId = workUserService.getById(userId).getDeptId();
Integer deptManagerId = workDeptService.getById(deptId).getDeptManagerId();
String deptManagerName = workUserService.getById(workDeptService.getById(deptId).getDeptManagerId()).getName(); String deptManagerName = null;
if (null != deptManagerId) {
deptManagerName = workUserService.getById(workDeptService.getById(deptId).getDeptManagerId()).getName();
}
// 2.获取可填报的类型 // 2.获取可填报的类型
List<ProjectInfoDto> projectList = new ArrayList<>(); List<ProjectInfoDto> projectList = new ArrayList<>();
// 3.获取正在进行中的项目/商机 // 3.获取正在进行中的项目/商机
...@@ -689,8 +697,11 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -689,8 +697,11 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
WorkTimeOrderDto dto = new WorkTimeOrderDto(); WorkTimeOrderDto dto = new WorkTimeOrderDto();
BeanUtils.copyProperties(workTimeOrder, dto); BeanUtils.copyProperties(workTimeOrder, dto);
dto.setUserName(workUserService.getById(workTimeOrder.getUserId()).getName()); dto.setUserName(workUserService.getById(workTimeOrder.getUserId()).getName());
/*dto.setManagerName(workUserService.getById(workTypeManagerService.getByDeptId(workTimeOrder.getDeptId()).get(0).getManagerId()).getName());*/
dto.setManagerName(workUserService.getById(workDeptService.getById(user.getDeptId()).getDeptManagerId()).getName()); Integer deptManagerId = workDeptService.getById(user.getDeptId()).getDeptManagerId();
if (null != deptManagerId) {
dto.setManagerName(workUserService.getById(deptManagerId).getName());
}
if (!CollectionUtils.isEmpty(typeIds)) { if (!CollectionUtils.isEmpty(typeIds)) {
if (typeIds.contains(workTimeOrder.getType())) { if (typeIds.contains(workTimeOrder.getType())) {
dto.setProjectName(workProjectService.getById(workTimeOrder.getProjectId()).getProjectName()); dto.setProjectName(workProjectService.getById(workTimeOrder.getProjectId()).getProjectName());
...@@ -839,9 +850,10 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -839,9 +850,10 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
WorkProject workProject = workProjectService.getById(wto.getProjectId()); WorkProject workProject = workProjectService.getById(wto.getProjectId());
return workProject != null ? workUserService.getById(workProject.getManagerId()).getName() : ""; return workProject != null ? workUserService.getById(workProject.getManagerId()).getName() : "";
} else { } else {
return workUserService.getById( Integer deptManagerId = workDeptService.getById(wto.getDeptId()).getDeptManagerId();
workDeptService.getById(wto.getDeptId()).getDeptManagerId()) if (null != deptManagerId) {
.getName(); return workUserService.getById(deptManagerId).getName();
}
} }
} }
return null; return null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment