diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/config/BeanConfig.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/config/BeanConfig.java index 93bfd09..315f77a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/config/BeanConfig.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/config/BeanConfig.java @@ -3,7 +3,6 @@ package com.ningdatech.pmapi.common.config; import com.alibaba.xxpt.gateway.shared.client.http.ExecutableClient; import com.ningdatech.pmapi.common.util.SpringContextHolder; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.DependsOn; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/enums/ProjectProessStageEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ProjectProessStageEnum.java similarity index 92% rename from pmapi/src/main/java/com/ningdatech/pmapi/common/enums/ProjectProessStageEnum.java rename to pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ProjectProessStageEnum.java index 3b7ad16..99cc654 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/enums/ProjectProessStageEnum.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ProjectProessStageEnum.java @@ -1,4 +1,4 @@ -package com.ningdatech.pmapi.common.enums; +package com.ningdatech.pmapi.common.enumeration; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/utils/BizUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java similarity index 96% rename from pmapi/src/main/java/com/ningdatech/pmapi/common/utils/BizUtils.java rename to pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java index 20cf2f1..136dfa8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/utils/BizUtils.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java @@ -1,4 +1,4 @@ -package com.ningdatech.pmapi.common.utils; +package com.ningdatech.pmapi.common.util; import cn.hutool.core.util.StrUtil; import com.ningdatech.basic.util.StrPool; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/utils/TreeUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/TreeUtil.java similarity index 99% rename from pmapi/src/main/java/com/ningdatech/pmapi/common/utils/TreeUtil.java rename to pmapi/src/main/java/com/ningdatech/pmapi/common/util/TreeUtil.java index 1359135..e75eeb3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/utils/TreeUtil.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/TreeUtil.java @@ -1,4 +1,4 @@ -package com.ningdatech.pmapi.common.utils; +package com.ningdatech.pmapi.common.util; import cn.hutool.core.collection.CollUtil; 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 7d7a76b..60358f1 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 @@ -7,7 +7,7 @@ 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.model.PageVo; -import com.ningdatech.pmapi.common.enums.ProjectProessStageEnum; +import com.ningdatech.pmapi.common.enumeration.ProjectProessStageEnum; import com.ningdatech.pmapi.projectdeclared.entity.ProjectDraft; import com.ningdatech.pmapi.projectdeclared.entity.dto.DeclaredProjectDto; import com.ningdatech.pmapi.projectdeclared.entity.dto.DeclaredProjectListParamDto; 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 171a79e..500f879 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 @@ -3,13 +3,14 @@ package com.ningdatech.pmapi.projectlib.controller; import com.ningdatech.basic.model.PageVo; import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; +import com.ningdatech.pmapi.projectlib.model.req.StartProjectDeclareReq; import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; /** *

@@ -33,4 +34,10 @@ public class AnnualPlanController { return annualPlanLibManage.annulPlanLibList(req); } + @PostMapping("/startProjectDeclared") + @ApiOperation("开启项目申报") + public void startProjectDeclared(@RequestBody @Valid StartProjectDeclareReq req) { + annualPlanLibManage.startProjectDeclared(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 ebb0435..1e3b004 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 @@ -2,16 +2,21 @@ package com.ningdatech.pmapi.projectlib.manage; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; +import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; 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.ProjectListReq; +import com.ningdatech.pmapi.projectlib.model.req.StartProjectDeclareReq; import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; import com.ningdatech.pmapi.projectlib.service.IProjectService; import lombok.AllArgsConstructor; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Arrays; @@ -32,6 +37,7 @@ import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; public class AnnualPlanLibManage { private final IProjectService projectService; + private final StateMachineUtils stateMachine; /** * 年度计划查询状态 @@ -57,6 +63,7 @@ public class AnnualPlanLibManage { public PageVo annulPlanLibList(ProjectListReq req) { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); + query.eq(Project::getIsTemporaryAugment, 0); query.orderByDesc(Project::getAnnualPlanAddTime); query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); Page page = projectService.page(req.page(), query); @@ -82,4 +89,21 @@ public class AnnualPlanLibManage { return result; } + @Transactional(rollbackFor = Exception.class) + public void startProjectDeclared(StartProjectDeclareReq req) { + List projects = projectService.listByIds(req.getProjectIds()); + projects.forEach(w -> { + if (!IN_THE_ANNUAL_PLAN.eq(w.getStatus())) { + throw BizException.wrap("开启方案申报失败"); + } + }); + projects.forEach(project -> { + try { + stateMachine.execute(project, ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE); + } catch (Exception e) { + throw new BizException("开启方案申报失败"); + } + }); + } + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/StartProjectDeclareReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/StartProjectDeclareReq.java new file mode 100644 index 0000000..0bcb177 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/StartProjectDeclareReq.java @@ -0,0 +1,25 @@ +package com.ningdatech.pmapi.projectlib.model.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.util.List; + +/** + *

+ * StartProjectDeclareReq + *

+ * + * @author WendyYang + * @since 17:47 2023/2/11 + */ +@Data +public class StartProjectDeclareReq { + + @ApiModelProperty("项目ID") + @NotEmpty(message = "项目ID不能为空") + private List projectIds; + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/MenuController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/MenuController.java index 0cdc8fc..a34a9c2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/MenuController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/MenuController.java @@ -7,7 +7,7 @@ import com.ningdatech.basic.auth.AbstractLoginUserUtil; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.log.annotation.WebLog; import com.ningdatech.pmapi.common.model.entity.MenuTreeEntity; -import com.ningdatech.pmapi.common.utils.TreeUtil; +import com.ningdatech.pmapi.common.util.TreeUtil; import com.ningdatech.pmapi.sys.entity.Menu; import com.ningdatech.pmapi.sys.entity.dto.MenuQueryDTO; import com.ningdatech.pmapi.sys.entity.dto.MenuSaveDTO; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/MenuManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/MenuManage.java index 3307485..e6dabd7 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/MenuManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/MenuManage.java @@ -4,7 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.utils.TreeUtil; +import com.ningdatech.pmapi.common.util.TreeUtil; import com.ningdatech.pmapi.sys.entity.Menu; import com.ningdatech.pmapi.sys.entity.RoleMenu; import com.ningdatech.pmapi.sys.entity.vo.MenuRoleVO; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java index bf45d80..3c48244 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java @@ -10,7 +10,7 @@ import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.file.entity.vo.result.AttachFileVo; import com.ningdatech.file.service.FileService; -import com.ningdatech.pmapi.common.utils.BizUtils; +import com.ningdatech.pmapi.common.util.BizUtils; import com.ningdatech.pmapi.sys.entity.Notice; import com.ningdatech.pmapi.sys.entity.req.NoticeListReq; import com.ningdatech.pmapi.sys.entity.req.NoticeSaveReq; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java index 2c3c2aa..2a8baab 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java @@ -7,8 +7,6 @@ import javax.validation.Valid; import com.ningdatech.pmapi.common.util.ExcelDownUtil; import com.ningdatech.pmapi.todocenter.bean.vo.ProcessProgressDetailVo; import com.ningdatech.pmapi.todocenter.model.dto.req.ReqProcessHandlerDTO; -import com.wflow.utils.R; -import com.wflow.workflow.bean.vo.ProcessHandlerParamsVo; import org.springframework.web.bind.annotation.*; import com.ningdatech.basic.model.ApiResponse; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enums/IsAppendProjectEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enumeration/IsAppendProjectEnum.java similarity index 90% rename from pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enums/IsAppendProjectEnum.java rename to pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enumeration/IsAppendProjectEnum.java index a744804..d0d5ba1 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enums/IsAppendProjectEnum.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enumeration/IsAppendProjectEnum.java @@ -1,16 +1,16 @@ -package com.ningdatech.pmapi.todocenter.enums; - -import java.util.Objects; - -import org.apache.commons.lang3.StringUtils; +package com.ningdatech.pmapi.todocenter.enumeration; import io.swagger.annotations.ApiModel; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; /** * 是否增补项目枚举 + * * @author CMM */ @Getter @@ -24,7 +24,7 @@ public enum IsAppendProjectEnum { NOT_APPEND_PROJECT(0, "非增补项目"), /** - *增补项目 + * 增补项目 */ APPEND_PROJECT(1, "增补项目"); @@ -41,7 +41,7 @@ public enum IsAppendProjectEnum { } public static String getDescByCode(Integer code) { - if(Objects.isNull(code)){ + if (Objects.isNull(code)) { return StringUtils.EMPTY; } for (IsAppendProjectEnum t : IsAppendProjectEnum.values()) { @@ -53,7 +53,7 @@ public enum IsAppendProjectEnum { } public static IsAppendProjectEnum getEnumByValue(Integer code) { - if(Objects.isNull(code)){ + if (Objects.isNull(code)) { return null; } for (IsAppendProjectEnum t : IsAppendProjectEnum.values()) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enums/ProcessStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enumeration/ProcessStatusEnum.java similarity index 85% rename from pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enums/ProcessStatusEnum.java rename to pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enumeration/ProcessStatusEnum.java index 91d311d..fd07266 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enums/ProcessStatusEnum.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enumeration/ProcessStatusEnum.java @@ -1,16 +1,16 @@ -package com.ningdatech.pmapi.todocenter.enums; - -import java.util.Objects; - -import org.apache.commons.lang3.StringUtils; +package com.ningdatech.pmapi.todocenter.enumeration; import io.swagger.annotations.ApiModel; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; /** * 待办中心-流程状态枚举 + * * @author CMM */ @Getter @@ -32,16 +32,16 @@ public enum ProcessStatusEnum { /** * 被驳回 */ - BE_REJECTED(3,"被驳回"), + BE_REJECTED(3, "被驳回"), /** * 审核通过 */ - APPROVED(4,"审核通过"), + APPROVED(4, "审核通过"), /** * 被撤回 */ - WITHDRAW(5,"被撤回"); + WITHDRAW(5, "被撤回"); private Integer code; @@ -56,7 +56,7 @@ public enum ProcessStatusEnum { } public static String getDescByCode(Integer code) { - if(Objects.isNull(code)){ + if (Objects.isNull(code)) { return StringUtils.EMPTY; } for (ProcessStatusEnum t : ProcessStatusEnum.values()) { @@ -68,11 +68,11 @@ public enum ProcessStatusEnum { } public static Integer getCodeByDesc(String desc) { - if(Objects.isNull(desc)){ + if (Objects.isNull(desc)) { return null; } for (ProcessStatusEnum t : ProcessStatusEnum.values()) { - if (desc.equals(t.getCode())) { + if (desc.equals(t.getDesc())) { return t.code; } } @@ -80,7 +80,7 @@ public enum ProcessStatusEnum { } public static ProcessStatusEnum getEnumByValue(Integer code) { - if(Objects.isNull(code)){ + if (Objects.isNull(code)) { return null; } for (ProcessStatusEnum t : ProcessStatusEnum.values()) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index c7b1627..a1b2ac6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -33,8 +33,8 @@ import com.ningdatech.pmapi.todocenter.bean.entity.ProgressNode; import com.ningdatech.pmapi.todocenter.bean.vo.ProcessProgressDetailVo; import com.ningdatech.pmapi.todocenter.bean.vo.ProgressNodeAuditInfoVo; import com.ningdatech.pmapi.todocenter.constant.HisProInsEndActId; -import com.ningdatech.pmapi.todocenter.enums.IsAppendProjectEnum; -import com.ningdatech.pmapi.todocenter.enums.ProcessStatusEnum; +import com.ningdatech.pmapi.todocenter.enumeration.IsAppendProjectEnum; +import com.ningdatech.pmapi.todocenter.enumeration.ProcessStatusEnum; import com.ningdatech.pmapi.todocenter.extension.cmd.BackToHisApprovalNodeCmd; import com.ningdatech.pmapi.todocenter.extension.cmd.SaveCommentCmd; import com.ningdatech.pmapi.todocenter.model.dto.req.ReqProcessHandlerDTO;