|
@@ -943,7 +943,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
p.setManDayStartDate(LocalDate.parse(manDayStartDate));
|
|
p.setManDayStartDate(LocalDate.parse(manDayStartDate));
|
|
}
|
|
}
|
|
//检查项目人天是否超过已经填报的项目工时
|
|
//检查项目人天是否超过已经填报的项目工时
|
|
- Report report = reportMapper.selectOne(new QueryWrapper<Report>().select("sum(working_time) as working_time").eq("project_id", id).and(i->i.eq("state", 0).or().eq("state", 1)));
|
|
|
|
|
|
+ Report report = reportMapper.selectOne(new QueryWrapper<Report>().select("sum(working_time) as working_time").ge(!StringUtils.isEmpty(p.getManDayStartDate()),"create_date",p.getManDayStartDate()).eq("project_id", id).and(i->i.eq("state", 0).or().eq("state", 1)));
|
|
if(report!=null){
|
|
if(report!=null){
|
|
DecimalFormat df = new DecimalFormat("0.0");
|
|
DecimalFormat df = new DecimalFormat("0.0");
|
|
if (estimateTimeSetting.getProjectManDayFillMode() == 0) {
|
|
if (estimateTimeSetting.getProjectManDayFillMode() == 0) {
|
|
@@ -4296,7 +4296,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public HttpRespMsg importData(String userId, MultipartFile multipartFile,Integer key, HttpServletRequest request) {
|
|
|
|
|
|
+ public HttpRespMsg importData(String userId, MultipartFile multipartFile,Integer key,@RequestParam(defaultValue = "0") Integer changeParticipation, HttpServletRequest request) {
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
User user = userMapper.selectById(userId);
|
|
User user = userMapper.selectById(userId);
|
|
TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
@@ -4610,9 +4610,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
project.setId(updateProject.getId());
|
|
project.setId(updateProject.getId());
|
|
projectMapper.updateById(project);
|
|
projectMapper.updateById(project);
|
|
}else {
|
|
}else {
|
|
- if(projectMapper.insert(project)>0){
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ projectMapper.insert(project);
|
|
}
|
|
}
|
|
importCount++;
|
|
importCount++;
|
|
//处理子项目
|
|
//处理子项目
|
|
@@ -4790,6 +4788,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
//批量保存
|
|
//批量保存
|
|
List<Participation> finalOldPartList = oldPartList;
|
|
List<Participation> finalOldPartList = oldPartList;
|
|
List<Participation> addPartList = participationList.stream().filter(newP-> !finalOldPartList.stream().anyMatch(oldP->oldP.getUserId().equals(newP.getUserId()))).collect(Collectors.toList());
|
|
List<Participation> addPartList = participationList.stream().filter(newP-> !finalOldPartList.stream().anyMatch(oldP->oldP.getUserId().equals(newP.getUserId()))).collect(Collectors.toList());
|
|
|
|
+ if(changeParticipation==1){
|
|
|
|
+ participationService.remove(new LambdaQueryWrapper<Participation>().eq(project.getId()!=null,Participation::getProjectId,project.getId()));
|
|
|
|
+ addPartList = participationList;
|
|
|
|
+ }
|
|
if (addPartList.size() > 0) {
|
|
if (addPartList.size() > 0) {
|
|
participationService.saveBatch(addPartList);
|
|
participationService.saveBatch(addPartList);
|
|
}
|
|
}
|
|
@@ -6024,6 +6026,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
//批量保存
|
|
//批量保存
|
|
List<Participation> finalOldPartList = oldPartList;
|
|
List<Participation> finalOldPartList = oldPartList;
|
|
List<Participation> addPartList = participationList.stream().filter(newP-> !finalOldPartList.stream().anyMatch(oldP->oldP.getUserId().equals(newP.getUserId()))).collect(Collectors.toList());
|
|
List<Participation> addPartList = participationList.stream().filter(newP-> !finalOldPartList.stream().anyMatch(oldP->oldP.getUserId().equals(newP.getUserId()))).collect(Collectors.toList());
|
|
|
|
+ if(changeParticipation==1){
|
|
|
|
+ participationService.remove(new LambdaQueryWrapper<Participation>().eq(project.getId()!=null,Participation::getProjectId,project.getId()));
|
|
|
|
+ addPartList = participationList;
|
|
|
|
+ }
|
|
if (addPartList.size() > 0) {
|
|
if (addPartList.size() > 0) {
|
|
participationService.saveBatch(addPartList);
|
|
participationService.saveBatch(addPartList);
|
|
}
|
|
}
|
|
@@ -12624,7 +12630,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public HttpRespMsg groupExpendProcessList(String startDate, String endDate) {
|
|
|
|
|
|
+ public HttpRespMsg groupExpendProcessList(String startDate, String endDate,Integer pageIndex,Integer pageSize) {
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
User user = userMapper.selectById(request.getHeader("token"));
|
|
User user = userMapper.selectById(request.getHeader("token"));
|
|
NumberFormat percentFormat = NumberFormat.getPercentInstance();
|
|
NumberFormat percentFormat = NumberFormat.getPercentInstance();
|
|
@@ -12635,12 +12641,42 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
List<Department> allDeptList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, companyId));
|
|
List<Department> allDeptList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, companyId));
|
|
List<Map<String,Object>> resultList;
|
|
List<Map<String,Object>> resultList;
|
|
Long total;
|
|
Long total;
|
|
|
|
+ Integer size=null;
|
|
|
|
+ Integer start=null;
|
|
|
|
+ if(pageIndex!=null&&pageSize!=null){
|
|
|
|
+ size=pageSize;
|
|
|
|
+ start=(pageIndex-1)*size;
|
|
|
|
+ }
|
|
|
|
+ //需要统计的部门
|
|
|
|
+ List<Integer> targetDeptIds=new ArrayList<>();
|
|
|
|
+ targetDeptIds.add(7458);
|
|
|
|
+ targetDeptIds.add(7459);
|
|
|
|
+ targetDeptIds.add(7460);
|
|
|
|
+ //需要统计的分组名称
|
|
|
|
+ List<String> targetGroupNameList=new ArrayList<>();
|
|
|
|
+ targetGroupNameList.add("生产部电气");
|
|
|
|
+ targetGroupNameList.add("生产部车间");
|
|
|
|
+ targetGroupNameList.add("工程部现场安装施工");
|
|
|
|
+ targetGroupNameList.add("工程部配合调试");
|
|
|
|
+ targetGroupNameList.add("研发部工艺设计");
|
|
|
|
+ targetGroupNameList.add("研发部结构设计");
|
|
|
|
+ targetGroupNameList.add("研发部BIM设计");
|
|
|
|
+ targetGroupNameList.add("研发部电气设计");
|
|
|
|
+ targetGroupNameList.add("研发部工艺调试验收");
|
|
|
|
+ targetGroupNameList.add("研发部电气调试验收");
|
|
|
|
+ List<TaskGroup> taskGroupList = taskGroupMapper.selectList(new LambdaQueryWrapper<TaskGroup>().in(TaskGroup::getName, targetGroupNameList).inSql(TaskGroup::getProjectId, "select id from project where company_id=" + companyId));
|
|
|
|
+ List<Integer> projectIds = taskGroupList.stream().map(TaskGroup::getProjectId).distinct().collect(Collectors.toList());
|
|
|
|
+ if(pageIndex==null&&pageSize==null){
|
|
|
|
+ pageIndex=-1;
|
|
|
|
+ pageSize=-1;
|
|
|
|
+ }
|
|
|
|
+ IPage<Project> projectIPage = projectMapper.selectPage(new Page<>(pageIndex, pageSize), new LambdaQueryWrapper<Project>().in(Project::getId, projectIds).eq(Project::getCompanyId, companyId));
|
|
|
|
+ List<Project> projectList = projectIPage.getRecords();
|
|
//是否具有查看全部数据的权限
|
|
//是否具有查看全部数据的权限
|
|
if(!viewAll){
|
|
if(!viewAll){
|
|
if(!incharger){
|
|
if(!incharger){
|
|
//只能查看本人的数据
|
|
//只能查看本人的数据
|
|
resultList=projectMapper.groupExpendProcessList(user.getId(),companyId,startDate,endDate,null);
|
|
resultList=projectMapper.groupExpendProcessList(user.getId(),companyId,startDate,endDate,null);
|
|
- total=projectMapper.groupExpendProcessListCount(user.getId(),companyId,startDate,endDate,null);
|
|
|
|
}else {
|
|
}else {
|
|
List<Department> departmentList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().select(Department::getDepartmentId).eq(Department::getManagerId, user.getId()));
|
|
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<DepartmentOtherManager> departmentOtherManagerList = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("other_manager_id", user.getId()));
|
|
@@ -12655,49 +12691,152 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
deptIds.addAll(branchDepartment);
|
|
deptIds.addAll(branchDepartment);
|
|
}
|
|
}
|
|
resultList=projectMapper.groupExpendProcessList(null,companyId,startDate,endDate,deptIds);
|
|
resultList=projectMapper.groupExpendProcessList(null,companyId,startDate,endDate,deptIds);
|
|
- total=projectMapper.groupExpendProcessListCount(null,companyId,startDate,endDate,deptIds);
|
|
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
resultList=projectMapper.groupExpendProcessList(null,companyId,startDate,endDate,null);
|
|
resultList=projectMapper.groupExpendProcessList(null,companyId,startDate,endDate,null);
|
|
- total=projectMapper.groupExpendProcessListCount(null,companyId,startDate,endDate,null);
|
|
|
|
}
|
|
}
|
|
- Map<String, List<Map<String, Object>>> listMapGroupList = resultList.stream().collect(Collectors.groupingBy(m -> String.valueOf(m.get("corpwxDeptId"))));
|
|
|
|
- List<String> departmentNameList = resultList.stream().map(m -> String.valueOf(m.get("corpwxDeptId"))).distinct().collect(Collectors.toList());
|
|
|
|
- List<Map<String,Object>> lastList=new ArrayList<>();
|
|
|
|
- for (String deptName : departmentNameList) {
|
|
|
|
- List<Map<String, Object>> maps = listMapGroupList.get(deptName);
|
|
|
|
- //再根据每个部门下员工数据长度合并人员名称列
|
|
|
|
- Map<String, List<Map<String, Object>>> listMapGroupList2 = maps.stream().collect(Collectors.groupingBy(m -> String.valueOf(m.get("groupName"))));
|
|
|
|
- List<String> groupNameList = maps.stream().map(m -> String.valueOf(m.get("groupName"))).distinct().collect(Collectors.toList());
|
|
|
|
- for (String groupName : groupNameList) {
|
|
|
|
- List<Map<String, Object>> mapList1 = listMapGroupList2.get(groupName);
|
|
|
|
- double planHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("planHour")))).sum();
|
|
|
|
- double normalHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("normalHour")))).sum();
|
|
|
|
- double overHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("overHour")))).sum();
|
|
|
|
- double realHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("realHour")))).sum();
|
|
|
|
- double realCost = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("realCost")))).sum();
|
|
|
|
- double planHourNum = new BigDecimal(planHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
- double normalHourNum = new BigDecimal(normalHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
- double overHourNum = new BigDecimal(overHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
- double realHourNum = new BigDecimal(realHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
- double realCostNum = new BigDecimal(realCost).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
- BigDecimal decimal = new BigDecimal(realHourNum);
|
|
|
|
- decimal=decimal.divide(new BigDecimal(planHourNum),4,BigDecimal.ROUND_HALF_UP);
|
|
|
|
- Map<String,Object> item=new HashMap<>();
|
|
|
|
- item.put("deptId",deptName);
|
|
|
|
- item.put("corpwxDeptId",maps.get(0).get("corpwxDeptId"));
|
|
|
|
- item.put("groupName",groupName);
|
|
|
|
- item.put("planHour",planHourNum);
|
|
|
|
- item.put("normalHour",normalHourNum);
|
|
|
|
- item.put("overHour",overHourNum);
|
|
|
|
- item.put("realHour",realHourNum);
|
|
|
|
- item.put("realCost",realCostNum);
|
|
|
|
- item.put("process",percentFormat.format(decimal.doubleValue()));
|
|
|
|
- lastList.add(item);
|
|
|
|
|
|
+ List<Department> departmentList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, companyId));
|
|
|
|
+ List<Map<String,Object>> itemList=new ArrayList<>();
|
|
|
|
+ for (Project project : projectList) {
|
|
|
|
+ for (Integer deptId : targetDeptIds) {
|
|
|
|
+ List<String> groupNames;
|
|
|
|
+ Optional<Department> department = departmentList.stream().filter(d -> d.getDepartmentId().equals(deptId)).findFirst();
|
|
|
|
+ Integer corpwxDeptid = department.get().getCorpwxDeptid();
|
|
|
|
+ String departmentName = department.get().getDepartmentName();
|
|
|
|
+ switch (deptId){
|
|
|
|
+ case 7459:
|
|
|
|
+ groupNames=new ArrayList<>();
|
|
|
|
+ groupNames.add("生产部电气");
|
|
|
|
+ groupNames.add("生产部车间");
|
|
|
|
+ for (String groupName : groupNames) {
|
|
|
|
+ Optional<TaskGroup> taskGroup = taskGroupList.stream().filter(f -> f.getName().equals(groupName) && f.getProjectId().equals(project.getId())).findFirst();
|
|
|
|
+ Map<String,Object> item=new HashMap<>();
|
|
|
|
+ item.put("projectId",project.getId());
|
|
|
|
+ item.put("projectName",project.getProjectName());
|
|
|
|
+ item.put("groupName",groupName);
|
|
|
|
+ item.put("corpwxDeptId",corpwxDeptid);
|
|
|
|
+ item.put("department_name",departmentName);
|
|
|
|
+ if(!taskGroup.isPresent()){
|
|
|
|
+ item.put("planHour",0);
|
|
|
|
+ item.put("realHour",0);
|
|
|
|
+ item.put("realCost",0);
|
|
|
|
+ item.put("overHour",0);
|
|
|
|
+ item.put("normalHour",0);
|
|
|
|
+ item.put("process","0%");
|
|
|
|
+ }else {
|
|
|
|
+ Optional<Map<String, Object>> first = 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)).findFirst();
|
|
|
|
+ if(first.isPresent()){
|
|
|
|
+ item.put("planHour",first.get().get("planHour"));
|
|
|
|
+ item.put("realHour",first.get().get("realHour"));
|
|
|
|
+ item.put("realCost",first.get().get("realCost"));
|
|
|
|
+ item.put("overHour",first.get().get("overHour"));
|
|
|
|
+ item.put("normalHour",first.get().get("normalHour"));
|
|
|
|
+ item.put("process",first.get().get("process"));
|
|
|
|
+ }else {
|
|
|
|
+ item.put("planHour",0);
|
|
|
|
+ item.put("realHour",0);
|
|
|
|
+ item.put("realCost",0);
|
|
|
|
+ item.put("overHour",0);
|
|
|
|
+ item.put("normalHour",0);
|
|
|
|
+ item.put("process","0%");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ itemList.add(item);
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case 7460:
|
|
|
|
+ groupNames=new ArrayList<>();
|
|
|
|
+ groupNames.add("工程部现场安装施工");
|
|
|
|
+ groupNames.add("工程部配合调试");
|
|
|
|
+ for (String groupName : groupNames) {
|
|
|
|
+ Optional<TaskGroup> taskGroup = taskGroupList.stream().filter(f -> f.getName().equals(groupName) && f.getProjectId().equals(project.getId())).findFirst();
|
|
|
|
+ Map<String,Object> item=new HashMap<>();
|
|
|
|
+ item.put("projectId",project.getId());
|
|
|
|
+ item.put("projectName",project.getProjectName());
|
|
|
|
+ item.put("groupName",groupName);
|
|
|
|
+ item.put("corpwxDeptId",corpwxDeptid);
|
|
|
|
+ item.put("department_name",departmentName);
|
|
|
|
+ if(!taskGroup.isPresent()){
|
|
|
|
+ item.put("planHour",0);
|
|
|
|
+ item.put("realHour",0);
|
|
|
|
+ item.put("realCost",0);
|
|
|
|
+ item.put("overHour",0);
|
|
|
|
+ item.put("normalHour",0);
|
|
|
|
+ item.put("process","0%");
|
|
|
|
+ }else {
|
|
|
|
+ Optional<Map<String, Object>> first = 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)).findFirst();
|
|
|
|
+ if(first.isPresent()){
|
|
|
|
+ item.put("planHour",first.get().get("planHour"));
|
|
|
|
+ item.put("realHour",first.get().get("realHour"));
|
|
|
|
+ item.put("realCost",first.get().get("realCost"));
|
|
|
|
+ item.put("overHour",first.get().get("overHour"));
|
|
|
|
+ item.put("normalHour",first.get().get("normalHour"));
|
|
|
|
+ item.put("process",first.get().get("process"));
|
|
|
|
+ }else {
|
|
|
|
+ item.put("planHour",0);
|
|
|
|
+ item.put("realHour",0);
|
|
|
|
+ item.put("realCost",0);
|
|
|
|
+ item.put("overHour",0);
|
|
|
|
+ item.put("normalHour",0);
|
|
|
|
+ item.put("process","0%");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ itemList.add(item);
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case 7458:
|
|
|
|
+ groupNames=new ArrayList<>();
|
|
|
|
+ groupNames.add("研发部工艺设计");
|
|
|
|
+ groupNames.add("研发部结构设计");
|
|
|
|
+ groupNames.add("研发部BIM设计");
|
|
|
|
+ groupNames.add("研发部电气设计");
|
|
|
|
+ groupNames.add("研发部工艺调试验收");
|
|
|
|
+ groupNames.add("研发部电气调试验收");
|
|
|
|
+ for (String groupName : groupNames) {
|
|
|
|
+ Optional<TaskGroup> taskGroup = taskGroupList.stream().filter(f -> f.getName().equals(groupName) && f.getProjectId().equals(project.getId())).findFirst();
|
|
|
|
+ Map<String,Object> item=new HashMap<>();
|
|
|
|
+ item.put("projectId",project.getId());
|
|
|
|
+ item.put("projectName",project.getProjectName());
|
|
|
|
+ item.put("groupName",groupName);
|
|
|
|
+ item.put("corpwxDeptId",corpwxDeptid);
|
|
|
|
+ item.put("department_name",departmentName);
|
|
|
|
+ if(!taskGroup.isPresent()){
|
|
|
|
+ item.put("planHour",0);
|
|
|
|
+ item.put("realHour",0);
|
|
|
|
+ item.put("realCost",0);
|
|
|
|
+ item.put("overHour",0);
|
|
|
|
+ item.put("normalHour",0);
|
|
|
|
+ item.put("process","0%");
|
|
|
|
+ }else {
|
|
|
|
+ Optional<Map<String, Object>> first = 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)).findFirst();
|
|
|
|
+ if(first.isPresent()){
|
|
|
|
+ item.put("planHour",first.get().get("planHour"));
|
|
|
|
+ item.put("realHour",first.get().get("realHour"));
|
|
|
|
+ item.put("realCost",first.get().get("realCost"));
|
|
|
|
+ item.put("overHour",first.get().get("overHour"));
|
|
|
|
+ item.put("normalHour",first.get().get("normalHour"));
|
|
|
|
+ item.put("process",first.get().get("process"));
|
|
|
|
+ }else {
|
|
|
|
+ item.put("planHour",0);
|
|
|
|
+ item.put("realHour",0);
|
|
|
|
+ item.put("realCost",0);
|
|
|
|
+ item.put("overHour",0);
|
|
|
|
+ item.put("normalHour",0);
|
|
|
|
+ item.put("process","0%");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ itemList.add(item);
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Map<String,Object> resultMap=new HashMap<>();
|
|
Map<String,Object> resultMap=new HashMap<>();
|
|
- resultMap.put("record",lastList);
|
|
|
|
|
|
+ resultMap.put("record",itemList);
|
|
|
|
+ resultMap.put("total",projectIPage.getTotal());
|
|
msg.setData(resultMap);
|
|
msg.setData(resultMap);
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
@@ -12707,7 +12846,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
NumberFormat percentFormat = NumberFormat.getPercentInstance();
|
|
NumberFormat percentFormat = NumberFormat.getPercentInstance();
|
|
percentFormat.setMaximumFractionDigits(2);
|
|
percentFormat.setMaximumFractionDigits(2);
|
|
- HttpRespMsg resultMsg = groupExpendProcessList(startDate,endDate);
|
|
|
|
|
|
+ HttpRespMsg resultMsg = groupExpendProcessList(startDate,endDate,null,null);
|
|
Map<String, Object> msgData = (Map<String, Object>) resultMsg.getData();
|
|
Map<String, Object> msgData = (Map<String, Object>) resultMsg.getData();
|
|
List<Map<String, Object>> mapList = (List<Map<String, Object>>) msgData.get("record");
|
|
List<Map<String, Object>> mapList = (List<Map<String, Object>>) msgData.get("record");
|
|
Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
@@ -12792,6 +12931,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
SXSSFRow row0 = sheet.createRow(rowNum++);
|
|
SXSSFRow row0 = sheet.createRow(rowNum++);
|
|
row0.setHeight((short)500);
|
|
row0.setHeight((short)500);
|
|
List<String> row_first =new ArrayList<>();
|
|
List<String> row_first =new ArrayList<>();
|
|
|
|
+ row_first.add("项目名称");
|
|
row_first.add("负责部门");
|
|
row_first.add("负责部门");
|
|
row_first.add("任务分组");
|
|
row_first.add("任务分组");
|
|
row_first.add("计划工时(财务)");
|
|
row_first.add("计划工时(财务)");
|
|
@@ -12805,11 +12945,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
tempCell.setCellValue(row_first.get(i));
|
|
tempCell.setCellValue(row_first.get(i));
|
|
tempCell.setCellStyle(headStyle);
|
|
tempCell.setCellStyle(headStyle);
|
|
}
|
|
}
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,0,3,6));
|
|
|
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0,0,4,7));
|
|
sheet.addMergedRegion(new CellRangeAddress(0,1,0,0));
|
|
sheet.addMergedRegion(new CellRangeAddress(0,1,0,0));
|
|
sheet.addMergedRegion(new CellRangeAddress(0,1,1,1));
|
|
sheet.addMergedRegion(new CellRangeAddress(0,1,1,1));
|
|
sheet.addMergedRegion(new CellRangeAddress(0,1,2,2));
|
|
sheet.addMergedRegion(new CellRangeAddress(0,1,2,2));
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,7,7));
|
|
|
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0,1,3,3));
|
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0,1,8,8));
|
|
//第二行
|
|
//第二行
|
|
SXSSFRow row1 = sheet.createRow(rowNum++);
|
|
SXSSFRow row1 = sheet.createRow(rowNum++);
|
|
row1.setHeight((short)500);
|
|
row1.setHeight((short)500);
|
|
@@ -12817,6 +12958,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
row_second.add("");
|
|
row_second.add("");
|
|
row_second.add("");
|
|
row_second.add("");
|
|
row_second.add("");
|
|
row_second.add("");
|
|
|
|
+ row_second.add("");
|
|
row_second.add("正常工时");
|
|
row_second.add("正常工时");
|
|
row_second.add("加班工时");
|
|
row_second.add("加班工时");
|
|
row_second.add("合计工时");
|
|
row_second.add("合计工时");
|
|
@@ -12828,50 +12970,43 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
tempCell.setCellStyle(headStyle);
|
|
tempCell.setCellStyle(headStyle);
|
|
}
|
|
}
|
|
List<String> list=new ArrayList<>();
|
|
List<String> list=new ArrayList<>();
|
|
- Map<String, List<Map<String, Object>>> listMapGroupList = mapList.stream().collect(Collectors.groupingBy(m -> String.valueOf(m.get("corpwxDeptId"))));
|
|
|
|
- List<String> departmentNameList = mapList.stream().map(m -> String.valueOf(m.get("corpwxDeptId"))).distinct().collect(Collectors.toList());
|
|
|
|
- //根据每个部门下数据长度合并部门名称列
|
|
|
|
- int deptIndex=rowNum;
|
|
|
|
- int allRowNum=0;
|
|
|
|
- for (String deptName : departmentNameList) {
|
|
|
|
- List<Map<String, Object>> maps = listMapGroupList.get(deptName);
|
|
|
|
- //再根据每个部门下员工数据长度合并人员名称列
|
|
|
|
- Map<String, List<Map<String, Object>>> listMapGroupList2 = maps.stream().collect(Collectors.groupingBy(m -> String.valueOf(m.get("groupName"))));
|
|
|
|
- List<String> groupNameList = maps.stream().map(m -> String.valueOf(m.get("groupName"))).distinct().collect(Collectors.toList());
|
|
|
|
- if(groupNameList.size()>1){
|
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(deptIndex,deptIndex+groupNameList.size()-1,0,0));
|
|
|
|
- }
|
|
|
|
- deptIndex+=groupNameList.size();
|
|
|
|
- for (String groupName : groupNameList) {
|
|
|
|
- List<Map<String, Object>> mapList1 = listMapGroupList2.get(groupName);
|
|
|
|
- list.add("$departmentName="+deptName+"$");
|
|
|
|
- list.add(groupName);
|
|
|
|
- double planHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("planHour")))).sum();
|
|
|
|
- double normalHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("normalHour")))).sum();
|
|
|
|
- double overHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("overHour")))).sum();
|
|
|
|
- double realHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("realHour")))).sum();
|
|
|
|
- double realCost = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("realCost")))).sum();
|
|
|
|
- double planHourNum = new BigDecimal(planHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
- double normalHourNum = new BigDecimal(normalHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
- double overHourNum = new BigDecimal(overHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
- double realHourNum = new BigDecimal(realHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
- double realCostNum = new BigDecimal(realCost).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
- list.add(String.valueOf(planHourNum));
|
|
|
|
- list.add(String.valueOf(normalHourNum));
|
|
|
|
- list.add(String.valueOf(overHourNum));
|
|
|
|
- list.add(String.valueOf(realHourNum));
|
|
|
|
- list.add(String.valueOf(realCostNum));
|
|
|
|
- BigDecimal decimal = new BigDecimal(realHourNum);
|
|
|
|
- decimal=decimal.divide(new BigDecimal(planHourNum),4,BigDecimal.ROUND_HALF_UP);
|
|
|
|
- list.add(percentFormat.format(decimal.doubleValue()));
|
|
|
|
- }
|
|
|
|
- allRowNum+=groupNameList.size();
|
|
|
|
|
|
+ Map<String, List<Map<String, Object>>> listMapGroupList = mapList.stream().collect(Collectors.groupingBy(m -> String.valueOf(m.get("projectId"))));
|
|
|
|
+ List<String> projectIdList = mapList.stream().map(m -> String.valueOf(m.get("projectId"))).distinct().collect(Collectors.toList());
|
|
|
|
+ //根据每个项目合并项目列表
|
|
|
|
+ Integer projectNum=rowNum;
|
|
|
|
+ for (String projectId : projectIdList) {
|
|
|
|
+ List<Map<String, Object>> maps = listMapGroupList.get(projectId);
|
|
|
|
+ if(maps.size()>1){
|
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(projectNum,projectNum+maps.size()-1,0,0));
|
|
|
|
+ }
|
|
|
|
+ Map<String, List<Map<String, Object>>> listMapGroupDeptList = maps.stream().collect(Collectors.groupingBy(m -> String.valueOf(m.get("corpwxDeptId"))));
|
|
|
|
+ List<String> deptIdList = maps.stream().map(m -> String.valueOf(m.get("corpwxDeptId"))).distinct().collect(Collectors.toList());
|
|
|
|
+ Integer deptNum=projectNum;
|
|
|
|
+ for (String deptId : deptIdList) {
|
|
|
|
+ List<Map<String, Object>> maps1 = listMapGroupDeptList.get(deptId);
|
|
|
|
+ if(maps1.size()>1){
|
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(deptNum,deptNum+maps1.size()-1,1,1));
|
|
|
|
+ }
|
|
|
|
+ deptNum+=maps1.size();
|
|
|
|
+ }
|
|
|
|
+ projectNum+=maps.size();
|
|
|
|
+ }
|
|
|
|
+ for (Map<String, Object> map : mapList) {
|
|
|
|
+ list.add(String.valueOf(map.get("projectName")));
|
|
|
|
+ list.add(String.valueOf(map.get("corpwxDeptId")));
|
|
|
|
+ list.add(String.valueOf(map.get("groupName")));
|
|
|
|
+ list.add(String.valueOf(map.get("planHour")));
|
|
|
|
+ list.add(String.valueOf(map.get("normalHour")));
|
|
|
|
+ list.add(String.valueOf(map.get("overHour")));
|
|
|
|
+ list.add(String.valueOf(map.get("realHour")));
|
|
|
|
+ list.add(String.valueOf(map.get("realCost")));
|
|
|
|
+ list.add(String.valueOf(map.get("process")));
|
|
}
|
|
}
|
|
int k=0;
|
|
int k=0;
|
|
- for(int i = 0;i<allRowNum;i++){
|
|
|
|
|
|
+ for(int i = 0;i<mapList.size();i++){
|
|
SXSSFRow tempRow = sheet.createRow(rowNum++);
|
|
SXSSFRow tempRow = sheet.createRow(rowNum++);
|
|
tempRow.setHeight((short)500);
|
|
tempRow.setHeight((short)500);
|
|
- for(int j=0;j<8;j++){
|
|
|
|
|
|
+ for(int j=0;j<9;j++){
|
|
SXSSFCell tempCell = tempRow.createCell(j);
|
|
SXSSFCell tempCell = tempRow.createCell(j);
|
|
String cellValue = "";
|
|
String cellValue = "";
|
|
tempCell.setCellStyle(cellStyle);
|
|
tempCell.setCellStyle(cellStyle);
|
|
@@ -12984,6 +13119,17 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
}
|
|
}
|
|
map.put("userProgress",targetLsit);
|
|
map.put("userProgress",targetLsit);
|
|
}
|
|
}
|
|
|
|
+ //处理项目下的负责组长
|
|
|
|
+ List<Integer> needProjectIds = resultList.stream().map(m -> Integer.valueOf(String.valueOf(m.get("projectId")))).collect(Collectors.toList());
|
|
|
|
+ List<Participation> participationList = participationMapper.selectList(new LambdaQueryWrapper<Participation>().in(Participation::getProjectId, needProjectIds));
|
|
|
|
+ List<String> needUserIds = participationList.stream().map(m -> String.valueOf(m.getUserId())).collect(Collectors.toList());
|
|
|
|
+ List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().in(User::getId, needUserIds));
|
|
|
|
+ resultList.forEach(r->{
|
|
|
|
+ List<Participation> targetParticipationList = participationList.stream().filter(p -> p.getProjectId().equals(Integer.valueOf(String.valueOf(r.get("projectId"))))).collect(Collectors.toList());
|
|
|
|
+ List<String> targetUserIds = targetParticipationList.stream().map(m -> String.valueOf(m.getUserId())).collect(Collectors.toList());
|
|
|
|
+ List<User> users = userList.stream().filter(u -> targetUserIds.contains(u.getId()) && u.getRoleId().equals(30770)).collect(Collectors.toList());
|
|
|
|
+ r.put("teamLeader",users);
|
|
|
|
+ });
|
|
Map<String,Object> resultMap=new HashMap<>();
|
|
Map<String,Object> resultMap=new HashMap<>();
|
|
resultMap.put("record",resultList);
|
|
resultMap.put("record",resultList);
|
|
resultMap.put("total",total);
|
|
resultMap.put("total",total);
|
|
@@ -13006,10 +13152,13 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
titleList.add("项目名称");
|
|
titleList.add("项目名称");
|
|
titleList.add("项目分类");
|
|
titleList.add("项目分类");
|
|
titleList.add("项目编号");
|
|
titleList.add("项目编号");
|
|
|
|
+ titleList.add("开始时间");
|
|
|
|
+ titleList.add("截止时间");
|
|
titleList.add("分配工时");
|
|
titleList.add("分配工时");
|
|
titleList.add("已消耗工时");
|
|
titleList.add("已消耗工时");
|
|
titleList.add("已消耗工时成本");
|
|
titleList.add("已消耗工时成本");
|
|
titleList.add("剩余工时");
|
|
titleList.add("剩余工时");
|
|
|
|
+ titleList.add("负责组长");
|
|
titleList.add("参与员工");
|
|
titleList.add("参与员工");
|
|
dataList.add(titleList);
|
|
dataList.add(titleList);
|
|
for (Map<String, Object> map : mapList) {
|
|
for (Map<String, Object> map : mapList) {
|
|
@@ -13017,10 +13166,31 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
item.add(String.valueOf(map.get("projectName")));
|
|
item.add(String.valueOf(map.get("projectName")));
|
|
item.add(String.valueOf(map.get("categoryName")));
|
|
item.add(String.valueOf(map.get("categoryName")));
|
|
item.add(String.valueOf(map.get("projectCode")));
|
|
item.add(String.valueOf(map.get("projectCode")));
|
|
|
|
+ item.add(String.valueOf(map.get("planStartDate")));
|
|
|
|
+ item.add(String.valueOf(map.get("planEndDate")));
|
|
item.add(String.valueOf(map.get("planHour")));
|
|
item.add(String.valueOf(map.get("planHour")));
|
|
item.add(String.valueOf(map.get("realHour")));
|
|
item.add(String.valueOf(map.get("realHour")));
|
|
item.add(String.valueOf(map.get("realCost")));
|
|
item.add(String.valueOf(map.get("realCost")));
|
|
item.add(String.valueOf(map.get("residueHour")));
|
|
item.add(String.valueOf(map.get("residueHour")));
|
|
|
|
+ StringBuilder sb1=new StringBuilder();
|
|
|
|
+ List<User> teamLeaders = (List<User>) map.get("teamLeader");
|
|
|
|
+ for (int i = 0; i < teamLeaders.size(); i++) {
|
|
|
|
+ if(i==teamLeaders.size()-1){
|
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
|
+ sb1.append("$userName="+String.valueOf(teamLeaders.get(i).getName())+"$");
|
|
|
|
+ }else {
|
|
|
|
+ sb1.append(String.valueOf(teamLeaders.get(i).getName()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }else {
|
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
|
+ sb1.append("$userName="+String.valueOf(teamLeaders.get(i).getName())+"$"+",");
|
|
|
|
+ }else {
|
|
|
|
+ sb1.append(String.valueOf(teamLeaders.get(i).getName())+",");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ item.add(sb1.toString());
|
|
List<Map<String, Object>> userProgress = (List<Map<String, Object>>) map.get("userProgress");
|
|
List<Map<String, Object>> userProgress = (List<Map<String, Object>>) map.get("userProgress");
|
|
StringBuilder sb=new StringBuilder();
|
|
StringBuilder sb=new StringBuilder();
|
|
for (int i = 0; i < userProgress.size(); i++) {
|
|
for (int i = 0; i < userProgress.size(); i++) {
|
|
@@ -13056,8 +13226,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
User user = userMapper.selectById(request.getHeader("token"));
|
|
User user = userMapper.selectById(request.getHeader("token"));
|
|
Integer companyId = user.getCompanyId();
|
|
Integer companyId = user.getCompanyId();
|
|
- boolean viewAll = sysFunctionService.hasPriviledge(user.getRoleId(), "全部员工项目进度表");
|
|
|
|
- boolean incharger = sysFunctionService.hasPriviledge(user.getRoleId(), "负责部门员工项目进度表");
|
|
|
|
|
|
+ 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<Department> allDeptList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, companyId));
|
|
List<Map<String,Object>> resultList;
|
|
List<Map<String,Object>> resultList;
|
|
Long total;
|
|
Long total;
|
|
@@ -13195,12 +13365,15 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
row_first.add("");
|
|
row_first.add("");
|
|
row_first.add("");
|
|
row_first.add("");
|
|
row_first.add("");
|
|
row_first.add("");
|
|
|
|
+ row_first.add("");
|
|
|
|
+ row_first.add("");
|
|
|
|
+ row_first.add("");
|
|
for (int i = 0; i < row_first.size(); i++) {
|
|
for (int i = 0; i < row_first.size(); i++) {
|
|
SXSSFCell tempCell = row0.createCell(i);
|
|
SXSSFCell tempCell = row0.createCell(i);
|
|
tempCell.setCellValue(row_first.get(i));
|
|
tempCell.setCellValue(row_first.get(i));
|
|
tempCell.setCellStyle(headStyle);
|
|
tempCell.setCellStyle(headStyle);
|
|
}
|
|
}
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,0,2,6));
|
|
|
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0,0,2,9));
|
|
sheet.addMergedRegion(new CellRangeAddress(0,1,0,0));
|
|
sheet.addMergedRegion(new CellRangeAddress(0,1,0,0));
|
|
sheet.addMergedRegion(new CellRangeAddress(0,1,1,1));
|
|
sheet.addMergedRegion(new CellRangeAddress(0,1,1,1));
|
|
//第二行
|
|
//第二行
|
|
@@ -13214,6 +13387,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
row_second.add("项目任务");
|
|
row_second.add("项目任务");
|
|
row_second.add("计划工时");
|
|
row_second.add("计划工时");
|
|
row_second.add("消耗工时");
|
|
row_second.add("消耗工时");
|
|
|
|
+ row_second.add("剩余工时");
|
|
|
|
+ row_second.add("项目开始时间");
|
|
|
|
+ row_second.add("项目截止时间");
|
|
for (int i = 0; i < row_second.size(); i++) {
|
|
for (int i = 0; i < row_second.size(); i++) {
|
|
SXSSFCell tempCell = row1.createCell(i);
|
|
SXSSFCell tempCell = row1.createCell(i);
|
|
tempCell.setCellValue(row_second.get(i));
|
|
tempCell.setCellValue(row_second.get(i));
|
|
@@ -13249,13 +13425,16 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
list.add(String.valueOf(maps.get(i).get("taskName")));
|
|
list.add(String.valueOf(maps.get(i).get("taskName")));
|
|
list.add(String.valueOf(maps.get(i).get("planHour")));
|
|
list.add(String.valueOf(maps.get(i).get("planHour")));
|
|
list.add(String.valueOf(maps.get(i).get("consumeTime")));
|
|
list.add(String.valueOf(maps.get(i).get("consumeTime")));
|
|
|
|
+ list.add(String.valueOf(maps.get(i).get("residue")));
|
|
|
|
+ list.add(String.valueOf(maps.get(i).get("planStartDate")));
|
|
|
|
+ list.add(String.valueOf(maps.get(i).get("planEndDate")));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
int k=0;
|
|
int k=0;
|
|
for(int i = 0;i<mapList.size();i++){
|
|
for(int i = 0;i<mapList.size();i++){
|
|
SXSSFRow tempRow = sheet.createRow(rowNum++);
|
|
SXSSFRow tempRow = sheet.createRow(rowNum++);
|
|
tempRow.setHeight((short)500);
|
|
tempRow.setHeight((short)500);
|
|
- for(int j=0;j<7;j++){
|
|
|
|
|
|
+ for(int j=0;j<10;j++){
|
|
SXSSFCell tempCell = tempRow.createCell(j);
|
|
SXSSFCell tempCell = tempRow.createCell(j);
|
|
String cellValue = "";
|
|
String cellValue = "";
|
|
tempCell.setCellStyle(cellStyle);
|
|
tempCell.setCellStyle(cellStyle);
|