瀏覽代碼

驾驶舱 统计逻辑接口

master
PoffyZhang 1 年之前
父節點
當前提交
d8b32c272b
共有 2 個檔案被更改,包括 38 行新增39 行删除
  1. +37
    -38
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java
  2. +1
    -1
      pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java

+ 37
- 38
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java 查看文件

@@ -33,10 +33,7 @@ import java.math.BigDecimal;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.time.LocalDateTime;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;

/**
@@ -253,7 +250,7 @@ public class CockpitStatsStatisticsTask {
cockpitStats.setTopApprovalProjectsNum(approvalNum);
cockpitStats.setTopApprovalProjectsAmount(BigDecimal.valueOf(approvalAmount));
//3.3 平均建设周期
Double average = projects.stream().mapToInt(p -> {
OptionalDouble od = projects.stream().mapToInt(p -> {
if (StringUtils.isNotBlank(p.getBuildCycle())) {
try {
Integer buildCycle = Integer.valueOf(p.getBuildCycle());
@@ -263,7 +260,8 @@ public class CockpitStatsStatisticsTask {
}
}
return 0;
}).average().getAsDouble();
}).average();
Double average = od.isPresent() ? od.getAsDouble() : 0.0;
cockpitStats.setTopAverageConstructionPeriod(average.intValue());
//3.4 在建项目数 采购备案后的项目
Integer contructionNum = projects.stream().filter(p -> {
@@ -380,45 +378,46 @@ public class CockpitStatsStatisticsTask {
//9.绩效
List<String> projectCodes = projects.stream().map(Project::getProjectCode).collect(Collectors.toList());
Map<String, String> projectMap = projects.stream().filter(p -> Objects.nonNull(p.getProjectCode())).collect(Collectors.toMap(Project::getProjectCode, Project::getProjectName));
List<PerformanceAppraisalProject> performanceAll = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.in(PerformanceAppraisalProject::getProjectCode, projectCodes));
List<PerformanceAppraisalProject> verified = performanceAll.stream().filter(p -> {
if (Objects.nonNull(p.getVerifyTotalScore())) {
return Boolean.TRUE;
if(CollUtil.isNotEmpty(projectCodes)){
List<PerformanceAppraisalProject> performanceAll = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.in(PerformanceAppraisalProject::getProjectCode, projectCodes));
List<PerformanceAppraisalProject> verified = performanceAll.stream().filter(p -> {
if (Objects.nonNull(p.getVerifyTotalScore())) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}).sorted(Comparator.comparing(PerformanceAppraisalProject::getVerifyTotalScore).reversed())
.collect(Collectors.toList());
cockpitStats.setPerformanceTotal(performanceAll.size());
cockpitStats.setPerformanceReviewedTotal(verified.size());
cockpitStats.setPerformanceTobeReviewTotal(performanceAll.size() - verified.size());

if(verified.size() > 0){
cockpitStats.setPerformanceTop1Name(projectMap.get(verified.get(0).getProjectCode()));
cockpitStats.setPerformanceTop1Score(verified.get(0).getVerifyTotalScore());
}
return Boolean.FALSE;
}).sorted(Comparator.comparing(PerformanceAppraisalProject::getVerifyTotalScore).reversed())
.collect(Collectors.toList());
cockpitStats.setPerformanceTotal(performanceAll.size());
cockpitStats.setPerformanceReviewedTotal(verified.size());
cockpitStats.setPerformanceTobeReviewTotal(performanceAll.size() - verified.size());

if(verified.size() > 0){
cockpitStats.setPerformanceTop1Name(projectMap.get(verified.get(0).getProjectCode()));
cockpitStats.setPerformanceTop1Score(verified.get(0).getVerifyTotalScore());
}

if(verified.size() > 1){
cockpitStats.setPerformanceTop2Name(verified.get(1).getProjectCode());
cockpitStats.setPerformanceTop2Score(verified.get(1).getVerifyTotalScore());
}
if(verified.size() > 1){
cockpitStats.setPerformanceTop2Name(verified.get(1).getProjectCode());
cockpitStats.setPerformanceTop2Score(verified.get(1).getVerifyTotalScore());
}

if(verified.size() > 2){
cockpitStats.setPerformanceTop3Name(verified.get(2).getProjectCode());
cockpitStats.setPerformanceTop3Score(verified.get(2).getVerifyTotalScore());
}
if(verified.size() > 2){
cockpitStats.setPerformanceTop3Name(verified.get(2).getProjectCode());
cockpitStats.setPerformanceTop3Score(verified.get(2).getVerifyTotalScore());
}

if(verified.size() > 3){
cockpitStats.setPerformanceTop4Name(verified.get(3).getProjectCode());
cockpitStats.setPerformanceTop4Score(verified.get(3).getVerifyTotalScore());
}
if(verified.size() > 3){
cockpitStats.setPerformanceTop4Name(verified.get(3).getProjectCode());
cockpitStats.setPerformanceTop4Score(verified.get(3).getVerifyTotalScore());
}

if(verified.size() > 4){
cockpitStats.setPerformanceTop5Name(verified.get(4).getProjectCode());
cockpitStats.setPerformanceTop5Score(verified.get(4).getVerifyTotalScore());
if(verified.size() > 4){
cockpitStats.setPerformanceTop5Name(verified.get(4).getProjectCode());
cockpitStats.setPerformanceTop5Score(verified.get(4).getVerifyTotalScore());
}
}


return cockpitStats;
}
}

+ 1
- 1
pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java 查看文件

@@ -75,7 +75,7 @@ public class ProjectCollectionTest extends AppTests {

@Test
public void test(){
List<String> baseProjIds = Lists.newArrayList("33110000020230100021");
List<String> baseProjIds = Lists.newArrayList("33110000020210100194","33110000020220100194");
for(String baseProjId : baseProjIds){
GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class)
.eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId)


Loading…
取消
儲存