Browse Source

修复立项备案产生两条数据

tags/24080901
WendyYang 7 months ago
parent
commit
7e4c576bfd
19 changed files with 506 additions and 199 deletions
  1. +1
    -45
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TenderStateChangeAction.java
  2. +76
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/XcfhxStateChangeAction.java
  3. +1
    -24
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/TenderStateMachineBuilderImpl.java
  4. +121
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/XcfhxStateMachineBuilderImpl.java
  5. +0
    -16
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/TenderStateChangeEvent.java
  6. +40
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/XcfhxStateChangeEvent.java
  7. +70
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/XcfhxStateMachineUtil.java
  8. +8
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PurchaseController.java
  9. +6
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java
  10. +48
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java
  11. +3
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Purchase.java
  12. +34
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/XcfhxListReq.java
  13. +44
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/XcfhxApplyListVO.java
  14. +0
    -5
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java
  15. +0
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TenderStatusEnum.java
  16. +44
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TenderXcfhxApplyStatusEnum.java
  17. +0
    -43
      hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/CpuController.java
  18. +0
    -46
      hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/CpuManage.java
  19. +10
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java

+ 1
- 45
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TenderStateChangeAction.java View File

@@ -67,57 +67,13 @@ public class TenderStateChangeAction {
*
* @param message \
*/
@OnTransition(source = "TO_BE_SUBMIT_FIRST_INSPECTED_INFO", target = "TO_BE_SUBMIT_XCFHX_APPLY")
@OnTransition(source = "TO_BE_SUBMIT_FIRST_INSPECTED_INFO", target = "TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY")
public void SUBMIT_FIRST_INSPECTED_FILES(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setStatus(TenderStatusEnum.TO_BE_SUBMIT_XCFHX_APPLY.getTenderStatus());
}

/**
* 信创符合性申请
*
* @param message \
*/
@OnTransition(source = "TO_BE_SUBMIT_XCFHX_APPLY", target = "ON_XCFHX_APPLY")
public void SUBMIT_XCFHX_APPLY(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setStatus(TenderStatusEnum.ON_XCFHX_APPLY.getTenderStatus());
}

/**
* 信创符合性申请通过
*
* @param message \
*/
@OnTransition(source = "ON_XCFHX_APPLY", target = "TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY")
public void XCFHX_APPLY_PASSED(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setStatus(TenderStatusEnum.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY.getTenderStatus());
}

/**
* 信创符合性申请失败
*
* @param message \
*/
@OnTransition(source = "ON_XCFHX_APPLY", target = "XCFHX_APPLY_FAILED")
public void XCFHX_APPLY_FAILED(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setStatus(TenderStatusEnum.XCFHX_APPLY_FAILED.getTenderStatus());
}

/**
* 重新提交信创符合性申请
*
* @param message \
*/
@OnTransition(source = "XCFHX_APPLY_FAILED", target = "ON_XCFHX_APPLY")
public void RESUBMIT_XCFHX_APPLY(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setStatus(TenderStatusEnum.ON_XCFHX_APPLY.getTenderStatus());
}

/**
* 终验申报
*
* @param message \


+ 76
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/XcfhxStateChangeAction.java View File

@@ -0,0 +1,76 @@
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.TenderXcfhxApplyStatusEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
import org.springframework.statemachine.annotation.OnTransition;
import org.springframework.statemachine.annotation.WithStateMachine;

/**
* <p>
* XcfhxStateChangeAction
* </p>
*
* @author WendyYang
* @since 11:40 2024/4/8
*/
@Slf4j
@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;
}

/**
* 信创符合性申请
*
* @param message \
*/
@OnTransition(source = "TO_BE_SUBMIT_XCFHX_APPLY", target = "ON_XCFHX_APPLY")
public void SUBMIT_XCFHX_APPLY(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setXcfhxApplyStatus(TenderXcfhxApplyStatusEnum.ON_XCFHX_APPLY.getCode());
}

/**
* 信创符合性申请通过
*
* @param message \
*/
@OnTransition(source = "ON_XCFHX_APPLY", target = "XCFHX_APPLY_PASSED")
public void XCFHX_APPLY_PASSED(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setXcfhxApplyStatus(TenderXcfhxApplyStatusEnum.XCFHX_APPLY_PASSED.getCode());
}

