Browse Source

统计

master
PoffyZhang 11 months ago
parent
commit
ece45eab55
1 changed files with 36 additions and 22 deletions
  1. +36
    -22
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/FundStatisticsManage.java

+ 36
- 22
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/FundStatisticsManage.java View File

@@ -413,36 +413,50 @@ public class FundStatisticsManage {
List<GovBizProjectApply> applies, List<GovBizProjectApprove> approves, List<GovBizProjectApply> applies, List<GovBizProjectApprove> approves,
List<GovBizProjectProcure> procures) { List<GovBizProjectProcure> procures) {
//申报项目颗粒度 //申报项目颗粒度
List<FundStatisticsVO.AmountData> orgAmounts = projects.stream().map(p -> {
Map<String, List<Project>> groupProjectMap = projects.stream()
.collect(Collectors.groupingBy(Project::getBuildOrgCode));
List<FundStatisticsVO.AmountData> projectAmounts = Lists.newArrayList();
for(Map.Entry<String, List<Project>> entry : groupProjectMap.entrySet()){
FundStatisticsVO.AmountData orgAmount = new FundStatisticsVO.AmountData(); FundStatisticsVO.AmountData orgAmount = new FundStatisticsVO.AmountData();
orgAmount.setName(p.getBuildOrgName());
orgAmount.setAmount(completeDeductionAmount(Lists.newArrayList(p),
List<Project> ps = entry.getValue();
if(CollUtil.isNotEmpty(ps)){
orgAmount.setName(ps.get(0).getBuildOrgName());
}
orgAmount.setAmount(completeDeductionAmount(entry.getValue(),
Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), Collections.emptyList(),
Collections.emptyList())); Collections.emptyList()));
return orgAmount;
}).collect(Collectors.toList());

Map<String, List<GovBizProjectApply>> applyMap = applies.stream().collect(Collectors
.groupingBy(GovBizProjectApply::getBaseProjId));
Map<String, List<GovBizProjectApprove>> approveMap = approves.stream().collect(Collectors
.groupingBy(GovBizProjectApprove::getBaseProjId));
Map<String, List<GovBizProjectProcure>> procureMap = procures.stream().collect(Collectors
.groupingBy(GovBizProjectProcure::getBaseProjId));
projectAmounts.add(orgAmount);
}


//项目归集颗粒度 //项目归集颗粒度
List<FundStatisticsVO.AmountData> orgAmountsGov = baseInfos.stream().map(p -> {
FundStatisticsVO.AmountData orgAmount = new FundStatisticsVO.AmountData();
orgAmount.setName(p.getBaseBuildDeprt());
List<GovBizProjectApply> appliesThis = applyMap.getOrDefault(p.getBaseProjId(), Collections.emptyList());
List<GovBizProjectApprove> approvesThis = approveMap.getOrDefault(p.getBaseProjId(), Collections.emptyList());
List<GovBizProjectProcure> procuresThis = procureMap.getOrDefault(p.getBaseProjId(), Collections.emptyList());
orgAmount.setAmount(completeDeductionAmount(Collections.emptyList(),
Map<String, List<GovBizProjectBaseinfo>> groupGovMap = baseInfos.stream()
.collect(Collectors.groupingBy(GovBizProjectBaseinfo::getBaseBuildDeprtDing));
List<FundStatisticsVO.AmountData> govAmounts = Lists.newArrayList();
for(Map.Entry<String, List<GovBizProjectBaseinfo>> entry : groupGovMap.entrySet()){
FundStatisticsVO.AmountData govAmount = new FundStatisticsVO.AmountData();
List<GovBizProjectBaseinfo> bs = entry.getValue();
List<String> baseProjIds = Lists.newArrayList();
if(CollUtil.isNotEmpty(bs)){
govAmount.setName(bs.get(0).getBaseBuildDeprt());
baseProjIds = bs.stream().map(GovBizProjectBaseinfo::getBaseProjId)
.collect(Collectors.toList());
}

List<String> finalBaseProjIds = baseProjIds;
List<GovBizProjectApply> appliesThis = applies.stream().filter(a -> Objects.nonNull(a.getBaseProjId())
&& finalBaseProjIds.contains(a.getBaseProjId())).collect(Collectors.toList());
List<GovBizProjectApprove> approvesThis = approves.stream().filter(a -> Objects.nonNull(a.getBaseProjId())
&& finalBaseProjIds.contains(a.getBaseProjId())).collect(Collectors.toList());
List<GovBizProjectProcure> procuresThis = procures.stream().filter(a -> Objects.nonNull(a.getBaseProjId())
&& finalBaseProjIds.contains(a.getBaseProjId())).collect(Collectors.toList());
govAmount.setAmount(completeDeductionAmount(Collections.emptyList(),
appliesThis, approvesThis,procuresThis)); appliesThis, approvesThis,procuresThis));
return orgAmount;
}).collect(Collectors.toList());
govAmounts.add(govAmount);
}


//求出TOP10 //求出TOP10
List<FundStatisticsVO.AmountData> res = Stream.concat(orgAmounts.stream(), orgAmountsGov.stream())
List<FundStatisticsVO.AmountData> res = Stream.concat(projectAmounts.stream(),
govAmounts.stream())
.sorted(Comparator.comparing(FundStatisticsVO.AmountData::getAmount).reversed()) .sorted(Comparator.comparing(FundStatisticsVO.AmountData::getAmount).reversed())
.limit(10).collect(Collectors.toList()); .limit(10).collect(Collectors.toList());




Loading…
Cancel
Save