Bpm 动态表单。移到bpm-core-service 模块
parent
6aca4ae9fd
commit
c5e2df943c
|
@ -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<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, ProcessDefinition> 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());
|
||||
|
|
|
@ -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<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 -> {
|
||||
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) {
|
||||
|
|
|
@ -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, "表单项({}) 和 ({}) 使用了相同的字段名({})");
|
||||
|
||||
}
|
||||
|
|
|
@ -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<Long, BpmFormDO> formMap = formService.getFormMap(formIds);
|
||||
Map<Long, BpmFormDTO> formMap = formServiceApi.getFormMap(formIds);
|
||||
|
||||
// 获得 Deployment Map
|
||||
Set<String> 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);
|
||||
}
|
||||
|
|
|
@ -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<Long> formIds = convertSet(processDefinitionDOs, BpmProcessDefinitionExtDO::getFormId);
|
||||
Map<Long, BpmFormDO> formMap = bpmFormService.getFormMap(formIds);
|
||||
Map<Long, BpmFormDTO> formMap = bpmFormServiceApi.getFormMap(formIds);
|
||||
|
||||
// 拼接结果
|
||||
long definitionCount = definitionQuery.count();
|
||||
|
|
|
@ -16,5 +16,9 @@
|
|||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -9,6 +9,7 @@ import java.util.Set;
|
|||
/**
|
||||
* Bpm 用户组 API 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author jason
|
||||
*/
|
||||
public interface BpmUserGroupServiceApi {
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
|
@ -24,6 +24,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
|
|||
/**
|
||||
* Bpm 用户组 API 接口 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author jason
|
||||
*/
|
||||
@Service
|
||||
|
|
|
@ -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<BpmFormDTO> convertList(List<BpmFormDO> list);
|
||||
|
||||
List<BpmFormSimpleRespVO> convertList2(List<BpmFormDO> list);
|
||||
|
||||
PageResult<BpmFormRespVO> convertPage(PageResult<BpmFormDO> page);
|
|
@ -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, "表单项({}) 和 ({}) 使用了相同的字段名({})");
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,2 +1,3 @@
|
|||
-- bpm 开头的 DB
|
||||
DELETE FROM "bpm_form";
|
||||
DELETE FROM "bpm_user_group";
|
||||
|
|
|
@ -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 '动态表单';
|
||||
|
|
Loading…
Reference in New Issue