@@ -50,5 +50,16 @@ public enum ChartTypeEnum { | |||||
/** | /** | ||||
* 各阶段项目数量 | * 各阶段项目数量 | ||||
*/ | */ | ||||
PROJECTS_NUMBER_IN_EACH_STAGE_CHART | |||||
PROJECTS_NUMBER_IN_EACH_STAGE_CHART, | |||||
/** | |||||
* 各领域项目投资金额 | |||||
*/ | |||||
PROJECTS_INVESTMENT_AMOUNT_IN_VARIOUS_FIELDS_CHART, | |||||
/** | |||||
* 各区域项目投资情况 | |||||
*/ | |||||
PROJECTS_INVESTMENT_SITUATION_IN_VARIOUS_REGIONS | |||||
} | } |
@@ -8,9 +8,11 @@ import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import java.math.BigDecimal; | |||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | import java.util.Map; | ||||
import java.util.Objects; | |||||
/** | /** | ||||
* @author liuxinxin | * @author liuxinxin | ||||
@@ -36,6 +38,33 @@ public class DashboardChartAssembler { | |||||
return analysisChart; | return analysisChart; | ||||
} | } | ||||
public static <T> AnalysisChart buildInvestmentAnalysisChart(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); | |||||
BigDecimal approvedTotalInvestmentIncreaseSum = new BigDecimal("0"); | |||||
if (CollUtil.isNotEmpty(projectList)) { | |||||
for (Project project : projectList) { | |||||
BigDecimal approvedTotalInvestmentIncrease = project.getApprovedTotalInvestmentIncrease(); | |||||
if (Objects.nonNull(approvedTotalInvestmentIncrease)) { | |||||
approvedTotalInvestmentIncreaseSum.add(approvedTotalInvestmentIncrease); | |||||
} | |||||
} | |||||
} | |||||
analysisData.setKey(chartKey); | |||||
analysisData.setValue(approvedTotalInvestmentIncreaseSum); | |||||
dataList.add(analysisData); | |||||
} | |||||
return analysisChart; | |||||
} | |||||
public static <T> AnalysisChart buildAnalysisChart(Map<T, String> keyValueMap | public static <T> AnalysisChart buildAnalysisChart(Map<T, String> keyValueMap | ||||
, Map<T, List<Project>> projectGroupMap, ChartTypeEnum chartTypeEnum) { | , Map<T, List<Project>> projectGroupMap, ChartTypeEnum chartTypeEnum) { | ||||
AnalysisChart analysisChart = new AnalysisChart(); | AnalysisChart analysisChart = new AnalysisChart(); | ||||
@@ -186,12 +186,11 @@ public class DashboardProjectManage { | |||||
// 预算年度 | // 预算年度 | ||||
Integer year = queryYearPO.getYear(); | Integer year = queryYearPO.getYear(); | ||||
String regionCode = queryYearPO.getRegionCode(); | String regionCode = queryYearPO.getRegionCode(); | ||||
List<Project> allProjectWithRepeatList = iProjectService.list(Wrappers.lambdaQuery(Project.class) | |||||
List<Project> allProjectList = iProjectService.list(Wrappers.lambdaQuery(Project.class) | |||||
.eq(Project::getNewest, true) | |||||
.eq(Objects.nonNull(year), Project::getProjectYear, year) | .eq(Objects.nonNull(year), Project::getProjectYear, year) | ||||
.eq(StringUtils.isNotBlank(regionCode), Project::getAreaCode, regionCode) | .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() | Map<Integer, List<Project>> isTemporaryAugmentGroupMap = allProjectList.stream() | ||||
@@ -240,9 +239,34 @@ public class DashboardProjectManage { | |||||
public DashboardInvestmentSummaryVO getInvestmentSummary(QueryYearPO queryYearPO) { | public DashboardInvestmentSummaryVO getInvestmentSummary(QueryYearPO queryYearPO) { | ||||
QueryTimeYearBO queryTimeYearBO = getQueryTimeYearBO(queryYearPO.getYear()); | |||||
// 预算年度 | |||||
Integer year = queryYearPO.getYear(); | |||||
String regionCode = queryYearPO.getRegionCode(); | |||||
List<Project> allProjectList = iProjectService.list(Wrappers.lambdaQuery(Project.class) | |||||
.eq(Project::getNewest, true) | |||||
.eq(Objects.nonNull(year), Project::getProjectYear, year) | |||||
.eq(StringUtils.isNotBlank(regionCode), Project::getAreaCode, regionCode) | |||||
); | |||||
// 各领域项目投资情况 | |||||
Map<Integer, List<Project>> bizDomainGroupMap = allProjectList.stream() | |||||
.collect(Collectors.groupingBy(Project::getBizDomain)); | |||||
Map<Integer, String> bizDomainMap = dashboardHelper.getBizDomainMap(); | |||||
AnalysisChart bizDomainInvestmentAnalysisChart = DashboardChartAssembler.buildInvestmentAnalysisChart(bizDomainMap, bizDomainGroupMap | |||||
, ChartTypeEnum.PROJECTS_INVESTMENT_AMOUNT_IN_VARIOUS_FIELDS_CHART); | |||||
// 各区域项目投资情况 | |||||
Map<String, List<Project>> areaCodeGroupMap = allProjectList.stream() | |||||
.collect(Collectors.groupingBy(Project::getAreaCode)); | |||||
Map<String, String> liShuiRegionCodeNameMap = dashboardHelper.getLiShuiRegionCodeNameMap(); | |||||
AnalysisChart areaCodeInvestmentAnalysisChart = DashboardChartAssembler.buildInvestmentAnalysisChart(liShuiRegionCodeNameMap, areaCodeGroupMap | |||||
, ChartTypeEnum.PROJECTS_INVESTMENT_SITUATION_IN_VARIOUS_REGIONS); | |||||
DashboardInvestmentSummaryVO dashboardInvestmentSummaryVO = new DashboardInvestmentSummaryVO(); | DashboardInvestmentSummaryVO dashboardInvestmentSummaryVO = new DashboardInvestmentSummaryVO(); | ||||
List<AnalysisChart> analysisChartList = new ArrayList<>(); | |||||
dashboardInvestmentSummaryVO.setAnalysisChartList(analysisChartList); | |||||
analysisChartList.add(areaCodeInvestmentAnalysisChart); | |||||
analysisChartList.add(bizDomainInvestmentAnalysisChart); | |||||
return dashboardInvestmentSummaryVO; | return dashboardInvestmentSummaryVO; | ||||
} | } | ||||
@@ -1,8 +1,12 @@ | |||||
package com.ningdatech.pmapi.dashboard.model.vo; | package com.ningdatech.pmapi.dashboard.model.vo; | ||||
import com.ningdatech.pmapi.dashboard.model.basic.AnalysisChart; | |||||
import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | import lombok.Data; | ||||
import java.util.List; | |||||
/** | /** | ||||
* @author liuxinxin | * @author liuxinxin | ||||
* @date 2023/8/2 下午3:36 | * @date 2023/8/2 下午3:36 | ||||
@@ -13,11 +17,13 @@ import lombok.Data; | |||||
public class DashboardInvestmentSummaryVO { | public class DashboardInvestmentSummaryVO { | ||||
/** | /** | ||||
* 各领域项目投资金额 | |||||
* 单位预算TOP5 | * 单位预算TOP5 | ||||
* 项目预算TOP5 | * 项目预算TOP5 | ||||
* 近5年项目投资走势 | * 近5年项目投资走势 | ||||
* 各区域项目投资情况 | |||||
* 近5年资金核定率走势 | * 近5年资金核定率走势 | ||||
*/ | */ | ||||
@ApiModelProperty("各领域项目投资金额,各区域项目投资情况") | |||||
List<AnalysisChart> analysisChartList; | |||||
} | } |