mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 23:31:52 +08:00
流程定义在创建时,增加 key 和 name 的校验,进一步保证 Model、Deployment、ProcessDefinition 的匹配性
This commit is contained in:
parent
066f57e5c5
commit
509e11a7b0
@ -23,18 +23,21 @@ public interface BpmErrorCodeConstants {
|
|||||||
ErrorCode OA_HR_POST_NOT_EXISTS = new ErrorCode(1009001006, "HR岗位未设置");
|
ErrorCode OA_HR_POST_NOT_EXISTS = new ErrorCode(1009001006, "HR岗位未设置");
|
||||||
ErrorCode OA_DAY_LEAVE_ERROR = new ErrorCode(1009001007, "请假天数必须>=1");
|
ErrorCode OA_DAY_LEAVE_ERROR = new ErrorCode(1009001007, "请假天数必须>=1");
|
||||||
|
|
||||||
// ========== OA 工作流模块 1-009-002-000 ==========
|
// ========== 流程模型 1-009-002-000 ==========
|
||||||
ErrorCode BPM_MODEL_KEY_EXISTS = new ErrorCode(1009002000, "已经存在流程标识为【{}】的流程");
|
ErrorCode MODEL_KEY_EXISTS = new ErrorCode(1009002000, "已经存在流程标识为【{}】的流程");
|
||||||
ErrorCode BPMN_MODEL_NOT_EXISTS = new ErrorCode(1009002001, "流程模型不存在");
|
ErrorCode MODEL_NOT_EXISTS = new ErrorCode(1009002001, "流程模型不存在");
|
||||||
ErrorCode BPMN_MODEL_KEY_VALID = new ErrorCode(1009002002, "流程标识格式不正确,需要以字母或下划线开头,后接任意字母、数字、中划线、下划线、句点!");
|
ErrorCode MODEL_KEY_VALID = new ErrorCode(1009002002, "流程标识格式不正确,需要以字母或下划线开头,后接任意字母、数字、中划线、下划线、句点!");
|
||||||
|
|
||||||
|
// ========== 流程模型 1-009-003-000 ==========
|
||||||
|
ErrorCode DEFINITION_KEY_NOT_MATCH = new ErrorCode(1009003000, "流程定义的标识期望是({}),当前是({}),请修改 BPMN 流程图");
|
||||||
|
ErrorCode DEFINITION_NAME_NOT_MATCH = new ErrorCode(1009003000, "流程定义的名字期望是({}),当前是({}),请修改 BPMN 流程图");
|
||||||
|
|
||||||
ErrorCode BPMN_MODEL_ERROR = new ErrorCode(1004001002, "工作流模型异常");
|
ErrorCode BPMN = new ErrorCode(1004001002, "工作流模型异常");
|
||||||
ErrorCode BPMN_MODEL_PROCESS_NOT_EXISTS = new ErrorCode(1004001009, "流程数据为空");
|
ErrorCode BPMN_MODEL_PROCESS_NOT_EXISTS = new ErrorCode(1004001009, "流程数据为空");
|
||||||
ErrorCode BPMN_PROCESS_DEFINITION_NOT_EXISTS = new ErrorCode(1004001004, "流程定义不存在");
|
ErrorCode BPMN_PROCESS_DEFINITION_NOT_EXISTS = new ErrorCode(1004001004, "流程定义不存在");
|
||||||
|
|
||||||
// ========== 动态表单模块 1-009-003-000 ==========
|
// ========== 动态表单模块 1-009-004-000 ==========
|
||||||
ErrorCode BPM_FORM_NOT_EXISTS = new ErrorCode(1009003000, "动态表单不存在");
|
ErrorCode FORM_NOT_EXISTS = new ErrorCode(1009004000, "动态表单不存在");
|
||||||
ErrorCode BPM_FORM_FIELD_REPEAT = new ErrorCode(1009003000, "表单项({}) 和 ({}) 使用了相同的字段名({})");
|
ErrorCode FORM_FIELD_REPEAT = new ErrorCode(1009004000, "表单项({}) 和 ({}) 使用了相同的字段名({})");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,9 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.DEFINITION_KEY_NOT_MATCH;
|
||||||
|
import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.DEFINITION_NAME_NOT_MATCH;
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -144,6 +147,15 @@ public class BpmDefinitionServiceImpl implements BpmDefinitionService {
|
|||||||
// 设置 ProcessDefinition 的 category 分类
|
// 设置 ProcessDefinition 的 category 分类
|
||||||
ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deploy.getId()).singleResult();
|
ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deploy.getId()).singleResult();
|
||||||
repositoryService.setProcessDefinitionCategory(definition.getId(), createReqDTO.getCategory());
|
repositoryService.setProcessDefinitionCategory(definition.getId(), createReqDTO.getCategory());
|
||||||
|
// 注意 1,ProcessDefinition 的 key 和 name 是通过 BPMN 中的 <bpmn2:process /> 的 id 和 name 决定
|
||||||
|
// 注意 2,目前该项目的设计上,需要保证 Model、Deployment、ProcessDefinition 使用相同的 key,保证关联性。
|
||||||
|
// 否则,会导致 ProcessDefinition 的分页无法查询到。
|
||||||
|
if (!Objects.equals(definition.getKey(), createReqDTO.getKey())) {
|
||||||
|
throw exception(DEFINITION_KEY_NOT_MATCH, createReqDTO.getKey(), definition.getKey());
|
||||||
|
}
|
||||||
|
if (!Objects.equals(definition.getName(), createReqDTO.getName())) {
|
||||||
|
throw exception(DEFINITION_NAME_NOT_MATCH, createReqDTO.getName(), definition.getName());
|
||||||
|
}
|
||||||
|
|
||||||
// 插入拓展表
|
// 插入拓展表
|
||||||
BpmProcessDefinitionDO definitionDO = BpmDefinitionConvert.INSTANCE.convert2(createReqDTO)
|
BpmProcessDefinitionDO definitionDO = BpmDefinitionConvert.INSTANCE.convert2(createReqDTO)
|
||||||
|
Loading…
Reference in New Issue
Block a user