Browse Source

项目增补情况,各类型项目数量,各区域项目数量,各领域项目数量,各阶段项目数量

tags/24080901
niohe·erbao 1 year ago
parent
commit
75ebfac200
10 changed files with 225 additions and 53 deletions
  1. +0
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/AnalysisBasicConstant.java
  2. +26
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/ChartTypeEnum.java
  3. +0
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/controller/DashboardController.java
  4. +55
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardChartAssembler.java
  5. +77
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardHelper.java
  6. +0
    -35
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardRegionHelper.java
  7. +3
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardExpertManage.java
  8. +56
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java
  9. +8
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectCntSummaryVO.java
  10. +0
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectSummaryVO.java

+ 0
- 2
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/AnalysisBasicConstant.java View File

@@ -13,6 +13,4 @@ public class AnalysisBasicConstant {
*/
public static final String LS_REGION_CODE = "331100";



}

+ 26
- 1
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/ChartTypeEnum.java View File

@@ -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
}

+ 0
- 1
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/controller/DashboardController.java View File

@@ -62,5 +62,4 @@ public class DashboardController {
return dashboardProjectManage.getInvestmentSummary(queryYearPO);
}


}

+ 55
- 0
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardChartAssembler.java View File

@@ -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<Integer, List<Project>> projectGroupMap, ChartTypeEnum chartTypeEnum) {
AnalysisChart analysisChart = new AnalysisChart();
List<AnalysisData> dataList = new ArrayList<>();
analysisChart.setChartType(chartTypeEnum);
analysisChart.setDataList(dataList);
for (Integer key : projectGroupMap.keySet()) {
AnalysisData analysisData = new AnalysisData();
String chartKey = ProjectStatusEnum.getDesc(key);
List<Project> projectList = projectGroupMap.get(key);
analysisData.setKey(chartKey);
analysisData.setValue(CollUtil.isEmpty(projectList) ? 0 : projectList.size());
dataList.add(analysisData);
}
return analysisChart;
}

public static <T> AnalysisChart buildAnalysisChart(Map<T, String> keyValueMap
, Map<T, List<Project>> projectGroupMap, ChartTypeEnum chartTypeEnum) {
AnalysisChart analysisChart = new AnalysisChart();
List<AnalysisData> dataList = new ArrayList<>();
analysisChart.setChartType(chartTypeEnum);
analysisChart.setDataList(dataList);
for (T key : keyValueMap.keySet()) {
AnalysisData analysisData = new AnalysisData();
String chartKey = keyValueMap.get(key);
List<Project> projectList = projectGroupMap.get(key);
analysisData.setKey(chartKey);
analysisData.setValue(CollUtil.isEmpty(projectList) ? 0 : projectList.size());
dataList.add(analysisData);
}
return analysisChart;
}
}

+ 77
- 0
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardHelper.java View File

@@ -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<String, String> getLiShuiRegionCodeNameMap() {
List<Region> regionList = iRegionService.list(Wrappers.lambdaQuery(Region.class)
.eq(Region::getParentCode, AnalysisBasicConstant.LS_REGION_CODE));
Map<String, String> regionCodeNameMap = regionList.stream().collect(Collectors.toMap(Region::getRegionCode, Region::getRegionName));
return regionCodeNameMap;
}

/**
* 获取增补情况键值表
*/
public Map<Integer, String> getTemporaryAugmentMap() {
// 0:否 1:是
Map<Integer, String> map = new HashMap<>();
map.put(1, "增补项目");
map.put(0, "非增补项目");
return map;
}


/**
* 获取项目类型键值表
*/
public Map<Integer, String> getProjectTypeMap() {
// "项目类型 1:建设 2:运维
Map<Integer, String> map = new HashMap<>();
map.put(1, "建设");
map.put(2, "运维");
return map;
}

/**
* 获取项目类型键值表
*/
public Map<Integer, String> getBizDomainMap() {
// 综合业务领域 1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治'
Map<Integer, String> 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;
}


}

+ 0
- 35
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardRegionHelper.java View File

