diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/AnalysisBasicConstant.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/AnalysisBasicConstant.java index e8af093..17c455e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/AnalysisBasicConstant.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/AnalysisBasicConstant.java @@ -13,6 +13,4 @@ public class AnalysisBasicConstant { */ public static final String LS_REGION_CODE = "331100"; - - } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/ChartTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/ChartTypeEnum.java index cca5749..29b1779 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/ChartTypeEnum.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/ChartTypeEnum.java @@ -25,5 +25,30 @@ public enum ChartTypeEnum { /** * 各类型评审次数 */ - MEETING_TYPE_CNT_CHART; + MEETING_TYPE_CNT_CHART, + + /** + * 项目增补情况 + */ + PROJECT_SUPPLEMENTATION_STATUS_CHART, + + /** + * 各类型项目数量 + */ + EACH_TYPE_QUANTITY_OF_PROJECT_CHART, + + /** + * 各区域项目数量 + */ + PROJECTS_NUMBER_IN_EACH_REGION_CHART, + + /** + * 各领域项目数量 + */ + PROJECTS_NUMBER_IN_VARIOUS_FIELDS_CHART, + + /** + * 各阶段项目数量 + */ + PROJECTS_NUMBER_IN_EACH_STAGE_CHART } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/controller/DashboardController.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/controller/DashboardController.java index 3352074..f5a93fe 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/controller/DashboardController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/controller/DashboardController.java @@ -62,5 +62,4 @@ public class DashboardController { return dashboardProjectManage.getInvestmentSummary(queryYearPO); } - } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardChartAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardChartAssembler.java new file mode 100644 index 0000000..19115cd --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardChartAssembler.java @@ -0,0 +1,55 @@ +package com.ningdatech.pmapi.dashboard.helper; + +import cn.hutool.core.collection.CollUtil; +import com.ningdatech.pmapi.dashboard.constant.ChartTypeEnum; +import com.ningdatech.pmapi.dashboard.model.basic.AnalysisChart; +import com.ningdatech.pmapi.dashboard.model.basic.AnalysisData; +import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; +import com.ningdatech.pmapi.projectlib.model.entity.Project; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * @author liuxinxin + * @date 2023/8/4 下午2:36 + */ + +@Component +public class DashboardChartAssembler { + + public static AnalysisChart buildProjectStateAnalysisChart(Map> projectGroupMap, ChartTypeEnum chartTypeEnum) { + AnalysisChart analysisChart = new AnalysisChart(); + List dataList = new ArrayList<>(); + analysisChart.setChartType(chartTypeEnum); + analysisChart.setDataList(dataList); + for (Integer key : projectGroupMap.keySet()) { + AnalysisData analysisData = new AnalysisData(); + String chartKey = ProjectStatusEnum.getDesc(key); + List projectList = projectGroupMap.get(key); + analysisData.setKey(chartKey); + analysisData.setValue(CollUtil.isEmpty(projectList) ? 0 : projectList.size()); + dataList.add(analysisData); + } + return analysisChart; + } + + public static AnalysisChart buildAnalysisChart(Map keyValueMap + , Map> projectGroupMap, ChartTypeEnum chartTypeEnum) { + AnalysisChart analysisChart = new AnalysisChart(); + List dataList = new ArrayList<>(); + analysisChart.setChartType(chartTypeEnum); + analysisChart.setDataList(dataList); + for (T key : keyValueMap.keySet()) { + AnalysisData analysisData = new AnalysisData(); + String chartKey = keyValueMap.get(key); + List projectList = projectGroupMap.get(key); + analysisData.setKey(chartKey); + analysisData.setValue(CollUtil.isEmpty(projectList) ? 0 : projectList.size()); + dataList.add(analysisData); + } + return analysisChart; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardHelper.java new file mode 100644 index 0000000..738cac3 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardHelper.java @@ -0,0 +1,77 @@ +package com.ningdatech.pmapi.dashboard.helper; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.pmapi.dashboard.constant.AnalysisBasicConstant; +import com.ningdatech.pmapi.sys.model.entity.Region; +import com.ningdatech.pmapi.sys.service.IRegionService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/8/3 下午3:13 + */ + +@Component +@RequiredArgsConstructor +public class DashboardHelper { + + private final IRegionService iRegionService; + + /** + * 获取丽水区域相关信息 + */ + public Map getLiShuiRegionCodeNameMap() { + List regionList = iRegionService.list(Wrappers.lambdaQuery(Region.class) + .eq(Region::getParentCode, AnalysisBasicConstant.LS_REGION_CODE)); + Map regionCodeNameMap = regionList.stream().collect(Collectors.toMap(Region::getRegionCode, Region::getRegionName)); + return regionCodeNameMap; + } + + /** + * 获取增补情况键值表 + */ + public Map getTemporaryAugmentMap() { +// 0:否 1:是 + Map map = new HashMap<>(); + map.put(1, "增补项目"); + map.put(0, "非增补项目"); + return map; + } + + + /** + * 获取项目类型键值表 + */ + public Map getProjectTypeMap() { + // "项目类型 1:建设 2:运维 + Map map = new HashMap<>(); + map.put(1, "建设"); + map.put(2, "运维"); + return map; + } + + /** + * 获取项目类型键值表 + */ + public Map getBizDomainMap() { + // 综合业务领域 1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治' + Map map = new HashMap<>(); + map.put(1, "党政机关整体智治"); + map.put(2, "数字政府"); + map.put(3, "数字经济"); + map.put(4, "数字社会"); + map.put(5, "数字文化"); + map.put(6, "数字法治"); + map.put(7, "一体化智能化公共数据平台"); + map.put(8, "基层智治"); + return map; + } + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardRegionHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardRegionHelper.java deleted file mode 100644 index 5bd5012..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardRegionHelper.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ningdatech.pmapi.dashboard.helper; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.dashboard.constant.AnalysisBasicConstant; -import com.ningdatech.pmapi.sys.model.entity.Region; -import com.ningdatech.pmapi.sys.service.IRegionService; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2023/8/3 下午3:13 - */ - -@Component -@RequiredArgsConstructor -public class DashboardRegionHelper { - - private final IRegionService iRegionService; - - /** - * 获取丽水区域相关信息 - */ - public Map getLiShuiRegionCodeNameMap() { - List regionList = iRegionService.list(Wrappers.lambdaQuery(Region.class) - .eq(Region::getParentCode, AnalysisBasicConstant.LS_REGION_CODE)); - Map regionCodeNameMap = regionList.stream().collect(Collectors.toMap(Region::getRegionCode, Region::getRegionName)); - return regionCodeNameMap; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardExpertManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardExpertManage.java index ada659c..da311cc 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardExpertManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardExpertManage.java @@ -4,7 +4,7 @@ import cn.hutool.core.collection.CollectionUtil; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.pmapi.dashboard.constant.ChartTypeEnum; -import com.ningdatech.pmapi.dashboard.helper.DashboardRegionHelper; +import com.ningdatech.pmapi.dashboard.helper.DashboardHelper; import com.ningdatech.pmapi.dashboard.model.basic.AnalysisChart; import com.ningdatech.pmapi.dashboard.model.basic.AnalysisData; import com.ningdatech.pmapi.dashboard.model.basic.StarExpertBO; @@ -38,7 +38,7 @@ import java.util.stream.Collectors; @RequiredArgsConstructor public class DashboardExpertManage { - private final DashboardRegionHelper dashboardRegionHelper; + private final DashboardHelper dashboardHelper; private final IExpertUserFullInfoService iExpertUserFullInfoService; private final IMeetingService iMeetingService; private final DictionaryCache dictionaryCache; @@ -51,7 +51,7 @@ public class DashboardExpertManage { List analysisChartList = new ArrayList<>(); // 获取丽水区域 code name Map - Map liShuiRegionCodeNameMap = dashboardRegionHelper.getLiShuiRegionCodeNameMap(); + Map liShuiRegionCodeNameMap = dashboardHelper.getLiShuiRegionCodeNameMap(); // 获取库内所有的专家列表 List evidenceHasBeenSubmittedExpertInfoList = iExpertUserFullInfoService.list(Wrappers.lambdaQuery(ExpertUserFullInfo.class) .eq(ExpertUserFullInfo::getUserInfoStep, ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey())); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java index 45c7bcc..36b45b2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java @@ -2,6 +2,10 @@ package com.ningdatech.pmapi.dashboard.manage; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.pmapi.dashboard.constant.ChartTypeEnum; +import com.ningdatech.pmapi.dashboard.helper.DashboardChartAssembler; +import com.ningdatech.pmapi.dashboard.helper.DashboardHelper; +import com.ningdatech.pmapi.dashboard.model.basic.AnalysisChart; import com.ningdatech.pmapi.dashboard.model.basic.QueryTimeYearBO; import com.ningdatech.pmapi.dashboard.model.po.QueryYearPO; import com.ningdatech.pmapi.dashboard.model.vo.DashboardInvestmentSummaryVO; @@ -39,6 +43,7 @@ public class DashboardProjectManage { private static String timeFormat = "%s-01-01 00:00:00"; private final IProjectService iProjectService; private final INdProjectDelayApplyService iProjectDelayApplyService; + private final DashboardHelper dashboardHelper; /** @@ -129,7 +134,6 @@ public class DashboardProjectManage { Integer delayProjectCnt = projectDelayApplyListMap.keySet().size(); Double delayProportion = new BigDecimal((float) delayProjectCnt / projectCnt).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); - // 项目变更数量 项目变更金额 List changedProjectList = new ArrayList<>(); Map> allProjectMap = allProjectWithRepeatList.stream().collect(Collectors.groupingBy(Project::getProjectCode)); @@ -179,12 +183,62 @@ public class DashboardProjectManage { } public DashboardProjectCntSummaryVO getProjectCntSummary(QueryYearPO queryYearPO) { - QueryTimeYearBO queryTimeYearBO = getQueryTimeYearBO(queryYearPO.getYear()); + // 预算年度 + Integer year = queryYearPO.getYear(); + String regionCode = queryYearPO.getRegionCode(); + List allProjectWithRepeatList = iProjectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Objects.nonNull(year), Project::getProjectYear, year) + .eq(StringUtils.isNotBlank(regionCode), Project::getAreaCode, regionCode) + ); + List allProjectList = allProjectWithRepeatList.stream() + .filter(r -> r.getNewest()).collect(Collectors.toList()); + + // 项目增补情况 + Map> isTemporaryAugmentGroupMap = allProjectList.stream() + .collect(Collectors.groupingBy(Project::getIsTemporaryAugment)); + Map temporaryAugmentMap = dashboardHelper.getTemporaryAugmentMap(); + AnalysisChart isTemporaryAugmentAnalysisChart = DashboardChartAssembler.buildAnalysisChart(temporaryAugmentMap, isTemporaryAugmentGroupMap + , ChartTypeEnum.PROJECT_SUPPLEMENTATION_STATUS_CHART); + + // 各类型项目数量 + Map> projectTypeGroupMap = allProjectList.stream() + .collect(Collectors.groupingBy(Project::getProjectType)); + Map projectTypeMap = dashboardHelper.getTemporaryAugmentMap(); + AnalysisChart projectTypeAnalysisChart = DashboardChartAssembler.buildAnalysisChart(projectTypeMap, projectTypeGroupMap + , ChartTypeEnum.EACH_TYPE_QUANTITY_OF_PROJECT_CHART); + + // 各区域项目数量 + Map> areaCodeGroupMap = allProjectList.stream() + .collect(Collectors.groupingBy(Project::getAreaCode)); + Map liShuiRegionCodeNameMap = dashboardHelper.getLiShuiRegionCodeNameMap(); + AnalysisChart areaCodeAnalysisChart = DashboardChartAssembler.buildAnalysisChart(liShuiRegionCodeNameMap, areaCodeGroupMap + , ChartTypeEnum.PROJECTS_NUMBER_IN_EACH_REGION_CHART); + + // 各领域项目数量 + Map> bizDomainGroupMap = allProjectList.stream() + .collect(Collectors.groupingBy(Project::getBizDomain)); + Map bizDomainMap = dashboardHelper.getBizDomainMap(); + AnalysisChart bizDomainAnalysisChart = DashboardChartAssembler.buildAnalysisChart(bizDomainMap, bizDomainGroupMap + , ChartTypeEnum.PROJECTS_NUMBER_IN_VARIOUS_FIELDS_CHART); + + // 各阶段项目数量 + Map> projectStateGroupMap = allProjectList.stream() + .collect(Collectors.groupingBy(Project::getStage)); + AnalysisChart projectStateAnalysisChart = DashboardChartAssembler + .buildProjectStateAnalysisChart(projectStateGroupMap, ChartTypeEnum.PROJECTS_NUMBER_IN_EACH_STAGE_CHART); DashboardProjectCntSummaryVO dashboardProjectCntSummaryVO = new DashboardProjectCntSummaryVO(); + List analysisChartList = new ArrayList<>(); + dashboardProjectCntSummaryVO.setAnalysisChartList(analysisChartList); + analysisChartList.add(isTemporaryAugmentAnalysisChart); + analysisChartList.add(projectTypeAnalysisChart); + analysisChartList.add(bizDomainAnalysisChart); + analysisChartList.add(areaCodeAnalysisChart); + analysisChartList.add(projectStateAnalysisChart); return dashboardProjectCntSummaryVO; } + public DashboardInvestmentSummaryVO getInvestmentSummary(QueryYearPO queryYearPO) { QueryTimeYearBO queryTimeYearBO = getQueryTimeYearBO(queryYearPO.getYear()); @@ -192,5 +246,4 @@ public class DashboardProjectManage { return dashboardInvestmentSummaryVO; } - } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectCntSummaryVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectCntSummaryVO.java index 138d6d1..9fdd90e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectCntSummaryVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectCntSummaryVO.java @@ -1,8 +1,12 @@ package com.ningdatech.pmapi.dashboard.model.vo; +import com.ningdatech.pmapi.dashboard.model.basic.AnalysisChart; import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.List; + /** * @author liuxinxin * @date 2023/8/2 下午3:36 @@ -12,13 +16,12 @@ import lombok.Data; @ApiModel("项目数量驶舱统计数据") public class DashboardProjectCntSummaryVO { /** - * 项目增补情况 - * 各类型项目数量 - * 各区域项目数量 - * 各领域项目数量 * 单位项目数量TOP5 * 近5年项目数量走势 * 近5年立项率走势 - * 各阶段项目数量 */ + + @ApiModelProperty("项目增补情况,各类型项目数量,各区域项目数量,各领域项目数量,各阶段项目数量") + List analysisChartList; + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectSummaryVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectSummaryVO.java index 86c75f2..c1d8efc 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectSummaryVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectSummaryVO.java @@ -16,9 +16,6 @@ import java.math.BigDecimal; public class DashboardProjectSummaryVO { /** * 项目画像 - * 项目立项率 - * 项目申报总金额 - * 项目批复总金额 * 项目采购总金额 * 资金核定率 */