@@ -0,0 +1,35 @@ | |||||
package com.ningdatech.pmapi.dashboard.controller; | |||||
import com.ningdatech.pmapi.dashboard.manage.FundStatisticsManage; | |||||
import com.ningdatech.pmapi.dashboard.model.vo.*; | |||||
import io.swagger.annotations.Api; | |||||
import io.swagger.annotations.ApiOperation; | |||||
import lombok.RequiredArgsConstructor; | |||||
import org.springframework.validation.annotation.Validated; | |||||
import org.springframework.web.bind.annotation.*; | |||||
/** | |||||
* @author ZPF | |||||
* @date 2023/11/25 上午10:36 | |||||
*/ | |||||
@RestController | |||||
@RequestMapping("/api/v1/statistics") | |||||
@Validated | |||||
@RequiredArgsConstructor | |||||
@Api(value = "StatisticsController", tags = "统计") | |||||
public class StatisticsController { | |||||
private final FundStatisticsManage fundStatisticsManage; | |||||
@GetMapping("/fund") | |||||
@ApiOperation("项目资金统计") | |||||
public FundStatisticsVO fund(@RequestParam(required = false) Integer year) { | |||||
return fundStatisticsManage.fund(year); | |||||
} | |||||
@GetMapping("/expert") | |||||
@ApiOperation("专家统计") | |||||
public ExpertStatisticsVO expert(@RequestParam(required = false) Integer year) { | |||||
return fundStatisticsManage.expert(year); | |||||
} | |||||
} |
@@ -0,0 +1,368 @@ | |||||
package com.ningdatech.pmapi.dashboard.manage; | |||||
import cn.hutool.core.collection.CollUtil; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.google.common.collect.Lists; | |||||
import com.ningdatech.pmapi.common.constant.BizConst; | |||||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||||
import com.ningdatech.pmapi.dashboard.constant.DashboardConstant; | |||||
import com.ningdatech.pmapi.dashboard.model.vo.ExpertStatisticsVO; | |||||
import com.ningdatech.pmapi.dashboard.model.vo.FundStatisticsVO; | |||||
import com.ningdatech.pmapi.gov.model.entity.GovBizProjectApply; | |||||
import com.ningdatech.pmapi.gov.model.entity.GovBizProjectApprove; | |||||
import com.ningdatech.pmapi.gov.model.entity.GovBizProjectBaseinfo; | |||||
import com.ningdatech.pmapi.gov.model.entity.GovBizProjectProcure; | |||||
import com.ningdatech.pmapi.gov.service.IGovBizProjectApplyService; | |||||
import com.ningdatech.pmapi.gov.service.IGovBizProjectApproveService; | |||||
import com.ningdatech.pmapi.gov.service.IGovBizProjectBaseinfoService; | |||||
import com.ningdatech.pmapi.gov.service.IGovBizProjectProcureService; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||||
import com.ningdatech.pmapi.sys.model.req.NoticeListReq; | |||||
import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedReq; | |||||
import com.ningdatech.pmapi.todocenter.model.vo.TodoCenterStatisticsVO; | |||||
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; | |||||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||||
import com.ningdatech.pmapi.workbench.converter.WorkbenchConverter; | |||||
import io.swagger.models.auth.In; | |||||
import lombok.RequiredArgsConstructor; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.apache.commons.lang3.StringUtils; | |||||
import org.springframework.stereotype.Component; | |||||
import java.math.BigDecimal; | |||||
import java.time.LocalDateTime; | |||||
import java.util.Arrays; | |||||
import java.util.List; | |||||
import java.util.Objects; | |||||
import java.util.concurrent.CompletableFuture; | |||||
import java.util.concurrent.ForkJoinPool; | |||||
import java.util.stream.Collectors; | |||||
/** | |||||
* @Classname FundStatisticsManage | |||||
* @Description | |||||
* @Date 2023/11/24 17:44 | |||||
* @Author PoffyZhang | |||||
*/ | |||||
@Component | |||||
@RequiredArgsConstructor | |||||
@Slf4j | |||||
public class FundStatisticsManage { | |||||
private final IProjectService projectService; | |||||
private final IGovBizProjectBaseinfoService baseinfoService; | |||||
private final IGovBizProjectApplyService applyService; | |||||
private final IGovBizProjectApproveService approveService; | |||||
private final IGovBizProjectProcureService procureService; | |||||
private Integer[] years = new Integer[]{2021,2022,2023,2024,2025}; | |||||
private Integer[] threeYears = new Integer[]{LocalDateTime.now().getYear()-2, | |||||
LocalDateTime.now().getYear()-1,LocalDateTime.now().getYear()}; | |||||
/** | |||||
* 项目统计 | |||||
* @param year | |||||
* @return | |||||
*/ | |||||
public FundStatisticsVO fund(Integer year) { | |||||
FundStatisticsVO res = new FundStatisticsVO(); | |||||
CompletableFuture.allOf( | |||||
CompletableFuture.runAsync(() -> { | |||||
//选择的年份去计算的数据 | |||||
yearCompleteAmount(res,year); | |||||
}, ForkJoinPool.commonPool()), | |||||
CompletableFuture.runAsync(() -> { | |||||
//近三年 | |||||
threeYearsCompleteAmount(res); | |||||
}, ForkJoinPool.commonPool()), | |||||
CompletableFuture.runAsync(() -> { | |||||
//所有年 用于算累积 | |||||
allYearsCompleteAmount(res); | |||||
}, ForkJoinPool.commonPool()) | |||||
).join(); | |||||
return res; | |||||
} | |||||
/** | |||||
* 计算 所有年的 | |||||
* @param res | |||||
*/ | |||||
private void allYearsCompleteAmount(FundStatisticsVO res) { | |||||
//1.申报项目 和 归集项目 | |||||
//申报项目 | |||||
List<Project> allProjects = projectService.list(Wrappers.lambdaQuery(Project.class) | |||||
.eq(Project::getNewest, Boolean.TRUE) | |||||
.in(Project::getProjectYear, years)); | |||||
//项目归集 | |||||
List<GovBizProjectApply> allApplieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) | |||||
.in(GovBizProjectApply::getBaseProjSetYear, years)); | |||||
List<String> allProjIds = allApplieYears.stream().map(GovBizProjectApply::getBaseProjId) | |||||
.collect(Collectors.toList()); | |||||
List<GovBizProjectBaseinfo> allBaseInfos = Lists.newArrayList(); | |||||
List<GovBizProjectApply> allApplies = Lists.newArrayList(); | |||||
List<GovBizProjectApprove> allApproves = Lists.newArrayList(); | |||||
List<GovBizProjectProcure> allProcures = Lists.newArrayList(); | |||||
if(CollUtil.isNotEmpty(allProjIds)){ | |||||
allBaseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) | |||||
.eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) | |||||
.in(GovBizProjectBaseinfo::getBaseProjId,allProjIds)); | |||||
if(CollUtil.isNotEmpty(allBaseInfos)){ | |||||
List<String> allBaseProjIds = allBaseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) | |||||
.collect(Collectors.toList()); | |||||
allApplies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) | |||||
.in(GovBizProjectApply::getBaseProjId,allBaseProjIds)); | |||||
allApproves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) | |||||
.in(GovBizProjectApprove::getBaseProjId,allBaseProjIds)); | |||||
allProcures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) | |||||
.in(GovBizProjectProcure::getBaseProjId,allBaseProjIds)); | |||||
} | |||||
} | |||||
//2.4 累积 核减 | |||||
res.setAccumulatedDeductionTotalAmount(completeDeductionAmount(allProjects,allApplies, | |||||
allApproves,allProcures)); | |||||
} | |||||
/** | |||||
* 计算核减资金的方法 | |||||
* @param projects | |||||
* @param applies | |||||
* @param approves | |||||
* @param procures | |||||
* @return | |||||
*/ | |||||
private BigDecimal completeDeductionAmount(List<Project> projects, | |||||
List<GovBizProjectApply> applies, List<GovBizProjectApprove> approves, | |||||
List<GovBizProjectProcure> procures) { | |||||
//首先完成年度计划 并且未注销的项目 | |||||
List<Project> normalProjects = projects.stream().filter(p -> { | |||||
if (Objects.nonNull(p.getStatus()) && | |||||
p.getStatus().compareTo(ProjectStatusEnum.BE_SUSPENDED.getCode()) > 0) { | |||||
return Boolean.TRUE; | |||||
} | |||||
return Boolean.FALSE; | |||||
}).collect(Collectors.toList()); | |||||
//申报的申报金额(申报项目:初步方案申报金额 项目归集:项目总投资) | |||||
BigDecimal declaredAmountApprove = normalProjects.stream().map(p -> { | |||||
BigDecimal declareAmount = Objects.nonNull(p.getDeclareAmount()) ? | |||||
p.getDeclareAmount() : BigDecimal.ZERO; | |||||
return declareAmount; | |||||
}).reduce(BigDecimal::add).get(); | |||||
BigDecimal declaredAmountApproveGov = applies.stream().map(g -> { | |||||
BigDecimal totalAmount = Objects.nonNull(g.getBaseProjTotalAmount()) ? g.getBaseProjTotalAmount() : BigDecimal.ZERO; | |||||
return totalAmount; | |||||
}).reduce(BigDecimal::add).get(); | |||||
BigDecimal declaredAmountApproveTotal = declaredAmountApprove.add(declaredAmountApproveGov); | |||||
//申报的批复金额(申报项目:建设方案申报金额 项目归集:建议总投资) | |||||
BigDecimal approvalAmountApprove = normalProjects.stream().map(p -> { | |||||
BigDecimal declareAmount = Objects.nonNull(p.getApprovalAmount()) ? p.getApprovalAmount() : BigDecimal.ZERO; | |||||
return declareAmount; | |||||
}).reduce(BigDecimal::add).get(); | |||||
BigDecimal approvalAmountApproveGov = approves.stream().map(p -> { | |||||
BigDecimal expertTotalMoney = Objects.nonNull(p.getBaseExpertTotalMoney()) ? p.getBaseExpertTotalMoney() : BigDecimal.ZERO; | |||||
return expertTotalMoney; | |||||
}).reduce(BigDecimal::add).get(); | |||||
BigDecimal approvalAmountApproveTotal = approvalAmountApprove.add(approvalAmountApproveGov); | |||||
//申报的差额 | |||||
BigDecimal subtractApprove = declaredAmountApproveTotal.subtract(approvalAmountApproveTotal); | |||||
//批复的批复金额(申报项目:归集信息建议批复总投资 项目归集:建议批复总投资) | |||||
BigDecimal approvalAmountApproval = normalProjects.stream().map(p -> { | |||||
BigDecimal proposeTotalInvest = Objects.nonNull(p.getProposeTotalInvest()) ? p.getProposeTotalInvest() : BigDecimal.ZERO; | |||||
return proposeTotalInvest; | |||||
}).reduce(BigDecimal::add).get(); | |||||
BigDecimal approvalAmountApprovalGov = approves.stream().map(p -> { | |||||
BigDecimal reviewTotalMoney = Objects.nonNull(p.getBaseInitialReviewTotalMoney()) ? p.getBaseInitialReviewTotalMoney() : BigDecimal.ZERO; | |||||
return reviewTotalMoney; | |||||
}).reduce(BigDecimal::add).get(); | |||||
BigDecimal approvalAmountApprovalTotal = approvalAmountApproval.add(approvalAmountApprovalGov); | |||||
//批复的差额 | |||||
BigDecimal subtractApproval = approvalAmountApproveTotal.subtract(approvalAmountApprovalTotal); | |||||
//合同的批复金额(申报项目:成交金额 项目归集:成交金额) | |||||
BigDecimal approvalAmountContract = normalProjects.stream().map(p -> { | |||||
BigDecimal transactionAmount = Objects.nonNull(p.getTransactionAmount()) ? p.getTransactionAmount() : BigDecimal.ZERO; | |||||
return transactionAmount; | |||||
}).reduce(BigDecimal::add).get(); | |||||
BigDecimal approvalAmountContractGov = procures.stream().map(p -> { | |||||
BigDecimal purchaseAmount = Objects.nonNull(p.getBaseProjPurchaseAmount()) ? | |||||
p.getBaseProjPurchaseAmount() : BigDecimal.ZERO; | |||||
return purchaseAmount; | |||||
}).reduce(BigDecimal::add).get(); | |||||
BigDecimal approvalAmountContractTotal = approvalAmountContract.add(approvalAmountContractGov); | |||||
//合同的差额 | |||||
BigDecimal subtractContract = approvalAmountApprovalTotal.subtract(approvalAmountContractTotal); | |||||
return subtractApprove.add(subtractApproval).add(subtractContract); | |||||
} | |||||
/** | |||||
* 近三年 | |||||
* @param res | |||||
*/ | |||||
private void threeYearsCompleteAmount(FundStatisticsVO res) { | |||||
//申报项目 | |||||
List<Project> threeYearsProjects = projectService.list(Wrappers.lambdaQuery(Project.class) | |||||
.eq(Project::getNewest, Boolean.TRUE) | |||||
.in(Project::getProjectYear, threeYears)); | |||||
//项目归集 | |||||
List<GovBizProjectApply> threeYearsApplieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) | |||||
.in(GovBizProjectApply::getBaseProjSetYear, threeYears)); | |||||
List<String> threeYearsProjIds = threeYearsApplieYears.stream().map(GovBizProjectApply::getBaseProjId) | |||||
.collect(Collectors.toList()); | |||||
List<GovBizProjectBaseinfo> threeYearsBaseInfos = Lists.newArrayList(); | |||||
List<GovBizProjectApply> threeYearsApplies = Lists.newArrayList(); | |||||
List<GovBizProjectApprove> threeYearsApproves = Lists.newArrayList(); | |||||
List<GovBizProjectProcure> threeYearsProcures = Lists.newArrayList(); | |||||
if(CollUtil.isNotEmpty(threeYearsProjIds)){ | |||||
threeYearsBaseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) | |||||
.eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) | |||||
.in(GovBizProjectBaseinfo::getBaseProjId,threeYearsProjIds)); | |||||
if(CollUtil.isNotEmpty(threeYearsBaseInfos)){ | |||||
List<String> threeYearsBaseProjIds = threeYearsBaseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) | |||||
.collect(Collectors.toList()); | |||||
threeYearsApplies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) | |||||
.in(GovBizProjectApply::getBaseProjId,threeYearsBaseProjIds)); | |||||
threeYearsApproves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) | |||||
.in(GovBizProjectApprove::getBaseProjId,threeYearsBaseProjIds)); | |||||
threeYearsProcures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) | |||||
.in(GovBizProjectProcure::getBaseProjId,threeYearsBaseProjIds)); | |||||
} | |||||
} | |||||
//2.4 近三年 核减 | |||||
res.setThreeYearsDeductionTotalAmount(completeDeductionAmount(threeYearsProjects,threeYearsApplies, | |||||
threeYearsApproves,threeYearsProcures)); | |||||
//安全起见 再排序下 | |||||
Arrays.sort(threeYears); | |||||
List<FundStatisticsVO.AmountData> threeYearsDeduction = Lists.newArrayList(); | |||||
for(Integer year : threeYears){ | |||||
FundStatisticsVO.AmountData amountData = new FundStatisticsVO.AmountData(); | |||||
//申报项目 | |||||
List<Project> thisYearsProjects = projectService.list(Wrappers.lambdaQuery(Project.class) | |||||
.eq(Project::getNewest, Boolean.TRUE) | |||||
.eq(Project::getProjectYear, year)); | |||||
//项目归集 | |||||
List<GovBizProjectApply> thisYearApplieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) | |||||
.eq(GovBizProjectApply::getBaseProjSetYear, year)); | |||||
List<String> thisYearProjIds = thisYearApplieYears.stream().map(GovBizProjectApply::getBaseProjId) | |||||
.collect(Collectors.toList()); | |||||
List<GovBizProjectBaseinfo> thisYearBaseInfos = Lists.newArrayList(); | |||||
List<GovBizProjectApply> thisYearApplies = Lists.newArrayList(); | |||||
List<GovBizProjectApprove> thisYearApproves = Lists.newArrayList(); | |||||
List<GovBizProjectProcure> thisYearProcures = Lists.newArrayList(); | |||||
if(CollUtil.isNotEmpty(thisYearProjIds)){ | |||||
thisYearBaseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) | |||||
.eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) | |||||
.in(GovBizProjectBaseinfo::getBaseProjId,threeYearsProjIds)); | |||||
if(CollUtil.isNotEmpty(thisYearBaseInfos)){ | |||||
List<String> threeYearsBaseProjIds = threeYearsBaseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) | |||||
.collect(Collectors.toList()); | |||||
thisYearApplies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) | |||||
.in(GovBizProjectApply::getBaseProjId,threeYearsBaseProjIds)); | |||||
thisYearApproves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) | |||||
.in(GovBizProjectApprove::getBaseProjId,threeYearsBaseProjIds)); | |||||
thisYearProcures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) | |||||
.in(GovBizProjectProcure::getBaseProjId,threeYearsBaseProjIds)); | |||||
} | |||||
} | |||||
amountData.setName(year.toString()); | |||||
amountData.setAmount(completeDeductionAmount(thisYearsProjects,thisYearApplies, | |||||
thisYearApproves,thisYearProcures)); | |||||
threeYearsDeduction.add(amountData); | |||||
} | |||||
res.setThreeYearsDeduction(threeYearsDeduction); | |||||
} | |||||
/** | |||||
* 选择年份去计算 | |||||
* @param res | |||||
*/ | |||||
private void yearCompleteAmount(FundStatisticsVO res, Integer year) { | |||||
//申报项目 | |||||
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class) | |||||
.eq(Project::getNewest, Boolean.TRUE) | |||||
.eq(Objects.nonNull(year), Project::getProjectYear, year) | |||||
.in(Objects.isNull(year), Project::getProjectYear, years)); | |||||
//项目归集 | |||||
List<GovBizProjectApply> applieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) | |||||
.eq(Objects.nonNull(year), GovBizProjectApply::getBaseProjSetYear, year) | |||||
.in(Objects.isNull(year), GovBizProjectApply::getBaseProjSetYear, years)); | |||||
List<String> yearProjIds = applieYears.stream().map(GovBizProjectApply::getBaseProjId) | |||||
.collect(Collectors.toList()); | |||||
List<GovBizProjectBaseinfo> baseInfos = Lists.newArrayList(); | |||||
List<GovBizProjectApply> applies = Lists.newArrayList(); | |||||
List<GovBizProjectApprove> approves = Lists.newArrayList(); | |||||
List<GovBizProjectProcure> procures = Lists.newArrayList(); | |||||
if(CollUtil.isNotEmpty(yearProjIds)){ | |||||
baseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) | |||||
.eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) | |||||
.in(GovBizProjectBaseinfo::getBaseProjId,yearProjIds)); | |||||
if(CollUtil.isNotEmpty(baseInfos)){ | |||||
List<String> baseProjIds = baseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) | |||||
.collect(Collectors.toList()); | |||||
applies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) | |||||
.in(GovBizProjectApply::getBaseProjId,baseProjIds)); | |||||
approves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) | |||||
.in(GovBizProjectApprove::getBaseProjId,baseProjIds)); | |||||
procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) | |||||
.in(GovBizProjectProcure::getBaseProjId,baseProjIds)); | |||||
} | |||||
} | |||||
//2 | |||||
//2.1 总申请金额 | |||||
BigDecimal declaredTotalAmount = projects.stream() | |||||
.map(p -> Objects.nonNull(p.getDeclareAmount()) ? p.getDeclareAmount() : BigDecimal.ZERO) | |||||
.reduce(BigDecimal::add).get(); | |||||
BigDecimal declaredTotalAmountGov = applies.stream() | |||||
.map(a -> Objects.nonNull(a.getBaseProjTotalAmount()) ? a.getBaseProjTotalAmount() : BigDecimal.ZERO) | |||||
.reduce(BigDecimal::add).get(); | |||||
res.setDeclaredTotalAmount(declaredTotalAmount.add(declaredTotalAmountGov)); | |||||
//2.2 总批复金额 | |||||
BigDecimal approvalTotalAmount = projects.stream() | |||||
.map(p -> Objects.nonNull(p.getApprovalAmount()) ? p.getApprovalAmount() : BigDecimal.ZERO) | |||||
.reduce(BigDecimal::add).get(); | |||||
BigDecimal approvalTotalAmountGov = approves.stream() | |||||
.map(a -> Objects.nonNull(a.getBaseExpertTotalMoney()) ? a.getBaseExpertTotalMoney() : BigDecimal.ZERO) | |||||
.reduce(BigDecimal::add).get(); | |||||
res.setApprovalTotalAmount(approvalTotalAmount.add(approvalTotalAmountGov)); | |||||
//2.3 总合同金额 | |||||
BigDecimal contractTotalAmount = projects.stream() | |||||
.map(p -> Objects.nonNull(p.getContractAmount()) ? p.getContractAmount() : BigDecimal.ZERO) | |||||
.reduce(BigDecimal::add).get(); | |||||
BigDecimal contractTotalAmountGov = procures.stream() | |||||
.map(p -> Objects.nonNull(p.getBaseProjPurchaseAmount()) ? p.getBaseProjPurchaseAmount() : BigDecimal.ZERO) | |||||
.reduce(BigDecimal::add).get(); | |||||
res.setApprovalTotalAmount(contractTotalAmount.add(contractTotalAmountGov)); | |||||
} | |||||
/** | |||||
* 专家统计 | |||||
* @param year | |||||
* @return | |||||
*/ | |||||
public ExpertStatisticsVO expert(Integer year) { | |||||
ExpertStatisticsVO res = new ExpertStatisticsVO(); | |||||
return res; | |||||
} | |||||
} |
@@ -0,0 +1,375 @@ | |||||
package com.ningdatech.pmapi.dashboard.model.vo; | |||||
import com.ningdatech.pmapi.dashboard.model.entity.CockpitApplication; | |||||
import com.ningdatech.pmapi.portrait.model.entity.Tag; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import java.io.Serializable; | |||||
import java.math.BigDecimal; | |||||
import java.time.LocalDateTime; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
@Data | |||||
@ApiModel(value = "专家统计", description = "") | |||||
public class ExpertStatisticsVO implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty("区域code") | |||||
private String regionCode; | |||||
@ApiModelProperty("区域名") | |||||
private String regionName; | |||||
@ApiModelProperty("年份") | |||||
private Integer year; | |||||
@ApiModelProperty("年份") | |||||
private LocalDateTime createOn; | |||||
@ApiModelProperty("项目监测数据") | |||||
private Monitor monitorData; | |||||
@ApiModelProperty("项目专家数据") | |||||
private Expert expertData; | |||||
@ApiModelProperty("顶部数据") | |||||
private TopData topData; | |||||
@ApiModelProperty("地图-项目数") | |||||
private List<MapProjectsData> mapProjectData; | |||||
@ApiModelProperty("状态-项目数") | |||||
private StatusProjectsData statusProjectsData; | |||||
@ApiModelProperty("优秀项目数据") | |||||
private ExcellentData excellentData; | |||||
@ApiModelProperty("核减数据") | |||||
private ReduceData reduceData; | |||||
@ApiModelProperty("产出数据") | |||||
private ProduceData produceData; | |||||
@ApiModelProperty("绩效数据") | |||||
private PerformanceData performanceData; | |||||
@ApiModelProperty("最佳应用or重大应用") | |||||
private Map<String,List<CockpitApplication>> appDatas; | |||||
@ApiModelProperty("数据质量区域信息") | |||||
private List<QualityData> qualityDatas; | |||||
@Data | |||||
public static class Monitor { | |||||
@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; | |||||
@ApiModelProperty("项目监控-等保等级图") | |||||
private List<SecrecyGradeChart> secrecyGradeCharts; | |||||
@ApiModelProperty("项目监控-密保等级图") | |||||
private List<PasswordGradeChart> passwordGradeCharts; | |||||
} | |||||
@Data | |||||
public static class SecrecyGradeChart { | |||||
public SecrecyGradeChart (Integer level,Integer num){ | |||||
this.level = level; | |||||
this.num = num; | |||||
} | |||||
@ApiModelProperty("等保等级") | |||||
private Integer level; | |||||
@ApiModelProperty("等保数量") | |||||
private Integer num; | |||||
} | |||||
@Data | |||||
public static class PasswordGradeChart { | |||||
public PasswordGradeChart (Integer level,Integer num){ | |||||
this.level = level; | |||||
this.num = num; | |||||
} | |||||
@ApiModelProperty("密保等级") | |||||
private Integer level; | |||||
@ApiModelProperty("密保数量") | |||||
private Integer num; | |||||
} | |||||
@Data | |||||
public static class SafetyInput { | |||||
private Integer year; | |||||
private BigDecimal rate; | |||||
private Integer amount; | |||||
} | |||||
@Data | |||||
public static class Expert { | |||||
@ApiModelProperty("专家-各区域专家数") | |||||
private List<ExpertRegion> expertRegionData; | |||||
@ApiModelProperty("专家-总人数") | |||||
private Integer expertTotalNum; | |||||
@ApiModelProperty("专家-总人数-包含这些标签的专家总人数") | |||||
private Integer specialExpertNum; | |||||
@ApiModelProperty("专家-方案合理性 数量") | |||||
private Integer expertPlanRationalityNum; | |||||
@ApiModelProperty("专家-计数可行性评估 数量") | |||||
private Integer expertTechnicalFeasibilityAssessmentNum; | |||||
@ApiModelProperty("专家-信创 数量") | |||||
private Integer expertXinchuangNum; | |||||
@ApiModelProperty("专家-软硬件核价 数量") | |||||
private Integer expertSoftHardPricingNum; | |||||
@ApiModelProperty("专家-党政信息 数量") | |||||
private Integer expertPartyGovInfoNum; | |||||
@ApiModelProperty("专家-网络安全 数量") | |||||
private Integer expertNetworkSecurityNum; | |||||
@ApiModelProperty("专家-信息化专家 数量") | |||||
private Integer expertPromotionInfoTechnologyNum; | |||||
@ApiModelProperty("专家-财务专家 数量") | |||||
private Integer expertFinancialNum; | |||||
@ApiModelProperty("专家-信创专家 数量") | |||||
private Integer expertXinchuangOtherNum; | |||||
} | |||||
@Data | |||||
public static class ExpertRegion { | |||||
@ApiModelProperty("区域CODE") | |||||
private String regionCode; | |||||
@ApiModelProperty("区域名字") | |||||
private String regionName; | |||||
@ApiModelProperty("专家数量") | |||||
private Integer expertNum; | |||||
} | |||||
@Data | |||||
public static class TopData { | |||||
@ApiModelProperty("顶部-计划项目数") | |||||
private Integer topPlanProjectsNum; | |||||
@ApiModelProperty("顶部-批复项目数") | |||||
private Integer topApprovalProjectsNum; | |||||
@ApiModelProperty("顶部-批复金额") | |||||
private BigDecimal topApprovalProjectsAmount; | |||||
@ApiModelProperty("顶部-平均建设周期") | |||||
private Integer topAverageConstructionPeriod; | |||||
@ApiModelProperty("顶部-在建项目数") | |||||
private Integer topOngoingProjectsNum; | |||||
} | |||||
@Data | |||||
public static class MapProjectsData { | |||||
@ApiModelProperty("区域CODE") | |||||
private String regionCode; | |||||
@ApiModelProperty("区域名字") | |||||
private String regionName; | |||||
@ApiModelProperty("项目数量") | |||||
private Integer projectsNum; | |||||
} | |||||
@Data | |||||
public static class QualityData { | |||||
@ApiModelProperty("区域CODE") | |||||
private String regionCode; | |||||
@ApiModelProperty("区域名字") | |||||
private String regionName; | |||||
@ApiModelProperty("质量分数") | |||||
private BigDecimal quality = BigDecimal.ZERO; | |||||
} | |||||
@Data | |||||
public static class StatusProjectsData { | |||||
@ApiModelProperty("项目总数-计划状态") | |||||
private Integer projectsTotalPlan; | |||||
@ApiModelProperty("项目总数-申报状态") | |||||
private Integer projectsTotalApply; | |||||
@ApiModelProperty("项目总数-审批状态") | |||||
private Integer projectsTotalApprove; | |||||
@ApiModelProperty("项目总数-建设状态") | |||||
private Integer projectsTotalConstruction; | |||||
@ApiModelProperty("项目总数-验收状态") | |||||
private Integer projectsTotalAccept; | |||||
@ApiModelProperty("项目总数-运维状态") | |||||
private Integer projectsTotalOperation; | |||||
@ApiModelProperty("项目总数-绩效状态") | |||||
private Integer projectsTotalPerformance; | |||||
@ApiModelProperty("项目总数-注销状态") | |||||
private Integer projectsTotalLogOff; | |||||
} | |||||
@Data | |||||
public static class ExcellentData { | |||||
@ApiModelProperty("优秀项目-最佳应用") | |||||
private Integer excellentBestAppNum; | |||||
@ApiModelProperty("优秀项目-重大应用") | |||||
private Integer excellentMajorAppNum; | |||||
@ApiModelProperty("优秀项目-跨域共享数") | |||||
private Integer excellentCrossDomainSharingNum; | |||||
@ApiModelProperty("优秀项目-跨域共享数") | |||||
private Integer excellentCrossLevelSharingNum; | |||||
@ApiModelProperty("优秀项目-列表") | |||||
private List<ExcellentProjects> excellentProjects; | |||||
} | |||||
@Data | |||||
public static class ExcellentProjects { | |||||
@ApiModelProperty("项目CODE") | |||||
private String projectCode; | |||||
@ApiModelProperty("项目名") | |||||
private String projectName; | |||||
@ApiModelProperty("项目简介") | |||||
private String projectIntroduction; | |||||
@ApiModelProperty("标签") | |||||
private List<Tag> tags; | |||||
} | |||||
@Data | |||||
public static class ReduceData { | |||||
@ApiModelProperty("核减资金") | |||||
private BigDecimal reduceFundsTotal; | |||||
@ApiModelProperty("驳回节约资金") | |||||
private BigDecimal rejectSavingsFunds; | |||||
@ApiModelProperty("资金对比图") | |||||
private List<AmountComparisonChart> amountComparisonCharts; | |||||
} | |||||
@Data | |||||
public static class AmountComparisonChart { | |||||
public AmountComparisonChart (String statusName,BigDecimal declaredAmount,BigDecimal approvalAmount,BigDecimal differenceAmount){ | |||||
this.statusName = statusName; | |||||
this.declaredAmount = declaredAmount; | |||||
this.approvalAmount = approvalAmount; | |||||
this.differenceAmount = differenceAmount; | |||||
} | |||||
@ApiModelProperty("状态名") | |||||
private String statusName; | |||||
@ApiModelProperty("申报金额") | |||||
private BigDecimal declaredAmount; | |||||
@ApiModelProperty("批复金额") | |||||
private BigDecimal approvalAmount; | |||||
@ApiModelProperty("差额") | |||||
private BigDecimal differenceAmount; | |||||
} | |||||
@Data | |||||
public static class ProduceData { | |||||
@ApiModelProperty("产出-应用数量") | |||||
private Integer produceAppNum; | |||||
@ApiModelProperty("产出-数据产品") | |||||
private Integer produceDataNum; | |||||
@ApiModelProperty("产出-组件数") | |||||
private Integer produceComponentNum; | |||||
@ApiModelProperty("产出-大脑要素") | |||||
private Integer produceBrainElementsNum; | |||||
@ApiModelProperty("产出-大脑要素") | |||||
private Integer produceBrainModelNum; | |||||
} | |||||
@Data | |||||
public static class PerformanceData { | |||||
@ApiModelProperty("绩效-项目总数量") | |||||
private Integer performanceTotal; | |||||
@ApiModelProperty("绩效-未评价数量") | |||||
private Integer performanceTobeReviewTotal; | |||||
@ApiModelProperty("绩效-已评价数量") | |||||
private Integer performanceReviewedTotal; | |||||
@ApiModelProperty("绩效-top数据") | |||||
private List<PerformanceTop> performanceTops; | |||||
} | |||||
@Data | |||||
public static class PerformanceTop { | |||||
public PerformanceTop (String topName,BigDecimal score,String appName){ | |||||
this.topName = topName; | |||||
this.score = score; | |||||
this.appName = appName; | |||||
} | |||||
@ApiModelProperty("绩效-top") | |||||
private String topName; | |||||
@ApiModelProperty("分数") | |||||
private BigDecimal score; | |||||
@ApiModelProperty("应用名称") | |||||
private String appName; | |||||
} | |||||
} |
@@ -0,0 +1,55 @@ | |||||
package com.ningdatech.pmapi.dashboard.model.vo; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import java.io.Serializable; | |||||
import java.math.BigDecimal; | |||||
import java.util.List; | |||||
@Data | |||||
@ApiModel(value = "项目资金统计", description = "") | |||||
public class FundStatisticsVO implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty("累积核减总资金") | |||||
private BigDecimal accumulatedDeductionTotalAmount; | |||||
@ApiModelProperty("近三年核减总资金") | |||||
private BigDecimal threeYearsDeductionTotalAmount; | |||||
@ApiModelProperty("申请总金额") | |||||
private BigDecimal declaredTotalAmount; | |||||
@ApiModelProperty("批复总金额") | |||||
private BigDecimal approvalTotalAmount; | |||||
@ApiModelProperty("合同总金额") | |||||
private BigDecimal contractTotalAmount; | |||||
@ApiModelProperty("近三年核减数据") | |||||
private List<AmountData> threeYearsDeduction; | |||||
@ApiModelProperty("计划阶段核减情况") | |||||
private List<AmountData> planDeduction; | |||||
@ApiModelProperty("批复阶段阶段核减情况") | |||||
private List<AmountData> approvalDeduction; | |||||
@ApiModelProperty("合同阶段阶段核减情况") | |||||
private List<AmountData> contractDeduction; | |||||
@ApiModelProperty("各部门核减TOP10") | |||||
private List<AmountData> departmentTop10; | |||||
@Data | |||||
public static class AmountData{ | |||||
@ApiModelProperty("金额") | |||||
private BigDecimal amount; | |||||
@ApiModelProperty("名称") | |||||
private String name; | |||||
} | |||||
} |
@@ -1697,9 +1697,7 @@ public class GovProjectCollectionManage { | |||||
StringJoiner sj = convertAndUpload(procure.getBiddingFile()); | StringJoiner sj = convertAndUpload(procure.getBiddingFile()); | ||||
saveProcure.setBiddingFilePdf(sj.toString()); | saveProcure.setBiddingFilePdf(sj.toString()); | ||||
} | } | ||||
Boolean purchaseContract = checkFieldNotPdf(procure.getPurchaseContract(), o, "purchaseContract"); | |||||
log.info("是否转换 采购合同 purchaseContract:{}",purchaseContract); | |||||
if(purchaseContract){ | |||||
if(checkFieldNotPdf(procure.getPurchaseContract(), o, "purchaseContract")){ | |||||
StringJoiner sj = convertAndUpload(procure.getPurchaseContract()); | StringJoiner sj = convertAndUpload(procure.getPurchaseContract()); | ||||
saveProcure.setPurchaseContractPdf(sj.toString()); | saveProcure.setPurchaseContractPdf(sj.toString()); | ||||
} | } | ||||
@@ -20,11 +20,11 @@ public enum WarningFlowTypeEnum { | |||||
/** | /** | ||||
* 预警填报类型枚举 | * 预警填报类型枚举 | ||||
*/ | */ | ||||
UNIT_INNER_AUDIT(1, "预审申报",ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode(),"declareManage/preExaminationDeclare"), | |||||
UNIT_INNER_AUDIT(1, "预审申报",ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode(),"declareManage/planDeclaration/preExaminationDeclare"), | |||||
PRELIMINARY_PREVIEW(2, "建设方案申报",ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode(),"declareManage/constructionPlanDeclare"), | PRELIMINARY_PREVIEW(2, "建设方案申报",ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode(),"declareManage/constructionPlanDeclare"), | ||||
DEPT_UNITED_REVIEW(3,"采购结果备案",ProjectStatusEnum.TO_BE_PURCHASED.getCode(),"declareManage/purchaseResults"), | |||||
CONSTRUCTION_PLAN_REVIEW(4,"初验备案",ProjectStatusEnum.UNDER_CONSTRUCTION.getCode(),"declareManage/initialInspectionRecord"), | |||||
PROJECT_FINAL_INSPECTION(5,"验收申报",ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode(),"declareManage/finalInspectionDeclare"); | |||||
DEPT_UNITED_REVIEW(3,"采购结果备案",ProjectStatusEnum.TO_BE_PURCHASED.getCode(),"declareManage/procurementRecord/purchaseResults"), | |||||
CONSTRUCTION_PLAN_REVIEW(4,"初验备案",ProjectStatusEnum.UNDER_CONSTRUCTION.getCode(),"declareManage/acceptanceApply/initialInspectionRecord"), | |||||
PROJECT_FINAL_INSPECTION(5,"验收申报",ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode(),"declareManage/acceptanceApply/finalInspectionDeclare"); | |||||
private Integer code; | private Integer code; | ||||
private String desc; | private String desc; | ||||
@@ -20,8 +20,8 @@ public enum WarningOperationTypeEnum { | |||||
/** | /** | ||||
* 预警实施类型枚举 | * 预警实施类型枚举 | ||||
*/ | */ | ||||
CHUYAN(1, "项目初验",ProjectStatusEnum.UNDER_CONSTRUCTION.getCode(),"declareManage/initialInspectionRecord"), | |||||
ZHONGYAN(2, "项目终验",ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode(),"declareManage/finalInspectionDeclare"); | |||||
CHUYAN(1, "项目初验",ProjectStatusEnum.UNDER_CONSTRUCTION.getCode(),"declareManage/acceptanceApply/initialInspectionRecord"), | |||||
ZHONGYAN(2, "项目终验",ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode(),"declareManage/acceptanceApply/finalInspectionDeclare"); | |||||
private Integer code; | private Integer code; | ||||
private String desc; | private String desc; | ||||
@@ -381,7 +381,7 @@ public class ProjectRenewalFundManage { | |||||
} | } | ||||
//判断金额 | //判断金额 | ||||
// checkPaymentAmount(projectCode,projectYear,dto.getAnnualPaymentAmount()); | |||||
checkPaymentAmount(projectCode,projectYear,dto.getAnnualPaymentAmount()); | |||||
declaration.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PENDING.name()); | declaration.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PENDING.name()); | ||||
if(Objects.nonNull(project)){ | if(Objects.nonNull(project)){ | ||||
@@ -209,24 +209,26 @@ public class CockpitStatsStatisticsTask { | |||||
Project::getAreaCode, regionCode) | Project::getAreaCode, regionCode) | ||||
.eq(Objects.nonNull(year) && !year.equals(DashboardConstant.CockpitStats.NONE_YEAR), | .eq(Objects.nonNull(year) && !year.equals(DashboardConstant.CockpitStats.NONE_YEAR), | ||||
Project::getProjectYear, year) | Project::getProjectYear, year) | ||||
.in(Objects.isNull(year) && year.equals(DashboardConstant.CockpitStats.NONE_YEAR), | |||||
.in(Objects.isNull(year) || year.equals(DashboardConstant.CockpitStats.NONE_YEAR), | |||||
Project::getProjectYear, years)); | Project::getProjectYear, years)); | ||||
//项目归集 | //项目归集 | ||||
List<GovBizProjectApply> applieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) | List<GovBizProjectApply> applieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) | ||||
.eq(Objects.nonNull(year) && !year.equals(DashboardConstant.CockpitStats.NONE_YEAR), | .eq(Objects.nonNull(year) && !year.equals(DashboardConstant.CockpitStats.NONE_YEAR), | ||||
GovBizProjectApply::getBaseProjSetYear, year) | GovBizProjectApply::getBaseProjSetYear, year) | ||||
.in(Objects.isNull(year) && year.equals(DashboardConstant.CockpitStats.NONE_YEAR), | |||||
.in(Objects.isNull(year) || year.equals(DashboardConstant.CockpitStats.NONE_YEAR), | |||||
GovBizProjectApply::getBaseProjSetYear, years)); | GovBizProjectApply::getBaseProjSetYear, years)); | ||||
List<String> yearProjIds = applieYears.stream().map(GovBizProjectApply::getBaseProjId) | List<String> yearProjIds = applieYears.stream().map(GovBizProjectApply::getBaseProjId) | ||||
.collect(Collectors.toList()); | .collect(Collectors.toList()); | ||||
List<GovBizProjectBaseinfo> 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) | |||||
.in(CollUtil.isNotEmpty(yearProjIds),GovBizProjectBaseinfo::getBaseProjId,yearProjIds) | |||||
.in(CollUtil.isEmpty(yearProjIds),GovBizProjectBaseinfo::getBaseProjId,Lists.newArrayList(BizConst.NINE_AREA_CODE_LAST))); | |||||
List<GovBizProjectBaseinfo> baseInfos = Lists.newArrayList(); | |||||
if(CollUtil.isNotEmpty(yearProjIds)){ | |||||
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) | |||||
.in(GovBizProjectBaseinfo::getBaseProjId,yearProjIds)); | |||||
} | |||||
List<GovBizProjectApprove> approves = Lists.newArrayList(); | List<GovBizProjectApprove> approves = Lists.newArrayList(); | ||||
List<GovBizProjectApply> applies = Lists.newArrayList(); | List<GovBizProjectApply> applies = Lists.newArrayList(); | ||||
@@ -483,22 +485,22 @@ public class CockpitStatsStatisticsTask { | |||||
return Boolean.FALSE; | return Boolean.FALSE; | ||||
}).collect(Collectors.toList()).size(); | }).collect(Collectors.toList()).size(); | ||||
Double approvalAmount = projects.stream().filter(p -> { | |||||
BigDecimal approvalAmount = projects.stream().filter(p -> { | |||||
if(Objects.nonNull(p.getApprovalAmount())){ | if(Objects.nonNull(p.getApprovalAmount())){ | ||||
return Boolean.TRUE; | return Boolean.TRUE; | ||||
} | } | ||||
return Boolean.FALSE; | return Boolean.FALSE; | ||||
}).mapToDouble(p -> p.getApprovalAmount().doubleValue()).sum(); | |||||
}).map(Project::getApprovalAmount).reduce(BigDecimal::add).get(); | |||||
Double approvalAmountGov = approves.stream().filter(a -> { | |||||
BigDecimal approvalAmountGov = approves.stream().filter(a -> { | |||||
if(Objects.nonNull(a.getBaseInitialReviewTotalMoney())){ | if(Objects.nonNull(a.getBaseInitialReviewTotalMoney())){ | ||||
return Boolean.TRUE; | return Boolean.TRUE; | ||||
} | } | ||||
return Boolean.FALSE; | return Boolean.FALSE; | ||||
}).mapToDouble(a -> a.getBaseInitialReviewTotalMoney().doubleValue()).sum(); | |||||
}).map(GovBizProjectApprove::getBaseInitialReviewTotalMoney).reduce(BigDecimal::add).get(); | |||||
cockpitStats.setTopApprovalProjectsNum(approvalNumDeclared + approvalNumGov); | cockpitStats.setTopApprovalProjectsNum(approvalNumDeclared + approvalNumGov); | ||||
cockpitStats.setTopApprovalProjectsAmount(BigDecimal.valueOf(approvalAmount).add(BigDecimal.valueOf(approvalAmountGov))); | |||||
cockpitStats.setTopApprovalProjectsAmount(approvalAmount.add(approvalAmountGov)); | |||||
//3.3 平均建设周期 | //3.3 平均建设周期 | ||||
OptionalDouble od = Stream.concat(projects.stream().map(Project::getBuildCycle), | OptionalDouble od = Stream.concat(projects.stream().map(Project::getBuildCycle), | ||||
applies.stream().map(GovBizProjectApply::getBaseProjDuration)).mapToInt(c -> { | applies.stream().map(GovBizProjectApply::getBaseProjDuration)).mapToInt(c -> { | ||||
@@ -674,13 +676,13 @@ public class CockpitStatsStatisticsTask { | |||||
} | } | ||||
return Boolean.FALSE; | return Boolean.FALSE; | ||||
}).collect(Collectors.toList()); | }).collect(Collectors.toList()); | ||||
Double rejectPreSum = rejectPreProjects.stream().mapToDouble(p -> { | |||||
BigDecimal rejectPreSum = rejectPreProjects.stream().map(p -> { | |||||
if (Objects.nonNull(p.getDeclareAmount())) { | if (Objects.nonNull(p.getDeclareAmount())) { | ||||
return p.getDeclareAmount().doubleValue(); | |||||
return p.getDeclareAmount(); | |||||
} | } | ||||
return 0.0; | |||||
}).sum(); | |||||
cockpitStats.setRejectSavingsFunds(BigDecimal.valueOf(rejectPreSum)); | |||||
return BigDecimal.ZERO; | |||||
}).reduce(BigDecimal::add).get(); | |||||
cockpitStats.setRejectSavingsFunds(rejectPreSum); | |||||
//7.3 柱状图 | //7.3 柱状图 | ||||
//7.3.1 申报状态的3个资金 | //7.3.1 申报状态的3个资金 | ||||
@@ -695,27 +697,28 @@ public class CockpitStatsStatisticsTask { | |||||
}).collect(Collectors.toList()); | }).collect(Collectors.toList()); | ||||
//申报的申报金额(申报项目:初步方案申报金额 项目归集:项目总投资) | //申报的申报金额(申报项目:初步方案申报金额 项目归集:项目总投资) | ||||
Double declaredAmountApprove = normalProjects.stream().mapToDouble(p -> { | |||||
BigDecimal declareAmount = Objects.nonNull(p.getDeclareAmount()) ? p.getDeclareAmount() : BigDecimal.ZERO; | |||||
return declareAmount.doubleValue(); | |||||
}).sum(); | |||||
Double declaredAmountApproveGov = applies.stream().mapToDouble(g -> { | |||||
BigDecimal declaredAmountApprove = normalProjects.stream().map(p -> { | |||||
BigDecimal declareAmount = Objects.nonNull(p.getDeclareAmount()) ? | |||||
p.getDeclareAmount() : BigDecimal.ZERO; | |||||
return declareAmount; | |||||
}).reduce(BigDecimal::add).get(); | |||||
BigDecimal declaredAmountApproveGov = applies.stream().map(g -> { | |||||
BigDecimal totalAmount = Objects.nonNull(g.getBaseProjTotalAmount()) ? g.getBaseProjTotalAmount() : BigDecimal.ZERO; | BigDecimal totalAmount = Objects.nonNull(g.getBaseProjTotalAmount()) ? g.getBaseProjTotalAmount() : BigDecimal.ZERO; | ||||
return totalAmount.doubleValue(); | |||||
}).sum(); | |||||
BigDecimal declaredAmountApproveTotal = BigDecimal.valueOf(declaredAmountApprove).add(BigDecimal.valueOf(declaredAmountApproveGov)); | |||||
return totalAmount; | |||||
}).reduce(BigDecimal::add).get(); | |||||
BigDecimal declaredAmountApproveTotal = declaredAmountApprove.add(declaredAmountApproveGov); | |||||
cockpitStats.setDeclaredAmountApprove(declaredAmountApproveTotal); | cockpitStats.setDeclaredAmountApprove(declaredAmountApproveTotal); | ||||
//申报的批复金额(申报项目:建设方案申报金额 项目归集:建议总投资) | //申报的批复金额(申报项目:建设方案申报金额 项目归集:建议总投资) | ||||
Double approvalAmountApprove = normalProjects.stream().mapToDouble(p -> { | |||||
BigDecimal approvalAmountApprove = normalProjects.stream().map(p -> { | |||||
BigDecimal declareAmount = Objects.nonNull(p.getApprovalAmount()) ? p.getApprovalAmount() : BigDecimal.ZERO; | BigDecimal declareAmount = Objects.nonNull(p.getApprovalAmount()) ? p.getApprovalAmount() : BigDecimal.ZERO; | ||||
return declareAmount.doubleValue(); | |||||
}).sum(); | |||||
Double approvalAmountApproveGov = approves.stream().mapToDouble(p -> { | |||||
return declareAmount; | |||||
}).reduce(BigDecimal::add).get(); | |||||
BigDecimal approvalAmountApproveGov = approves.stream().map(p -> { | |||||
BigDecimal expertTotalMoney = Objects.nonNull(p.getBaseExpertTotalMoney()) ? p.getBaseExpertTotalMoney() : BigDecimal.ZERO; | BigDecimal expertTotalMoney = Objects.nonNull(p.getBaseExpertTotalMoney()) ? p.getBaseExpertTotalMoney() : BigDecimal.ZERO; | ||||
return expertTotalMoney.doubleValue(); | |||||
}).sum(); | |||||
BigDecimal approvalAmountApproveTotal = BigDecimal.valueOf(approvalAmountApprove).add(BigDecimal.valueOf(approvalAmountApproveGov)); | |||||
return expertTotalMoney; | |||||
}).reduce(BigDecimal::add).get(); | |||||
BigDecimal approvalAmountApproveTotal = approvalAmountApprove.add(approvalAmountApproveGov); | |||||
cockpitStats.setApprovalAmountApprove(approvalAmountApproveTotal); | cockpitStats.setApprovalAmountApprove(approvalAmountApproveTotal); | ||||
//申报的差额 | //申报的差额 | ||||
BigDecimal subtractApprove = declaredAmountApproveTotal.subtract(approvalAmountApproveTotal); | BigDecimal subtractApprove = declaredAmountApproveTotal.subtract(approvalAmountApproveTotal); | ||||
@@ -725,15 +728,15 @@ public class CockpitStatsStatisticsTask { | |||||
cockpitStats.setDeclaredAmountApproval(approvalAmountApproveTotal); | cockpitStats.setDeclaredAmountApproval(approvalAmountApproveTotal); | ||||
//批复的批复金额(申报项目:归集信息建议批复总投资 项目归集:建议批复总投资) | //批复的批复金额(申报项目:归集信息建议批复总投资 项目归集:建议批复总投资) | ||||
Double approvalAmountApproval = normalProjects.stream().mapToDouble(p -> { | |||||
BigDecimal approvalAmountApproval = normalProjects.stream().map(p -> { | |||||
BigDecimal proposeTotalInvest = Objects.nonNull(p.getProposeTotalInvest()) ? p.getProposeTotalInvest() : BigDecimal.ZERO; | BigDecimal proposeTotalInvest = Objects.nonNull(p.getProposeTotalInvest()) ? p.getProposeTotalInvest() : BigDecimal.ZERO; | ||||
return proposeTotalInvest.doubleValue(); | |||||
}).sum(); | |||||
Double approvalAmountApprovalGov = approves.stream().mapToDouble(p -> { | |||||
return proposeTotalInvest; | |||||
}).reduce(BigDecimal::add).get(); | |||||
BigDecimal approvalAmountApprovalGov = approves.stream().map(p -> { | |||||
BigDecimal reviewTotalMoney = Objects.nonNull(p.getBaseInitialReviewTotalMoney()) ? p.getBaseInitialReviewTotalMoney() : BigDecimal.ZERO; | BigDecimal reviewTotalMoney = Objects.nonNull(p.getBaseInitialReviewTotalMoney()) ? p.getBaseInitialReviewTotalMoney() : BigDecimal.ZERO; | ||||
return reviewTotalMoney.doubleValue(); | |||||
}).sum(); | |||||
BigDecimal approvalAmountApprovalTotal = BigDecimal.valueOf(approvalAmountApproval).add(BigDecimal.valueOf(approvalAmountApprovalGov)); | |||||
return reviewTotalMoney; | |||||
}).reduce(BigDecimal::add).get(); | |||||
BigDecimal approvalAmountApprovalTotal = approvalAmountApproval.add(approvalAmountApprovalGov); | |||||
cockpitStats.setApprovalAmountApproval(approvalAmountApprovalTotal); | cockpitStats.setApprovalAmountApproval(approvalAmountApprovalTotal); | ||||
//批复的差额 | //批复的差额 | ||||
@@ -744,16 +747,16 @@ public class CockpitStatsStatisticsTask { | |||||
cockpitStats.setDeclaredAmountContract(approvalAmountApprovalTotal); | cockpitStats.setDeclaredAmountContract(approvalAmountApprovalTotal); | ||||
//合同的批复金额(申报项目:成交金额 项目归集:成交金额) | //合同的批复金额(申报项目:成交金额 项目归集:成交金额) | ||||
Double approvalAmountContract = normalProjects.stream().mapToDouble(p -> { | |||||
BigDecimal approvalAmountContract = normalProjects.stream().map(p -> { | |||||
BigDecimal transactionAmount = Objects.nonNull(p.getTransactionAmount()) ? p.getTransactionAmount() : BigDecimal.ZERO; | BigDecimal transactionAmount = Objects.nonNull(p.getTransactionAmount()) ? p.getTransactionAmount() : BigDecimal.ZERO; | ||||
return transactionAmount.doubleValue(); | |||||
}).sum(); | |||||
Double approvalAmountContractGov = procures.stream().mapToDouble(p -> { | |||||
return transactionAmount; | |||||
}).reduce(BigDecimal::add).get(); | |||||
BigDecimal approvalAmountContractGov = procures.stream().map(p -> { | |||||
BigDecimal purchaseAmount = Objects.nonNull(p.getBaseProjPurchaseAmount()) ? | BigDecimal purchaseAmount = Objects.nonNull(p.getBaseProjPurchaseAmount()) ? | ||||
p.getBaseProjPurchaseAmount() : BigDecimal.ZERO; | p.getBaseProjPurchaseAmount() : BigDecimal.ZERO; | ||||
return purchaseAmount.doubleValue(); | |||||
}).sum(); | |||||
BigDecimal approvalAmountContractTotal = BigDecimal.valueOf(approvalAmountContract).add(BigDecimal.valueOf(approvalAmountContractGov)); | |||||
return purchaseAmount; | |||||
}).reduce(BigDecimal::add).get(); | |||||
BigDecimal approvalAmountContractTotal = approvalAmountContract.add(approvalAmountContractGov); | |||||
cockpitStats.setApprovalAmountContract(approvalAmountContractTotal); | cockpitStats.setApprovalAmountContract(approvalAmountContractTotal); | ||||
//合同的差额 | //合同的差额 | ||||
@@ -0,0 +1,73 @@ | |||||
package com.ningdatech.pmapi.expert; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.google.common.collect.Lists; | |||||
import com.ningdatech.pmapi.AppTests; | |||||
import com.ningdatech.pmapi.common.constant.RegionConst; | |||||
import com.ningdatech.pmapi.dashboard.constant.DashboardConstant; | |||||
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; | |||||
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; | |||||
import com.ningdatech.pmapi.meta.model.entity.ExpertTag; | |||||
import com.ningdatech.pmapi.meta.service.IExpertTagService; | |||||
import org.apache.commons.lang3.StringUtils; | |||||
import org.junit.Test; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
import java.util.stream.Collectors; | |||||
/** | |||||
* @Classname ExpertTest | |||||
* @Description | |||||
* @Date 2023/11/24 9:35 | |||||
* @Author PoffyZhang | |||||
*/ | |||||
public class ExpertTest extends AppTests { | |||||
@Autowired | |||||
private IExpertTagService expertTagService; | |||||
@Autowired | |||||
private IExpertUserFullInfoService expertUserFullInfoService; | |||||
@Test | |||||
public void test(){ | |||||
List<String> lsRegionCodes = RegionConst.LS_ARR; | |||||
List<ExpertUserFullInfo> experts = expertUserFullInfoService.list(Wrappers.lambdaQuery(ExpertUserFullInfo.class) | |||||
.in(ExpertUserFullInfo::getRegionCode,lsRegionCodes) | |||||
.eq(ExpertUserFullInfo::getExpertAccountStatus,"available")); | |||||
List<ExpertTag> goodAt = expertTagService.list(Wrappers.lambdaQuery(ExpertTag.class)); | |||||
Map<Long, List<ExpertTag>> tagMap = goodAt.stream() | |||||
.collect(Collectors.groupingBy(ExpertTag::getUserId)); | |||||
String networkCode = "1030000"; | |||||
String xinchuangCode = "2040000"; | |||||
String fanganCode = "2030000"; | |||||
String jishuCode = "2010000"; | |||||
String dangzhengCode = "1020000"; | |||||
String ruanyingCode = "2020000"; | |||||
String caiwuCode = "5600000"; | |||||
List<String> specialTags = Lists.newArrayList(networkCode,xinchuangCode,fanganCode,jishuCode, | |||||
dangzhengCode,ruanyingCode,caiwuCode); | |||||
List<Long> users = Lists.newArrayList(); | |||||
for(ExpertUserFullInfo e : experts) { | |||||
if (tagMap.containsKey(e.getUserId())) { | |||||
List<ExpertTag> expertTags = tagMap.get(e.getUserId()); | |||||
Boolean isContain = Boolean.FALSE; | |||||
for (ExpertTag expertTag : expertTags) { | |||||
if (specialTags.contains(expertTag.getTagCode())) { | |||||
isContain = Boolean.TRUE; | |||||
} | |||||
} | |||||
if (!isContain) { | |||||
users.add(e.getUserId()); | |||||
} | |||||
} | |||||
} | |||||
System.out.println(users); | |||||
} | |||||
} |