Explorar el Código

debug 驾驶舱算法

tags/24080901
PoffyZhang hace 1 año
padre
commit
b40995fb6f
Se han modificado 5 ficheros con 72 adiciones y 1 borrados
  1. +10
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java
  2. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/handle/CockpitStatsHandler.java
  3. +14
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/entity/CockpitStats.java
  4. +15
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/CockpitStatsVO.java
  5. +32
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java

+ 10
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java Ver fichero

@@ -7,6 +7,8 @@ import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.NumberUtils;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
@@ -126,4 +128,12 @@ public class BizUtils {
}
return null;
}

public static String computeRise(Integer numa, Integer numb) {
if(Objects.isNull(numa) || Objects.isNull(numb)){
return "0";
}
return BigDecimal.valueOf((numa - numb) * 100.0).divide(BigDecimal.valueOf(numb),2, RoundingMode.CEILING)
.stripTrailingZeros().toPlainString();
}
}

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/handle/CockpitStatsHandler.java Ver fichero

@@ -38,7 +38,7 @@ public class CockpitStatsHandler {

private final ICockpitStatsService cockpitStatsService;

private static final List<Integer> years = Lists.newArrayList(2021,2022,2023,2024);
private static final List<Integer> years = Lists.newArrayList(2021,2022,2023,2024,2025);

public CockpitStatsVO convertCockpitStats(CockpitStats cockpitStats,String regionCode,Integer year) {
CockpitStatsVO res = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.class);


+ 14
- 0
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/entity/CockpitStats.java Ver fichero

@@ -36,18 +36,32 @@ public class CockpitStats implements Serializable {
@ApiModelProperty("项目监控-超期建设项目数")
private Integer monitorOverdueConstructionProjectsNum;

@ApiModelProperty("项目监控-超期建设项目-增长比例")
private String monitorOverdueConstructionProjectsRise = "0";

@ApiModelProperty("项目监控-环节滞后项目数")
private Integer monitorLaggingProjectsNum;

@ApiModelProperty("项目监控-环节滞后项目-增长比例")
private String monitorLaggingProjectsRise = "0";

@ApiModelProperty("项目监控-预审驳回项目数")
private Integer monitorRejectedPreReviewProjectsNum;

@ApiModelProperty("项目监控-预审驳回项目-增长比例")
private String monitorRejectedPreReviewProjectsRise = "0";

@ApiModelProperty("项目监控-评审驳回项目数")
private Integer monitorRejectedApproveProjectsNum;

@ApiModelProperty("项目监控-评审驳回项目-增长比例")
private String monitorRejectedApproveProjectsRise = "0";
@ApiModelProperty("项目监控-验收条件未达标")
private Integer monitorAcceptConditionsNotStandardsNum;

@ApiModelProperty("项目监控-验收条件未达标-增长比例")
private String monitorAcceptConditionsNotStandardsRise = "0";

@ApiModelProperty("项目监控-安全投入金额(用于算安全投入占比)")
private BigDecimal monitorSafetyInputAmount;



+ 15
- 0
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/CockpitStatsVO.java Ver fichero

@@ -62,18 +62,33 @@ public class CockpitStatsVO implements Serializable {
@ApiModelProperty("项目监控-超期建设项目数")
private Integer monitorOverdueConstructionProjectsNum;

@ApiModelProperty("项目监控-超期建设项目-增长比例")
private String monitorOverdueConstructionProjectsRise;

@ApiModelProperty("项目监控-环节滞后项目数")
private Integer monitorLaggingProjectsNum;

@ApiModelProperty("项目监控-环节滞后项目-增长比例")
private String monitorLaggingProjectsRise;

@ApiModelProperty("项目监控-预审驳回项目数")
private Integer monitorRejectedPreReviewProjectsNum;

@ApiModelProperty("项目监控-预审驳回项目-增长比例")
private String monitorRejectedPreReviewProjectsRise;

@ApiModelProperty("项目监控-评审驳回项目数")
private Integer monitorRejectedApproveProjectsNum;

@ApiModelProperty("项目监控-评审驳回项目-增长比例")
private String monitorRejectedApproveProjectsRise;

@ApiModelProperty("项目监控-验收条件未达标")
private Integer monitorAcceptConditionsNotStandardsNum;

@ApiModelProperty("项目监控-验收条件未达标-增长比例")
private String monitorAcceptConditionsNotStandardsRise;

@ApiModelProperty("项目监控-安全投入占比 图")
private List<SafetyInput> monitorSafetyInputRate;



+ 32
- 0
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java Ver fichero

@@ -11,6 +11,7 @@ import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.constant.RegionConst;
import com.ningdatech.pmapi.common.helper.RegionCacheHelper;
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant;
import com.ningdatech.pmapi.common.util.BizUtils;
import com.ningdatech.pmapi.dashboard.constant.DashboardConstant;
import com.ningdatech.pmapi.dashboard.model.entity.CockpitStats;
import com.ningdatech.pmapi.dashboard.model.po.SecrecyPasswordGradePO;
@@ -171,6 +172,8 @@ public class CockpitStatsStatisticsTask {
baseProjCount = count.intValue();
}



//1.项目监测
//1.1 超期在建项目
Integer overdueConstructionProjectsNum = projects.stream().filter(p -> {
@@ -200,6 +203,19 @@ public class CockpitStatsStatisticsTask {
cockpitStats.setMonitorRejectedApproveProjectsNum(constructionFailed);
//1.5 验收不达标
cockpitStats.setMonitorAcceptConditionsNotStandardsNum(0);

//算增长率
//去年的数据 用于算 增长比例
if(Objects.isNull(year)){
Integer thisYear = LocalDateTime.now().getYear();
CockpitStats thisYearData = statisticsData(regionCode, regionName, thisYear);
CockpitStats lastYearData = statisticsData(regionCode, regionName, thisYear - 1);
buidMonitorRise(cockpitStats,thisYearData,lastYearData);
}else{
CockpitStats lastYearData = statisticsData(regionCode, regionName, year);
buidMonitorRise(cockpitStats,cockpitStats,lastYearData);
}

//1.6 总申报金额
Double totalDeclaredAmount = projects.stream().mapToDouble(p -> Objects.nonNull(p.getDeclareAmount()) ? p.getDeclareAmount().doubleValue() : 0.0).sum();
cockpitStats.setMonitorDeclaredAmount(BigDecimal.valueOf(totalDeclaredAmount));
@@ -475,4 +491,20 @@ public class CockpitStatsStatisticsTask {

return cockpitStats;
}

private void buidMonitorRise(CockpitStats cockpitStats, CockpitStats thisYearData, CockpitStats lastYearData) {
if(Objects.isNull(thisYearData) || Objects.isNull(lastYearData)){
return;
}
cockpitStats.setMonitorOverdueConstructionProjectsRise(BizUtils.computeRise(thisYearData.getMonitorOverdueConstructionProjectsNum(),
lastYearData.getMonitorOverdueConstructionProjectsNum()));
cockpitStats.setMonitorLaggingProjectsRise(BizUtils.computeRise(thisYearData.getMonitorOverdueConstructionProjectsNum(),
lastYearData.getMonitorOverdueConstructionProjectsNum()));
cockpitStats.setMonitorRejectedApproveProjectsRise(BizUtils.computeRise(thisYearData.getMonitorOverdueConstructionProjectsNum(),
lastYearData.getMonitorOverdueConstructionProjectsNum()));
cockpitStats.setMonitorRejectedPreReviewProjectsRise(BizUtils.computeRise(thisYearData.getMonitorOverdueConstructionProjectsNum(),
lastYearData.getMonitorOverdueConstructionProjectsNum()));
cockpitStats.setMonitorAcceptConditionsNotStandardsRise(BizUtils.computeRise(thisYearData.getMonitorOverdueConstructionProjectsNum(),
lastYearData.getMonitorOverdueConstructionProjectsNum()));
}
}

Cargando…
Cancelar
Guardar