/**
* 信创符合性申请失败
*
* @param message \
*/
@OnTransition(source = "ON_XCFHX_APPLY", target = "XCFHX_APPLY_FAILED")
public void XCFHX_APPLY_FAILED(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setXcfhxApplyStatus(TenderXcfhxApplyStatusEnum.XCFHX_APPLY_FAILED.getCode());
}

/**
* 重新提交信创符合性申请
*
* @param message \
*/
@OnTransition(source = "XCFHX_APPLY_FAILED", target = "ON_XCFHX_APPLY")
public void RESUBMIT_XCFHX_APPLY(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setXcfhxApplyStatus(TenderXcfhxApplyStatusEnum.ON_XCFHX_APPLY.getCode());
}

}

+ 1
- 24
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/TenderStateMachineBuilderImpl.java View File

@@ -90,31 +90,8 @@ public class TenderStateMachineBuilderImpl implements BaseStateMachineBuilder<Pu
// 上传初验材料
.withExternal()
.source(TenderStatusEnum.TO_BE_SUBMIT_FIRST_INSPECTED_INFO)
.target(TenderStatusEnum.TO_BE_SUBMIT_XCFHX_APPLY)
.event(TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES)
.and()
// 信创符合性申请
.withExternal()
.source(TenderStatusEnum.TO_BE_SUBMIT_XCFHX_APPLY)
.target(TenderStatusEnum.ON_XCFHX_APPLY)
.event(TenderStateChangeEvent.SUBMIT_XCFHX_APPLY)
.and()// 信创符合性申请
.withExternal()
.source(TenderStatusEnum.XCFHX_APPLY_FAILED)
.target(TenderStatusEnum.ON_XCFHX_APPLY)
.event(TenderStateChangeEvent.RESUBMIT_XCFHX_APPLY)
.and()
// 信创符合性申请通过
.withExternal()
.source(TenderStatusEnum.ON_XCFHX_APPLY)
.target(TenderStatusEnum.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY)
.event(TenderStateChangeEvent.XCFHX_APPLY_PASSED)
.and()
// 信创符合性申请失败
.withExternal()
.source(TenderStatusEnum.ON_XCFHX_APPLY)
.target(TenderStatusEnum.XCFHX_APPLY_FAILED)
.event(TenderStateChangeEvent.XCFHX_APPLY_FAILED)
.event(TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES)
.and()
// 终验申报
.withExternal()


+ 121
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/XcfhxStateMachineBuilderImpl.java View File

@@ -0,0 +1,121 @@
package com.hz.pm.api.common.statemachine.builder.impl;

import com.hz.pm.api.common.statemachine.builder.BaseStateMachineBuilder;
import com.hz.pm.api.common.statemachine.event.AdaptStateChangeEvent;
import com.hz.pm.api.common.statemachine.event.TenderStateChangeEvent;
import com.hz.pm.api.common.statemachine.event.XcfhxStateChangeEvent;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectlib.model.enumeration.TenderAdaptStatusEnum;
import com.hz.pm.api.projectlib.model.enumeration.TenderStatusEnum;
import com.hz.pm.api.projectlib.model.enumeration.TenderXcfhxApplyStatusEnum;
import com.ningdatech.basic.exception.BizException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.StateMachineContext;
import org.springframework.statemachine.StateMachineException;
import org.springframework.statemachine.StateMachinePersist;
import org.springframework.statemachine.config.EnableStateMachine;
import org.springframework.statemachine.config.StateMachineBuilder;
import org.springframework.statemachine.persist.DefaultStateMachinePersister;
import org.springframework.statemachine.persist.StateMachinePersister;
import org.springframework.statemachine.support.DefaultStateMachineContext;
import org.springframework.stereotype.Component;

import java.util.EnumSet;

