|
|
@@ -15,7 +15,10 @@ import com.google.common.collect.Sets; |
|
|
|
import com.hz.pm.api.common.helper.UserInfoHelper; |
|
|
|
import com.hz.pm.api.common.model.constant.BizConst; |
|
|
|
import com.hz.pm.api.common.model.constant.ExistsSqlConst; |
|
|
|
import com.hz.pm.api.common.statemachine.event.*; |
|
|
|
import com.hz.pm.api.common.statemachine.event.AbstractStateChangeEvent; |
|
|
|
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; |
|
|
|
import com.hz.pm.api.common.statemachine.event.TenderStateChangeEvent; |
|
|
|
import com.hz.pm.api.common.statemachine.event.XcfhxStateChangeEvent; |
|
|
|
import com.hz.pm.api.common.util.DecimalUtil; |
|
|
|
import com.hz.pm.api.projectdeclared.model.entity.Contract; |
|
|
|
import com.hz.pm.api.projectdeclared.model.entity.Purchase; |
|
|
@@ -86,6 +89,10 @@ import java.util.function.BiFunction; |
|
|
|
import java.util.function.Predicate; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import static com.hz.pm.api.common.statemachine.event.AdaptStateChangeEvent.ADAPT_INFO_PASSED; |
|
|
|
import static com.hz.pm.api.common.statemachine.event.SelfTestStateChangeEvent.SELF_TEST_PASSED; |
|
|
|
import static com.hz.pm.api.common.statemachine.event.TenderStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM; |
|
|
|
import static com.hz.pm.api.common.statemachine.event.TestValidStateChangeEvent.TEST_VALID_INFO_PASSED; |
|
|
|
import static com.hz.pm.api.projectlib.helper.ProjectManageUtil.projectQueryByProjectStatusChange; |
|
|
|
import static com.hz.pm.api.workbench.model.vo.ProjectProcessStatVO.TenderAdaptFinishStatVO; |
|
|
|
|
|
|
@@ -443,13 +450,13 @@ public class WorkbenchManage { |
|
|
|
.select(PurchaseStatusChange::getEvent, PurchaseStatusChange::getProjectId) |
|
|
|
.in(PurchaseStatusChange::getProjectId, projectIds) |
|
|
|
.in(PurchaseStatusChange::getEvent, |
|
|
|
AdaptStateChangeEvent.ADAPT_INFO_PASSED, |
|
|
|
SelfTestStateChangeEvent.SELF_TEST_PASSED, |
|
|
|
TestValidStateChangeEvent.TEST_VALID_INFO_PASSED, |
|
|
|
ADAPT_INFO_PASSED, |
|
|
|
SELF_TEST_PASSED, |
|
|
|
TEST_VALID_INFO_PASSED, |
|
|
|
TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES, |
|
|
|
XcfhxStateChangeEvent.XCFHX_APPLY_PASSED, |
|
|
|
TenderStateChangeEvent.FINALLY_INSPECTED_PASSED, |
|
|
|
TenderStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM, |
|
|
|
SUBMIT_PURCHASE_ORG_CONFIRM, |
|
|
|
TenderStateChangeEvent.SUBMIT_PURCHASE_CONSTRUCTION_INFO); |
|
|
|
List<PurchaseStatusChange> purchaseChanges = purchaseStatusChangeService.list(pQuery); |
|
|
|
Map<String, Map<Long, Long>> purchaseEventMapTmp = purchaseChanges.stream() |
|
|
@@ -461,7 +468,7 @@ public class WorkbenchManage { |
|
|
|
} |
|
|
|
break; |
|
|
|
case PROJECT_ADAPTION: { |
|
|
|
List<Long> projectIds = computeProjectIds.apply(TenderStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM, node); |
|
|
|
List<Long> projectIds = computeProjectIds.apply(SUBMIT_PURCHASE_ORG_CONFIRM, node); |
|
|
|
currStat.setProjectCount(projectIds.size()); |
|
|
|
Pair<Integer, Integer> replaceSystemCount = countReplaceSystemByProjectIds(projectIds); |
|
|
|
currStat.setSourceCount(replaceSystemCount.getKey()); |
|
|
@@ -475,7 +482,7 @@ public class WorkbenchManage { |
|
|
|
.map(Map.Entry::getKey) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
if (!tmpProjectIds.isEmpty()) { |
|
|
|
currStat.setAdaptFinishStat(tenderAdaptStatistics(tmpProjectIds)); |
|
|
|
currStat.setAdaptFinishStat(tenderAdaptStatistics(tmpProjectIds, projectPurchaseCountMap)); |
|
|
|
} |
|
|
|
} |
|
|
|
long finishPurchaseByWithoutApp = CollUtil.count(projectPurchaseCountMap.entrySet(), w -> { |
|
|
@@ -521,26 +528,42 @@ public class WorkbenchManage { |
|
|
|
return retData; |
|
|
|
} |
|
|
|
|
|
|
|
private TenderAdaptFinishStatVO tenderAdaptStatistics(List<Long> projectIds) { |
|
|
|
private TenderAdaptFinishStatVO tenderAdaptStatistics(List<Long> projectIds, Map<Long, List<Purchase>> projectPurchaseCountMap) { |
|
|
|
Wrapper<PurchaseStatusChange> purchaseQuery = Wrappers.lambdaQuery(PurchaseStatusChange.class) |
|
|
|
.select(PurchaseStatusChange::getEvent, PurchaseStatusChange::getBidId) |
|
|
|
.select(PurchaseStatusChange::getEvent, PurchaseStatusChange::getBidId, PurchaseStatusChange::getProjectId) |
|
|
|
.in(PurchaseStatusChange::getProjectId, projectIds) |
|
|
|
.in(PurchaseStatusChange::getEvent, AdaptStateChangeEvent.SUBMIT_ADAPT_INFO, |
|
|
|
SelfTestStateChangeEvent.SUBMIT_SELF_TEST_INFO, |
|
|
|
TestValidStateChangeEvent.SUBMIT_TEST_VALID_INFO, |
|
|
|
TenderStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM); |
|
|
|
.in(PurchaseStatusChange::getEvent, ADAPT_INFO_PASSED, |
|
|
|
SELF_TEST_PASSED, |
|
|
|
TEST_VALID_INFO_PASSED, |
|
|
|
SUBMIT_PURCHASE_ORG_CONFIRM); |
|
|
|
List<PurchaseStatusChange> statusChanges = purchaseStatusChangeService.list(purchaseQuery); |
|
|
|
Map<String, Integer> eventMap = statusChanges.stream() |
|
|
|
.collect(Collectors.groupingBy(PurchaseStatusChange::getEvent, |
|
|
|
Collectors.collectingAndThen(Collectors.mapping(PurchaseStatusChange::getBidId, Collectors.toSet()), Set::size))); |
|
|
|
|
|
|
|
Map<Long, List<PurchaseStatusChange>> projectPurchaseStatusChangeMap = CollUtils.group(statusChanges, PurchaseStatusChange::getProjectId); |
|
|
|
|
|
|
|
TenderAdaptFinishStatVO stat = new TenderAdaptFinishStatVO(); |
|
|
|
stat.setFinishTestValidCount(eventMap.getOrDefault(TestValidStateChangeEvent.SUBMIT_TEST_VALID_INFO.name(), 0)); |
|
|
|
stat.setFinishAdaptionInfo(eventMap.getOrDefault(AdaptStateChangeEvent.SUBMIT_ADAPT_INFO.name(), 0)); |
|
|
|
stat.setFinishOrgConfirmCount(eventMap.getOrDefault(TenderStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM.name(), 0)); |
|
|
|
stat.setFinishSelfTestCount(eventMap.getOrDefault(SelfTestStateChangeEvent.SUBMIT_SELF_TEST_INFO.name(), 0)); |
|
|
|
stat.setFinishTestValidCount(countAdaptBranchStatus(TEST_VALID_INFO_PASSED, projectIds, projectPurchaseCountMap, projectPurchaseStatusChangeMap)); |
|
|
|
stat.setFinishAdaptionInfo(countAdaptBranchStatus(ADAPT_INFO_PASSED, projectIds, projectPurchaseCountMap, projectPurchaseStatusChangeMap)); |
|
|
|
stat.setFinishOrgConfirmCount(countAdaptBranchStatus(SUBMIT_PURCHASE_ORG_CONFIRM, projectIds, projectPurchaseCountMap, projectPurchaseStatusChangeMap)); |
|
|
|
stat.setFinishSelfTestCount(countAdaptBranchStatus(SELF_TEST_PASSED, projectIds, projectPurchaseCountMap, projectPurchaseStatusChangeMap)); |
|
|
|
return stat; |
|
|
|
} |
|
|
|
|
|
|
|
private static <T extends AbstractStateChangeEvent> int countAdaptBranchStatus(T event, |
|
|
|
List<Long> projectIds, |
|
|
|
Map<Long, List<Purchase>> projectPurchaseCountMap, |
|
|
|
Map<Long, List<PurchaseStatusChange>> projectPurchaseChangeMap) { |
|
|
|
return (int) projectIds.stream().filter(w -> { |
|
|
|
int bidCount = CollUtil.count(projectPurchaseCountMap.getOrDefault(w, Collections.emptyList()), |
|
|
|
w1 -> BidTypeEnum.BUILD_APP.eq(w1.getBidType())); |
|
|
|
List<PurchaseStatusChange> purchaseStatusChanges = projectPurchaseChangeMap.getOrDefault(w, Collections.emptyList()); |
|
|
|
int finishedBidCount = purchaseStatusChanges.stream() |
|
|
|
.filter(w1 -> w1.getProjectId().equals(w) && event.eq(w1.getEvent())) |
|
|
|
.map(PurchaseStatusChange::getBidId) |
|
|
|
.collect(Collectors.toSet()).size(); |
|
|
|
return finishedBidCount != 0 && finishedBidCount == bidCount; |
|
|
|
}).count(); |
|
|
|
} |
|
|
|
|
|
|
|
private static int stoppedProjectCount(Map<String, List<ProjectStatusChange>> projectStatusChangeMap, List<String> projectCodes) { |
|
|
|
return CollUtil.count(projectStatusChangeMap.entrySet(), |
|
|
|
w -> projectCodes.contains(w.getKey()) |
|
|
@@ -597,17 +620,17 @@ public class WorkbenchManage { |
|
|
|
case TEST_VALID: |
|
|
|
query.apply("(select count(1) from nd_purchase np where np.project_id = nd_project.id and bid_type = {0}) " + |
|
|
|
"= (select count(distinct bid_id) from nd_purchase_status_change npsc where npsc.project_code = nd_project.project_code " + |
|
|
|
"and event = {1})", BidTypeEnum.BUILD_APP.getCode(), TestValidStateChangeEvent.TEST_VALID_INFO_PASSED); |
|
|
|
"and event = {1})", BidTypeEnum.BUILD_APP.getCode(), TEST_VALID_INFO_PASSED); |
|
|
|
break; |
|
|
|
case SELF_TEST: |
|
|
|
query.apply("(select count(1) from nd_purchase np where np.project_id = nd_project.id and bid_type = {0}) " + |
|
|
|
"= (select count(distinct bid_id) from nd_purchase_status_change npsc where npsc.project_code = nd_project.project_code " + |
|
|
|
"and event = {1})", BidTypeEnum.BUILD_APP.getCode(), SelfTestStateChangeEvent.SELF_TEST_PASSED); |
|
|
|
"and event = {1})", BidTypeEnum.BUILD_APP.getCode(), SELF_TEST_PASSED); |
|
|
|
break; |
|
|
|
case SUBMIT_START_FILE: |
|
|
|
query.apply("(select count(1) from nd_purchase np where np.project_id = nd_project.id and bid_type = {0}) " + |
|
|
|
"= (select count(distinct bid_id) from nd_purchase_status_change npsc where npsc.project_code = nd_project.project_code " + |
|
|
|
"and event = {1})", BidTypeEnum.BUILD_APP.getCode(), AdaptStateChangeEvent.ADAPT_INFO_PASSED); |
|
|
|
"and event = {1})", BidTypeEnum.BUILD_APP.getCode(), ADAPT_INFO_PASSED); |
|
|
|
break; |
|
|
|
default: |
|
|
|
return PageVo.empty(); |
|
|
|