From 2b4a70e743b4485620163766fa6ac706a6fb64d5 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 13 Feb 2023 15:10:31 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E5=AE=A1=E9=A1=B9=E7=9B=AE=20?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ConstructionPlanController.java | 50 +++ .../controller/DeclaredProjectController.java | 6 +- .../PrequalificationDeclaredController.java | 2 +- .../pmapi/projectdeclared/entity/ProjectDraft.java | 3 + .../entity/dto/ConstructionPlanDto.java | 45 +++ .../entity/dto/DeclaredProjectListParamDto.java | 2 + .../entity/dto/ProjectDraftSaveDto.java | 378 +-------------------- .../manage/ConstructionPlanManage.java | 132 +++++++ .../manage/DeclaredProjectManage.java | 5 +- .../pmapi/sys/project/ProjectStateTest.java | 5 +- 10 files changed, 248 insertions(+), 380 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionPlanController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/ConstructionPlanDto.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionPlanController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionPlanController.java new file mode 100644 index 0000000..8c3dbda --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionPlanController.java @@ -0,0 +1,50 @@ +package com.ningdatech.pmapi.projectdeclared.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.pmapi.projectdeclared.entity.dto.ConstructionPlanDto; +import com.ningdatech.pmapi.projectdeclared.manage.ConstructionPlanManage; +import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; +import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; +import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; +import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; +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 ConstructionPlanController + * @Description 建设方案申报 + * @Date 2023/2/13 9:53 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/construction") +@Api(value = "ConstructionPlan", tags = "申报管理-建设方案申报") +@RequiredArgsConstructor +public class ConstructionPlanController { + + private final ConstructionPlanManage constructionPlanManage; + + private final ProjectLibManage projectLibManage; + + @ApiOperation(value = "可申报建设方案项目列表", notes = "可申报建设方案项目列表") + @GetMapping("/list") + public PageVo list(@Validated @ModelAttribute ProjectListReq req) { + //项目阶段 状态 已定 待预审 + req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + req.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + return projectLibManage.projectLibList(req); + } + + @ApiOperation(value = "建设方案申报", notes = "建设方案申报") + @PostMapping("/start") + public String startTheProcess(@Validated @RequestBody ConstructionPlanDto dto) { + String instanceId = constructionPlanManage.startTheProcess(dto); + return "建设方案申报 【" + instanceId + "】 成功"; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java index 21c631f..67bfd0a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java @@ -1,17 +1,13 @@ package com.ningdatech.pmapi.projectdeclared.controller; -import com.ningdatech.basic.model.ApiResponse; 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.manage.ProjectLibManage; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -65,6 +61,6 @@ public class DeclaredProjectController { @PostMapping("/start") public String startTheProcess(@Validated @RequestBody DeclaredProjectDto dto) { String instanceId = declaredProjectManage.startTheProcess(dto); - return "启动流程实例 " + instanceId + " 成功"; + return "启动流程实例 【" + instanceId + "】 成功"; } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PrequalificationDeclaredController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PrequalificationDeclaredController.java index 8d6d249..c05225f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PrequalificationDeclaredController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PrequalificationDeclaredController.java @@ -45,6 +45,6 @@ public class PrequalificationDeclaredController { @PostMapping("/start") public String startTheProcess(@Validated @RequestBody PreDeclaredProjectDto dto) { String instanceId = prequalificationDeclaredProjectManage.startTheProcess(dto); - return "提交预审 " + instanceId + " 成功"; + return "提交预审 【" + instanceId + "】 成功"; } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/ProjectDraft.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/ProjectDraft.java index a1c17b2..ea2815b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/ProjectDraft.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/ProjectDraft.java @@ -410,6 +410,9 @@ public class ProjectDraft implements Serializable { @ApiModelProperty("新增form内容") private String dynamicForm; + @ApiModelProperty("用户id") + private String userId; + private Long createBy; private Long updateBy; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/ConstructionPlanDto.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/ConstructionPlanDto.java new file mode 100644 index 0000000..86ba27c --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/ConstructionPlanDto.java @@ -0,0 +1,45 @@ +package com.ningdatech.pmapi.projectdeclared.entity.dto; + +import cn.hutool.core.collection.CollUtil; +import com.google.common.collect.Maps; +import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Map; + +/** + * @Classname DeclaredProjectDto + * @Description 申报项目 + * @Date 2023/2/1 14:52 + * @Author PoffyZhang + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ConstructionPlanDto implements Serializable { + + @NotNull + private Long projectId; + + //建设方案文件 + private String constructionPlanFile; + + private Map formData; + + @NotNull + private ProcessInstanceUserDto user; + + public Map getFormData(){ + if(CollUtil.isEmpty(this.formData)){ + this.formData = Maps.newHashMap(); + return this.formData; + } + return this.formData; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/DeclaredProjectListParamDto.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/DeclaredProjectListParamDto.java index 53178e7..32b1868 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/DeclaredProjectListParamDto.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/DeclaredProjectListParamDto.java @@ -19,6 +19,8 @@ import org.springframework.format.annotation.DateTimeFormat; @AllArgsConstructor public class DeclaredProjectListParamDto extends PagePo { + private String userId; + private String projectName; private Integer projectType; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/ProjectDraftSaveDto.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/ProjectDraftSaveDto.java index 28f1785..0fdf995 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/ProjectDraftSaveDto.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/ProjectDraftSaveDto.java @@ -1,15 +1,11 @@ package com.ningdatech.pmapi.projectdeclared.entity.dto; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.pmapi.projectlib.model.dto.ProjectDto; +import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.*; - +import javax.validation.constraints.NotNull; import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; /** *

