|
@@ -723,6 +723,18 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
String endDate = "2021-01-31";
|
|
|
}
|
|
|
|
|
|
+ private List<Integer> getBranchDepartment(Integer departmentId, List<Department> departmentList) {
|
|
|
+ List<Integer> list = new ArrayList<>();
|
|
|
+ list.add(departmentId);
|
|
|
+ //搜到子部门进行添加
|
|
|
+ for (Department department : departmentList) {
|
|
|
+ if (departmentId.equals(department.getSuperiorId())) {
|
|
|
+ list.addAll(getBranchDepartment(department.getDepartmentId(), departmentList));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
//获取查询者所在公司每个项目的工时成本
|
|
|
@Override
|
|
|
public HttpRespMsg getTimeCost(String startDate, String endDate, String userId, HttpServletRequest request) {
|
|
@@ -734,6 +746,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
//当前用户管理部门
|
|
|
List<Integer> deptIds=null;
|
|
|
+ List<Department> allDepartmentList=departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id",companyId));
|
|
|
List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("manager_id", targetUser.getId()).eq("company_id", companyId));
|
|
|
List<SysRichFunction> functionAllList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看全公司");
|
|
|
List<SysRichFunction> functionDpartList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看负责部门");
|
|
@@ -742,8 +755,13 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//判断查看权限
|
|
|
if(functionAllList.size()==0){
|
|
|
if(functionDpartList.size()>0){
|
|
|
+ deptIds=new ArrayList<>();
|
|
|
if(functionTimeList.size()>0||functionCostList.size()>0){
|
|
|
- deptIds = departmentList.stream().map(dp -> dp.getDepartmentId()).distinct().collect(Collectors.toList());
|
|
|
+ List<Integer> collect = departmentList.stream().distinct().map(dm -> dm.getDepartmentId()).collect(Collectors.toList());
|
|
|
+ for (Integer integer : collect) {
|
|
|
+ List<Integer> branchDepartment = getBranchDepartment(integer, allDepartmentList);
|
|
|
+ deptIds.addAll(branchDepartment);
|
|
|
+ }
|
|
|
}
|
|
|
}else {
|
|
|
deptIds=new ArrayList<>();
|
|
@@ -854,6 +872,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
httpRespMsg.data = resultMap;
|
|
|
}
|
|
|
} catch (NullPointerException e) {
|
|
|
+ e.printStackTrace();
|
|
|
httpRespMsg.setError("验证失败");
|
|
|
return httpRespMsg;
|
|
|
}
|
|
@@ -3504,6 +3523,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
//当前用户管理部门
|
|
|
List<Integer> deptIds=null;
|
|
|
+ List<Department> allDepartmentList=departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id",companyId));
|
|
|
List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("manager_id", targetUser.getId()).eq("company_id", companyId));
|
|
|
List<SysRichFunction> functionAllList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看全公司");
|
|
|
List<SysRichFunction> functionDpartList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看负责部门");
|
|
@@ -3512,8 +3532,13 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//判断查看权限
|
|
|
if(functionAllList.size()==0){
|
|
|
if(functionDpartList.size()>0){
|
|
|
+ deptIds=new ArrayList<>();
|
|
|
if(functionTimeList.size()>0||functionCostList.size()>0){
|
|
|
- deptIds = departmentList.stream().map(dp -> dp.getDepartmentId()).distinct().collect(Collectors.toList());
|
|
|
+ List<Integer> collect = departmentList.stream().distinct().map(dm -> dm.getDepartmentId()).collect(Collectors.toList());
|
|
|
+ for (Integer integer : collect) {
|
|
|
+ List<Integer> branchDepartment = getBranchDepartment(integer, allDepartmentList);
|
|
|
+ deptIds.addAll(branchDepartment);
|
|
|
+ }
|
|
|
}
|
|
|
}else {
|
|
|
deptIds=new ArrayList<>();
|