From 3d22c5456557aaec6355a6f4912e258387f08c86 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 24 Oct 2023 10:41:47 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E8=AD=A6=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=BD=93=E6=97=B6=E7=9A=84=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scheduler/task/CockpitStatsStatisticsTask.java | 44 ++++++++++++++++------ .../pmapi/sys/manage/EarlyWarningManage.java | 3 ++ .../sys/model/entity/WflowEarlyWarningRecords.java | 9 ++++- 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java index b74c32a..021d549 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java @@ -20,8 +20,10 @@ import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; import com.ningdatech.pmapi.gov.model.entity.GovBizProjectApply; import com.ningdatech.pmapi.gov.model.entity.GovBizProjectBaseinfo; +import com.ningdatech.pmapi.gov.model.entity.GovOperationProjectBaseinfo; import com.ningdatech.pmapi.gov.service.IGovBizProjectApplyService; import com.ningdatech.pmapi.gov.service.IGovBizProjectBaseinfoService; +import com.ningdatech.pmapi.gov.service.IGovOperationProjectBaseinfoService; import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectService; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; @@ -77,8 +79,12 @@ public class CockpitStatsStatisticsTask { private IGovBizProjectBaseinfoService baseinfoService; @Autowired + private IGovOperationProjectBaseinfoService operationBaseInfoService; + + @Autowired private IGovBizProjectApplyService applyService; + private List years = Lists.newArrayList(2021,2022,2023,2024,2025); /** * 定义统计 驾驶舱数据 每天3点开始执行一次 @@ -101,22 +107,21 @@ public class CockpitStatsStatisticsTask { StopWatch stopWatch = new StopWatch(); stopWatch.start(); - List years = Lists.newArrayList(2021,2022,2023,2024,2025); - List res = Lists.newArrayList(); //1.根据2个维度来统计 区域和分年 //1.总的 res.add(statisticsData(DashboardConstant.CockpitStats.TOTAL, - DashboardConstant.CockpitStats.TOTAL,0)); + DashboardConstant.CockpitStats.TOTAL,DashboardConstant.CockpitStats.NONE_YEAR)); for(Integer year : years){ res.add(statisticsData(DashboardConstant.CockpitStats.TOTAL, DashboardConstant.CockpitStats.TOTAL,year)); } List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); - regions = regions.stream().filter(r -> r.getRegionLevel() != 2).collect(Collectors.toList()); + regions = regions.stream().filter(r -> r.getRegionLevel() != RegionConst.RL_CITY).collect(Collectors.toList()); for(RegionDTO regionDto : regions){ - res.add(statisticsData(regionDto.getRegionCode(),regionDto.getRegionName(),0)); + res.add(statisticsData(regionDto.getRegionCode(),regionDto.getRegionName(), + DashboardConstant.CockpitStats.NONE_YEAR)); for(Integer year : years){ res.add(statisticsData(regionDto.getRegionCode(),regionDto.getRegionName(),year)); } @@ -170,6 +175,7 @@ public class CockpitStatsStatisticsTask { cockpitStats.setRegionName(regionName); cockpitStats.setYear(year); + //申报项目 List projects = projectService.list(Wrappers.lambdaQuery(Project.class) .eq(Project::getNewest, Boolean.TRUE) .eq(StringUtils.isNotBlank(regionCode) && !DashboardConstant.CockpitStats.TOTAL.equals(regionCode), @@ -177,27 +183,42 @@ public class CockpitStatsStatisticsTask { .eq(Objects.nonNull(year) && !year.equals(DashboardConstant.CockpitStats.NONE_YEAR), Project::getProjectYear, year) .in(Objects.isNull(year) && year.equals(DashboardConstant.CockpitStats.NONE_YEAR), - Project::getProjectYear, Lists.newArrayList(2021,2022,2023,2024))); + Project::getProjectYear, years)); + + //项目归集 List baseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) .eq(StringUtils.isNotBlank(regionCode) && !DashboardConstant.CockpitStats.TOTAL.equals(regionCode), GovBizProjectBaseinfo::getBaseAreaCode, regionCode + RegionContant.MORE_CODE)); - List baseProjIds = baseInfos.stream().map(b -> b.getBaseProjId()).collect(Collectors.toList()); + + //运维备案 + List operationBaseInfos = operationBaseInfoService.list(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) + .eq(GovOperationProjectBaseinfo::getDeleted, Boolean.FALSE) + .eq(StringUtils.isNotBlank(regionCode) && !DashboardConstant.CockpitStats.TOTAL.equals(regionCode), + GovOperationProjectBaseinfo::getBaseAreaCode, regionCode + RegionContant.MORE_CODE)); + + List baseProjIds = baseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) + .collect(Collectors.toList()); + List operationBaseProjIds = operationBaseInfos.stream().map(GovOperationProjectBaseinfo::getBaseProjId) + .collect(Collectors.toList()); Integer baseProjCount = 0; - if(CollUtil.isNotEmpty(baseProjIds)){ + if(CollUtil.isNotEmpty(baseProjIds) || CollUtil.isNotEmpty(operationBaseProjIds)){ + baseProjIds.addAll(operationBaseProjIds); Long count = applyService.count(Wrappers.lambdaQuery(GovBizProjectApply.class) .in(GovBizProjectApply::getBaseProjId, baseProjIds) .eq(Objects.nonNull(year) && !year.equals(DashboardConstant.CockpitStats.NONE_YEAR), GovBizProjectApply::getBaseProjSetYear, year) .in(Objects.isNull(year) && year.equals(DashboardConstant.CockpitStats.NONE_YEAR), - GovBizProjectApply::getBaseProjSetYear, Lists.newArrayList(2021, 2022, 2023, 2024))); + GovBizProjectApply::getBaseProjSetYear, years)); baseProjCount = count.intValue(); } //1.项目监测 //1.1 超期在建项目 Integer overdueConstructionProjectsNum = projects.stream().filter(p -> { - if(Objects.nonNull(p.getPlanAcceptanceTime()) && p.getPlanAcceptanceTime().compareTo(LocalDateTime.now()) < 0){ + if(Objects.nonNull(p.getPlanAcceptanceTime()) && + p.getPlanAcceptanceTime().compareTo(LocalDateTime.now()) < 0 && + Objects.nonNull(p.getStatus()) && p.getStatus().compareTo(ProjectStatusEnum.ACCEPTED.getCode()) < 0){ return Boolean.TRUE; } return Boolean.FALSE; @@ -207,7 +228,8 @@ public class CockpitStatsStatisticsTask { cockpitStats.setMonitorLaggingProjectsNum(0); //1.3预审驳回项目 Integer preFailed = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && p.getStatus().equals(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode())){ + if(Objects.nonNull(p.getStatus()) && + p.getStatus().equals(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode())){ return Boolean.TRUE; } return Boolean.FALSE; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/EarlyWarningManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/EarlyWarningManage.java index 674da96..0603be4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/EarlyWarningManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/EarlyWarningManage.java @@ -95,6 +95,9 @@ public class EarlyWarningManage { records.setProjectName(project.getProjectName()); records.setWarningUsername(Objects.nonNull(user) ? user.getUsername() : StringUtils.EMPTY); records.setWarningEmployeecode(employeeCode); + records.setProjectId(project.getId()); + records.setProjectCode(project.getProjectCode()); + records.setProjectStatus(project.getStatus()); earlyWarningRecordsService.save(records); //2.消息提醒 diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/WflowEarlyWarningRecords.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/WflowEarlyWarningRecords.java index c130f7f..f02f2c4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/WflowEarlyWarningRecords.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/WflowEarlyWarningRecords.java @@ -40,11 +40,16 @@ public class WflowEarlyWarningRecords implements Serializable { private String areaCode; /** - * 项目名称 + * 项目 */ + @ApiModelProperty(value = "项目编码") + private String projectCode; + @ApiModelProperty(value = "项目id") + private Long projectId; @ApiModelProperty(value = "项目名称") private String projectName; - + @ApiModelProperty(value = "项目当时的状态") + private Integer projectStatus; /** * 流程类型