/**
* <p>
* 标段信创符合性申请状态机
* </p>
*
* @author WendyYang
* @since 16:38 2024/2/24
*/
@Slf4j
@Component
@EnableStateMachine(name = XcfhxStateMachineBuilderImpl.MACHINE_ID)
@RequiredArgsConstructor
public class XcfhxStateMachineBuilderImpl implements BaseStateMachineBuilder<Purchase, XcfhxStateChangeEvent, TenderXcfhxApplyStatusEnum> {

public static final String MACHINE_ID = "xcfhxStateMachine";

private final BeanFactory beanFactory;

@Override
public StateMachine<TenderXcfhxApplyStatusEnum, XcfhxStateChangeEvent> build() throws StateMachineException {
StateMachine<TenderXcfhxApplyStatusEnum, XcfhxStateChangeEvent> stateMachine = build(beanFactory);
log.info("状态机ID:{}", stateMachine.getId());
stateMachine.start();
return stateMachine;
}

@Override
public StateMachine<TenderXcfhxApplyStatusEnum, XcfhxStateChangeEvent> build(BeanFactory beanFactory) throws StateMachineException {
try {
return buildStateMachine(beanFactory);
} catch (Exception e) {
throw new StateMachineException("状态机构建失败", e);
}
}

private StateMachine<TenderXcfhxApplyStatusEnum, XcfhxStateChangeEvent> buildStateMachine(BeanFactory factory) throws Exception {
StateMachineBuilder.Builder<TenderXcfhxApplyStatusEnum, XcfhxStateChangeEvent> builder = StateMachineBuilder.builder();
builder.configureConfiguration()
.withConfiguration()
.machineId(MACHINE_ID)
.beanFactory(factory);

builder.configureStates()
.withStates()
.initial(TenderXcfhxApplyStatusEnum.TO_BE_SUBMIT_XCFHX_APPLY)
.states(EnumSet.allOf(TenderXcfhxApplyStatusEnum.class));

builder.configureTransitions()
// 信创符合性申请
.withExternal()
.source(TenderXcfhxApplyStatusEnum.TO_BE_SUBMIT_XCFHX_APPLY)
.target(TenderXcfhxApplyStatusEnum.ON_XCFHX_APPLY)
.event(XcfhxStateChangeEvent.SUBMIT_XCFHX_APPLY)
.and()// 信创符合性申请
.withExternal()
.source(TenderXcfhxApplyStatusEnum.XCFHX_APPLY_FAILED)
.target(TenderXcfhxApplyStatusEnum.ON_XCFHX_APPLY)
.event(XcfhxStateChangeEvent.RESUBMIT_XCFHX_APPLY)
.and()
// 信创符合性申请通过
.withExternal()
.source(TenderXcfhxApplyStatusEnum.ON_XCFHX_APPLY)
.target(TenderXcfhxApplyStatusEnum.XCFHX_APPLY_PASSED)
.event(XcfhxStateChangeEvent.XCFHX_APPLY_PASSED)
.and()
// 信创符合性申请失败
.withExternal()
.source(TenderXcfhxApplyStatusEnum.ON_XCFHX_APPLY)
.target(TenderXcfhxApplyStatusEnum.XCFHX_APPLY_FAILED)
.event(XcfhxStateChangeEvent.XCFHX_APPLY_FAILED)
.and();
return builder.build();
}

@Override
@Bean(name = "xcfhxStatePersister")
public StateMachinePersister<TenderXcfhxApplyStatusEnum, XcfhxStateChangeEvent, Purchase> stateMachinePersister() {
return new DefaultStateMachinePersister<>(new StateMachinePersist<TenderXcfhxApplyStatusEnum, XcfhxStateChangeEvent, Purchase>() {
@Override
public void write(StateMachineContext<TenderXcfhxApplyStatusEnum, XcfhxStateChangeEvent> context, Purchase contextObj) {
log.info("当前项目为:{}", contextObj);
}

@Override
public StateMachineContext<TenderXcfhxApplyStatusEnum, XcfhxStateChangeEvent> read(Purchase contextObj) {
TenderXcfhxApplyStatusEnum status = TenderXcfhxApplyStatusEnum.get(contextObj.getXcfhxApplyStatus())
.orElseThrow(() -> BizException.wrap("信创符合性申请状态无效"));
return new DefaultStateMachineContext<>(status, null, null, null, null, MACHINE_ID);
}
});
}

}

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

