|
@@ -318,7 +318,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
.mapToDouble(r->r.getWorkingTime()).sum();
|
|
|
String rWorkTime=reallWorkTime==null ? "0":df.format(reallWorkTime);
|
|
|
project.setReallyWorkTime(rWorkTime);
|
|
|
- String pEstimatedWork=Integer.valueOf(String.valueOf(project.getManDay()))==null ? 0*allday+"": project.getManDay()*allday+"";
|
|
|
+ String pEstimatedWork=project.getManDay()==null? "0": (project.getManDay()*allday+"");
|
|
|
project.setEstimatedWorkTime(pEstimatedWork);
|
|
|
List<TaskGroup> taskGroupCollect = taskGroups.stream().filter(t -> t.getProjectId().equals(project.getId())).collect(Collectors.toList());
|
|
|
|
|
@@ -649,17 +649,20 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
long end = System.currentTimeMillis();
|
|
|
List<String> stringList = providerCategoryList.stream().map(ProviderCategory::getProviderCategoryName).distinct().collect(Collectors.toList());
|
|
|
- //处理项目日报审核人
|
|
|
- if(projectIds.size()>0){
|
|
|
- List<ProjectAuditor> projectAuditorList = projectAuditorMapper.selectList(new LambdaQueryWrapper<ProjectAuditor>().in(ProjectAuditor::getProjectId, projectIds));
|
|
|
- list.forEach(l->{
|
|
|
- Optional<ProjectAuditor> first = projectAuditorList.stream().filter(p -> p.getProjectId().equals(l.getId())).findFirst();
|
|
|
- if(first.isPresent()){
|
|
|
- l.setProjectAuditorName(first.get().getAuditorName());
|
|
|
- l.setProjectAuditorId(first.get().getAuditorId());
|
|
|
- }
|
|
|
- });
|
|
|
+ //针对成都明夷电子科技有限公司,显示项目日报审核人
|
|
|
+ if (company.getCompanyName().equals("成都明夷电子科技有限公司")) {
|
|
|
+ if(projectIds.size()>0){
|
|
|
+ List<ProjectAuditor> projectAuditorList = projectAuditorMapper.selectList(new LambdaQueryWrapper<ProjectAuditor>().in(ProjectAuditor::getProjectId, projectIds));
|
|
|
+ list.forEach(l->{
|
|
|
+ Optional<ProjectAuditor> first = projectAuditorList.stream().filter(p -> p.getProjectId().equals(l.getId())).findFirst();
|
|
|
+ if(first.isPresent()){
|
|
|
+ l.setProjectAuditorName(first.get().getAuditorName());
|
|
|
+ l.setProjectAuditorId(first.get().getAuditorId());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
//stringList.add("未分类");
|
|
|
stringList.add(MessageUtils.message("excel.unclassified"));
|
|
|
Long total = projectIPage.getTotal();
|
|
@@ -1020,6 +1023,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
p.setCategory(category);
|
|
|
p.setCategoryName(projectCategory.getName());
|
|
|
}
|
|
|
+ }else {
|
|
|
+ projectMapper.updateProjectCategoryToNull(p.getId());
|
|
|
}
|
|
|
ProjectSeparate oldSeparate = projectSeparateMapper.selectById(id);
|
|
|
if(companyId==936){
|
|
@@ -2219,9 +2224,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//String fileName = "项目成本工时统计_"+System.currentTimeMillis();
|
|
|
String fileName = null;
|
|
|
if (withMainProject == 1) {
|
|
|
- fileName = "主项目成本工时统计"+System.currentTimeMillis();
|
|
|
+ fileName = "主项目成本工时统计" +(startDate==null?"":(startDate+MessageUtils.message("leave.to")+endDate))+System.currentTimeMillis();
|
|
|
} else {
|
|
|
- fileName = MessageUtils.message("fileName.projectCost")+System.currentTimeMillis();
|
|
|
+ fileName = (startDate==null?"":(startDate+MessageUtils.message("leave.to")+endDate)) + MessageUtils.message("fileName.projectCost")+System.currentTimeMillis();
|
|
|
}
|
|
|
|
|
|
return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,dingding,fileName , allList, path);
|
|
@@ -8227,7 +8232,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
//生成excel文件导出
|
|
|
//String fileName = "项目分类工时成本统计_"+System.currentTimeMillis();
|
|
|
- String fileName = MessageUtils.message("fileName.proClassLaborCost")+System.currentTimeMillis();
|
|
|
+ String fileName = (startDate==null?"":(startDate+MessageUtils.message("leave.to")+endDate)) + MessageUtils.message("fileName.proClassLaborCost")+System.currentTimeMillis();
|
|
|
try {
|
|
|
return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,dingding,fileName , allList, path);
|
|
|
} catch (Exception e) {
|
|
@@ -11789,7 +11794,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
allList.add(sumRow);
|
|
|
//生成excel文件导出
|
|
|
//String fileName = "维度成本工时统计_"+System.currentTimeMillis();
|
|
|
- String fileName = timeType.getCustomDegreeName() + MessageUtils.message("fileName.degreeCost")+System.currentTimeMillis();
|
|
|
+ String fileName = (startDate==null?"":(startDate+MessageUtils.message("leave.to")+endDate)) + timeType.getCustomDegreeName() + MessageUtils.message("fileName.degreeCost")+System.currentTimeMillis();
|
|
|
return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,dingding,fileName , allList, path);
|
|
|
} catch (NullPointerException e) {
|
|
|
e.printStackTrace();
|
|
@@ -13552,8 +13557,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
item.put("corpwxDeptId",corpwxDeptid);
|
|
|
item.put("department_name",departmentName);
|
|
|
if(taskGroup.isPresent()){
|
|
|
-// List<Map<String, Object>> mapList = resultList.stream().filter(r -> Integer.valueOf(String.valueOf(r.get("projectId"))).equals(project.getId())
|
|
|
-// && Integer.valueOf(String.valueOf(r.get("groupId"))).equals(taskGroup.get().getId()) && (Integer.valueOf(String.valueOf(r.get("deptId"))).equals(7458) || subDeptIds.contains(Integer.valueOf(String.valueOf(r.get("deptId")))))).collect(Collectors.toList());
|
|
|
List<Map<String, Object>> mapList = resultList.stream().filter(r -> Integer.valueOf(String.valueOf(r.get("projectId"))).equals(project.getId())
|
|
|
&& Integer.valueOf(String.valueOf(r.get("groupId"))).equals(taskGroup.get().getId())).collect(Collectors.toList());
|
|
|
if(mapList!=null&&mapList.size()>0){
|
|
@@ -14407,4 +14410,219 @@ 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,Integer pageIndex,Integer pageSize) {
|
|
|
+ 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 start=null;
|
|
|
+ Integer size=null;
|
|
|
+ if(pageIndex!=null&&pageSize!=null){
|
|
|
+ size=pageSize;
|
|
|
+ start=(pageIndex-1)*size;
|
|
|
+ }
|
|
|
+ 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;
|
|
|
+ Integer total;
|
|
|
+ //是否具有查看全部数据的权限
|
|
|
+ //针对依斯呗 指定部门
|
|
|
+ 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,start,size);
|
|
|
+ total=projectMapper.groupExpendProcessListForUserCount(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,start,size);
|
|
|
+ total=projectMapper.groupExpendProcessListForUserCount(null,companyId,startDate,endDate,deptIdList,regularDeptIds,projectIdList,groupNameList,deptIdList);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ resultList=projectMapper.groupExpendProcessListForUser(null,companyId,startDate,endDate,null,regularDeptIds,projectIdList,groupNameList,deptIdList,start,size);
|
|
|
+ total=projectMapper.groupExpendProcessListForUserCount(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));
|
|
|
+ });
|
|
|
+ Map<String,Object> map=new HashMap<>();
|
|
|
+ resultList=resultList.stream().filter(r->Double.valueOf(String.valueOf(r.get("totalWorkTime")))>0).collect(Collectors.toList());
|
|
|
+ map.put("record",resultList);
|
|
|
+ map.put("total",total);
|
|
|
+ msg.setData(map);
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg groupExpendProcessListForProject(String startDate, String endDate, String projectIds, String groupNames, String deptIdStr,Integer pageIndex,Integer pageSize) {
|
|
|
+ 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 start=null;
|
|
|
+ Integer size=null;
|
|
|
+ if(pageIndex!=null&&pageSize!=null){
|
|
|
+ size=pageSize;
|
|
|
+ start=(pageIndex-1)*size;
|
|
|
+ }
|
|
|
+ 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;
|
|
|
+ Integer total;
|
|
|
+ //是否具有查看全部数据的权限
|
|
|
+ //针对依斯呗 指定部门
|
|
|
+ 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.groupExpendProcessListForProject(user.getId(),companyId,startDate,endDate,null,null,projectIdList,groupNameList,deptIdList,start,size);
|
|
|
+ total=projectMapper.groupExpendProcessListForProjectCount(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.groupExpendProcessListForProject(null,companyId,startDate,endDate,deptIdList,regularDeptIds,projectIdList,groupNameList,deptIdList,start,size);
|
|
|
+ total=projectMapper.groupExpendProcessListForProjectCount(null,companyId,startDate,endDate,deptIdList,regularDeptIds,projectIdList,groupNameList,deptIdList);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ resultList=projectMapper.groupExpendProcessListForProject(null,companyId,startDate,endDate,null,regularDeptIds,projectIdList,groupNameList,deptIdList,start,size);
|
|
|
+ total=projectMapper.groupExpendProcessListForProjectCount(null,companyId,startDate,endDate,null,regularDeptIds,projectIdList,groupNameList,deptIdList);
|
|
|
+ }
|
|
|
+ //计算占比
|
|
|
+ double workTime = resultList.stream().mapToDouble(r -> Double.valueOf(String.valueOf(r.get("workTime")))).sum();
|
|
|
+ resultList.forEach(r->{
|
|
|
+ BigDecimal time = new BigDecimal(String.valueOf(r.get("workTime")));
|
|
|
+ time=time.divide(new BigDecimal(workTime),4,RoundingMode.HALF_UP);
|
|
|
+ time=time.multiply(new BigDecimal(100));
|
|
|
+// String format = percentFormat.format(time.doubleValue());
|
|
|
+ r.put("percent",time.doubleValue()+"%");
|
|
|
+ });
|
|
|
+ Map<String,Object> map=new HashMap<>();
|
|
|
+ map.put("record",resultList);
|
|
|
+ map.put("total",total);
|
|
|
+ msg.setData(map);
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg exportGroupExpendProcessListForUser(String startDate, String endDate, String projectIds, String groupNames,String titleStr, String deptIdStr) {
|
|
|
+ User user = userMapper.selectById(request.getHeader("token"));
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new LambdaQueryWrapper<WxCorpInfo>().eq(WxCorpInfo::getCompanyId, user.getCompanyId()));
|
|
|
+ List<List<String>> dataList=new ArrayList<>();
|
|
|
+ List<String> titleList=new ArrayList<>();
|
|
|
+ titleList.add("所属部门");
|
|
|
+ titleList.add("工号");
|
|
|
+ titleList.add("员工");
|
|
|
+ if(!StringUtils.isEmpty(titleStr)){
|
|
|
+ List<String> strings = Arrays.asList(titleStr.split(","));
|
|
|
+ titleList.addAll(strings);
|
|
|
+ }
|
|
|
+ dataList.add(titleList);
|
|
|
+ HttpRespMsg msg = groupExpendProcessListForUser(startDate, endDate, projectIds, groupNames, deptIdStr, null, null);
|
|
|
+ Map<String, Object> data = (Map<String, Object>) msg.data;
|
|
|
+ List<Map<String, Object>> mapList = (List<Map<String, Object>>) data.get("record");
|
|
|
+ for (Map<String, Object> map : mapList) {
|
|
|
+ List<String> item=new ArrayList<>();
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
+ item.add("$departmentName="+String.valueOf(map.get("departmentName"))+"$");
|
|
|
+ }else {
|
|
|
+ item.add(String.valueOf(map.get("departmentName")));
|
|
|
+ }
|
|
|
+ item.add(String.valueOf(map.get("jobNumber")));
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
+ item.add("$userName="+String.valueOf(map.get("userName"))+"$");
|
|
|
+ }else {
|
|
|
+ item.add(String.valueOf(map.get("userName")));
|
|
|
+ }
|
|
|
+ for (String s : titleList) {
|
|
|
+ item.add(String.valueOf(map.get(s)));
|
|
|
+ }
|
|
|
+ dataList.add(item);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,null,"人员分组耗用表",dataList,path);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
}
|