@@ -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; | |||
/** | |||
* <p> | |||
* 测试验证状态机action集合类 | |||
@@ -24,12 +24,6 @@ import org.springframework.statemachine.annotation.WithStateMachine; | |||
@WithStateMachine(id = AdaptStateMachineBuilderImpl.MACHINE_ID) | |||
public class AdaptStateChangeAction { | |||
private Purchase getPurchaseInfo(Message<AdaptStateChangeEvent> 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<AdaptStateChangeEvent> message) { | |||
Purchase purchase = getPurchaseInfo(message); | |||
@@ -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; | |||
/** | |||
* <p> | |||
* 系统自测状态机action集合类 | |||
@@ -24,12 +24,6 @@ import org.springframework.statemachine.annotation.WithStateMachine; | |||
@WithStateMachine(id = SelfTestStateMachineBuilderImpl.MACHINE_ID) | |||
public class SelfTestStateChangeAction { | |||
private Purchase getPurchaseInfo(Message<SelfTestStateChangeEvent> 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<SelfTestStateChangeEvent> message) { | |||
Purchase purchase = getPurchaseInfo(message); | |||
@@ -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; | |||
/** | |||
* <p> | |||
* 标段状态机action集合类 | |||
@@ -24,12 +24,6 @@ import org.springframework.statemachine.annotation.WithStateMachine; | |||
@WithStateMachine(id = TenderStateMachineBuilderImpl.MACHINE_ID) | |||
public class TenderStateChangeAction { | |||
public static Purchase getPurchaseInfo(Message<TenderStateChangeEvent> message) { | |||
Purchase purchase = (Purchase) message.getHeaders().get(TenderStateMachineUtil.PURCHASE); | |||
Assert.notNull(purchase, "未获取到需要状态变更的标段信息"); | |||
return purchase; | |||
} | |||
/** | |||
* 填写合同信息 | |||
* | |||
@@ -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; | |||
/** | |||
* <p> | |||
* TenderStateChangeActionUtil | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 15:30 2024/8/21 | |||
*/ | |||
public class TenderStateChangeActionUtil { | |||
private TenderStateChangeActionUtil() { | |||
} | |||
public static <E extends AbstractStateChangeEvent> Purchase getPurchaseInfo(Message<E> message) { | |||
Purchase purchase = (Purchase) message.getHeaders().get(TenderStateMachineUtil.PURCHASE); | |||
Assert.notNull(purchase, "未获取到需要状态变更的标段信息"); | |||
return purchase; | |||
} | |||
} |
@@ -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; | |||
/** | |||
* <p> | |||
* 测试验证状态机action集合类 | |||
@@ -24,12 +24,6 @@ import org.springframework.statemachine.annotation.WithStateMachine; | |||
@WithStateMachine(id = TestValidStateMachineBuilderImpl.MACHINE_ID) | |||
public class TestValidStateChangeAction { | |||
private Purchase getPurchaseInfo(Message<TestValidStateChangeEvent> 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<TestValidStateChangeEvent> message) { | |||
Purchase purchase = getPurchaseInfo(message); | |||
@@ -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; | |||
/** | |||
* <p> | |||
* XcfhxStateChangeAction | |||
@@ -23,12 +23,6 @@ import org.springframework.statemachine.annotation.WithStateMachine; | |||
@WithStateMachine(id = XcfhxStateMachineBuilderImpl.MACHINE_ID) | |||
public class XcfhxStateChangeAction { | |||
private Purchase getPurchaseInfo(Message<ProjectStateChangeEvent> message) { | |||
Purchase purchase = (Purchase) message.getHeaders().get(TenderStateMachineUtil.PURCHASE); | |||
Assert.notNull(purchase, "未获取到需要状态变更的标段信息"); | |||
return purchase; | |||
} | |||
/** | |||
* 信创符合性申请 | |||
* | |||
@@ -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<ITenderStatus, TenderStateChangeEvent> { | |||
@Override | |||
public boolean evaluate(StateContext<ITenderStatus, TenderStateChangeEvent> context) { | |||
Purchase purchase = TenderStateChangeAction.getPurchaseInfo(context.getMessage()); | |||
Purchase purchase = TenderStateChangeActionUtil.getPurchaseInfo(context.getMessage()); | |||
return !BidTypeEnum.BUILD_APP.eq(purchase.getBidType()); | |||
} | |||
} | |||
@@ -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<Long> viewOrgCodes = getMhUnitCache().getViewChildIdsRecursion(req.getDeclaredUnitId()); | |||
query.in(Project::getBuildOrgCode, viewOrgCodes); | |||
} | |||
} | |||
/** | |||