@@ -32,22 +32,6 @@ public enum TenderStateChangeEvent implements AbstractStateChangeEvent {
*/
SUBMIT_FIRST_INSPECTED_FILES(201, null, null),
/**
* 信创符合性申请
*/
SUBMIT_XCFHX_APPLY(301, null, null),
/**
* 信创符合性重新申请
*/
RESUBMIT_XCFHX_APPLY(303, null, null),
/**
* 信创符合性申请通过
*/
XCFHX_APPLY_PASSED(302, null, null),
/**
* 信创符合性申请不通过
*/
XCFHX_APPLY_FAILED(null, 302, null),
/**
* 终验申报
*/
SUBMIT_FINALLY_INSPECTED(401, null, null),


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

@@ -0,0 +1,40 @@
package com.hz.pm.api.common.statemachine.event;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
* <p>
* TenderStatusChangeEvent
* </p>
*
* @author WendyYang
* @since 00:14 2024/2/24
*/
@Getter
@AllArgsConstructor
public enum XcfhxStateChangeEvent implements AbstractStateChangeEvent {

/**
* 信创符合性申请
*/
SUBMIT_XCFHX_APPLY(301, null, null),
/**
* 信创符合性重新申请
*/
RESUBMIT_XCFHX_APPLY(303, null, null),
/**
* 信创符合性申请通过
*/
XCFHX_APPLY_PASSED(302, null, null),
/**
* 信创符合性申请不通过
*/
XCFHX_APPLY_FAILED(null, 302, null);


private final Integer passStatusCode;
private final Integer rejectStatusCode;
private final Integer withdrawStatusCode;

}

+ 70
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/XcfhxStateMachineUtil.java View File

@@ -0,0 +1,70 @@
package com.hz.pm.api.common.statemachine.util;

import com.hz.pm.api.common.statemachine.builder.impl.XcfhxStateMachineBuilderImpl;
import com.hz.pm.api.common.statemachine.event.XcfhxStateChangeEvent;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil;
import com.hz.pm.api.projectlib.entity.PurchaseStatusChange;
import com.hz.pm.api.projectlib.model.enumeration.TenderXcfhxApplyStatusEnum;
import com.hz.pm.api.projectlib.service.IPurchaseStatusChangeService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.persist.StateMachinePersister;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.function.Function;

/**
* <p>
* 标段状态机工具类
* </p>
*
* @author WendyYang
* @since 17:06 2024/2/24
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class XcfhxStateMachineUtil implements AbstractStateMachineUtil<Purchase, XcfhxStateChangeEvent> {

public static final String PURCHASE = "purchaseInfo";

//==================================================================================================================

private final XcfhxStateMachineBuilderImpl xcfhxStateMachineBuilder;
private final IPurchaseStatusChangeService purchaseStatusChangeService;

@Override
public Function<Purchase, Integer> statusFunction() {
return Purchase::getXcfhxApplyStatus;
}

@Override
public void execute(Purchase purchase, XcfhxStateChangeEvent event) throws Exception {
log.info("调用状态机前的标段状态为:{}", purchase.getStatus());
// 获取TO状态机
PurchaseStatusChange change = new PurchaseStatusChange();
change.setBeforeStatus(purchase.getXcfhxApplyStatus());
change.setEvent(event.name());
change.setBidId(purchase.getId());
change.setProjectId(purchase.getProjectId());
change.setProjectCode(ProjectIdCodeCacheUtil.get(purchase.getProjectId()));
change.setCreateOn(LocalDateTime.now());
StateMachine<TenderXcfhxApplyStatusEnum, XcfhxStateChangeEvent> stateMachine = xcfhxStateMachineBuilder.build();
Message<XcfhxStateChangeEvent> message = MessageBuilder.withPayload(event)
.setHeader(PURCHASE, purchase)
.build();
//初始化状态机
StateMachinePersister<TenderXcfhxApplyStatusEnum, XcfhxStateChangeEvent, Purchase> stateMachinePersister = xcfhxStateMachineBuilder.stateMachinePersister();
stateMachinePersister.restore(stateMachine, purchase);
stateMachine.sendEvent(message);
change.setAfterStatus(purchase.getXcfhxApplyStatus());
purchaseStatusChangeService.save(change);
log.info("调用状态机后的标段状态为:{}", purchase.getStatus());
}

}

+ 8
- 4
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PurchaseController.java View File

@@ -3,12 +3,10 @@ package com.hz.pm.api.projectdeclared.controller;
import com.hz.pm.api.common.util.ExcelDownUtil;
import com.hz.pm.api.projectdeclared.manage.PurchaseManage;
import com.hz.pm.api.projectdeclared.model.dto.PurchaseSaveDTO;
import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseNoticeReq;
import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseRecordReq;
import com.hz.pm.api.projectdeclared.model.req.TestValidInfoReq;
import com.hz.pm.api.projectdeclared.model.req.TestValidListReq;
import com.hz.pm.api.projectdeclared.model.req.*;
import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO;
import com.hz.pm.api.projectdeclared.model.vo.TestValidListVO;
import com.hz.pm.api.projectdeclared.model.vo.XcfhxApplyListVO;
import com.hz.pm.api.projectlib.model.req.ProjectListReq;
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.basic.model.PageVo;
@@ -117,4 +115,10 @@ public class PurchaseController {
purchaseManage.submitSelfTestInfo(req);
}

@GetMapping("/pageXcfhxApply")
@ApiOperation("获取信创符合性申请列表")
public PageVo<XcfhxApplyListVO> pageXcfhxApply(XcfhxListReq req) {
return purchaseManage.pageXcfhxApply(req);
}

}

+ 6
- 6
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java View File

@@ -12,6 +12,7 @@ import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil;
import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil;
import com.hz.pm.api.common.statemachine.util.XcfhxStateMachineUtil;
import com.hz.pm.api.common.util.DecimalUtil;
import com.hz.pm.api.common.util.ExcelDownUtil;
import com.hz.pm.api.common.util.ExcelExportStyle;
@@ -34,6 +35,7 @@ import com.hz.pm.api.projectlib.model.entity.ProjectInst;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum;
import com.hz.pm.api.projectlib.model.enumeration.TenderStatusEnum;
import com.hz.pm.api.projectlib.model.enumeration.TenderXcfhxApplyStatusEnum;
import com.hz.pm.api.projectlib.model.req.ProjectListReq;
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO;
import com.hz.pm.api.projectlib.model.vo.TenderListInfoVO;
@@ -92,6 +94,7 @@ public class ConstructionManage {
private final ProjectStateMachineUtil projectStateMachineUtil;
private final IProjectAnnualPaymentPlanService projectPaymentPlanService;
private final TenderStateMachineUtil tenderStateMachineUtil;
private final XcfhxStateMachineUtil xcfhxStateMachineUtil;

/**
* 待采购的-项目列表
@@ -338,9 +341,6 @@ public class ConstructionManage {
static {
PRE_INSPECTED_PURCHASE_STATUS = new ArrayList<>();
PRE_INSPECTED_PURCHASE_STATUS.add(TenderStatusEnum.TO_BE_SUBMIT_FIRST_INSPECTED_INFO);
PRE_INSPECTED_PURCHASE_STATUS.add(TenderStatusEnum.TO_BE_SUBMIT_XCFHX_APPLY);
PRE_INSPECTED_PURCHASE_STATUS.add(TenderStatusEnum.ON_XCFHX_APPLY);
PRE_INSPECTED_PURCHASE_STATUS.add(TenderStatusEnum.XCFHX_APPLY_FAILED);
}

/**
@@ -568,8 +568,8 @@ public class ConstructionManage {
@Transactional(rollbackFor = Exception.class)
public synchronized void submitXcfhxApply(XcfhxApplyReq req) {
Purchase purchase = purchaseService.getById(req.getBidId());
if (!TenderStatusEnum.TO_BE_SUBMIT_XCFHX_APPLY.eq(purchase.getStatus())
&& !TenderStatusEnum.XCFHX_APPLY_FAILED.eq(purchase.getStatus())) {
if (!TenderXcfhxApplyStatusEnum.TO_BE_SUBMIT_XCFHX_APPLY.eq(purchase.getXcfhxApplyStatus())
&& !TenderXcfhxApplyStatusEnum.XCFHX_APPLY_FAILED.eq(purchase.getXcfhxApplyStatus())) {
throw BizException.wrap("该标段不支持提交信创符合性申请");
}

@@ -600,7 +600,7 @@ public class ConstructionManage {
purchase.setMatchXcfhx(req.getMatchXcfhx());
purchase.setXcfhxApplyRemark(req.getXcfhxApplyRemark());
purchase.setXcfhxReportFiles(req.getXcfhxReportFiles());
tenderStateMachineUtil.pass(purchase);
xcfhxStateMachineUtil.pass(purchase);
purchaseService.updateById(purchase);

PurchaseInst purchaseInst = new PurchaseInst();


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

@@ -38,13 +38,11 @@ import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectdeclared.model.entity.PurchaseInst;
import com.hz.pm.api.projectdeclared.model.enumerization.BidTypeEnum;
import com.hz.pm.api.projectdeclared.model.enumerization.PurchaseScopeEnum;
import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseNoticeReq;
import com.hz.pm.api.projectdeclared.model.req.*;
import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseNoticeReq.PurchaseNoticeTenderDTO;
import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseRecordReq;
import com.hz.pm.api.projectdeclared.model.req.TestValidInfoReq;
import com.hz.pm.api.projectdeclared.model.req.TestValidListReq;
import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO;
import com.hz.pm.api.projectdeclared.model.vo.TestValidListVO;
import com.hz.pm.api.projectdeclared.model.vo.XcfhxApplyListVO;
import com.hz.pm.api.projectdeclared.service.IContractService;
import com.hz.pm.api.projectdeclared.service.IOperationService;
import com.hz.pm.api.projectdeclared.service.IPurchaseInstService;
@@ -74,7 +72,6 @@ import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.file.entity.File;
import com.ningdatech.file.entity.vo.result.FileResultVO;
import com.ningdatech.file.service.FileService;
import com.sun.org.apache.xpath.internal.operations.Bool;
import com.wflow.bean.entity.WflowModels;
import com.wflow.exception.BusinessException;
import com.wflow.workflow.bean.dto.OrgInfoDTO;
@@ -83,7 +80,6 @@ import com.wflow.workflow.service.ProcessInstanceService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@@ -381,6 +377,7 @@ public class PurchaseManage {
purchase.setTestValidStatus(TenderTestValidStatusEnum.WITHOUT_TEST_VALID_INFO.getCode());
purchase.setAdaptStatus(TenderAdaptStatusEnum.WITHOUT_ADAPT_INFO.getCode());
purchase.setStatus(TenderStatusEnum.TO_BE_SUBMIT_PURCHASE_INFO.getTenderStatus());
purchase.setXcfhxApplyStatus(TenderXcfhxApplyStatusEnum.TO_BE_SUBMIT_XCFHX_APPLY.getCode());
if (Boolean.TRUE.equals(mhPurchaseNoticeOpen)) {
notices.add(buildPurchaseNotice(w, user));
}
@@ -710,4 +707,49 @@ public class PurchaseManage {
}
}

public PageVo<XcfhxApplyListVO> pageXcfhxApply(XcfhxListReq req) {
LambdaQueryWrapper<Purchase> query = Wrappers.lambdaQuery(Purchase.class)
.like(StrUtil.isNotBlank(req.getBidName()), Purchase::getBidName, req.getBidName())
.le(req.getCreateOnMax() != null, Purchase::getCreateOn, req.getCreateOnMax())
.ge(req.getCreateOnMin() != null, Purchase::getCreateOn, req.getCreateOnMin())
.eq(req.getStatus() != null, Purchase::getXcfhxApplyStatus, req.getStatus())
.orderByDesc(Purchase::getCreateOn);
if (Boolean.TRUE.equals(req.getFinished())) {
query.eq(Purchase::getXcfhxApplyStatus, TenderXcfhxApplyStatusEnum.XCFHX_APPLY_PASSED.getCode());
} else {
query.ne(Purchase::getXcfhxApplyStatus, TenderXcfhxApplyStatusEnum.XCFHX_APPLY_PASSED.getCode());
}
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
if (!buildPurchaseQueryPermission(query, user)) {
return PageVo.empty();
}
Page<Purchase> page = purchaseService.page(req.page(), query);
if (page.getTotal() == 0) {
return PageVo.empty();
}
List<Purchase> records = page.getRecords();
Set<Long> projectIds = CollUtils.fieldSet(records, Purchase::getProjectId);
List<Project> projects = projectService.listByIds(projectIds);
Map<Long, Project> projectMap = CollUtils.listToMap(projects, Project::getId);
Map<Long, Contract> contractMap = contractService.listByProjectIds(projectIds);
List<XcfhxApplyListVO> data = records.stream().map(w -> {
Project project = projectMap.get(w.getProjectId());
XcfhxApplyListVO item = XcfhxApplyListVO.builder()
.bidId(w.getId())
.bizName(w.getBidName())
.status(w.getXcfhxApplyStatus())
.projectId(w.getProjectId())
.projectCode(project.getProjectCode())
.projectName(project.getProjectName())
.createOn(w.getCreateOn())
.build();
Contract contract = contractMap.get(w.getId());
if (contract != null) {
item.setContractAmount(contract.getTotalAmount());
}
return item;
}).collect(Collectors.toList());
return PageVo.of(data, page.getTotal());
}

}

+ 3
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Purchase.java View File

@@ -155,4 +155,7 @@ public class Purchase {
@ApiModelProperty("测试验证状态")
private Integer testValidStatus;

@ApiModelProperty("信创符合性申请状态")
private Integer xcfhxApplyStatus;

}

+ 34
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/XcfhxListReq.java View File

@@ -0,0 +1,34 @@
package com.hz.pm.api.projectdeclared.model.req;

import com.ningdatech.basic.model.PagePo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

/**
* <p>
* XcfhxListReq
* </p>
*
* @author WendyYang
* @since 14:49 2024/3/27
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class XcfhxListReq extends PagePo {

private String bidName;

private Integer status;

@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createOnMin;

@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createOnMax;

private Boolean finished;

}

+ 44
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/XcfhxApplyListVO.java View File

@@ -0,0 +1,44 @@
package com.hz.pm.api.projectdeclared.model.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
* <p>
* TestValidListVO
* </p>
*
* @author WendyYang
* @since 14:43 2024/3/27
*/
@Data
@Builder
public class XcfhxApplyListVO {

@ApiModelProperty("标段ID")
private Long bidId;

@ApiModelProperty("标段名称")
private String bizName;

@ApiModelProperty("项目名称")
private String projectName;

@ApiModelProperty("合同金额")
private BigDecimal contractAmount;

@ApiModelProperty("状态")
private Integer status;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

private Long projectId;

private String projectCode;

}

+ 0
- 5
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java View File

@@ -300,11 +300,6 @@ public class DeclaredRecordManage {
projectInfo.setSuperOrg(user.getMhUnitName());
}

//如果是重新提交的话 判断下 项目是否存在
if (Objects.nonNull(projectInfo.getId())) {
//新申报的项目不允许带项目id
projectInfo.setId(null);
}
ProjectProcessStageEnum instType = ProjectProcessStageEnum.PROJECT_RECORD_APPROVAL_PROCESS;
WflowModels model = processModelManage.getWflowModels(instType, user.getMhUnitId());
if (Objects.isNull(model)) {


+ 0
- 3
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TenderStatusEnum.java View File

@@ -23,9 +23,6 @@ public enum TenderStatusEnum {
TO_BE_SUBMIT_CONSTRUCTION_INFO(ProjectStatusEnum.ON_PURCHASING, 102, "待填写合同信息"),
TO_BE_SUBMIT_OPERATION_PLAN(ProjectStatusEnum.ON_PURCHASING, 103, "待填写实施计划"),
TO_BE_SUBMIT_FIRST_INSPECTED_INFO(ProjectStatusEnum.TO_BE_FIRST_INSPECTED, 201, "待上传初验材料"),
TO_BE_SUBMIT_XCFHX_APPLY(ProjectStatusEnum.ON_FIRST_INSPECTED, 301, "待信创符合性申请"),
ON_XCFHX_APPLY(ProjectStatusEnum.ON_FIRST_INSPECTED, 302, "信创符合性申请中"),
XCFHX_APPLY_FAILED(ProjectStatusEnum.ON_FIRST_INSPECTED, 303, "信创符合性申请不通过"),
TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY(ProjectStatusEnum.ON_FIRST_INSPECTED, 401, "待终验申报"),
ON_FINALLY_INSPECTED_APPLY(ProjectStatusEnum.ON_FINALLY_INSPECTED, 501, "终验申报中"),
FINALLY_INSPECTED_FAILED(ProjectStatusEnum.ON_FINALLY_INSPECTED, 502, "终验申报不通过"),


+ 44
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/TenderXcfhxApplyStatusEnum.java View File

@@ -0,0 +1,44 @@
package com.hz.pm.api.projectlib.model.enumeration;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
* <p>
* 信创符合性申请状态
* </p>
*
* @author WendyYang
* @since 10:59 2024/4/8
*/
@Getter
@AllArgsConstructor
public enum TenderXcfhxApplyStatusEnum {

TO_BE_SUBMIT_XCFHX_APPLY(301, "待信创符合性申请"),
ON_XCFHX_APPLY(302, "信创符合性申请中"),
XCFHX_APPLY_FAILED(303, "信创符合性申请不通过"),
XCFHX_APPLY_PASSED(304, "信创符合性申请不通过");

private final Integer code;
private final String val;

public boolean eq(Integer code) {
return this.code.equals(code);
}

public static Optional<TenderXcfhxApplyStatusEnum> get(Integer code) {
return Arrays.stream(values())
.filter(w -> w.getCode().equals(code))
.findFirst();
}

public static String getVal(Integer code) {
return get(code).flatMap(w -> Optional.of(w.getVal())).orElse("");
}


}

+ 0
- 43
hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/CpuController.java View File

@@ -1,43 +0,0 @@
package com.hz.pm.api.sys.controller;

import com.ningdatech.log.annotation.WebLog;
import com.hz.pm.api.sys.manage.CpuManage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
* @Classname CpuController
* @Description
* @Date 2023/10/30 11:06
* @Author PoffyZhang
*/
@Slf4j
@Validated
@RestController
@RequestMapping("/api/v1/cpu")
@Api(value = "CpuController", tags = "CPU提升和关闭提升")
@RequiredArgsConstructor
public class CpuController {

private final CpuManage cpuManage;

@ApiOperation(value = "提升cpu 增加一个线程", notes = "提升cpu 增加一个线程")
@PostMapping("/high")
@WebLog("提升cpu")
public String high() {
cpuManage.high();
return "提高成功";
}

@ApiOperation(value = "关闭提升cpu", notes = "关闭提升cpu")
@PostMapping("/close")
@WebLog("关闭提升cpu")
public String close() {
cpuManage.close();
return "关闭成功";
}
}

+ 0
- 46
hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/CpuManage.java View File

@@ -1,46 +0,0 @@
package com.hz.pm.api.sys.manage;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.concurrent.*;

/**
* @Classname CpuManage
* @Description
* @Date 2023/8/7 9:25
* @Author PoffyZhang
*/
@Component
@Slf4j
public class CpuManage {
private static ExecutorService executorService = Executors.newFixedThreadPool(10);

private static volatile boolean flag = true;

public void high() {
flag = true;
executorService.execute(() -> {
while (flag) {
// 一个复杂的计算任务
long x = 123456789123456789L;
for (int j = 0; j < 10000; j++) {
if(!flag){
break;
}
x = (x * 123456789123456789L) % 123456789;
}
}
});
}

public void close(){
try{
executorService.shutdownNow();
flag = false;
executorService = Executors.newFixedThreadPool(10);
}catch (Exception e){
log.error(e.getMessage());
}
}
}

+ 10
- 1
hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java View File

@@ -103,6 +103,7 @@ public class HandlerManage {
private final SelfTestStateMachineUtil selfTestStateMachineUtil;
private final AdaptStateMachineUtil adaptStateMachineUtil;
private final TestValidStateMachineUtil testValidStateMachineUtil;
private final XcfhxStateMachineUtil xcfhxStateMachineUtil;
private final WflowHelper wflowHelper;

@Value("${spring.profiles.active}")
@@ -166,7 +167,8 @@ public class HandlerManage {
|| InstTypeEnum.APPLY_BORROW.eq(instType)
|| InstTypeEnum.TEST_VALID.eq(instType)
|| InstTypeEnum.SELF_TEST.eq(instType)
|| InstTypeEnum.ADAPTION.eq(instType)) {
|| InstTypeEnum.ADAPTION.eq(instType)
|| InstTypeEnum.XCFHX_APPLY.eq(instType)) {
switch (instTypeEnum) {
case APPLY_DELAY:
// 保存延期申请记录,更新项目建设周期和计划验收时间
@@ -179,6 +181,7 @@ public class HandlerManage {
case ADAPTION:
case SELF_TEST:
case TEST_VALID:
case XCFHX_APPLY:
purchaseOperationPassedCallback(project.getId(), instanceId, instTypeEnum);
break;
default:
@@ -253,6 +256,9 @@ public class HandlerManage {
case TEST_VALID:
testValidStateMachineUtil.pass(purchase);
break;
case XCFHX_APPLY:
xcfhxStateMachineUtil.pass(purchase);
break;
default:
throw BizException.wrap("无效的流程类型");
}
@@ -272,6 +278,9 @@ public class HandlerManage {
case TEST_VALID:
testValidStateMachineUtil.reject(purchase);
break;
case XCFHX_APPLY:
xcfhxStateMachineUtil.reject(purchase);
break;
default:
throw BizException.wrap("无效的流程类型");
}


Loading…
Cancel
Save