diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/AdaptStateChangeAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/AdaptStateChangeAction.java
index 5cb5778..a08ec72 100644
--- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/AdaptStateChangeAction.java
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/AdaptStateChangeAction.java
@@ -1,9 +1,7 @@
package com.hz.pm.api.common.statemachine.action;
-import cn.hutool.core.lang.Assert;
import com.hz.pm.api.common.statemachine.builder.impl.AdaptStateMachineBuilderImpl;
import com.hz.pm.api.common.statemachine.event.AdaptStateChangeEvent;
-import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectlib.model.enumeration.status.TenderAdaptStatus;
import com.hz.pm.api.projectlib.model.enumeration.status.TenderSelfTestStatus;
@@ -12,6 +10,8 @@ import org.springframework.messaging.Message;
import org.springframework.statemachine.annotation.OnTransition;
import org.springframework.statemachine.annotation.WithStateMachine;
+import static com.hz.pm.api.common.statemachine.action.TenderStateChangeActionUtil.getPurchaseInfo;
+
/**
*
* 测试验证状态机action集合类
@@ -24,12 +24,6 @@ import org.springframework.statemachine.annotation.WithStateMachine;
@WithStateMachine(id = AdaptStateMachineBuilderImpl.MACHINE_ID)
public class AdaptStateChangeAction {
- private Purchase getPurchaseInfo(Message message) {
- Purchase purchase = (Purchase) message.getHeaders().get(TenderStateMachineUtil.PURCHASE);
- Assert.notNull(purchase, "未获取到需要状态变更的标段信息");
- return purchase;
- }
-
@OnTransition(source = "WITHOUT_ADAPT_INFO", target = "ADAPT_INFO_AUDIT")
public void SUBMIT_ADAPT_INFO(Message message) {
Purchase purchase = getPurchaseInfo(message);
diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/SelfTestStateChangeAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/SelfTestStateChangeAction.java
index 1fd1e77..2bce050 100644
--- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/SelfTestStateChangeAction.java
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/SelfTestStateChangeAction.java
@@ -1,9 +1,7 @@
package com.hz.pm.api.common.statemachine.action;
-import cn.hutool.core.lang.Assert;
import com.hz.pm.api.common.statemachine.builder.impl.SelfTestStateMachineBuilderImpl;
import com.hz.pm.api.common.statemachine.event.SelfTestStateChangeEvent;
-import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectlib.model.enumeration.status.TenderSelfTestStatus;
import com.hz.pm.api.projectlib.model.enumeration.status.TenderTestValidStatus;
@@ -12,6 +10,8 @@ import org.springframework.messaging.Message;
import org.springframework.statemachine.annotation.OnTransition;
import org.springframework.statemachine.annotation.WithStateMachine;
+import static com.hz.pm.api.common.statemachine.action.TenderStateChangeActionUtil.getPurchaseInfo;
+
/**
*
* 系统自测状态机action集合类
@@ -24,12 +24,6 @@ import org.springframework.statemachine.annotation.WithStateMachine;
@WithStateMachine(id = SelfTestStateMachineBuilderImpl.MACHINE_ID)
public class SelfTestStateChangeAction {
- private Purchase getPurchaseInfo(Message message) {
- Purchase purchase = (Purchase) message.getHeaders().get(TenderStateMachineUtil.PURCHASE);
- Assert.notNull(purchase, "未获取到需要状态变更的标段信息");
- return purchase;
- }
-
@OnTransition(source = "WITHOUT_SELF_TEST_INFO", target = "SELF_TEST_INFO_AUDIT")
public void SUBMIT_SELF_TEST_INFO(Message message) {
Purchase purchase = getPurchaseInfo(message);
diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TenderStateChangeAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TenderStateChangeAction.java
index 5511d8f..b4db656 100644
--- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TenderStateChangeAction.java
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TenderStateChangeAction.java
@@ -1,9 +1,7 @@
package com.hz.pm.api.common.statemachine.action;
-import cn.hutool.core.lang.Assert;
import com.hz.pm.api.common.statemachine.builder.impl.TenderStateMachineBuilderImpl;
import com.hz.pm.api.common.statemachine.event.TenderStateChangeEvent;
-import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectlib.model.enumeration.status.TenderAdaptStatus;
import com.hz.pm.api.projectlib.model.enumeration.status.TenderMainStatus;
@@ -12,6 +10,8 @@ import org.springframework.messaging.Message;
import org.springframework.statemachine.annotation.OnTransition;
import org.springframework.statemachine.annotation.WithStateMachine;
+import static com.hz.pm.api.common.statemachine.action.TenderStateChangeActionUtil.getPurchaseInfo;
+
/**
*
* 标段状态机action集合类
@@ -24,12 +24,6 @@ import org.springframework.statemachine.annotation.WithStateMachine;
@WithStateMachine(id = TenderStateMachineBuilderImpl.MACHINE_ID)
public class TenderStateChangeAction {
- public static Purchase getPurchaseInfo(Message message) {
- Purchase purchase = (Purchase) message.getHeaders().get(TenderStateMachineUtil.PURCHASE);
- Assert.notNull(purchase, "未获取到需要状态变更的标段信息");
- return purchase;
- }
-
/**
* 填写合同信息
*
diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TenderStateChangeActionUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TenderStateChangeActionUtil.java
new file mode 100644
index 0000000..73b0895
--- /dev/null
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TenderStateChangeActionUtil.java
@@ -0,0 +1,28 @@
+package com.hz.pm.api.common.statemachine.action;
+
+import cn.hutool.core.lang.Assert;
+import com.hz.pm.api.common.statemachine.event.AbstractStateChangeEvent;
+import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil;
+import com.hz.pm.api.projectdeclared.model.entity.Purchase;
+import org.springframework.messaging.Message;
+
+/**
+ *
+ * TenderStateChangeActionUtil
+ *
+ *
+ * @author WendyYang
+ * @since 15:30 2024/8/21
+ */
+public class TenderStateChangeActionUtil {
+
+ private TenderStateChangeActionUtil() {
+ }
+
+ public static Purchase getPurchaseInfo(Message message) {
+ Purchase purchase = (Purchase) message.getHeaders().get(TenderStateMachineUtil.PURCHASE);
+ Assert.notNull(purchase, "未获取到需要状态变更的标段信息");
+ return purchase;
+ }
+
+}
diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TestValidStateChangeAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TestValidStateChangeAction.java
index cc96a8a..938e9cf 100644
--- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TestValidStateChangeAction.java
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TestValidStateChangeAction.java
@@ -1,9 +1,7 @@
package com.hz.pm.api.common.statemachine.action;
-import cn.hutool.core.lang.Assert;
import com.hz.pm.api.common.statemachine.builder.impl.TestValidStateMachineBuilderImpl;
import com.hz.pm.api.common.statemachine.event.TestValidStateChangeEvent;
-import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectlib.model.enumeration.status.TenderMainStatus;
import com.hz.pm.api.projectlib.model.enumeration.status.TenderTestValidStatus;
@@ -12,6 +10,8 @@ import org.springframework.messaging.Message;
import org.springframework.statemachine.annotation.OnTransition;
import org.springframework.statemachine.annotation.WithStateMachine;
+import static com.hz.pm.api.common.statemachine.action.TenderStateChangeActionUtil.getPurchaseInfo;
+
/**
*
* 测试验证状态机action集合类
@@ -24,12 +24,6 @@ import org.springframework.statemachine.annotation.WithStateMachine;
@WithStateMachine(id = TestValidStateMachineBuilderImpl.MACHINE_ID)
public class TestValidStateChangeAction {
- private Purchase getPurchaseInfo(Message message) {
- Purchase purchase = (Purchase) message.getHeaders().get(TenderStateMachineUtil.PURCHASE);
- Assert.notNull(purchase, "未获取到需要状态变更的标段信息");
- return purchase;
- }
-
@OnTransition(source = "WITHOUT_TEST_VALID_INFO", target = "TEST_VALID_INFO_AUDIT")
public void SUBMIT_TEST_VALID_INFO(Message message) {
Purchase purchase = getPurchaseInfo(message);
diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/XcfhxStateChangeAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/XcfhxStateChangeAction.java
index e15523c..569664e 100644
--- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/XcfhxStateChangeAction.java
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/XcfhxStateChangeAction.java
@@ -1,9 +1,7 @@
package com.hz.pm.api.common.statemachine.action;
-import cn.hutool.core.lang.Assert;
import com.hz.pm.api.common.statemachine.builder.impl.XcfhxStateMachineBuilderImpl;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
-import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectlib.model.enumeration.status.TenderXcfhxApplyStatus;
import lombok.extern.slf4j.Slf4j;
@@ -11,6 +9,8 @@ import org.springframework.messaging.Message;
import org.springframework.statemachine.annotation.OnTransition;
import org.springframework.statemachine.annotation.WithStateMachine;
+import static com.hz.pm.api.common.statemachine.action.TenderStateChangeActionUtil.getPurchaseInfo;
+
/**
*
* XcfhxStateChangeAction
@@ -23,12 +23,6 @@ import org.springframework.statemachine.annotation.WithStateMachine;
@WithStateMachine(id = XcfhxStateMachineBuilderImpl.MACHINE_ID)
public class XcfhxStateChangeAction {
- private Purchase getPurchaseInfo(Message message) {
- Purchase purchase = (Purchase) message.getHeaders().get(TenderStateMachineUtil.PURCHASE);
- Assert.notNull(purchase, "未获取到需要状态变更的标段信息");
- return purchase;
- }
-
/**
* 信创符合性申请
*
diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/TenderGuardFactory.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/TenderGuardFactory.java
index bb00188..95e7a7c 100644
--- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/TenderGuardFactory.java
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/TenderGuardFactory.java
@@ -1,6 +1,6 @@
package com.hz.pm.api.common.statemachine.factory;
-import com.hz.pm.api.common.statemachine.action.TenderStateChangeAction;
+import com.hz.pm.api.common.statemachine.action.TenderStateChangeActionUtil;
import com.hz.pm.api.common.statemachine.event.TenderStateChangeEvent;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectdeclared.model.enumerization.BidTypeEnum;
@@ -24,7 +24,7 @@ public class TenderGuardFactory {
public static class PurchaseContractRecordGuard implements Guard {
@Override
public boolean evaluate(StateContext context) {
- Purchase purchase = TenderStateChangeAction.getPurchaseInfo(context.getMessage());
+ Purchase purchase = TenderStateChangeActionUtil.getPurchaseInfo(context.getMessage());
return !BidTypeEnum.BUILD_APP.eq(purchase.getBidType());
}
}
diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectManageUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectManageUtil.java
index f6f28f0..4be5a86 100644
--- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectManageUtil.java
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectManageUtil.java
@@ -1,7 +1,9 @@
package com.hz.pm.api.projectlib.helper;
import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.spring.SpringUtil;
import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators;
+import com.hz.pm.api.user.helper.MhUnitCache;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
@@ -26,6 +28,19 @@ import java.util.Map;
*/
public class ProjectManageUtil {
+ private static volatile MhUnitCache unitCache;
+
+ private static MhUnitCache getMhUnitCache() {
+ if (unitCache == null) {
+ synchronized (ProjectManageUtil.class) {
+ if (unitCache == null) {
+ unitCache = SpringUtil.getBean(MhUnitCache.class);
+ }
+ }
+ }
+ return unitCache;
+ }
+
private ProjectManageUtil() {
}
@@ -59,7 +74,6 @@ public class ProjectManageUtil {
.like(req.getBuildOrg() != null, Project::getBuildOrgName, req.getBuildOrg())
.eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip())
- .eq(req.getBuildOrgCode() != null, Project::getBuildOrgCode, req.getBuildOrgCode())
.like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName())
.eq(req.getSuperOrgCode() != null, Project::getSuperOrgCode, req.getSuperOrgCode())
.eq(req.getIsTemporaryAugment() != null, Project::getIsTemporaryAugment, req.getIsTemporaryAugment())
@@ -72,6 +86,10 @@ public class ProjectManageUtil {
.notIn(CollUtil.isNotEmpty(req.getProjectCodes()), Project::getProjectCode, req.getProjectCodes())
.eq(req.getIsStartDeclaredProject() != null, Project::getAnnualPlanOpened, req.getIsStartDeclaredProject())
.orderByDesc(Project::getUpdateOn);
+ if (req.getBuildOrgCode() != null) {
+ List viewOrgCodes = getMhUnitCache().getViewChildIdsRecursion(req.getDeclaredUnitId());
+ query.in(Project::getBuildOrgCode, viewOrgCodes);
+ }
}
/**