@@ -29,370 +25,10 @@ public class ProjectDraftSaveDto implements Serializable { private static final long serialVersionUID = 1L; - @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 String applicationName; - - @ApiModelProperty("关联IRS现有应用") - private String relatedExistsApplication; - - @ApiModelProperty("关联IRS现有应用-IRS应用编码") - private String relatedExistsApplicationCode; - - @ApiModelProperty("应用类型") - private String applicationType; - - @ApiModelProperty("是否统建应用 0:否 1:是") - private Integer isUniteBuild; - - @ApiModelProperty("统建类型 1:全省统建 2:全市统建") - private Integer unionBuildKind; - - @ApiModelProperty("是否数改系统 0:否 1:是") - private Integer isDigitalModification; - - @ApiModelProperty("数改系统") - private String digitalModification; - - @ApiModelProperty("发布端") - private String publishSide; - - @ApiModelProperty("是否一本账场景应用名称 0:否 1:是") - private Integer isAccountAppName; - - @ApiModelProperty("一本账应用名称") - private String accountAppName; - - @ApiModelProperty("领域大脑一本账") - private String domainBrainAccount; - - @ApiModelProperty("是否业务协同 0:否 1:是") - private Integer isBizCooperate; - - @ApiModelProperty("业务协同描述") - private String bizCooperateInfo; - - @ApiModelProperty("使用范围") - private String usesRangeRemark; - - @ApiModelProperty("应用简介") - private String applicationSummary; - - @ApiModelProperty("应用备注") - private String applicationRemark; - - @ApiModelProperty("应用总投资测算明细-文件") - private String applicationEstimateFile; - - @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") - private Integer secrecyGrade; - - @ApiModelProperty("密码测评级别 1:一级 2:二级 3:三级 4:四级 5:五级") - private Integer passwordGrade; - - @ApiModelProperty("是否符合国家信息技术应用创新相关规范 0:否 1:是") - private Integer nationalItSpec; - - @ApiModelProperty("是否使用政务云资源 0否 1是") - private Integer useGovCloud; - - @ApiModelProperty("云资源类型") - private String cloudsType; - - @ApiModelProperty("云资源基础规格") - private String cloudsFoundationSpecifications; - - @ApiModelProperty("云资源台数") - private Integer cloudsNumber; - - @ApiModelProperty("云资源用户描述") - private String cloudsDescription; - - @ApiModelProperty("网络环境 1:政务内网 2:政务外网 3:互联网 4:业务专网 5:单机") - private Integer netEnv; - - @ApiModelProperty("是否使用公共数据 0否 1是") - private Integer useCommonData; - - @ApiModelProperty("数据名称") - private String dataName; - - @ApiModelProperty("是否使用公共组件 0否 1是") - private Integer useCommonComponent; - - @ApiModelProperty("使用的公共组件名称") - private String commonComponents; - - @ApiModelProperty("是否产生公共组件 0否 1是") - private Integer produceCommonComponent; - - @ApiModelProperty("预计产生组件名称") - private String produceCommonComponents; - - @ApiModelProperty("试点任务名称") - private String pilotTasksName; - - @ApiModelProperty("试点任务编号") - private String pilotTasksCode; - - @ApiModelProperty("所属重大应用名称") - private String importantTaskName; - - @ApiModelProperty("所属重大应用编号") - private String importantTaskCode; - - @ApiModelProperty("所属子场景应用名称") - private String subSceneApplicationName; + @NotNull + private ProjectDto projectInfo; - @ApiModelProperty("试点文件") - private String experimentsFile; + @NotNull + private ProcessInstanceUserDto user; - @ApiModelProperty("新增form内容") - private String formData; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java new file mode 100644 index 0000000..b5e9ff9 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java @@ -0,0 +1,132 @@ +package com.ningdatech.pmapi.projectdeclared.manage; + +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.pmapi.common.enums.ProjectProessStageEnum; +import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; +import com.ningdatech.pmapi.projectdeclared.entity.ProjectDraft; +import com.ningdatech.pmapi.projectdeclared.entity.dto.*; +import com.ningdatech.pmapi.projectdeclared.entity.vo.ProjectDeclaredDetailVO; +import com.ningdatech.pmapi.projectdeclared.entity.vo.ProjectDraftVo; +import com.ningdatech.pmapi.projectdeclared.service.IProjectDraftService; +import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; +import com.ningdatech.pmapi.projectlib.model.dto.ProjectDto; +import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; +import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; +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; +import com.wflow.workflow.bean.vo.ProcessStartParamsVo; +import com.wflow.workflow.service.ProcessInstanceService; +import com.wflow.workflow.service.ProcessModelService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname DeclaredProjectManage + * @Description + * @Date 2023/2/1 14:48 + * @Author PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class ConstructionPlanManage { + + private final IProjectService projectService; + + private final ProcessInstanceService processService; + + private final ProcessModelService processModelService; + + private final StateMachineUtils stateMachineUtils; + + /** + * 提交预审 + * @param dto + * @return + */ + public String startTheProcess(ConstructionPlanDto dto) { + Project projectInfo = projectService.getById(dto.getProjectId()); + + VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); + + String regionCode = projectInfo.getAreaCode(); + + WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) + .eq(WflowModels::getRegionCode, regionCode) + .eq(WflowModels::getFormName, ProjectProessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getDesc()) + .last("limit 1")); + + if (Objects.isNull(model)) { + log.error("此 【{}】区域找不到 建设申报流程配置", regionCode); + throw new BusinessException(String.format("此 【%s】区域找不到 建设申报流程配置", regionCode)); + } + + //首先要判断 项目当前状态 是不是 待预审 + VUtils.isTrue(!ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(projectInfo.getStatus()) || + !ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage())) + .throwMessage("提交失败 该项目不是 待预审状态或者未立项阶段"); + //TODO 再判断 该项目是否 真实走完 单位内部审批 + + ProcessStartParamsVo params = new ProcessStartParamsVo(); + params.setUser(dto.getUser()); + params.setProcessUsers(Collections.emptyMap()); + //放入条件判断的项目字段 + ProjectConditionDto conditionDto = new ProjectConditionDto(); + BeanUtils.copyProperties(projectInfo, conditionDto); + if (Objects.nonNull(conditionDto)) { + dto.getFormData().putAll( + JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference>() { + }) + ); + } + params.setFormData(dto.getFormData()); + String instanceId = processService.startProcess(model.getProcessDefId(), params); + log.info("提交预审项目成功 【{}】", instanceId); + + //保存建设项目 + modifyProject(projectInfo, instanceId,dto.getConstructionPlanFile()); + + return instanceId; + } + + /** + * 提交预审项目 时 更新信息 + * + * @param project + * @param instanceId + */ + private void modifyProject(Project project, String instanceId,String constructionPlanFile) { + //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 + try { + project.setUpdateOn(LocalDateTime.now()); + project.setInstCode(instanceId); + project.setConstructionPlanFile(constructionPlanFile); + //调用状态机 进入下一个通过状态 + stateMachineUtils.execute(project,stateMachineUtils.getProjectStatusPassEvent(project.getStatus())); + projectService.updateById(project); + } catch (Exception e) { + log.error("提交建设方案 项目信息修改 错误 ", e); + throw new BusinessException("提交建设方案 项目信息修改 错误 :" + e.getMessage()); + } + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java index 810e69d..fc9d2ed 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java @@ -99,6 +99,7 @@ public class DeclaredProjectManage { public PageVo pageDraft(DeclaredProjectListParamDto params) { Page page = params.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectDraft.class) + .eq(ProjectDraft::getUserId,params.getUserId()) .ge(Objects.nonNull(params.getStartTime()), ProjectDraft::getCreateOn, params.getStartTime()) .le(Objects.nonNull(params.getEndTime()), ProjectDraft::getCreateOn, params.getEndTime()) .eq(Objects.nonNull(params.getProjectType()), ProjectDraft::getProjectType, params.getProjectType()) @@ -210,8 +211,10 @@ public class DeclaredProjectManage { * @return */ public Long saveToDraft(ProjectDraftSaveDto dto) { + ProjectDto projectInfo = dto.getProjectInfo(); ProjectDraft draft = new ProjectDraft(); - BeanUtils.copyProperties(dto, draft); + BeanUtils.copyProperties(projectInfo, draft); + draft.setUserId(dto.getUser().getUserId()); if (Objects.isNull(draft.getId())) { draft.setCreateOn(LocalDateTime.now()); } diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/sys/project/ProjectStateTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/sys/project/ProjectStateTest.java index 6ff2647..4970683 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/sys/project/ProjectStateTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/sys/project/ProjectStateTest.java @@ -36,8 +36,9 @@ public class ProjectStateTest extends AppTests { project.setInstCode("1"); project.setId(1L); project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - stateMachineUtils.execute(project, ProjectStatusChangeEvent.UNDER_INTERNAL_PASS); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + //调用状态机 进入下一个通过状态 + stateMachineUtils.execute(project,stateMachineUtils.getProjectStatusPassEvent(project.getStatus())); stopWatch.stop(); System.out.println("调用状态机结束 :" + stopWatch.getTotalTimeSeconds());