From 1016b777f1d84fd5d8944129911a0b666b762d5a Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 11 Dec 2024 19:24:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=201.=20=E5=88=A4=E6=96=AD=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E6=89=80=E6=9C=89=E6=A0=87=E9=A1=B9=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=8D=95=E4=BD=8D=E7=A1=AE=E8=AE=A4=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/projectdeclared/manage/PurchaseManage.java | 27 ++++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java index 59d6569..0a6c724 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java @@ -1164,16 +1164,7 @@ public class PurchaseManage { } tenderStateMachineUtil.pass(purchase); purchaseService.updateById(purchase); - LambdaQueryWrapper purchaseQuery = Wrappers.lambdaQuery(Purchase.class) - .select(Purchase::getStatus, Purchase::getBidType) - .eq(Purchase::getProjectId, purchase.getProjectId()); - List purchases = purchaseService.list(purchaseQuery); - boolean changeProjectStatus = CollUtil.allMatch(purchases, w -> { - if (!BidTypeEnum.BUILD_APP.eq(w.getBidType())) { - return true; - } - return TenderMainStatus.TO_BE_SUBMIT_FIRST_INSPECTED_INFO.eq(w.getStatus()); - }); + boolean changeProjectStatus = allPurchaseOrgConfirmed(purchase.getProjectId()); Project project = projectService.getNewestNoNull(purchase.getProjectId()); if (changeProjectStatus) { projectStateMachineUtil.pass(project); @@ -1183,4 +1174,20 @@ public class PurchaseManage { SpringUtil.publishEvent(MhTodoSendEvent.of(MHTodoTypeEnum.WITHOUT_FIRST_ACCEPT_RECORD, project, purchase)); } + private boolean allPurchaseOrgConfirmed(Long projectId) { + Wrapper purchaseQuery = Wrappers.lambdaQuery(Purchase.class) + .select(Purchase::getId) + .eq(Purchase::getProjectId, projectId) + .eq(Purchase::getBidType, BidTypeEnum.BUILD_APP.getCode()); + List purchases = purchaseService.list(purchaseQuery); + Set bidIds = CollUtils.fieldSet(purchases, Purchase::getId); + Wrapper statusChangeQuery = Wrappers.lambdaQuery(PurchaseStatusChange.class) + .select(PurchaseStatusChange::getBidId) + .eq(PurchaseStatusChange::getEvent, TenderStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM) + .in(PurchaseStatusChange::getBidId, bidIds); + List changes = purchaseStatusChangeService.list(statusChangeQuery); + int orgConfirmedCount = CollUtils.fieldSet(changes, PurchaseStatusChange::getBidId).size(); + return orgConfirmedCount == bidIds.size(); + } + }