|
@@ -2697,7 +2697,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg getProjectTask(Integer pageIndex, Integer pageSize, Integer projectId, HttpServletRequest request,Integer taskType) {
|
|
|
+ public HttpRespMsg getProjectTask(Integer pageIndex, Integer pageSize, Integer projectId,Integer groupId, HttpServletRequest request,Integer taskType) {
|
|
|
User user = userMapper.selectById(request.getHeader("Token"));
|
|
|
Integer companyId = user.getCompanyId();
|
|
|
int pageStart = (pageIndex -1) * pageSize;
|
|
@@ -2718,8 +2718,25 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
inchagerIds.add(-1);
|
|
|
}
|
|
|
}
|
|
|
- int total = taskMapper.getProjectTaskCount(companyId, projectId,taskType,inchagerIds);
|
|
|
- List projectTask = taskMapper.getProjectTask(companyId, pageStart, pageSize, projectId,taskType,inchagerIds);
|
|
|
+ int total = taskMapper.getProjectTaskCount(companyId, projectId,groupId,taskType,inchagerIds);
|
|
|
+ List<Map<String,Object>> projectTask = taskMapper.getProjectTask(companyId, pageStart, pageSize, projectId,groupId,taskType,inchagerIds);
|
|
|
+ if(companyId==3092){
|
|
|
+ List<Integer> groupIds = projectTask.stream().map(p -> Integer.valueOf(String.valueOf(p.get("groupId")))).distinct().collect(Collectors.toList());
|
|
|
+ groupIds.add(-1);
|
|
|
+ List<Report> reportList = reportMapper.selectList(new LambdaQueryWrapper<Report>().select(Report::getGroupId, Report::getWorkingTime).in(Report::getGroupId, groupIds));
|
|
|
+ List<TaskGroup> taskGroupList = taskGroupMapper.selectList(new LambdaQueryWrapper<TaskGroup>().in(TaskGroup::getId, groupIds));
|
|
|
+ for (Map<String, Object> p : projectTask) {
|
|
|
+ Optional<TaskGroup> group = taskGroupList.stream().filter(t -> t.getId().equals(Integer.valueOf(String.valueOf(p.get("groupId"))))).findFirst();
|
|
|
+ p.put("group_plan_hours",0);
|
|
|
+ if(group.isPresent()){
|
|
|
+ p.put("group_plan_hours",0);
|
|
|
+ }
|
|
|
+ List<Report> reports = reportList.stream().filter(r -> r.getGroupId().equals(Integer.valueOf(String.valueOf(p.get("groupId"))))).collect(Collectors.toList());
|
|
|
+ BigDecimal reduce = reports.stream().map(r -> new BigDecimal(r.getWorkingTime())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ reduce = reduce.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ p.put("group_real_hours",reduce.doubleValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("records", projectTask);
|
|
@@ -2755,7 +2772,24 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
inchagerIds.add(-1);
|
|
|
}
|
|
|
}
|
|
|
- List<Map> projectList = taskMapper.getProjectTask(companyId, null, null, null,taskType,inchagerIds);
|
|
|
+ List<Map<String,Object>> projectList = taskMapper.getProjectTask(companyId, null, null, null,null,taskType,inchagerIds);
|
|
|
+ if(companyId==3092){
|
|
|
+ List<Integer> groupIds = projectList.stream().map(p -> Integer.valueOf(String.valueOf(p.get("groupId")))).distinct().collect(Collectors.toList());
|
|
|
+ groupIds.add(-1);
|
|
|
+ List<Report> reportList = reportMapper.selectList(new LambdaQueryWrapper<Report>().select(Report::getGroupId, Report::getWorkingTime).in(Report::getGroupId, groupIds));
|
|
|
+ List<TaskGroup> taskGroupList = taskGroupMapper.selectList(new LambdaQueryWrapper<TaskGroup>().in(TaskGroup::getId, groupIds));
|
|
|
+ for (Map<String, Object> p : projectList) {
|
|
|
+ Optional<TaskGroup> group = taskGroupList.stream().filter(t -> t.getId().equals(Integer.valueOf(String.valueOf(p.get("groupId"))))).findFirst();
|
|
|
+ p.put("group_plan_hours",0);
|
|
|
+ if(group.isPresent()){
|
|
|
+ p.put("group_plan_hours",0);
|
|
|
+ }
|
|
|
+ List<Report> reports = reportList.stream().filter(r -> r.getGroupId().equals(Integer.valueOf(String.valueOf(p.get("groupId"))))).collect(Collectors.toList());
|
|
|
+ BigDecimal reduce = reports.stream().map(r -> new BigDecimal(r.getWorkingTime())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ reduce = reduce.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ p.put("group_real_hours",reduce.doubleValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
List<ProjectVO> list = new ArrayList<>();
|
|
|
//String[] statusNames = {"进行中","已完成","已撤销"};
|
|
|
String[] statusNames = {MessageUtils.message("excel.onGoing"),MessageUtils.message("excel.complete"),MessageUtils.message("excel.revoke")};
|
|
@@ -2764,11 +2798,19 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
List<List<String>> exportList = new ArrayList<>();
|
|
|
//String[] titles = {"项目编号", "项目名称", "任务名称", "执行人","计划工时(h)", "实际工时(h)","状态", "类型", "截止日期"};
|
|
|
String[] titles = {MessageUtils.message("entry.projectId"), MessageUtils.message("entry.projectName"), MessageUtils.message("entry.taskName"), MessageUtils.message("excel.executor"),MessageUtils.message("excel.plannedWork"), MessageUtils.message("excel.actualWork"),MessageUtils.message("leave.status"), MessageUtils.message("excel.type"), MessageUtils.message("entry.endDate")};
|
|
|
+ if(companyId==3092){
|
|
|
+ titles = new String[]{"项目编号", "项目名称","任务分组","分组预估工时","分组实际工时", "任务名称", "执行人","计划工时(h)", "实际工时(h)","状态", "类型", "截止日期"};
|
|
|
+ }
|
|
|
exportList.add(Lists.list(titles));
|
|
|
for (Map task : projectList) {
|
|
|
List<String> data = new ArrayList<>();
|
|
|
data.add(task.get("project_code") == null?"":task.get("project_code").toString());
|
|
|
data.add(task.get("project_name") == null?"":task.get("project_name").toString());
|
|
|
+ if(companyId==3092){
|
|
|
+ data.add(task.get("groupName") == null?"":task.get("groupName").toString());
|
|
|
+ data.add(task.get("group_plan_hours") == null?"":task.get("group_plan_hours").toString());
|
|
|
+ data.add(task.get("group_real_hours") == null?"":task.get("group_real_hours").toString());
|
|
|
+ }
|
|
|
data.add(task.get("name") != null?task.get("name").toString():"");
|
|
|
if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
String userName = "";
|