|
@@ -14407,4 +14407,74 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
msg.setData(resultList);
|
|
|
return msg;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg groupExpendProcessListForUser(String startDate, String endDate, String projectIds, String groupNames, String deptIdStr) {
|
|
|
+ HttpRespMsg msg=new HttpRespMsg();
|
|
|
+ User user = userMapper.selectById(request.getHeader("token"));
|
|
|
+ List<Department> departments = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, user.getCompanyId()));
|
|
|
+ NumberFormat percentFormat = NumberFormat.getPercentInstance();
|
|
|
+ percentFormat.setMaximumFractionDigits(2);
|
|
|
+ Integer companyId = user.getCompanyId();
|
|
|
+ List<String> groupNameList=new ArrayList<>();
|
|
|
+ List<Integer> projectIdList=new ArrayList<>();
|
|
|
+ List<Integer> deptIdList=new ArrayList<>();
|
|
|
+ if(!StringUtils.isEmpty(groupNames)){
|
|
|
+ groupNameList = Arrays.asList(groupNames.split(","));
|
|
|
+ }
|
|
|
+ if(!StringUtils.isEmpty(projectIds)){
|
|
|
+ projectIdList=Arrays.asList(projectIds.split(",")).stream().map(i->Integer.valueOf(i)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ if(!StringUtils.isEmpty(deptIdStr)){
|
|
|
+ deptIdList=Arrays.asList(deptIdStr.split(",")).stream().map(i->Integer.valueOf(i)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ boolean viewAll = sysFunctionService.hasPriviledge(user.getRoleId(), "全部分组耗用进度表");
|
|
|
+ boolean incharger = sysFunctionService.hasPriviledge(user.getRoleId(), "负责部门分组耗用进度表");
|
|
|
+ List<Department> allDeptList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, companyId));
|
|
|
+ List<Map<String,Object>> resultList;
|
|
|
+ //是否具有查看全部数据的权限
|
|
|
+ //针对依斯呗 指定部门
|
|
|
+ List<Integer> regularDeptIds=new ArrayList<>();
|
|
|
+ if(user.getCompanyId()==3092){
|
|
|
+ List<String> nameString=new ArrayList<>();
|
|
|
+ nameString.add("4");
|
|
|
+ nameString.add("46");
|
|
|
+ nameString.add("45");
|
|
|
+ List<Department> departmentList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, user.getCompanyId()).in(Department::getDepartmentName, nameString));
|
|
|
+ List<Integer> theCollect = departmentList.stream().map(dm -> dm.getDepartmentId()).distinct().collect(Collectors.toList());
|
|
|
+ theCollect.add(-1);
|
|
|
+ for (Integer integer : theCollect) {
|
|
|
+ List<Integer> branchDepartment = getBranchDepartment(integer, allDeptList);
|
|
|
+ regularDeptIds.addAll(branchDepartment);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!viewAll){
|
|
|
+ if(!incharger){
|
|
|
+ //只能查看本人的数据
|
|
|
+ resultList=projectMapper.groupExpendProcessListForUser(user.getId(),companyId,startDate,endDate,null,null,projectIdList,groupNameList,deptIdList);
|
|
|
+ }else {
|
|
|
+ List<Department> departmentList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().select(Department::getDepartmentId).eq(Department::getManagerId, user.getId()));
|
|
|
+ List<DepartmentOtherManager> departmentOtherManagerList = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("other_manager_id", user.getId()));
|
|
|
+ List<Integer> deptIds=new ArrayList<>();
|
|
|
+ List<Integer> theCollect = departmentList.stream().map(dm -> dm.getDepartmentId()).distinct().collect(Collectors.toList());
|
|
|
+ theCollect.add(-1);
|
|
|
+ List<Integer> otherCollect = departmentOtherManagerList.stream().map(dom -> dom.getDepartmentId()).distinct().collect(Collectors.toList());
|
|
|
+ otherCollect.add(-1);
|
|
|
+ theCollect.addAll(otherCollect);
|
|
|
+ for (Integer integer : theCollect) {
|
|
|
+ List<Integer> branchDepartment = getBranchDepartment(integer, allDeptList);
|
|
|
+ deptIds.addAll(branchDepartment);
|
|
|
+ }
|
|
|
+ resultList=projectMapper.groupExpendProcessListForUser(null,companyId,startDate,endDate,deptIdList,regularDeptIds,projectIdList,groupNameList,deptIdList);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ resultList=projectMapper.groupExpendProcessListForUser(null,companyId,startDate,endDate,null,regularDeptIds,projectIdList,groupNameList,deptIdList);
|
|
|
+ }
|
|
|
+ resultList.forEach(r->{
|
|
|
+ Optional<Department> department = departments.stream().filter(d -> d.getDepartmentId().equals(Integer.valueOf(String.valueOf(r.get("departmentId"))))).findFirst();
|
|
|
+ r.put("departmentName",departmentService.getSupDepartment(department.get(),departments));
|
|
|
+ });
|
|
|
+ msg.setData(resultList);
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
}
|