From 99b3994968ef1e719c9a675b0307efc14b597439 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Mon, 13 Feb 2023 09:38:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B4=E5=BA=A6=E8=AE=A1=E5=88=92=E6=9A=82?= =?UTF-8?q?=E7=BC=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AnnualPlanController.java | 8 ++++++++ .../projectlib/manage/AnnualPlanLibManage.java | 8 +++++++- .../projectlib/model/req/ProjectApprovedReq.java | 2 +- .../pmapi/projectlib/model/req/ProjectIdReq.java | 23 ++++++++++++++++++++++ 4 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectIdReq.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/AnnualPlanController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/AnnualPlanController.java index 43a252a..2d1bc26 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/AnnualPlanController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/AnnualPlanController.java @@ -4,6 +4,7 @@ import com.ningdatech.basic.model.PageVo; import com.ningdatech.log.annotation.WebLog; import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; import com.ningdatech.pmapi.projectlib.model.req.ProjectApprovedReq; +import com.ningdatech.pmapi.projectlib.model.req.ProjectIdReq; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; import com.ningdatech.pmapi.projectlib.model.req.StartProjectDeclareReq; import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; @@ -50,4 +51,11 @@ public class AnnualPlanController { annualPlanLibManage.projectApproved(req); } + @PostMapping("/suspendAnnualPlan") + @ApiOperation("暂缓年度计划") + @WebLog("暂缓年度计划") + public void suspendAnnualPlan(@RequestBody @Valid ProjectIdReq req) throws Exception { + annualPlanLibManage.suspendAnnualPlan(req); + } + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java index fe3c113..9da7bd6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java @@ -13,6 +13,7 @@ import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.req.ProjectApprovedReq; +import com.ningdatech.pmapi.projectlib.model.req.ProjectIdReq; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; import com.ningdatech.pmapi.projectlib.model.req.StartProjectDeclareReq; import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; @@ -47,7 +48,6 @@ public class AnnualPlanLibManage { */ private static final List ANNUAL_PLAN_LIST_STATUS = Arrays.asList( IN_THE_ANNUAL_PLAN, - BE_SUSPENDED, SCHEME_UNDER_REVIEW, SCHEME_REVIEW_FAILED, TO_BE_APPROVED, @@ -123,4 +123,10 @@ public class AnnualPlanLibManage { projectService.update(update); } + @Transactional(rollbackFor = Exception.class) + public void suspendAnnualPlan(ProjectIdReq req) throws Exception { + Project project = projectService.getById(req.getProjectId()); + stateMachine.execute(project, ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND); + } + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectApprovedReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectApprovedReq.java index d98645f..64708c3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectApprovedReq.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectApprovedReq.java @@ -40,7 +40,7 @@ public class ProjectApprovedReq { @ApiModelProperty("建设周期") @NotNull(message = "建设周期不能为空") @Range(min = 1, max = 99999, message = "建设周期无效") - private LocalDate buildCycle; + private Integer buildCycle; @ApiModelProperty("批复文件ID") @NotNull(message = "批复文件不能为空") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectIdReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectIdReq.java new file mode 100644 index 0000000..82278b1 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectIdReq.java @@ -0,0 +1,23 @@ +package com.ningdatech.pmapi.projectlib.model.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + *

+ * ProjectIdReq + *

+ * + * @author WendyYang + * @since 09:32 2023/2/13 + */ +@Data +public class ProjectIdReq { + + @ApiModelProperty("项目ID") + @NotNull(message = "项目ID不能为空") + private Long projectId; + +}