@@ -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<String, String> getLiShuiRegionCodeNameMap() {
List<Region> regionList = iRegionService.list(Wrappers.lambdaQuery(Region.class)
.eq(Region::getParentCode, AnalysisBasicConstant.LS_REGION_CODE));
Map<String, String> regionCodeNameMap = regionList.stream().collect(Collectors.toMap(Region::getRegionCode, Region::getRegionName));
return regionCodeNameMap;
}

}

+ 3
- 3
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardExpertManage.java View File

@@ -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<AnalysisChart> analysisChartList = new ArrayList<>();

// 获取丽水区域 code name Map
Map<String, String> liShuiRegionCodeNameMap = dashboardRegionHelper.getLiShuiRegionCodeNameMap();
Map<String, String> liShuiRegionCodeNameMap = dashboardHelper.getLiShuiRegionCodeNameMap();
// 获取库内所有的专家列表
List<ExpertUserFullInfo> evidenceHasBeenSubmittedExpertInfoList = iExpertUserFullInfoService.list(Wrappers.lambdaQuery(ExpertUserFullInfo.class)
.eq(ExpertUserFullInfo::getUserInfoStep, ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey()));


+ 56
- 3
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java View File

@@ -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<Project> changedProjectList = new ArrayList<>();
Map<String, List<Project>> 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<Project> allProjectWithRepeatList = iProjectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Objects.nonNull(year), Project::getProjectYear, year)
.eq(StringUtils.isNotBlank(regionCode), Project::getAreaCode, regionCode)
);
List<Project> allProjectList = allProjectWithRepeatList.stream()
.filter(r -> r.getNewest()).collect(Collectors.toList());

// 项目增补情况
Map<Integer, List<Project>> isTemporaryAugmentGroupMap = allProjectList.stream()
.collect(Collectors.groupingBy(Project::getIsTemporaryAugment));
Map<Integer, String> temporaryAugmentMap = dashboardHelper.getTemporaryAugmentMap();
AnalysisChart isTemporaryAugmentAnalysisChart = DashboardChartAssembler.buildAnalysisChart(temporaryAugmentMap, isTemporaryAugmentGroupMap
, ChartTypeEnum.PROJECT_SUPPLEMENTATION_STATUS_CHART);

// 各类型项目数量
Map<Integer, List<Project>> projectTypeGroupMap = allProjectList.stream()
.collect(Collectors.groupingBy(Project::getProjectType));
Map<Integer, String> projectTypeMap = dashboardHelper.getTemporaryAugmentMap();
AnalysisChart projectTypeAnalysisChart = DashboardChartAssembler.buildAnalysisChart(projectTypeMap, projectTypeGroupMap
, ChartTypeEnum.EACH_TYPE_QUANTITY_OF_PROJECT_CHART);

// 各区域项目数量
Map<String, List<Project>> areaCodeGroupMap = allProjectList.stream()
.collect(Collectors.groupingBy(Project::getAreaCode));
Map<String, String> liShuiRegionCodeNameMap = dashboardHelper.getLiShuiRegionCodeNameMap();
AnalysisChart areaCodeAnalysisChart = DashboardChartAssembler.buildAnalysisChart(liShuiRegionCodeNameMap, areaCodeGroupMap
, ChartTypeEnum.PROJECTS_NUMBER_IN_EACH_REGION_CHART);

// 各领域项目数量
Map<Integer, List<Project>> bizDomainGroupMap = allProjectList.stream()
.collect(Collectors.groupingBy(Project::getBizDomain));
Map<Integer, String> bizDomainMap = dashboardHelper.getBizDomainMap();
AnalysisChart bizDomainAnalysisChart = DashboardChartAssembler.buildAnalysisChart(bizDomainMap, bizDomainGroupMap
, ChartTypeEnum.PROJECTS_NUMBER_IN_VARIOUS_FIELDS_CHART);

// 各阶段项目数量
Map<Integer, List<Project>> 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<AnalysisChart> 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;
}


}

+ 8
- 5
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectCntSummaryVO.java View File

@@ -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<AnalysisChart> analysisChartList;

}

+ 0
- 3
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectSummaryVO.java View File

@@ -16,9 +16,6 @@ import java.math.BigDecimal;
public class DashboardProjectSummaryVO {
/**
* 项目画像
* 项目立项率
* 项目申报总金额
* 项目批复总金额
* 项目采购总金额
* 资金核定率
*/


Loading…
Cancel
Save