|
@@ -1,6 +1,5 @@ |
|
|
package com.hz.pm.api.projectdeclared.manage; |
|
|
package com.hz.pm.api.projectdeclared.manage; |
|
|
|
|
|
|
|
|
import cn.dev33.satoken.fun.SaParamRetFunction; |
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.io.FileUtil; |
|
|
import cn.hutool.core.io.FileUtil; |
|
@@ -17,7 +16,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.google.common.collect.Lists; |
|
|
import com.google.common.collect.Lists; |
|
|
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; |
|
|
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; |
|
|
import com.hz.pm.api.common.helper.UserInfoHelper; |
|
|
import com.hz.pm.api.common.helper.UserInfoHelper; |
|
|
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.AdaptStateChangeEvent; |
|
|
|
|
|
import com.hz.pm.api.common.statemachine.event.SelfTestStateChangeEvent; |
|
|
|
|
|
import com.hz.pm.api.common.statemachine.event.TestValidStateChangeEvent; |
|
|
import com.hz.pm.api.common.statemachine.util.*; |
|
|
import com.hz.pm.api.common.statemachine.util.*; |
|
|
import com.hz.pm.api.common.util.BizUtils; |
|
|
import com.hz.pm.api.common.util.BizUtils; |
|
|
import com.hz.pm.api.common.util.EnvironmentUtil; |
|
|
import com.hz.pm.api.common.util.EnvironmentUtil; |
|
@@ -452,14 +454,13 @@ public class PurchaseManage { |
|
|
.isNotNull(function) |
|
|
.isNotNull(function) |
|
|
.orderByDesc(Purchase::getCreateOn); |
|
|
.orderByDesc(Purchase::getCreateOn); |
|
|
boolean display = !Boolean.FALSE.equals(req.getDisplay()); |
|
|
boolean display = !Boolean.FALSE.equals(req.getDisplay()); |
|
|
|
|
|
String existsSql = String.format("select 1 from nd_project_operation no" + |
|
|
|
|
|
" where no.bid_id = nd_purchase.id and no.%s is not null", actualTimeColumn); |
|
|
if (display) { |
|
|
if (display) { |
|
|
query.and(q1 -> q1.eq(Purchase::getBidType, BidTypeEnum.BUILD_APP.getCode()) |
|
|
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)))); |
|
|
|
|
|
|
|
|
.or(q2 -> q2.exists(existsSql))); |
|
|
} else { |
|
|
} else { |
|
|
query.ne(Purchase::getBidType, BidTypeEnum.BUILD_APP.getCode()) |
|
|
|
|
|
.exists(String.format("select 1 from nd_project_operation no" + |
|
|
|
|
|
" where no.bid_id = nd_purchase.id and no.%s is null", actualTimeColumn)); |
|
|
|
|
|
|
|
|
query.ne(Purchase::getBidType, BidTypeEnum.BUILD_APP.getCode()).notExists(existsSql); |
|
|
} |
|
|
} |
|
|
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); |
|
|
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); |
|
|
if (!buildPurchaseQueryPermission(query, user)) { |
|
|
if (!buildPurchaseQueryPermission(query, user)) { |
|
@@ -482,22 +483,20 @@ public class PurchaseManage { |
|
|
event = SelfTestStateChangeEvent.SUBMIT_SELF_TEST_INFO; |
|
|
event = SelfTestStateChangeEvent.SUBMIT_SELF_TEST_INFO; |
|
|
} |
|
|
} |
|
|
Wrapper<PurchaseStatusChange> pscQuery = Wrappers.lambdaQuery(PurchaseStatusChange.class) |
|
|
Wrapper<PurchaseStatusChange> pscQuery = Wrappers.lambdaQuery(PurchaseStatusChange.class) |
|
|
.in(PurchaseStatusChange::getEvent, event.name(), TenderStateChangeEvent.SUBMIT_OPERATION_PLAN) |
|
|
|
|
|
|
|
|
.in(PurchaseStatusChange::getEvent, event.name()) |
|
|
.in(PurchaseStatusChange::getBidId, bidIds) |
|
|
.in(PurchaseStatusChange::getBidId, bidIds) |
|
|
.orderByAsc(PurchaseStatusChange::getCreateOn); |
|
|
.orderByAsc(PurchaseStatusChange::getCreateOn); |
|
|
List<PurchaseStatusChange> changes = purchaseStatusChangeService.list(pscQuery); |
|
|
List<PurchaseStatusChange> changes = purchaseStatusChangeService.list(pscQuery); |
|
|
Map<Long, List<PurchaseStatusChange>> mapByBidId = CollUtils.group(changes, PurchaseStatusChange::getBidId); |
|
|
|
|
|
|
|
|
Map<Long, PurchaseStatusChange> mapByBidId = BizUtils.groupFirstMap(changes, |
|
|
|
|
|
PurchaseStatusChange::getBidId, Comparator.comparing(PurchaseStatusChange::getCreateOn)); |
|
|
records.forEach(w -> { |
|
|
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())) { |
|
|
if (BidTypeEnum.BUILD_APP.getCode().equals(w.getBidType())) { |
|
|
createOnMap.put(w.getId(), changeMap.get(TenderStateChangeEvent.SUBMIT_OPERATION_PLAN.name())); |
|
|
|
|
|
|
|
|
createOnMap.put(w.getId(), w.getCreateOn()); |
|
|
} else { |
|
|
} else { |
|
|
createOnMap.put(w.getId(), changeMap.get(event.name())); |
|
|
|
|
|
|
|
|
PurchaseStatusChange change = mapByBidId.get(w.getId()); |
|
|
|
|
|
if (change != null) { |
|
|
|
|
|
createOnMap.put(w.getId(), change.getCreateOn()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
@@ -517,10 +516,12 @@ public class PurchaseManage { |
|
|
String projectCode = ProjectIdCodeCacheUtil.get(w.getProjectId()); |
|
|
String projectCode = ProjectIdCodeCacheUtil.get(w.getProjectId()); |
|
|
item.setProjectCode(projectCode); |
|
|
item.setProjectCode(projectCode); |
|
|
Contract contract = contractMap.get(w.getId()); |
|
|
Contract contract = contractMap.get(w.getId()); |
|
|
item.setContractAmount(contract.getTotalAmount()); |
|
|
|
|
|
|
|
|
if (contract != null) { |
|
|
|
|
|
item.setContractAmount(contract.getTotalAmount()); |
|
|
|
|
|
} |
|
|
item.setStatus(function.apply(w)); |
|
|
item.setStatus(function.apply(w)); |
|
|
if (display) { |
|
|
if (display) { |
|
|
item.setCreateOn(createOnMap.getOrDefault(w.getId(), w.getCreateOn())); |
|
|
|
|
|
|
|
|
item.setCreateOn(createOnMap.get(w.getId())); |
|
|
} |
|
|
} |
|
|
return item; |
|
|
return item; |
|
|
}).collect(Collectors.toList()); |
|
|
}).collect(Collectors.toList()); |
|
@@ -554,6 +555,7 @@ public class PurchaseManage { |
|
|
if (Objects.isNull(model)) { |
|
|
if (Objects.isNull(model)) { |
|
|
throw new BusinessException("找不到测试验证流程配置"); |
|
|
throw new BusinessException("找不到测试验证流程配置"); |
|
|
} |
|
|
} |
|
|
|
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
for (Purchase purchase : purchases) { |
|
|
for (Purchase purchase : purchases) { |
|
|
Long projectId = purchase.getProjectId(); |
|
|
Long projectId = purchase.getProjectId(); |
|
|
Project project = projectService.getNewProject(projectId); |
|
|
Project project = projectService.getNewProject(projectId); |
|
@@ -564,14 +566,23 @@ public class PurchaseManage { |
|
|
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 |
|
|
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 |
|
|
Map<String, OrgInfoDTO> orgMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project); |
|
|
Map<String, OrgInfoDTO> orgMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project); |
|
|
String instanceId = processInstanceService.startProcessLs(model, instParam, orgMap); |
|
|
String instanceId = processInstanceService.startProcessLs(model, instParam, orgMap); |
|
|
Wrapper<Operation> update = Wrappers.lambdaUpdate(Operation.class) |
|
|
|
|
|
.set(Operation::getActualTestValidTime, req.getActualTime()) |
|
|
|
|
|
.set(Operation::getTestValidFiles, req.getFiles()) |
|
|
|
|
|
.set(Operation::getTestValidRemark, req.getRemark()) |
|
|
|
|
|
.eq(Operation::getBidId, purchase.getId()); |
|
|
|
|
|
testValidStateMachineUtil.pass(purchase); |
|
|
testValidStateMachineUtil.pass(purchase); |
|
|
purchaseService.updateById(purchase); |
|
|
purchaseService.updateById(purchase); |
|
|
operationService.update(update); |
|
|
|
|
|
|
|
|
Operation operation = operationService.getByBidId(purchase.getId()); |
|
|
|
|
|
if (operation == null) { |
|
|
|
|
|
operation = new Operation(); |
|
|
|
|
|
operation.setActualTestValidTime(req.getActualTime()); |
|
|
|
|
|
operation.setTestValidFiles(req.getFiles()); |
|
|
|
|
|
operation.setTestValidRemark(req.getRemark()); |
|
|
|
|
|
operation.setBidId(purchase.getId()); |
|
|
|
|
|
operation.setCreateBy(user.getUsername()); |
|
|
|
|
|
operation.setCreateOn(now); |
|
|
|
|
|
operation.setProjectId(projectId); |
|
|
|
|
|
operation.setProjectCode(project.getProjectCode()); |
|
|
|
|
|
} |
|
|
|
|
|
operation.setUpdateBy(user.getUsername()); |
|
|
|
|
|
operation.setUpdateOn(now); |
|
|
|
|
|
operationService.saveOrUpdate(operation); |
|
|
saveProjectPurchaseInstCode(purchase.getId(), instanceId, project.getId(), instType); |
|
|
saveProjectPurchaseInstCode(purchase.getId(), instanceId, project.getId(), instType); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@@ -610,6 +621,7 @@ public class PurchaseManage { |
|
|
if (Objects.isNull(model)) { |
|
|
if (Objects.isNull(model)) { |
|
|
throw new BusinessException("找不到系统自测流程配置"); |
|
|
throw new BusinessException("找不到系统自测流程配置"); |
|
|
} |
|
|
} |
|
|
|
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
for (Purchase purchase : purchases) { |
|
|
for (Purchase purchase : purchases) { |
|
|
Long projectId = purchase.getProjectId(); |
|
|
Long projectId = purchase.getProjectId(); |
|
|
Project project = projectService.getNewProject(projectId); |
|
|
Project project = projectService.getNewProject(projectId); |
|
@@ -620,14 +632,23 @@ public class PurchaseManage { |
|
|
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 |
|
|
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 |
|
|
Map<String, OrgInfoDTO> orgMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project); |
|
|
Map<String, OrgInfoDTO> orgMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project); |
|
|
String instanceId = processInstanceService.startProcessLs(model, instParam, orgMap); |
|
|
String instanceId = processInstanceService.startProcessLs(model, instParam, orgMap); |
|
|
Wrapper<Operation> update = Wrappers.lambdaUpdate(Operation.class) |
|
|
|
|
|
.set(Operation::getActualSelfTestTime, req.getActualTime()) |
|
|
|
|
|
.set(Operation::getSelfTestFiles, req.getFiles()) |
|
|
|
|
|
.set(Operation::getSelfTestRemark, req.getRemark()) |
|
|
|
|
|
.eq(Operation::getBidId, purchase.getId()); |
|
|
|
|
|
selfTestStateMachineUtil.pass(purchase); |
|
|
selfTestStateMachineUtil.pass(purchase); |
|
|
purchaseService.updateById(purchase); |
|
|
purchaseService.updateById(purchase); |
|
|
operationService.update(update); |
|
|
|
|
|
|
|
|
Operation operation = operationService.getByBidId(purchase.getId()); |
|
|
|
|
|
if (operation == null) { |
|
|
|
|
|
operation = new Operation(); |
|
|
|
|
|
operation.setActualSelfTestTime(req.getActualTime()); |
|
|
|
|
|
operation.setSelfTestFiles(req.getFiles()); |
|
|
|
|
|
operation.setSelfTestRemark(req.getRemark()); |
|
|
|
|
|
operation.setBidId(purchase.getId()); |
|
|
|
|
|
operation.setCreateBy(user.getUsername()); |
|
|
|
|
|
operation.setCreateOn(now); |
|
|
|
|
|
operation.setProjectId(projectId); |
|
|
|
|
|
operation.setProjectCode(project.getProjectCode()); |
|
|
|
|
|
} |
|
|
|
|
|
operation.setUpdateBy(user.getUsername()); |
|
|
|
|
|
operation.setUpdateOn(now); |
|
|
|
|
|
operationService.saveOrUpdate(operation); |
|
|
saveProjectPurchaseInstCode(purchase.getId(), instanceId, project.getId(), instType); |
|
|
saveProjectPurchaseInstCode(purchase.getId(), instanceId, project.getId(), instType); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@@ -647,6 +668,7 @@ public class PurchaseManage { |
|
|
if (Objects.isNull(model)) { |
|
|
if (Objects.isNull(model)) { |
|
|
throw new BusinessException("找不到适配改造流程配置"); |
|
|
throw new BusinessException("找不到适配改造流程配置"); |
|
|
} |
|
|
} |
|
|
|
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
for (Purchase purchase : purchases) { |
|
|
for (Purchase purchase : purchases) { |
|
|
Long projectId = purchase.getProjectId(); |
|
|
Long projectId = purchase.getProjectId(); |
|
|
Project project = projectService.getNewProject(projectId); |
|
|
Project project = projectService.getNewProject(projectId); |
|
@@ -657,14 +679,23 @@ public class PurchaseManage { |
|
|
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 |
|
|
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 |
|
|
Map<String, OrgInfoDTO> orgMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project); |
|
|
Map<String, OrgInfoDTO> orgMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project); |
|
|
String instanceId = processInstanceService.startProcessLs(model, instParam, orgMap); |
|
|
String instanceId = processInstanceService.startProcessLs(model, instParam, orgMap); |
|
|
Wrapper<Operation> update = Wrappers.lambdaUpdate(Operation.class) |
|
|
|
|
|
.set(Operation::getActualAdaptionTime, req.getActualTime()) |
|
|
|
|
|
.set(Operation::getAdaptionFiles, req.getFiles()) |
|
|
|
|
|
.set(Operation::getAdaptionRemark, req.getRemark()) |
|
|
|
|
|
.eq(Operation::getBidId, purchase.getId()); |
|
|
|
|
|
adaptStateMachineUtil.pass(purchase); |
|
|
adaptStateMachineUtil.pass(purchase); |
|
|
purchaseService.updateById(purchase); |
|
|
purchaseService.updateById(purchase); |
|
|
operationService.update(update); |
|
|
|
|
|
|
|
|
Operation operation = operationService.getByBidId(purchase.getId()); |
|
|
|
|
|
if (operation == null) { |
|
|
|
|
|
operation = new Operation(); |
|
|
|
|
|
operation.setActualAdaptionTime(req.getActualTime()); |
|
|
|
|
|
operation.setAdaptionFiles(req.getFiles()); |
|
|
|
|
|
operation.setAdaptionRemark(req.getRemark()); |
|
|
|
|
|
operation.setBidId(purchase.getId()); |
|
|
|
|
|
operation.setCreateBy(user.getUsername()); |
|
|
|
|
|
operation.setCreateOn(now); |
|
|
|
|
|
operation.setProjectId(projectId); |
|
|
|
|
|
operation.setProjectCode(project.getProjectCode()); |
|
|
|
|
|
} |
|
|
|
|
|
operation.setUpdateBy(user.getUsername()); |
|
|
|
|
|
operation.setUpdateOn(now); |
|
|
|
|
|
operationService.saveOrUpdate(operation); |
|
|
saveProjectPurchaseInstCode(purchase.getId(), instanceId, project.getId(), instType); |
|
|
saveProjectPurchaseInstCode(purchase.getId(), instanceId, project.getId(), instType); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|