From c5e2df943cbd2fe30ecebdd83f82515da96fa26c Mon Sep 17 00:00:00 2001 From: jason <2667446@qq.com> Date: Sat, 29 Jan 2022 22:40:50 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Bpm=20=E5=8A=A8=E6=80=81=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E3=80=82=E7=A7=BB=E5=88=B0bpm-core-service=20=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../convert/definition/BpmModelConvert.java | 12 ++--- .../BpmProcessDefinitionConvert.java | 8 ++-- .../bpm/enums/BpmErrorCodeConstants.java | 2 - .../definition/impl/BpmModelServiceImpl.java | 19 ++++---- .../impl/BpmProcessDefinitionServiceImpl.java | 11 +++-- .../yudao-module-bpm-core-service-api/pom.xml | 4 ++ .../bpm/api/form/BpmFormServiceApi.java | 46 +++++++++++++++++++ .../modules/bpm/api/form/dto/BpmFormDTO.java | 39 ++++++++++++++++ .../bpm/api/group/BpmUserGroupServiceApi.java | 1 + .../bpm/api/BpmFormServiceApiImpl.java | 33 +++++++++++++ .../bpm/api/BpmUserGroupServiceApiImpl.java | 1 + .../definition/BpmFormController.java | 0 .../definition/vo/form/BpmFormBaseVO.java | 0 .../vo/form/BpmFormCreateReqVO.java | 0 .../definition/vo/form/BpmFormPageReqVO.java | 0 .../definition/vo/form/BpmFormRespVO.java | 0 .../vo/form/BpmFormSimpleRespVO.java | 0 .../vo/form/BpmFormUpdateReqVO.java | 0 .../convert/definition/BpmFormConvert.java | 5 ++ .../dal/dataobject/definition/BpmFormDO.java | 0 .../dal/mysql/definition/BpmFormMapper.java | 0 .../bpm/enums/BpmErrorCodeConstants.java | 3 ++ .../service/definition/BpmFormService.java | 0 .../definition/dto/BpmFormFieldRespDTO.java | 0 .../definition/impl/BpmFormServiceImpl.java | 10 ++-- .../definition/BpmFormServiceTest.java | 0 .../src/test/resources/sql/clean.sql | 1 + .../src/test/resources/sql/create_tables.sql | 15 ++++++ 28 files changed, 177 insertions(+), 33 deletions(-) create mode 100644 yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-api/src/main/java/cn/iocoder/yudao/coreservice/modules/bpm/api/form/BpmFormServiceApi.java create mode 100644 yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-api/src/main/java/cn/iocoder/yudao/coreservice/modules/bpm/api/form/dto/BpmFormDTO.java create mode 100644 yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/api/BpmFormServiceApiImpl.java rename yudao-module-bpm/{yudao-module-bpm-activiti => yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl}/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/BpmFormController.java (100%) rename yudao-module-bpm/{yudao-module-bpm-activiti => yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl}/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormBaseVO.java (100%) rename yudao-module-bpm/{yudao-module-bpm-activiti => yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl}/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormCreateReqVO.java (100%) rename yudao-module-bpm/{yudao-module-bpm-activiti => yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl}/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormPageReqVO.java (100%) rename yudao-module-bpm/{yudao-module-bpm-activiti => yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl}/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormRespVO.java (100%) rename yudao-module-bpm/{yudao-module-bpm-activiti => yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl}/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormSimpleRespVO.java (100%) rename yudao-module-bpm/{yudao-module-bpm-activiti => yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl}/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormUpdateReqVO.java (100%) rename yudao-module-bpm/{yudao-module-bpm-activiti => yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl}/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmFormConvert.java (86%) rename yudao-module-bpm/{yudao-module-bpm-activiti => yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl}/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/definition/BpmFormDO.java (100%) rename yudao-module-bpm/{yudao-module-bpm-activiti => yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl}/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/mysql/definition/BpmFormMapper.java (100%) rename yudao-module-bpm/{yudao-module-bpm-activiti => yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl}/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmFormService.java (100%) rename yudao-module-bpm/{yudao-module-bpm-activiti => yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl}/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/dto/BpmFormFieldRespDTO.java (100%) rename yudao-module-bpm/{yudao-module-bpm-activiti => yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl}/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmFormServiceImpl.java (88%) rename yudao-module-bpm/{yudao-module-bpm-activiti => yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl}/src/test/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmFormServiceTest.java (100%) diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmModelConvert.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmModelConvert.java index eb3362ac6..c2b287720 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmModelConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmModelConvert.java @@ -2,9 +2,9 @@ package cn.iocoder.yudao.adminserver.modules.bpm.convert.definition; import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.model.*; -import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmFormDO; -import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto.BpmProcessDefinitionCreateReqDTO; import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto.BpmModelMetaInfoRespDTO; +import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto.BpmProcessDefinitionCreateReqDTO; +import cn.iocoder.yudao.coreservice.modules.bpm.api.form.dto.BpmFormDTO; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import org.activiti.engine.impl.persistence.entity.SuspensionState; @@ -30,19 +30,19 @@ public interface BpmModelConvert { BpmModelConvert INSTANCE = Mappers.getMapper(BpmModelConvert.class); - default List convertList(List list, Map formMap, + default List convertList(List list, Map formMap, Map deploymentMap, Map processDefinitionMap) { return CollectionUtils.convertList(list, model -> { BpmModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(model.getMetaInfo(), BpmModelMetaInfoRespDTO.class); - BpmFormDO form = metaInfo != null ? formMap.get(metaInfo.getFormId()) : null; + BpmFormDTO form = metaInfo != null ? formMap.get(metaInfo.getFormId()) : null; Deployment deployment = model.getDeploymentId() != null ? deploymentMap.get(model.getDeploymentId()) : null; ProcessDefinition processDefinition = model.getDeploymentId() != null ? processDefinitionMap.get(model.getDeploymentId()) : null; return convert(model, form, deployment, processDefinition); }); } - default BpmModelPageItemRespVO convert(Model model, BpmFormDO form, Deployment deployment, ProcessDefinition processDefinition) { + default BpmModelPageItemRespVO convert(Model model, BpmFormDTO form, Deployment deployment, ProcessDefinition processDefinition) { BpmModelPageItemRespVO modelRespVO = new BpmModelPageItemRespVO(); modelRespVO.setId(model.getId()); modelRespVO.setCreateTime(model.getCreateTime()); @@ -83,7 +83,7 @@ public interface BpmModelConvert { void copyTo(BpmModelMetaInfoRespDTO from, @MappingTarget BpmModelBaseVO to); - default BpmProcessDefinitionCreateReqDTO convert2(Model model, BpmFormDO form) { + default BpmProcessDefinitionCreateReqDTO convert2(Model model, BpmFormDTO form) { BpmProcessDefinitionCreateReqDTO createReqDTO = new BpmProcessDefinitionCreateReqDTO(); createReqDTO.setModelId(model.getId()); createReqDTO.setName(model.getName()); diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmProcessDefinitionConvert.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmProcessDefinitionConvert.java index fb11704e6..ed85492f2 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmProcessDefinitionConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmProcessDefinitionConvert.java @@ -3,8 +3,8 @@ package cn.iocoder.yudao.adminserver.modules.bpm.convert.definition; import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.process.BpmProcessDefinitionPageItemRespVO; import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.process.BpmProcessDefinitionRespVO; import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmProcessDefinitionExtDO; -import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmFormDO; import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto.BpmProcessDefinitionCreateReqDTO; +import cn.iocoder.yudao.coreservice.modules.bpm.api.form.dto.BpmFormDTO; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import org.activiti.engine.impl.persistence.entity.SuspensionState; import org.activiti.engine.repository.Deployment; @@ -29,17 +29,17 @@ public interface BpmProcessDefinitionConvert { BpmProcessDefinitionConvert INSTANCE = Mappers.getMapper(BpmProcessDefinitionConvert.class); default List convertList(List list, Map deploymentMap, - Map processDefinitionDOMap, Map formMap) { + Map processDefinitionDOMap, Map formMap) { return CollectionUtils.convertList(list, definition -> { Deployment deployment = definition.getDeploymentId() != null ? deploymentMap.get(definition.getDeploymentId()) : null; BpmProcessDefinitionExtDO definitionDO = processDefinitionDOMap.get(definition.getId()); - BpmFormDO form = definitionDO != null ? formMap.get(definitionDO.getFormId()) : null; + BpmFormDTO form = definitionDO != null ? formMap.get(definitionDO.getFormId()) : null; return convert(definition, deployment, definitionDO, form); }); } default BpmProcessDefinitionPageItemRespVO convert(ProcessDefinition bean, Deployment deployment, - BpmProcessDefinitionExtDO processDefinitionExtDO, BpmFormDO form) { + BpmProcessDefinitionExtDO processDefinitionExtDO, BpmFormDTO form) { BpmProcessDefinitionPageItemRespVO respVO = convert(bean); respVO.setSuspensionState(bean.isSuspended() ? SuspensionState.SUSPENDED.getStateCode() : SuspensionState.ACTIVE.getStateCode()); if (deployment != null) { diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java index 771a04f5e..66fc20b8f 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java @@ -55,6 +55,4 @@ public interface BpmErrorCodeConstants { // ========== 动态表单模块 1-009-010-000 ========== ErrorCode FORM_NOT_EXISTS = new ErrorCode(1009010000, "动态表单不存在"); - ErrorCode FORM_FIELD_REPEAT = new ErrorCode(1009010000, "表单项({}) 和 ({}) 使用了相同的字段名({})"); - } diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmModelServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmModelServiceImpl.java index 60a313863..1f5882a4b 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmModelServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmModelServiceImpl.java @@ -6,14 +6,14 @@ import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.model.*; import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.rule.BpmTaskAssignRuleRespVO; import cn.iocoder.yudao.adminserver.modules.bpm.convert.definition.BpmModelConvert; -import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmFormDO; import cn.iocoder.yudao.adminserver.modules.bpm.enums.definition.BpmModelFormTypeEnum; +import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmModelService; import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmProcessDefinitionService; import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmTaskAssignRuleService; -import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto.BpmProcessDefinitionCreateReqDTO; -import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmFormService; -import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmModelService; import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto.BpmModelMetaInfoRespDTO; +import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto.BpmProcessDefinitionCreateReqDTO; +import cn.iocoder.yudao.coreservice.modules.bpm.api.form.BpmFormServiceApi; +import cn.iocoder.yudao.coreservice.modules.bpm.api.form.dto.BpmFormDTO; import cn.iocoder.yudao.framework.activiti.core.util.ActivitiUtils; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; @@ -39,7 +39,6 @@ import java.util.*; import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.*; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; /** @@ -57,7 +56,7 @@ public class BpmModelServiceImpl implements BpmModelService { @Resource private RepositoryService repositoryService; @Resource - private BpmFormService formService; + private BpmFormServiceApi formServiceApi; @Resource private BpmProcessDefinitionService processDefinitionService; @Resource @@ -85,7 +84,7 @@ public class BpmModelServiceImpl implements BpmModelService { BpmModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(model.getMetaInfo(), BpmModelMetaInfoRespDTO.class); return metaInfo != null ? metaInfo.getFormId() : null; }); - Map formMap = formService.getFormMap(formIds); + Map formMap = formServiceApi.getFormMap(formIds); // 获得 Deployment Map Set deploymentIds = new HashSet<>(); @@ -172,7 +171,7 @@ public class BpmModelServiceImpl implements BpmModelService { } // TODO 芋艿:校验流程图的有效性;例如说,是否有开始的元素,是否有结束的元素; // 校验表单已配 - BpmFormDO form = checkFormConfig(model); + BpmFormDTO form = checkFormConfig(model); // 校验任务分配规则已配置 checkTaskAssignRuleAllConfig(id); @@ -225,14 +224,14 @@ public class BpmModelServiceImpl implements BpmModelService { * @param model 流程模型 * @return 流程表单 */ - private BpmFormDO checkFormConfig(Model model) { + private BpmFormDTO checkFormConfig(Model model) { BpmModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(model.getMetaInfo(), BpmModelMetaInfoRespDTO.class); if (metaInfo == null || metaInfo.getFormType() == null) { throw exception(MODEL_DEPLOY_FAIL_FORM_NOT_CONFIG); } // 校验表单存在 if (Objects.equals(metaInfo.getFormType(), BpmModelFormTypeEnum.NORMAL.getType())) { - BpmFormDO form = formService.getForm(metaInfo.getFormId()); + BpmFormDTO form = formServiceApi.getForm(metaInfo.getFormId()); if (form == null) { throw exception(FORM_NOT_EXISTS); } diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmProcessDefinitionServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmProcessDefinitionServiceImpl.java index 289cd4d63..9d906d5eb 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmProcessDefinitionServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmProcessDefinitionServiceImpl.java @@ -8,12 +8,12 @@ import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.process import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.process.BpmProcessDefinitionPageReqVO; import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.process.BpmProcessDefinitionRespVO; import cn.iocoder.yudao.adminserver.modules.bpm.convert.definition.BpmProcessDefinitionConvert; -import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmFormDO; import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmProcessDefinitionExtDO; import cn.iocoder.yudao.adminserver.modules.bpm.dal.mysql.definition.BpmProcessDefinitionExtMapper; -import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmFormService; import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmProcessDefinitionService; import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto.BpmProcessDefinitionCreateReqDTO; +import cn.iocoder.yudao.coreservice.modules.bpm.api.form.BpmFormServiceApi; +import cn.iocoder.yudao.coreservice.modules.bpm.api.form.dto.BpmFormDTO; import cn.iocoder.yudao.framework.activiti.core.util.ActivitiUtils; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.PageUtils; @@ -31,7 +31,8 @@ import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import java.util.*; -import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.*; +import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.PROCESS_DEFINITION_KEY_NOT_MATCH; +import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.PROCESS_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.*; import static java.util.Collections.emptyList; @@ -54,7 +55,7 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ @Resource private RepositoryService repositoryService; @Resource - private BpmFormService bpmFormService; + private BpmFormServiceApi bpmFormServiceApi; @Resource private BpmProcessDefinitionExtMapper processDefinitionMapper; @@ -85,7 +86,7 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ // 获得 Form Map Set formIds = convertSet(processDefinitionDOs, BpmProcessDefinitionExtDO::getFormId); - Map formMap = bpmFormService.getFormMap(formIds); + Map formMap = bpmFormServiceApi.getFormMap(formIds); // 拼接结果 long definitionCount = definitionQuery.count(); diff --git a/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-api/pom.xml b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-api/pom.xml index fb5a4f08e..c488c2296 100644 --- a/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-api/pom.xml +++ b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-api/pom.xml @@ -16,5 +16,9 @@ org.projectlombok lombok + + cn.iocoder.boot + yudao-common + \ No newline at end of file diff --git a/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-api/src/main/java/cn/iocoder/yudao/coreservice/modules/bpm/api/form/BpmFormServiceApi.java b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-api/src/main/java/cn/iocoder/yudao/coreservice/modules/bpm/api/form/BpmFormServiceApi.java new file mode 100644 index 000000000..f8f66a7d9 --- /dev/null +++ b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-api/src/main/java/cn/iocoder/yudao/coreservice/modules/bpm/api/form/BpmFormServiceApi.java @@ -0,0 +1,46 @@ +package cn.iocoder.yudao.coreservice.modules.bpm.api.form; + +import cn.hutool.core.collection.CollUtil; +import cn.iocoder.yudao.coreservice.modules.bpm.api.form.dto.BpmFormDTO; +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** + * Bpm 动态表单 Service API 接口 + * + * @author @风里雾里 + */ +public interface BpmFormServiceApi { + /** + * 获得动态表单 + * + * @param id 编号 + * @return 动态表单 + */ + BpmFormDTO getForm(Long id); + + /** + * 获得动态表单列表 + * + * @param ids 编号 + * @return 动态表单列表 + */ + List getFormList(Collection ids); + + /** + * 获得动态表单 Map + * + * @param ids 编号 + * @return 动态表单 Map + */ + default Map getFormMap(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return Collections.emptyMap(); + } + return CollectionUtils.convertMap(this.getFormList(ids), BpmFormDTO::getId); + } +} diff --git a/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-api/src/main/java/cn/iocoder/yudao/coreservice/modules/bpm/api/form/dto/BpmFormDTO.java b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-api/src/main/java/cn/iocoder/yudao/coreservice/modules/bpm/api/form/dto/BpmFormDTO.java new file mode 100644 index 000000000..0a5c0f94a --- /dev/null +++ b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-api/src/main/java/cn/iocoder/yudao/coreservice/modules/bpm/api/form/dto/BpmFormDTO.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.coreservice.modules.bpm.api.form.dto; + +import lombok.Data; + +import java.util.List; + +/** + * 工作流的表单定义 DTO + * 用于工作流的申请表单,需要动态配置的场景 + * TODO 暂时拷贝 BpmFormDO 字段, 不知道那些字段是必须的, 后续删掉不需要的字段 + * @author jason + */ +@Data +public class BpmFormDTO { + + /** + * 编号 + */ + private Long id; + /** + * 表单名 + */ + private String name; + /** + * 表单的配置 + */ + private String conf; + /** + * 表单项的数组 + * + * 目前直接将 https://github.com/JakHuang/form-generator 生成的 JSON 串,直接保存 + * 定义:https://github.com/JakHuang/form-generator/issues/46 + */ + private List fields; + /** + * 备注 + */ + private String remark; +} diff --git a/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-api/src/main/java/cn/iocoder/yudao/coreservice/modules/bpm/api/group/BpmUserGroupServiceApi.java b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-api/src/main/java/cn/iocoder/yudao/coreservice/modules/bpm/api/group/BpmUserGroupServiceApi.java index c83486970..796dbd4df 100644 --- a/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-api/src/main/java/cn/iocoder/yudao/coreservice/modules/bpm/api/group/BpmUserGroupServiceApi.java +++ b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-api/src/main/java/cn/iocoder/yudao/coreservice/modules/bpm/api/group/BpmUserGroupServiceApi.java @@ -9,6 +9,7 @@ import java.util.Set; /** * Bpm 用户组 API 接口 * + * @author 芋道源码 * @author jason */ public interface BpmUserGroupServiceApi { diff --git a/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/api/BpmFormServiceApiImpl.java b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/api/BpmFormServiceApiImpl.java new file mode 100644 index 000000000..104445275 --- /dev/null +++ b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/api/BpmFormServiceApiImpl.java @@ -0,0 +1,33 @@ +package cn.iocoder.yudao.adminserver.modules.bpm.api; + +import cn.iocoder.yudao.adminserver.modules.bpm.convert.definition.BpmFormConvert; +import cn.iocoder.yudao.adminserver.modules.bpm.dal.mysql.definition.BpmFormMapper; +import cn.iocoder.yudao.coreservice.modules.bpm.api.form.BpmFormServiceApi; +import cn.iocoder.yudao.coreservice.modules.bpm.api.form.dto.BpmFormDTO; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Collection; +import java.util.List; +/** + * 动态表单 Api Service 实现类 + * + * @author 风里雾里 + * @author jason + */ +@Service +public class BpmFormServiceApiImpl implements BpmFormServiceApi { + + @Resource + private BpmFormMapper formMapper; + + @Override + public BpmFormDTO getForm(Long id) { + return BpmFormConvert.INSTANCE.convert1(formMapper.selectById(id)); + } + + @Override + public List getFormList(Collection ids) { + return BpmFormConvert.INSTANCE.convertList(formMapper.selectBatchIds(ids)); + } +} diff --git a/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/api/BpmUserGroupServiceApiImpl.java b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/api/BpmUserGroupServiceApiImpl.java index b789ba9e1..2b9ad5a6d 100644 --- a/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/api/BpmUserGroupServiceApiImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/api/BpmUserGroupServiceApiImpl.java @@ -24,6 +24,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU /** * Bpm 用户组 API 接口 实现类 * + * @author 芋道源码 * @author jason */ @Service diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/BpmFormController.java b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/BpmFormController.java similarity index 100% rename from yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/BpmFormController.java rename to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/BpmFormController.java diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormBaseVO.java b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormBaseVO.java similarity index 100% rename from yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormBaseVO.java rename to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormBaseVO.java diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormCreateReqVO.java b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormCreateReqVO.java similarity index 100% rename from yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormCreateReqVO.java rename to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormCreateReqVO.java diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormPageReqVO.java b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormPageReqVO.java similarity index 100% rename from yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormPageReqVO.java rename to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormPageReqVO.java diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormRespVO.java b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormRespVO.java similarity index 100% rename from yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormRespVO.java rename to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormRespVO.java diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormSimpleRespVO.java b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormSimpleRespVO.java similarity index 100% rename from yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormSimpleRespVO.java rename to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormSimpleRespVO.java diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormUpdateReqVO.java b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormUpdateReqVO.java similarity index 100% rename from yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormUpdateReqVO.java rename to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/form/BpmFormUpdateReqVO.java diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmFormConvert.java b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmFormConvert.java similarity index 86% rename from yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmFormConvert.java rename to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmFormConvert.java index 10e77f1e8..7dc2dfabf 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmFormConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmFormConvert.java @@ -5,6 +5,7 @@ import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.form.Bp import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.form.BpmFormSimpleRespVO; import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.form.BpmFormUpdateReqVO; import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmFormDO; +import cn.iocoder.yudao.coreservice.modules.bpm.api.form.dto.BpmFormDTO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; @@ -27,6 +28,10 @@ public interface BpmFormConvert { BpmFormRespVO convert(BpmFormDO bean); + BpmFormDTO convert1(BpmFormDO bean); + + List convertList(List list); + List convertList2(List list); PageResult convertPage(PageResult page); diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/definition/BpmFormDO.java b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/definition/BpmFormDO.java similarity index 100% rename from yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/definition/BpmFormDO.java rename to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/definition/BpmFormDO.java diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/mysql/definition/BpmFormMapper.java b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/mysql/definition/BpmFormMapper.java similarity index 100% rename from yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/mysql/definition/BpmFormMapper.java rename to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/mysql/definition/BpmFormMapper.java diff --git a/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java index 5fd230cef..531f7fac4 100644 --- a/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java +++ b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java @@ -7,4 +7,7 @@ public interface BpmErrorCodeConstants { ErrorCode USER_GROUP_NOT_EXISTS = new ErrorCode(1009011000, "用户组不存在"); ErrorCode USER_GROUP_IS_DISABLE = new ErrorCode(1009011001, "名字为【{}】的用户组已被禁用"); + // ========== 动态表单模块 1-009-010-000 ========== + ErrorCode FORM_NOT_EXISTS = new ErrorCode(1009010000, "动态表单不存在"); + ErrorCode FORM_FIELD_REPEAT = new ErrorCode(1009010000, "表单项({}) 和 ({}) 使用了相同的字段名({})"); } diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmFormService.java b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmFormService.java similarity index 100% rename from yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmFormService.java rename to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmFormService.java diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/dto/BpmFormFieldRespDTO.java b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/dto/BpmFormFieldRespDTO.java similarity index 100% rename from yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/dto/BpmFormFieldRespDTO.java rename to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/dto/BpmFormFieldRespDTO.java diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmFormServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmFormServiceImpl.java similarity index 88% rename from yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmFormServiceImpl.java rename to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmFormServiceImpl.java index e7ba8dfa9..8bebc39ca 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmFormServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmFormServiceImpl.java @@ -7,8 +7,10 @@ import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.form.Bp import cn.iocoder.yudao.adminserver.modules.bpm.convert.definition.BpmFormConvert; import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmFormDO; import cn.iocoder.yudao.adminserver.modules.bpm.dal.mysql.definition.BpmFormMapper; +import cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants; import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmFormService; import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto.BpmFormFieldRespDTO; +import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import org.springframework.stereotype.Service; @@ -20,10 +22,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.FORM_FIELD_REPEAT; -import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.FORM_NOT_EXISTS; -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; - /** * 动态表单 Service 实现类 * @@ -66,7 +64,7 @@ public class BpmFormServiceImpl implements BpmFormService { private void validateFormExists(Long id) { if (formMapper.selectById(id) == null) { - throw exception(FORM_NOT_EXISTS); + throw ServiceExceptionUtil.exception(BpmErrorCodeConstants.FORM_NOT_EXISTS); } } @@ -106,7 +104,7 @@ public class BpmFormServiceImpl implements BpmFormService { continue; } // 如果存在,则报错 - throw exception(FORM_FIELD_REPEAT, oldLabel, fieldDTO.getLabel(), fieldDTO.getVModel()); + throw ServiceExceptionUtil.exception(BpmErrorCodeConstants.FORM_FIELD_REPEAT, oldLabel, fieldDTO.getLabel(), fieldDTO.getVModel()); } } diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/test/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmFormServiceTest.java b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/test/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmFormServiceTest.java similarity index 100% rename from yudao-module-bpm/yudao-module-bpm-activiti/src/test/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmFormServiceTest.java rename to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/test/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmFormServiceTest.java diff --git a/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/test/resources/sql/clean.sql b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/test/resources/sql/clean.sql index 45b43e0e8..43c1cc535 100644 --- a/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/test/resources/sql/clean.sql +++ b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/test/resources/sql/clean.sql @@ -1,2 +1,3 @@ -- bpm 开头的 DB +DELETE FROM "bpm_form"; DELETE FROM "bpm_user_group"; diff --git a/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/test/resources/sql/create_tables.sql b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/test/resources/sql/create_tables.sql index da5b9a613..92d250064 100644 --- a/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/test/resources/sql/create_tables.sql +++ b/yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/test/resources/sql/create_tables.sql @@ -12,3 +12,18 @@ CREATE TABLE IF NOT EXISTS "bpm_user_group" ( "deleted" bit NOT NULL DEFAULT FALSE, PRIMARY KEY ("id") ) COMMENT '用户组'; + +CREATE TABLE IF NOT EXISTS "bpm_form" ( + "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, + "name" varchar(63) NOT NULL, + "status" tinyint NOT NULL, + "fields" varchar(255) NOT NULL, + "conf" varchar(255) NOT NULL, + "remark" varchar(255), + "creator" varchar(64) DEFAULT '', + "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updater" varchar(64) DEFAULT '', + "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + "deleted" bit NOT NULL DEFAULT FALSE, + PRIMARY KEY ("id") +) COMMENT '动态表单'; From 933bb7c6a643fd1c1065ba5ef6c3262c5c9af6c8 Mon Sep 17 00:00:00 2001 From: jason <2667446@qq.com> Date: Sat, 29 Jan 2022 23:15:57 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E5=90=8E=E7=9A=84=E7=BC=96=E8=AF=91=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/activiti/config/BpmActivitiConfiguration.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/config/BpmActivitiConfiguration.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/config/BpmActivitiConfiguration.java index 8e30c22db..2e1da6f4a 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/config/BpmActivitiConfiguration.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/config/BpmActivitiConfiguration.java @@ -10,17 +10,11 @@ import cn.iocoder.yudao.coreservice.modules.bpm.api.group.BpmUserGroupServiceApi import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService; import cn.iocoder.yudao.coreservice.modules.system.service.permission.SysPermissionCoreService; import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; -import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmUserGroupService; -import cn.iocoder.yudao.adminserver.modules.system.service.dept.SysDeptService; -import cn.iocoder.yudao.adminserver.modules.system.service.permission.SysPermissionService; -import cn.iocoder.yudao.adminserver.modules.system.service.user.SysUserService; import org.activiti.api.runtime.shared.identity.UserGroupManager; -import org.activiti.core.common.spring.identity.ActivitiUserGroupManagerImpl; import org.activiti.spring.boot.ProcessEngineConfigurationConfigurer; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.security.core.userdetails.UserDetailsService; import java.util.Collections; import java.util.List;