Browse Source

修改实施创建时间

tags/24080901
WendyYang 7 months ago
parent
commit
74775e9e9f
2 changed files with 42 additions and 1 deletions
  1. +1
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/AbstractStateChangeEvent.java
  2. +41
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java

+ 1
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/AbstractStateChangeEvent.java View File

@@ -15,6 +15,7 @@ import java.util.Objects;
*/
public interface AbstractStateChangeEvent {

String name();

Integer getPassStatusCode();



+ 41
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java View File

@@ -1,5 +1,6 @@
package com.hz.pm.api.projectdeclared.manage;

import cn.dev33.satoken.fun.SaParamRetFunction;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
@@ -16,6 +17,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum;
import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.common.statemachine.event.*;
import com.hz.pm.api.common.statemachine.util.*;
import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.common.util.EnvironmentUtil;
@@ -46,6 +48,7 @@ import com.hz.pm.api.projectdeclared.service.IOperationService;
import com.hz.pm.api.projectdeclared.service.IPurchaseInstService;
import com.hz.pm.api.projectdeclared.service.IPurchaseService;
import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil;
import com.hz.pm.api.projectlib.entity.PurchaseStatusChange;
import com.hz.pm.api.projectlib.helper.ProjectHelper;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.entity.ProjectInst;
@@ -55,6 +58,7 @@ import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO;
import com.hz.pm.api.projectlib.model.vo.TenderListInfoVO;
import com.hz.pm.api.projectlib.service.IProjectInstService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.projectlib.service.IPurchaseStatusChangeService;
import com.hz.pm.api.sys.manage.ProcessModelManage;
import com.hz.pm.api.user.helper.MhUnitCache;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
@@ -121,6 +125,7 @@ public class PurchaseManage {
private final IPurchaseInstService purchaseInstService;
private final IProjectInstService projectInstService;
private final EnvironmentUtil environmentUtil;
private final IPurchaseStatusChangeService purchaseStatusChangeService;

private boolean buildPurchaseQueryPermission(LambdaQueryWrapper<Purchase> query, UserFullInfoDTO user) {
boolean queryState = true;
@@ -443,7 +448,8 @@ public class PurchaseManage {
.eq(req.getStatus() != null, function, req.getStatus())
.isNotNull(function)
.orderByDesc(Purchase::getCreateOn);
if (!Boolean.FALSE.equals(req.getDisplay())) {
boolean display = !Boolean.FALSE.equals(req.getDisplay());
if (display) {
query.and(q1 -> q1.eq(Purchase::getBidType, BidTypeEnum.BUILD_APP.getCode())
.or(q2 -> q2.exists(String.format("select 1 from nd_project_operation no" +
" where no.bid_id = nd_purchase.id and no.%s is not null", actualTimeColumn))));
@@ -461,6 +467,37 @@ public class PurchaseManage {
return PageVo.empty();
}
List<Purchase> records = page.getRecords();
Map<Long, LocalDateTime> createOnMap = new HashMap<>();
if (display) {
List<Long> bidIds = CollUtils.fieldList(records, Purchase::getId);
AbstractStateChangeEvent event;
if ("actual_test_valid_time".equals(actualTimeColumn)) {
event = TestValidStateChangeEvent.SUBMIT_TEST_VALID_INFO;
} else if ("actual_adaption_time".equals(actualTimeColumn)) {
event = AdaptStateChangeEvent.SUBMIT_ADAPT_INFO;
} else {
event = SelfTestStateChangeEvent.SUBMIT_SELF_TEST_INFO;
}
Wrapper<PurchaseStatusChange> pscQuery = Wrappers.lambdaQuery(PurchaseStatusChange.class)
.in(PurchaseStatusChange::getEvent, event.name(), TenderStateChangeEvent.SUBMIT_OPERATION_PLAN)
.in(PurchaseStatusChange::getBidId, bidIds)
.orderByAsc(PurchaseStatusChange::getCreateOn);
List<PurchaseStatusChange> changes = purchaseStatusChangeService.list(pscQuery);
Map<Long, List<PurchaseStatusChange>> mapByBidId = CollUtils.group(changes, PurchaseStatusChange::getBidId);
records.forEach(w -> {
List<PurchaseStatusChange> tmpChanges = mapByBidId.get(w.getId());
if (tmpChanges == null) {
return;
}
Map<String, LocalDateTime> changeMap = CollUtils.listToMap(tmpChanges,
PurchaseStatusChange::getEvent, PurchaseStatusChange::getCreateOn);
if (BidTypeEnum.BUILD_APP.getCode().equals(w.getBidType())) {
createOnMap.put(w.getId(), changeMap.get(TenderStateChangeEvent.SUBMIT_OPERATION_PLAN.name()));
} else {
createOnMap.put(w.getId(), changeMap.get(event.name()));
}
});
}
List<Long> projectIds = CollUtils.fieldList(records, Purchase::getProjectId);
Map<Long, Contract> contractMap = contractService.listByProjectIds(projectIds);
List<TestValidListVO> data = records.stream().map(w -> {
@@ -473,6 +510,9 @@ public class PurchaseManage {
Contract contract = contractMap.get(w.getId());
item.setContractAmount(contract.getTotalAmount());
item.setStatus(function.apply(w));
if (display) {
item.setCreateOn(createOnMap.getOrDefault(w.getId(), w.getCreateOn()));
}
return item;
}).collect(Collectors.toList());
return PageVo.of(data, page.getTotal());


Loading…
Cancel
Save