Browse Source

续建项目金额申请

tags/24080901
PoffyZhang 1 year ago
parent
commit
20b4e20900
7 changed files with 54 additions and 8 deletions
  1. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java
  2. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/event/ProjectStatusChangeEvent.java
  3. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java
  4. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectStatusEnum.java
  5. +17
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java
  6. +28
    -0
      pmapi/src/test/java/com/ningdatech/pmapi/instance/InstanceTest.java
  7. +4
    -1
      pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java View File

@@ -226,7 +226,7 @@ public class ProjectDeclareAction {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 终验审核通过后,项目一级状态变更为已归档 // 终验审核通过后,项目一级状态变更为已归档
project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); project.setStage(ProjectStatusEnum.ARCHIVED.getCode());
project.setStatus(ProjectStatusEnum.ARCHIVED.getCode());
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode());
} }


@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED")


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/event/ProjectStatusChangeEvent.java View File

@@ -105,7 +105,7 @@ public enum ProjectStatusChangeEvent {
/** /**
* 终验审核通过(项目状态变为:已归档) * 终验审核通过(项目状态变为:已归档)
*/ */
FINAL_ACCEPTANCE_PASS(null, null, null),
FINAL_ACCEPTANCE_PASS(20004, null, null),


// 下个节点还未提交审核意见时,流程发起人和前一个审核人可以点击撤回 // 下个节点还未提交审核意见时,流程发起人和前一个审核人可以点击撤回




+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java View File

@@ -81,7 +81,7 @@ public class ConstructionPlanManage {
//首先要判断 项目当前状态 是不是 方案待申报 //首先要判断 项目当前状态 是不是 方案待申报
VUtils.isTrue(!ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode().equals(projectInfo.getStatus()) || VUtils.isTrue(!ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode().equals(projectInfo.getStatus()) ||
!ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage())) !ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage()))
.throwMessage("提交失败 该项目不是 待预审状态或者未立项阶段");
.throwMessage("提交失败 该项目不是 方案待申报状态或者未立项阶段");
// TODO 再判断 该项目是否 真实走完 预审审批 // TODO 再判断 该项目是否 真实走完 预审审批


ProcessStartParamsVo params = new ProcessStartParamsVo(); ProcessStartParamsVo params = new ProcessStartParamsVo();


+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectStatusEnum.java View File

@@ -54,7 +54,8 @@ public enum ProjectStatusEnum {
/** /**
* 项目阶段:已归档 * 项目阶段:已归档
*/ */
ARCHIVED(30000, "已归档");
ARCHIVED(30000, "已归档"),
ACCEPTED(30001, "已验收");


private Integer code; private Integer code;
private String desc; private String desc;


+ 17
- 3
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java View File

@@ -1,9 +1,11 @@
package com.ningdatech.pmapi.projectlib.manage; package com.ningdatech.pmapi.projectlib.manage;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils; import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectRenewalFundDeclarationDTO; import com.ningdatech.pmapi.projectlib.model.dto.ProjectRenewalFundDeclarationDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration;
@@ -90,14 +92,26 @@ public class ProjectRenewalFundManage {
* @return * @return
*/ */
public Long declared(ProjectRenewalFundDeclarationDTO dto) { public Long declared(ProjectRenewalFundDeclarationDTO dto) {
//要判断 项目id 是否 以及状态是 已验收
Long projectId = dto.getProjectId();
Project project = projectService.getById(projectId);
VUtils.isTrue(Objects.isNull(project)).throwMessage(String.format("关联的项目【%s】不存在 提交失败!",projectId));
VUtils.isTrue(!ProjectStatusEnum.ACCEPTED.getCode().equals(project.getStatus()) ||
!ProjectStatusEnum.ARCHIVED.getCode().equals(project.getStage()))
.throwMessage("提交失败 该项目不是 已验收状态或者已归档阶段");
ProjectRenewalFundDeclaration declaration = new ProjectRenewalFundDeclaration(); ProjectRenewalFundDeclaration declaration = new ProjectRenewalFundDeclaration();
//如果是重新申报
if(Objects.nonNull(dto.getId())){
ProjectRenewalFundDeclaration oldDeclaration = projectRenewalFundDeclarationService.getById(dto.getId());
VUtils.isTrue(Objects.isNull(oldDeclaration)).throwMessage(String.format("重新申报失败 【%s】 该申报不存在!",dto.getId()));
BeanUtils.copyProperties(oldDeclaration,declaration);
}
BeanUtils.copyProperties(dto,declaration); BeanUtils.copyProperties(dto,declaration);
declaration.setId(null);
declaration.setCreateOn(LocalDateTime.now()); declaration.setCreateOn(LocalDateTime.now());
declaration.setUpdateOn(LocalDateTime.now()); declaration.setUpdateOn(LocalDateTime.now());
declaration.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PENDING.name()); declaration.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PENDING.name());
if(!projectRenewalFundDeclarationService.save(declaration)){
throw new BusinessException("申报失败");
if(!projectRenewalFundDeclarationService.saveOrUpdate(declaration)){
throw new BusinessException(String.format("申报失败 【%s】",dto.getId()));
} }
return declaration.getId(); return declaration.getId();
} }


+ 28
- 0
pmapi/src/test/java/com/ningdatech/pmapi/instance/InstanceTest.java View File

@@ -0,0 +1,28 @@
package com.ningdatech.pmapi.instance;

import com.alibaba.fastjson.JSON;
import com.ningdatech.pmapi.AppTests;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import org.flowable.engine.RuntimeService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

/**
* @Classname InstanceTest
* @Description
* @Date 2023/2/16 14:44
* @Author PoffyZhang
*/
public class InstanceTest extends AppTests {

@Autowired
private RuntimeService runtimeService;

@Test
public void test(){
String instanceId = "896fa188-96d8-11ed-9539-e2d4e8f16b2f";
Object user = runtimeService.getVariable(instanceId,
"owner");
System.out.println(JSON.toJSONString(user));
}
}

+ 4
- 1
pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java View File

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.statemachine; package com.ningdatech.pmapi.statemachine;


import com.alibaba.fastjson.JSON;
import com.ningdatech.pmapi.AppTests; import com.ningdatech.pmapi.AppTests;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent;
@@ -24,9 +25,11 @@ public class StateMachineTest extends AppTests {
@Test @Test
public void stateMachineTest() throws Exception { public void stateMachineTest() throws Exception {
Project project = new Project(); Project project = new Project();
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode());
project.setDeclareAmount(BigDecimal.valueOf(2000)); project.setDeclareAmount(BigDecimal.valueOf(2000));
// stateMachineUtils.execute(project, ProjectStatusChangeEvent.UNDER_INTERNAL_PASS); // stateMachineUtils.execute(project, ProjectStatusChangeEvent.UNDER_INTERNAL_PASS);
stateMachineUtils.execute(project, stateMachineUtils.getProjectStatusPassEvent(project.getStatus())); stateMachineUtils.execute(project, stateMachineUtils.getProjectStatusPassEvent(project.getStatus()));
System.out.println(String.format("project:%s", JSON.toJSONString(project)));
} }
} }

Loading…
Cancel
Save