Quellcode durchsuchen

状态机增加监听,根据项目状态获取对应事件

master
CMM vor 1 Jahr
Ursprung
Commit
36bc648535
8 geänderte Dateien mit 437 neuen und 9 gelöschten Zeilen
  1. +11
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java
  2. +277
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/vo/ProjectDeclaredDetailVO.java
  3. +58
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/vo/ProjectDeclaredListItemVO.java
  4. +19
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java
  5. +0
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enums/ProjectStatusEnum.java
  6. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java
  7. +30
    -0
      pmapi/src/test/java/com/ningdatech/pmapi/sys/project/DraftTest.java
  8. +40
    -0
      pmapi/src/test/java/com/ningdatech/pmapi/sys/project/ProjectStateTest.java

+ 11
- 4
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java Datei anzeigen

@@ -4,9 +4,10 @@ import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.projectdeclared.entity.dto.DeclaredProjectDto;
import com.ningdatech.pmapi.projectdeclared.entity.dto.DeclaredProjectListParamDto;
import com.ningdatech.pmapi.projectdeclared.entity.dto.ProjectDraftSaveDto;
import com.ningdatech.pmapi.projectdeclared.entity.vo.ProjectDeclaredDetailVO;
import com.ningdatech.pmapi.projectdeclared.entity.vo.ProjectDeclaredListItemVO;
import com.ningdatech.pmapi.projectdeclared.entity.vo.ProjectDraftVo;
import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
@@ -31,10 +32,16 @@ public class DeclaredProjectController {

@ApiOperation(value = "申报项目已申报列表", notes = "申报项目已申报列表")
@GetMapping("/list")
public PageVo<ProjectLibListItemVO> list(@Validated @ModelAttribute DeclaredProjectListParamDto params) {;
public PageVo<ProjectDeclaredListItemVO> list(@Validated @ModelAttribute DeclaredProjectListParamDto params) {;
return declaredProjectManage.page(params);
}

@ApiOperation(value = "申报项目已申报项目", notes = "申报项目已申报项目")
@GetMapping("/{id}")
public ProjectDeclaredDetailVO detail(@PathVariable Long id) {;
return declaredProjectManage.detail(id);
}

@ApiOperation(value = "申报项目草稿箱列表", notes = "申报项目草稿箱列表")
@GetMapping("/draft")
public PageVo<ProjectDraftVo> draft(@Validated @ModelAttribute DeclaredProjectListParamDto params) {
@@ -42,8 +49,8 @@ public class DeclaredProjectController {
}

@ApiOperation(value = "申报项目草稿箱详情", notes = "申报项目草稿箱详情")
@GetMapping("/draft-detail/{id}")
public ProjectDraftVo draftDatail(@PathVariable Long id) {
@GetMapping("/draft/{id}")
public ProjectDraftVo draft(@PathVariable Long id) {
return declaredProjectManage.draftDatail(id);
}



+ 277
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/vo/ProjectDeclaredDetailVO.java Datei anzeigen

@@ -0,0 +1,277 @@
package com.ningdatech.pmapi.projectdeclared.entity.vo;

import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
* <p>
* ProjectLibListItemVO
* </p>
*
* @author WendyYang
* @since 15:13 2023/2/1
*/
@Data
@ApiModel("申报项目列表视图")
public class ProjectDeclaredDetailVO {

@ApiModelProperty("应用ID 新增为空")
private Long id;

@ApiModelProperty("所属地区编号")
private String areaCode;

@ApiModelProperty("所属地区名称")
private String area;

@ApiModelProperty("项目阶段")
private Integer stage;

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

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

@ApiModelProperty("是否临时增补 0:否 1:是")
private Integer isTemporaryAugment;

@ApiModelProperty("项目负责人")
private String responsibleMan;

@ApiModelProperty("负责人手机号码")
private String responsibleManMobile;

@ApiModelProperty("项目联系人")
private String contactName;

@ApiModelProperty("项目联系人手机号码")
private String contactPhone;

@ApiModelProperty("建设单位名称")
private String buildUnitName;

@ApiModelProperty("建设单位统一社会信用代码")
private String buildUnitCode;

@ApiModelProperty("建设单位浙政钉ID")
private String buildUnitZheJiangGovernmentDingId;

@ApiModelProperty("项目类型 1:建设 2:运维")
private Integer projectType;

@ApiModelProperty("是否首次新建 0:否 1:是")
private Integer isFirst;

@ApiModelProperty("项目预算年度")
private Integer projectYear;

@ApiModelProperty("项目建设起始时间")
private String beginTime;

@ApiModelProperty("项目建设终止时间")
private String endTime;

@ApiModelProperty("四大体系 1:业务应用 2:应用支撑 3:数据资源 4:基础设施")
private Integer fourSystems;

@ApiModelProperty("是否数字化改革项目 0:否 1:是")
private Integer isDigitalReform;

@ApiModelProperty("综合业务领域")
private String bizDomain;

@ApiModelProperty("建设层级 1:国家级 2:省级 3:省本级 4:市级 5:市本级 6:区县 7乡镇")
private Integer buildLevel;

@ApiModelProperty("立项依据")
private String buildBasis;

@ApiModelProperty("发改编码")
private String developCode;

@ApiModelProperty("财政编码")
private String financialCode;

@ApiModelProperty("是否上云 0:否 1:是")
private Integer isCloud;

private String cloudType;

@ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级")
private Integer protectionLevel;

@ApiModelProperty("是否密评 0:否 1:是")
private Integer isSecretComments;

@ApiModelProperty("项目简介")
private String projectIntroduction;

@ApiModelProperty("资金申报情况-申报金额(万元)")
private BigDecimal declareAmount;

@ApiModelProperty("资金申报情况-自有金额(万元)")
private BigDecimal declareHaveAmount;

@ApiModelProperty("资金申报情况-政府投资-本级财政资金(万元)")
private BigDecimal declareGovernmentOwnFinanceAmount;

@ApiModelProperty("资金申报情况-政府投资-上级补助资金(万元)")
private BigDecimal declareGovernmentSuperiorFinanceAmount;

@ApiModelProperty("银行贷款(万元)")
private BigDecimal declareBankLendingAmount;

@ApiModelProperty("其它资金(万元)")
private BigDecimal declareOtherAmount;

@ApiModelProperty("资金分配情况-软件开发(万元)")
private BigDecimal softwareDevelopmentAmount;

@ApiModelProperty("资金分配情况-云资源、硬件购置(万元)")
private BigDecimal cloudHardwarePurchaseAmount;

@ApiModelProperty("资金分配情况-第三方服务(万元)")
private BigDecimal thirdPartyAmount;

@ApiModelProperty("年度支付计划-年度支付计划(万元)")
private BigDecimal annualPlanAmount;

@ApiModelProperty("年度支付计划-自有金额(万元)")
private BigDecimal annualPlanHaveAmount;

@ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)")
private BigDecimal annualPlanGovernmentOwnFinanceAmount;

@ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)")
private BigDecimal annualPlanGovernmentSuperiorFinanceAmount;

@ApiModelProperty("年度支付计划-银行贷款(万元)")
private BigDecimal annualPlanBankLendingAmount;

@ApiModelProperty("年度支付计划-其它资金(万元)")
private BigDecimal annualPlanOtherAmount;

@ApiModelProperty("立项批复资金(万元)")
private BigDecimal approvalAmount;

private LocalDateTime annualPlanAddTime;

@ApiModelProperty("核心业务-核心业务模块")
private String coreBusiness;

@ApiModelProperty("安全投入-投入项")
private String safetyInputTitle;

@ApiModelProperty("安全投入-内容描述")
private String safetyInputDescribe;

@ApiModelProperty("安全投入-金额(万元)")
private BigDecimal safetyInputAmount;

@ApiModelProperty("附件-初步方案")
private String preliminaryPlanFile;

@ApiModelProperty("附件-佐证材料")
private String supportingMaterialsFile;

@ApiModelProperty("附件-项目总投资测算明细")
private String calculationTotalInvestmentFile;

@ApiModelProperty("附件-申报单位主要职责(单位三定方案)")
private String mainResponsibilitiesApplicantFile;

@ApiModelProperty("备注")
private String projectRemarks;

@ApiModelProperty("是否包含应用 0:否 1:是")
private Integer includeApplication;

@ApiModelProperty("工程形象进度-第一季度")
private String engineeringSpeedOne;

@ApiModelProperty("工程形象进度-第二季度")
private String engineeringSpeedTwo;

@ApiModelProperty("工程形象进度-第三季度")
private String engineeringSpeedThree;

@ApiModelProperty("工程形象进度-第四季度")
private String engineeringSpeedFour;

@ApiModelProperty("核心业务-是否开启核心业务模块 false:关闭 true:开启")
private Boolean isOpenCoreBusiness;

@ApiModelProperty("安全投入-是否开启安全投入模块 false:关闭 true:开启")
private Boolean isOpenSafetyInput;

@ApiModelProperty("工程形象进度-是否开启 false:关闭 true:开启")
private Boolean isEngineeringSpeed;

@ApiModelProperty("附件-是否开启 false:关闭 true:开启")
private Boolean isAccessories;

@ApiModelProperty("备注-是否开启 false:关闭 true:开启")
private Boolean isRemarks;

@ApiModelProperty("年度支付计划-是否开启 false:关闭 true:开启")
private Boolean isAnnualPlanAmount;

@ApiModelProperty("一地创新全省共享项目-是否开启 false:关闭 true:开启")
private Boolean isInnovateWholeProvinceShare;

@ApiModelProperty("安全投入-模块信息")
private String safetyInputModular;

@ApiModelProperty("项目申报pdf")
private String projectPdf;

@ApiModelProperty("立项申报pdf")
private String declarationPdf;

@ApiModelProperty("建设周期(月)")
private String buildCycle;

@ApiModelProperty("建设方案文件")
private String constructionPlanFile;

@ApiModelProperty("立项批复文件")
private String approvedFile;

@ApiModelProperty("批复金额")
private BigDecimal approvedTotalInvestmentIncrease;

@ApiModelProperty("上级主管部门")
private String higherSuperUnit;

@ApiModelProperty("上级主管部门Code")
private String higherSuperUnitCode;

@ApiModelProperty("主管部门名称")
private String superUnit;

@ApiModelProperty("主管部门Code")
private String superUnitCode;

@ApiModelProperty("前端所需验证字段")
private Integer allApplicationsDone;

@ApiModelProperty("项目一级状态 10000 20000 30000")
private Integer projectStatusFirst;

@ApiModelProperty("项目二级状态")
private Integer projectStatusSecond;

@ApiModelProperty("项目应用")
private List<ProjectApplication> projectApplications;

@ApiModelProperty("新增form内容")
private String formData;

}

+ 58
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/vo/ProjectDeclaredListItemVO.java Datei anzeigen

@@ -0,0 +1,58 @@
package com.ningdatech.pmapi.projectdeclared.entity.vo;

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

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

/**
* <p>
* ProjectLibListItemVO
* </p>
*
* @author WendyYang
* @since 15:13 2023/2/1
*/
@Data
@ApiModel("申报项目列表视图")
public class ProjectDeclaredListItemVO {

@ApiModelProperty("项目ID")
private Long id;

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

@ApiModelProperty("申报金额")
private BigDecimal declaredAmount;

@ApiModelProperty("批复金额")
private BigDecimal approvedAmount;

@ApiModelProperty("项目类型")
private Integer projectType;

@ApiModelProperty("项目状态1")
private Integer projectStatusFirst;

@ApiModelProperty("项目状态")
private Integer projectStatusSecond;

@ApiModelProperty("申报年度")
private Integer projectYear;

@ApiModelProperty("申报单位")
private String buildUnit;

@ApiModelProperty("业务领域")
private String bizDomain;

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

@ApiModelProperty("修改时间")
private LocalDateTime updateOn;

}

+ 19
- 4
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java Datei anzeigen

@@ -10,11 +10,14 @@ import com.ningdatech.pmapi.projectdeclared.entity.ProjectDraft;
import com.ningdatech.pmapi.projectdeclared.entity.dto.DeclaredProjectDto;
import com.ningdatech.pmapi.projectdeclared.entity.dto.DeclaredProjectListParamDto;
import com.ningdatech.pmapi.projectdeclared.entity.dto.ProjectDraftSaveDto;
import com.ningdatech.pmapi.projectdeclared.entity.vo.ProjectDeclaredDetailVO;
import com.ningdatech.pmapi.projectdeclared.entity.vo.ProjectDeclaredListItemVO;
import com.ningdatech.pmapi.projectdeclared.entity.vo.ProjectDraftVo;
import com.ningdatech.pmapi.projectdeclared.service.IProjectDraftService;
import com.ningdatech.pmapi.projectlib.enums.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.wflow.bean.entity.WflowModels;
import com.wflow.exception.BusinessException;
@@ -48,13 +51,15 @@ public class DeclaredProjectManage {

private final IProjectService projectService;

private final IProjectApplicationService projectApplicationService;

private final IProjectDraftService projectDraftService;

private final ProcessInstanceService processService;

private final ProcessModelService processModelService;

public PageVo<ProjectLibListItemVO> page(DeclaredProjectListParamDto params) {
public PageVo<ProjectDeclaredListItemVO> page(DeclaredProjectListParamDto params) {
Page<Project> page = params.page();
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class)
.ge(Objects.nonNull(params.getStartTime()), Project::getCreateOn, params.getStartTime())
@@ -69,14 +74,24 @@ public class DeclaredProjectManage {
if(0L == page.getTotal()){
return PageVo.empty();
}
List<ProjectLibListItemVO> res = page.getRecords().stream().map(record -> {
ProjectLibListItemVO vo = new ProjectLibListItemVO();
List<ProjectDeclaredListItemVO> res = page.getRecords().stream().map(record -> {
ProjectDeclaredListItemVO vo = new ProjectDeclaredListItemVO();
BeanUtils.copyProperties(record, vo);
return vo;
}).collect(Collectors.toList());
return PageVo.of(res,page.getTotal());
}

public ProjectDeclaredDetailVO detail(Long id) {
Project project = projectService.getById(id);
ProjectDeclaredDetailVO vo = new ProjectDeclaredDetailVO();
BeanUtils.copyProperties(project, vo);
List<ProjectApplication> projectApptions = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectId, id));
vo.setProjectApplications(projectApptions);
return vo;
}

public PageVo<ProjectDraftVo> pageDraft(DeclaredProjectListParamDto params) {
Page<ProjectDraft> page = params.page();
LambdaQueryWrapper<ProjectDraft> wrapper = Wrappers.lambdaQuery(ProjectDraft.class)


+ 0
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enums/ProjectStatusEnum.java Datei anzeigen

@@ -3,7 +3,6 @@ package com.ningdatech.pmapi.projectlib.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.EnumUtils;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;


+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java Datei anzeigen

@@ -7,6 +7,7 @@ import java.io.Serializable;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* <p>
@@ -18,6 +19,7 @@ import io.swagger.annotations.ApiModelProperty;
*/
@TableName("nd_project_application")
@ApiModel(value = "NdProjectApplication对象", description = "")
@Data
public class ProjectApplication implements Serializable {

private static final long serialVersionUID = 1L;


+ 30
- 0
pmapi/src/test/java/com/ningdatech/pmapi/sys/project/DraftTest.java Datei anzeigen

@@ -0,0 +1,30 @@
package com.ningdatech.pmapi.sys.project;

import com.alibaba.fastjson.JSON;
import com.ningdatech.pmapi.AppTests;
import com.ningdatech.pmapi.projectdeclared.entity.ProjectDraft;
import com.ningdatech.pmapi.projectdeclared.service.IProjectDraftService;
import org.junit.Test;

import javax.annotation.Resource;

/**
* @Classname DraftTest
* @Description
* @Date 2023/2/7 10:56
* @Author PoffyZhang
*/
public class DraftTest extends AppTests {

@Resource
private IProjectDraftService projectDraftService;

@Test
public void one(){

ProjectDraft byId = projectDraftService.getById(1);

System.out.println(JSON.toJSONString(byId));
}

}

+ 40
- 0
pmapi/src/test/java/com/ningdatech/pmapi/sys/project/ProjectStateTest.java Datei anzeigen

@@ -0,0 +1,40 @@
package com.ningdatech.pmapi.sys.project;

import cn.hutool.core.date.StopWatch;
import com.ningdatech.pmapi.AppTests;
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.projectlib.enums.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import org.junit.Test;

import javax.annotation.Resource;

/**
* @Classname ProjectStateTest
* @Description
* @Date 2023/2/8 11:12
* @Author PoffyZhang
*/
public class ProjectStateTest extends AppTests {

@Resource
private StateMachineUtils stateMachineUtils;

@Test
public void execute() throws Exception {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
System.out.println("调用状态机开始");

Project project = new Project();
project.setInstCode("1");
project.setId(1L);
project.setProjectStatusFirst(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setProjectStatusSecond(ProjectStatusEnum.NOT_APPROVED.getCode());
stateMachineUtils.execute(project, ProjectStatusChangeEvent.PROJECT_APPLICATION_SUBMIT);

stopWatch.stop();
System.out.println("调用状态机结束 :" + stopWatch.getTotalTimeSeconds());
}
}

Laden…
Abbrechen
Speichern