Przeglądaj źródła

feat:

1. 判断是否所有标项完成单位确认;
tags/24121201
WendyYang 4 tygodni temu
rodzic
commit
1016b777f1
1 zmienionych plików z 17 dodań i 10 usunięć
  1. +17
    -10
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java

+ 17
- 10
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java Wyświetl plik

@@ -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();
}

}

Ładowanie…
Anuluj
Zapisz