|
|
@@ -1164,16 +1164,7 @@ public class PurchaseManage { |
|
|
|
} |
|
|
|
tenderStateMachineUtil.pass(purchase); |
|
|
|
purchaseService.updateById(purchase); |
|
|
|
LambdaQueryWrapper<Purchase> purchaseQuery = Wrappers.lambdaQuery(Purchase.class) |
|
|
|
.select(Purchase::getStatus, Purchase::getBidType) |
|
|
|
.eq(Purchase::getProjectId, purchase.getProjectId()); |
|
|
|
List<Purchase> 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<Purchase> purchaseQuery = Wrappers.lambdaQuery(Purchase.class) |
|
|
|
.select(Purchase::getId) |
|
|
|
.eq(Purchase::getProjectId, projectId) |
|
|
|
.eq(Purchase::getBidType, BidTypeEnum.BUILD_APP.getCode()); |
|
|
|
List<Purchase> purchases = purchaseService.list(purchaseQuery); |
|
|
|
Set<Long> bidIds = CollUtils.fieldSet(purchases, Purchase::getId); |
|
|
|
Wrapper<PurchaseStatusChange> statusChangeQuery = Wrappers.lambdaQuery(PurchaseStatusChange.class) |
|
|
|
.select(PurchaseStatusChange::getBidId) |
|
|
|
.eq(PurchaseStatusChange::getEvent, TenderStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM) |
|
|
|
.in(PurchaseStatusChange::getBidId, bidIds); |
|
|
|
List<PurchaseStatusChange> changes = purchaseStatusChangeService.list(statusChangeQuery); |
|
|
|
int orgConfirmedCount = CollUtils.fieldSet(changes, PurchaseStatusChange::getBidId).size(); |
|
|
|
return orgConfirmedCount == bidIds.size(); |
|
|
|
} |
|
|
|
|
|
|
|
} |