Browse Source

feat:

1. 工作台金额统计修改;
dev
WendyYang 3 days ago
parent
commit
8bb1a68e3e
1 changed files with 6 additions and 29 deletions
  1. +6
    -29
      hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java

+ 6
- 29
hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java View File

@@ -88,7 +88,6 @@ import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.BiFunction;
import java.util.function.Predicate;
import java.util.stream.Collectors;

@@ -366,28 +365,10 @@ public class WorkbenchManage {
List<String> allProjectCodes = new ArrayList<>();
Map<String, Map<Long, Long>> purchaseEventMap = new HashMap<>();
Map<Long, List<Purchase>> projectPurchaseCountMap = new HashMap<>();
BiFunction<AbstractStateChangeEvent, WorkbenchProcessNode, List<Long>> computeProjectIds = (event, node) -> {
Map<Long, Long> projBizMap = purchaseEventMap.getOrDefault(event.name(), Collections.emptyMap());
if (node.equals(WorkbenchProcessNode.PROJECT_ADAPTION)
|| node.equals(WorkbenchProcessNode.FIRST_INSPECTED)
|| node.equals(WorkbenchProcessNode.FINAL_INSPECTED)) {
return projectPurchaseCountMap.entrySet().stream().filter(w -> {
Long finishedBizCount = projBizMap.get(w.getKey());
return finishedBizCount != null && finishedBizCount > 0
&& finishedBizCount == CollUtil.count(w.getValue(), x -> BidTypeEnum.BUILD_APP.eq(x.getBidType()));
}).map(Map.Entry::getKey).collect(Collectors.toList());
} else {
return projectPurchaseCountMap.entrySet().stream().filter(w -> {
Long finishedBizCount = projBizMap.get(w.getKey());
return finishedBizCount != null && finishedBizCount == w.getValue().size();
}).map(Map.Entry::getKey).collect(Collectors.toList());
}
};

// 查询完成立项备案的项目
List<Long> viewUnitIds = mhUnitCache.getViewChildIdsRecursion(req.getUnitId());
Wrapper<Project> query = Wrappers.lambdaQuery(Project.class)
.select(Project::getId, Project::getApprovalAmount, Project::getProjectCode)
.select(Project::getId, Project::getApprovalAmount, Project::getProjectCode, Project::getStatus)
.eq(Project::getProjectYear, req.getProjectYear())
.eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip())
.eq(Project::getNewest, Boolean.TRUE)
@@ -514,9 +495,9 @@ public class WorkbenchManage {
}
break;
case PROJECT_ADAPTION: {
List<Long> projectIds = computeProjectIds.apply(SUBMIT_PURCHASE_ORG_CONFIRM, node);
List<String> projectIds = getProjectCodes(projectStatusChangeMap, ProjectStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM);
currStat.setProjectCount(projectIds.size());
Pair<Integer, Integer> replaceSystemCount = countReplaceSystemByProjectIds(projectIds);
Pair<Integer, Integer> replaceSystemCount = countReplaceSystemByProjectCodes(projectIds);
currStat.setSourceCount(replaceSystemCount.getKey());
currStat.setTargetCount(replaceSystemCount.getValue());
Map<Long, Long> submitPurcahseRecordMap = purchaseEventMap.get(TenderStateChangeEvent.SUBMIT_PURCHASE_CONSTRUCTION_INFO.name());
@@ -546,9 +527,7 @@ public class WorkbenchManage {
}
break;
case FIRST_INSPECTED: {
List<String> projectCodes = CollUtils.filter(projectStatusChangeMap.entrySet(),
w -> CollUtil.anyMatch(w.getValue(), w1 -> ProjectStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES.eq(w1.getEvent())),
Map.Entry::getKey);
List<String> projectCodes = getProjectCodes(projectStatusChangeMap, ProjectStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES);
Pair<Integer, Integer> replaceSystemCount = countReplaceSystemByProjectCodes(projectCodes);
currStat.setProjectCount(projectCodes.size());
currStat.setSourceCount(replaceSystemCount.getKey());
@@ -560,9 +539,7 @@ public class WorkbenchManage {
}
break;
case FINAL_INSPECTED: {
List<String> projectCodes = CollUtils.filter(projectStatusChangeMap.entrySet(),
w -> CollUtil.anyMatch(w.getValue(), w1 -> ProjectStateChangeEvent.FINAL_ACCEPTANCE_PASS.eq(w1.getEvent())),
Map.Entry::getKey);
List<String> projectCodes = getProjectCodes(projectStatusChangeMap, ProjectStateChangeEvent.FINAL_ACCEPTANCE_PASS);
Pair<Integer, Integer> replaceSystemCount = countReplaceSystemByProjectCodes(projectCodes);
currStat.setProjectCount(projectCodes.size());
currStat.setSourceCount(replaceSystemCount.getKey());
@@ -622,7 +599,7 @@ public class WorkbenchManage {
.filter(w1 -> w1.getProjectId().equals(w) && event.eq(w1.getEvent()))
.map(PurchaseStatusChange::getBidId)
.collect(Collectors.toSet()).size();
return finishedBidCount != 0 && finishedBidCount == bidCount;
return bidCount > 0 && finishedBidCount == bidCount;
}).count();
}



Loading…
Cancel
Save