Commit 42b3925f authored by cq990612's avatar cq990612

优化代码结构

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