Merge branch 'feature/flowable' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into feature/multi-module

 Conflicts:
	yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/config/BpmActivitiConfiguration.java
pull/2/head
YunaiV 2022-01-31 00:34:25 +08:00
commit 14097b4120
29 changed files with 180 additions and 33 deletions

View File

@ -2,9 +2,9 @@ package cn.iocoder.yudao.adminserver.modules.bpm.convert.definition;
import cn.hutool.core.util.StrUtil; 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.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.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.collection.CollectionUtils;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import org.activiti.engine.impl.persistence.entity.SuspensionState; import org.activiti.engine.impl.persistence.entity.SuspensionState;
@ -30,19 +30,19 @@ public interface BpmModelConvert {
BpmModelConvert INSTANCE = Mappers.getMapper(BpmModelConvert.class); BpmModelConvert INSTANCE = Mappers.getMapper(BpmModelConvert.class);
default List<BpmModelPageItemRespVO> convertList(List<Model> list, Map<Long, BpmFormDO> formMap, default List<BpmModelPageItemRespVO> convertList(List<Model> list, Map<Long, BpmFormDTO> formMap,
Map<String, Deployment> deploymentMap, Map<String, Deployment> deploymentMap,
Map<String, ProcessDefinition> processDefinitionMap) { Map<String, ProcessDefinition> processDefinitionMap) {
return CollectionUtils.convertList(list, model -> { return CollectionUtils.convertList(list, model -> {
BpmModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(model.getMetaInfo(), BpmModelMetaInfoRespDTO.class); 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; Deployment deployment = model.getDeploymentId() != null ? deploymentMap.get(model.getDeploymentId()) : null;
ProcessDefinition processDefinition = model.getDeploymentId() != null ? processDefinitionMap.get(model.getDeploymentId()) : null; ProcessDefinition processDefinition = model.getDeploymentId() != null ? processDefinitionMap.get(model.getDeploymentId()) : null;
return convert(model, form, deployment, processDefinition); 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(); BpmModelPageItemRespVO modelRespVO = new BpmModelPageItemRespVO();
modelRespVO.setId(model.getId()); modelRespVO.setId(model.getId());
modelRespVO.setCreateTime(model.getCreateTime()); modelRespVO.setCreateTime(model.getCreateTime());
@ -83,7 +83,7 @@ public interface BpmModelConvert {
void copyTo(BpmModelMetaInfoRespDTO from, @MappingTarget BpmModelBaseVO to); 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(); BpmProcessDefinitionCreateReqDTO createReqDTO = new BpmProcessDefinitionCreateReqDTO();
createReqDTO.setModelId(model.getId()); createReqDTO.setModelId(model.getId());
createReqDTO.setName(model.getName()); createReqDTO.setName(model.getName());

View File

@ -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.BpmProcessDefinitionPageItemRespVO;
import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.process.BpmProcessDefinitionRespVO; 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.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.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.collection.CollectionUtils;
import org.activiti.engine.impl.persistence.entity.SuspensionState; import org.activiti.engine.impl.persistence.entity.SuspensionState;
import org.activiti.engine.repository.Deployment; import org.activiti.engine.repository.Deployment;
@ -29,17 +29,17 @@ public interface BpmProcessDefinitionConvert {
BpmProcessDefinitionConvert INSTANCE = Mappers.getMapper(BpmProcessDefinitionConvert.class); BpmProcessDefinitionConvert INSTANCE = Mappers.getMapper(BpmProcessDefinitionConvert.class);
default List<BpmProcessDefinitionPageItemRespVO> convertList(List<ProcessDefinition> list, Map<String, Deployment> deploymentMap, default List<BpmProcessDefinitionPageItemRespVO> convertList(List<ProcessDefinition> list, Map<String, Deployment> deploymentMap,
Map<String, BpmProcessDefinitionExtDO> processDefinitionDOMap, Map<Long, BpmFormDO> formMap) { Map<String, BpmProcessDefinitionExtDO> processDefinitionDOMap, Map<Long, BpmFormDTO> formMap) {
return CollectionUtils.convertList(list, definition -> { return CollectionUtils.convertList(list, definition -> {
Deployment deployment = definition.getDeploymentId() != null ? deploymentMap.get(definition.getDeploymentId()) : null; Deployment deployment = definition.getDeploymentId() != null ? deploymentMap.get(definition.getDeploymentId()) : null;
BpmProcessDefinitionExtDO definitionDO = processDefinitionDOMap.get(definition.getId()); 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); return convert(definition, deployment, definitionDO, form);
}); });
} }
default BpmProcessDefinitionPageItemRespVO convert(ProcessDefinition bean, Deployment deployment, default BpmProcessDefinitionPageItemRespVO convert(ProcessDefinition bean, Deployment deployment,
BpmProcessDefinitionExtDO processDefinitionExtDO, BpmFormDO form) { BpmProcessDefinitionExtDO processDefinitionExtDO, BpmFormDTO form) {
BpmProcessDefinitionPageItemRespVO respVO = convert(bean); BpmProcessDefinitionPageItemRespVO respVO = convert(bean);
respVO.setSuspensionState(bean.isSuspended() ? SuspensionState.SUSPENDED.getStateCode() : SuspensionState.ACTIVE.getStateCode()); respVO.setSuspensionState(bean.isSuspended() ? SuspensionState.SUSPENDED.getStateCode() : SuspensionState.ACTIVE.getStateCode());
if (deployment != null) { if (deployment != null) {

View File

@ -55,6 +55,4 @@ public interface BpmErrorCodeConstants {
// ========== 动态表单模块 1-009-010-000 ========== // ========== 动态表单模块 1-009-010-000 ==========
ErrorCode FORM_NOT_EXISTS = new ErrorCode(1009010000, "动态表单不存在"); ErrorCode FORM_NOT_EXISTS = new ErrorCode(1009010000, "动态表单不存在");
ErrorCode FORM_FIELD_REPEAT = new ErrorCode(1009010000, "表单项({}) 和 ({}) 使用了相同的字段名({})");
} }

View File

@ -10,6 +10,9 @@ import cn.iocoder.yudao.coreservice.modules.bpm.api.group.BpmUserGroupServiceApi
import cn.iocoder.yudao.module.system.service.dept.SysDeptCoreService; import cn.iocoder.yudao.module.system.service.dept.SysDeptCoreService;
import cn.iocoder.yudao.module.system.service.permission.SysPermissionCoreService; import cn.iocoder.yudao.module.system.service.permission.SysPermissionCoreService;
import cn.iocoder.yudao.module.system.service.user.SysUserCoreService; import cn.iocoder.yudao.module.system.service.user.SysUserCoreService;
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 org.activiti.api.runtime.shared.identity.UserGroupManager; import org.activiti.api.runtime.shared.identity.UserGroupManager;
import org.activiti.spring.boot.ProcessEngineConfigurationConfigurer; import org.activiti.spring.boot.ProcessEngineConfigurationConfigurer;
import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisher;

View File

@ -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.model.*;
import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.rule.BpmTaskAssignRuleRespVO; 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.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.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.BpmProcessDefinitionService;
import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmTaskAssignRuleService; 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.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.activiti.core.util.ActivitiUtils;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; 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.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.exception;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
/** /**
@ -57,7 +56,7 @@ public class BpmModelServiceImpl implements BpmModelService {
@Resource @Resource
private RepositoryService repositoryService; private RepositoryService repositoryService;
@Resource @Resource
private BpmFormService formService; private BpmFormServiceApi formServiceApi;
@Resource @Resource
private BpmProcessDefinitionService processDefinitionService; private BpmProcessDefinitionService processDefinitionService;
@Resource @Resource
@ -85,7 +84,7 @@ public class BpmModelServiceImpl implements BpmModelService {
BpmModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(model.getMetaInfo(), BpmModelMetaInfoRespDTO.class); BpmModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(model.getMetaInfo(), BpmModelMetaInfoRespDTO.class);
return metaInfo != null ? metaInfo.getFormId() : null; return metaInfo != null ? metaInfo.getFormId() : null;
}); });
Map<Long, BpmFormDO> formMap = formService.getFormMap(formIds); Map<Long, BpmFormDTO> formMap = formServiceApi.getFormMap(formIds);
// 获得 Deployment Map // 获得 Deployment Map
Set<String> deploymentIds = new HashSet<>(); Set<String> deploymentIds = new HashSet<>();
@ -172,7 +171,7 @@ public class BpmModelServiceImpl implements BpmModelService {
} }
// TODO 芋艿:校验流程图的有效性;例如说,是否有开始的元素,是否有结束的元素; // TODO 芋艿:校验流程图的有效性;例如说,是否有开始的元素,是否有结束的元素;
// 校验表单已配 // 校验表单已配
BpmFormDO form = checkFormConfig(model); BpmFormDTO form = checkFormConfig(model);
// 校验任务分配规则已配置 // 校验任务分配规则已配置
checkTaskAssignRuleAllConfig(id); checkTaskAssignRuleAllConfig(id);
@ -225,14 +224,14 @@ public class BpmModelServiceImpl implements BpmModelService {
* @param model * @param model
* @return * @return
*/ */
private BpmFormDO checkFormConfig(Model model) { private BpmFormDTO checkFormConfig(Model model) {
BpmModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(model.getMetaInfo(), BpmModelMetaInfoRespDTO.class); BpmModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(model.getMetaInfo(), BpmModelMetaInfoRespDTO.class);
if (metaInfo == null || metaInfo.getFormType() == null) { if (metaInfo == null || metaInfo.getFormType() == null) {
throw exception(MODEL_DEPLOY_FAIL_FORM_NOT_CONFIG); throw exception(MODEL_DEPLOY_FAIL_FORM_NOT_CONFIG);
} }
// 校验表单存在 // 校验表单存在
if (Objects.equals(metaInfo.getFormType(), BpmModelFormTypeEnum.NORMAL.getType())) { if (Objects.equals(metaInfo.getFormType(), BpmModelFormTypeEnum.NORMAL.getType())) {
BpmFormDO form = formService.getForm(metaInfo.getFormId()); BpmFormDTO form = formServiceApi.getForm(metaInfo.getFormId());
if (form == null) { if (form == null) {
throw exception(FORM_NOT_EXISTS); throw exception(FORM_NOT_EXISTS);
} }

View File

@ -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.BpmProcessDefinitionPageReqVO;
import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.process.BpmProcessDefinitionRespVO; 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.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.dataobject.definition.BpmProcessDefinitionExtDO;
import cn.iocoder.yudao.adminserver.modules.bpm.dal.mysql.definition.BpmProcessDefinitionExtMapper; 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.BpmProcessDefinitionService;
import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto.BpmProcessDefinitionCreateReqDTO; 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.activiti.core.util.ActivitiUtils;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.PageUtils; import cn.iocoder.yudao.framework.common.util.object.PageUtils;
@ -31,7 +31,8 @@ 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.*; 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.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
import static java.util.Collections.emptyList; import static java.util.Collections.emptyList;
@ -54,7 +55,7 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
@Resource @Resource
private RepositoryService repositoryService; private RepositoryService repositoryService;
@Resource @Resource
private BpmFormService bpmFormService; private BpmFormServiceApi bpmFormServiceApi;
@Resource @Resource
private BpmProcessDefinitionExtMapper processDefinitionMapper; private BpmProcessDefinitionExtMapper processDefinitionMapper;
@ -85,7 +86,7 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
// 获得 Form Map // 获得 Form Map
Set<Long> formIds = convertSet(processDefinitionDOs, BpmProcessDefinitionExtDO::getFormId); Set<Long> formIds = convertSet(processDefinitionDOs, BpmProcessDefinitionExtDO::getFormId);
Map<Long, BpmFormDO> formMap = bpmFormService.getFormMap(formIds); Map<Long, BpmFormDTO> formMap = bpmFormServiceApi.getFormMap(formIds);
// 拼接结果 // 拼接结果
long definitionCount = definitionQuery.count(); long definitionCount = definitionQuery.count();

View File

@ -16,5 +16,9 @@
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
</dependency> </dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-common</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -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<BpmFormDTO> getFormList(Collection<Long> ids);
/**
* Map
*
* @param ids
* @return Map
*/
default Map<Long, BpmFormDTO> getFormMap(Collection<Long> ids) {
if (CollUtil.isEmpty(ids)) {
return Collections.emptyMap();
}
return CollectionUtils.convertMap(this.getFormList(ids), BpmFormDTO::getId);
}
}

View File

@ -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<String> fields;
/**
*
*/
private String remark;
}

View File

@ -9,6 +9,7 @@ import java.util.Set;
/** /**
* Bpm API * Bpm API
* *
* @author
* @author jason * @author jason
*/ */
public interface BpmUserGroupServiceApi { public interface BpmUserGroupServiceApi {

View File

@ -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<BpmFormDTO> getFormList(Collection<Long> ids) {
return BpmFormConvert.INSTANCE.convertList(formMapper.selectBatchIds(ids));
}
}

View File

@ -24,6 +24,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
/** /**
* Bpm API * Bpm API
* *
* @author
* @author jason * @author jason
*/ */
@Service @Service

View File

@ -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.BpmFormSimpleRespVO;
import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.form.BpmFormUpdateReqVO; 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.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 cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
@ -27,6 +28,10 @@ public interface BpmFormConvert {
BpmFormRespVO convert(BpmFormDO bean); BpmFormRespVO convert(BpmFormDO bean);
BpmFormDTO convert1(BpmFormDO bean);
List<BpmFormDTO> convertList(List<BpmFormDO> list);
List<BpmFormSimpleRespVO> convertList2(List<BpmFormDO> list); List<BpmFormSimpleRespVO> convertList2(List<BpmFormDO> list);
PageResult<BpmFormRespVO> convertPage(PageResult<BpmFormDO> page); PageResult<BpmFormRespVO> convertPage(PageResult<BpmFormDO> page);

View File

@ -7,4 +7,7 @@ public interface BpmErrorCodeConstants {
ErrorCode USER_GROUP_NOT_EXISTS = new ErrorCode(1009011000, "用户组不存在"); ErrorCode USER_GROUP_NOT_EXISTS = new ErrorCode(1009011000, "用户组不存在");
ErrorCode USER_GROUP_IS_DISABLE = new ErrorCode(1009011001, "名字为【{}】的用户组已被禁用"); 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, "表单项({}) 和 ({}) 使用了相同的字段名({})");
} }

View File

@ -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.convert.definition.BpmFormConvert;
import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmFormDO; 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.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.BpmFormService;
import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto.BpmFormFieldRespDTO; 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.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -20,10 +22,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; 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 * Service
* *
@ -66,7 +64,7 @@ public class BpmFormServiceImpl implements BpmFormService {
private void validateFormExists(Long id) { private void validateFormExists(Long id) {
if (formMapper.selectById(id) == null) { 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; continue;
} }
// 如果存在,则报错 // 如果存在,则报错
throw exception(FORM_FIELD_REPEAT, oldLabel, fieldDTO.getLabel(), fieldDTO.getVModel()); throw ServiceExceptionUtil.exception(BpmErrorCodeConstants.FORM_FIELD_REPEAT, oldLabel, fieldDTO.getLabel(), fieldDTO.getVModel());
} }
} }

View File

@ -1,2 +1,3 @@
-- bpm DB -- bpm DB
DELETE FROM "bpm_form";
DELETE FROM "bpm_user_group"; DELETE FROM "bpm_user_group";

View File

@ -12,3 +12,18 @@ CREATE TABLE IF NOT EXISTS "bpm_user_group" (
"deleted" bit NOT NULL DEFAULT FALSE, "deleted" bit NOT NULL DEFAULT FALSE,
PRIMARY KEY ("id") PRIMARY KEY ("id")
) COMMENT ''; ) 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 '';