Browse Source

阶段统计

master
Jinyuanyuan 2 months ago
parent
commit
6d6868440b
  1. 6
      huzhou/src/main/java/com/easy/admin/modules/huzhou/controller/HuzhouProjectController.java
  2. 2
      huzhou/src/main/java/com/easy/admin/modules/huzhou/service/IHuzhouProjectinfoService.java
  3. 42
      huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouProjectinfoServiceImpl.java
  4. 12
      huzhou/src/main/java/com/easy/admin/modules/huzhou/vo/CountStageOV.java

6
huzhou/src/main/java/com/easy/admin/modules/huzhou/controller/HuzhouProjectController.java

@ -319,5 +319,9 @@ public class HuzhouProjectController {
IPage<ProjectDetailOV> result = projectinfoService.getProjectDetailPage(projectinfo, pageNo, pageSize); IPage<ProjectDetailOV> result = projectinfoService.getProjectDetailPage(projectinfo, pageNo, pageSize);
return Result.ok(result); return Result.ok(result);
} }
@GetMapping("/countStage")
public Result<?> countStage(HuzhouProjectinfoOV projectinfo){
List<CountStageOV> result = projectinfoService.countStage(projectinfo);
return Result.ok(result);
}
} }

2
huzhou/src/main/java/com/easy/admin/modules/huzhou/service/IHuzhouProjectinfoService.java

@ -195,6 +195,8 @@ public interface IHuzhouProjectinfoService extends IService<HuzhouProjectinfo> {
IPage<ProjectDetailOV> getProjectDetailPage(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize); IPage<ProjectDetailOV> getProjectDetailPage(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize);
List<CountStageOV> countStage(HuzhouProjectinfo projectInfo);
} }

42
huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouProjectinfoServiceImpl.java

@ -1447,6 +1447,48 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
result.setCurrent(pageNo).setSize(pageSize).setRecords(records).setTotal(projectAndChildInfoPageList.getTotal()); result.setCurrent(pageNo).setSize(pageSize).setRecords(records).setTotal(projectAndChildInfoPageList.getTotal());
return result; return result;
} }
public List<CountStageOV> countStage(HuzhouProjectinfo projectInfo){
List<CountStageOV> result = new ArrayList<>();
HashMap<String,Integer> stageMap=new HashMap<>();
stageMap.put("1",0);
stageMap.put("2",0);
stageMap.put("3",0);
stageMap.put("4",0);
stageMap.put("5",0);
//只要入库项目
projectInfo.setType("1");
ProjectInfoAuthSelect projectInfoAuthSelect = CommonUtils.setGetProjectInfoAuth(projectInfo);
Page page = new Page(1, 10000);
List<HuzhouProjectinfoOV> projectAndChildInfoList = projectinfoMapper.getProjectAndChildInfoPageList(page, projectInfoAuthSelect).getRecords();
List<String> projectIds = projectAndChildInfoList.stream().map(x -> x.getId()).collect(Collectors.toList());
for(String id:projectIds){
LambdaQueryWrapper<HuzhouPlaninfo> query=new LambdaQueryWrapper<>();
query.eq(HuzhouPlaninfo::getProjectId,id);
query.eq(HuzhouPlaninfo::getIsfinish,"2");
List<String[]> levelList = planinfoService.list(query).stream().map(x -> x.getTaskLevel().split("\\.")).collect(Collectors.toList());
String taskLevel;
int count;
if(!levelList.isEmpty()){
List<String[]> keyList = levelList.stream().filter(x -> x.length == 2).collect(Collectors.toList());
int max = keyList.stream().mapToInt(x -> Integer.parseInt(x[0])).summaryStatistics().getMax();
taskLevel=String.valueOf(max);
}else {
taskLevel="1";
}
if(stageMap.containsKey(taskLevel)){
count=stageMap.get(taskLevel)+1;
stageMap.put(taskLevel,count);
}
}
for(Map.Entry<String,Integer> entry:stageMap.entrySet()){
CountStageOV countStageOV=new CountStageOV();
countStageOV.setName(entry.getKey());
countStageOV.setValue(entry.getValue());
result.add(countStageOV);
}
return result;
}
} }

12
huzhou/src/main/java/com/easy/admin/modules/huzhou/vo/CountStageOV.java

@ -0,0 +1,12 @@
package com.easy.admin.modules.huzhou.vo;
import lombok.Data;
@Data
public class CountStageOV {
private String name;
private Integer value;
}
Loading…
Cancel
Save