feat(REQ-3004) - 集成表单引擎测试

This commit is contained in:
wangli 2024-11-12 10:17:49 +08:00
parent d5ed0367d5
commit db9c9bec31
29 changed files with 550 additions and 235 deletions

View File

@ -0,0 +1,25 @@
package cn.axzo.workflow.client.feign.manage;
import cn.axzo.workflow.client.annotation.WorkflowEngineFeignClient;
import cn.axzo.workflow.common.annotation.Manageable;
import cn.axzo.workflow.common.model.request.form.instance.FormSearchDTO;
import cn.axzo.workflow.common.model.response.BpmPageResult;
import cn.axzo.workflow.common.model.response.form.FormVO;
import cn.azxo.framework.common.model.CommonResponse;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* 表达实例相关 API
*
* @author wangli
* @since 2024-11-11 20:08
*/
@WorkflowEngineFeignClient
@Manageable
public interface FormInstanceApi {
@PostMapping("/api/form/instance/form/page")
CommonResponse<BpmPageResult<FormVO>> formPage(@Validated @RequestBody FormSearchDTO dto);
}

View File

@ -22,4 +22,7 @@ public class BpmnFormRelationCreateDTO {
@ApiModelProperty(value = "表单部署ID")
private String formDeploymentId;
@ApiModelProperty(value = "租户 ID")
private String tenantId;
}

View File

@ -1,7 +1,11 @@
package cn.axzo.workflow.common.model.dto;
import cn.axzo.workflow.common.model.request.BpmPageParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import static cn.axzo.workflow.common.constant.BpmnConstants.NO_TENANT_ID;
/**
* 搜索
@ -9,8 +13,9 @@ import lombok.Data;
* @author wangli
* @date 2024/11/08
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class BpmnFormRelationSearchDTO {
public class BpmnFormRelationSearchDTO extends BpmPageParam {
/**
* 业务标识
@ -29,4 +34,10 @@ public class BpmnFormRelationSearchDTO {
*/
@ApiModelProperty(value = "表单定义部署 ID")
private String formDeploymentId;
/**
* 租户 ID
*/
@ApiModelProperty(value = "租户 ID")
private String tenantId = NO_TENANT_ID;
}

View File

@ -20,15 +20,6 @@ import java.util.Map;
@Data
public class BpmnProcessInstanceCreateWithFormDTO extends BpmnProcessInstanceCreateDTO {
// /**
// * 表单的定义 ID
// * <p>
// * 参考:ACT_FO_FORM_DEFINITION 表的主键
// */
// @ApiModelProperty(value = "表单定义 ID", example = "ssss")
// @NotBlank(message = "表单不能为空")
// private String formDefinitionId;
@ApiModelProperty(value = "通过表单创建流程时传入的初始表单数据")
private Map<String, Object> startFormVariables = new HashMap<>();
/**
@ -36,7 +27,7 @@ public class BpmnProcessInstanceCreateWithFormDTO extends BpmnProcessInstanceCre
* <p>
* 一般不用设置
*/
@ApiModelProperty(value = "用于接入外部传入的信息", hidden = true)
@ApiModelProperty(value = "用于接入外部传入的信息, 类似于 Bpmn 的 BusinessKey", hidden = true)
private String outcome;
}

View File

@ -0,0 +1,50 @@
package cn.axzo.workflow.common.model.request.form.definition;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Map;
import static cn.axzo.workflow.common.constant.BpmnConstants.NO_TENANT_ID;
/**
* 表单定义内容的响应模型
*
* @author wangli
* @since 2024-11-11 14:23
*/
@ApiModel("表单定义于内容的响应模型")
@Data
public class FormContentSearchDTO {
/**
* 表单 KEY
*/
@ApiModelProperty(value = "表单唯一标识")
private String key;
/**
* 流程实例 ID
*/
@ApiModelProperty(value = "流程实例 ID", example = "we", notes = "当 key 不知道时,可以用实例 ID 代替key")
private String processInstanceId;
/**
* 流程任务 ID
*/
@ApiModelProperty(value = "流程任务 ID")
private String taskId;
/**
* 变量集合
*/
@ApiModelProperty(value = "额外变量")
private Map<String, Object> variables;
/**
* 租户 ID
*/
@ApiModelProperty(value = "租户 ID")
private String tenantId = NO_TENANT_ID;
}

View File

@ -14,7 +14,7 @@ import static cn.axzo.workflow.common.constant.BpmnConstants.NO_TENANT_ID;
*/
@ApiModel("表单定义的搜索入参模型")
@Data
public class FromDefinitionSearchDTO {
public class FormDefinitionSearchDTO {
@ApiModelProperty(value = "表单部署 ID")
private String deploymentId;

View File

@ -0,0 +1,51 @@
package cn.axzo.workflow.common.model.request.form.instance;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Map;
import static cn.axzo.workflow.common.constant.BpmnConstants.NO_TENANT_ID;
/**
* 表单实例数据响应模型
*
* @author wangli
* @since 2024-11-11 15:26
*/
@ApiModel("表单实例数据响应模型")
@Data
public class FormInstanceSearchDTO implements Serializable {
/**
* 表单标识=业务标识
*/
@ApiModelProperty(value = "表单标识=业务标识")
private String key;
/**
* 实例 ID
*/
@ApiModelProperty(value = "实例 ID")
private String processInstanceId;
/**
* 任务 ID
*/
@ApiModelProperty(value = "任务 ID")
private String taskId;
/**
* 变量
*/
@ApiModelProperty(value = "变量")
private Map<String,Object> variables;
/**
* 租户 ID
*/
@ApiModelProperty(value = "租户 ID")
private String tenantId = NO_TENANT_ID;
}

View File

@ -0,0 +1,34 @@
package cn.axzo.workflow.common.model.request.form.instance;
import cn.axzo.workflow.common.model.request.BpmPageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import static cn.axzo.workflow.common.constant.BpmnConstants.NO_TENANT_ID;
/**
* 表单搜索入参模型
*
* @author wangli
* @since 2024-11-11 19:55
*/
@EqualsAndHashCode(callSuper = true)
@ApiModel("表单搜索入参模型")
@Data
public class FormSearchDTO extends BpmPageParam {
/**
* 业务标识
*/
@ApiModelProperty("业务标识")
private String key;
/**
* 租户 ID
*/
@ApiModelProperty(value = "租户 ID")
private String tenantId = NO_TENANT_ID;
}

View File

@ -0,0 +1,35 @@
package cn.axzo.workflow.common.model.response.form;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 表单相应模型
*
* @author wangli
* @since 2024-11-11 20:01
*/
@ApiModel("表单响应模型")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class FormVO {
/**
* 业务标识
*/
@ApiModelProperty(value = "业务标识")
private String key;
/**
* 租户 ID
*/
@ApiModelProperty(value = "租户 ID")
private String tenantId;
}

View File

@ -28,6 +28,7 @@ import com.alibaba.cloud.nacos.NacosServiceManager;
import com.google.common.collect.Lists;
import org.flowable.common.engine.api.delegate.event.FlowableEventListener;
import org.flowable.common.engine.impl.history.HistoryLevel;
import org.flowable.form.engine.configurator.FormEngineConfigurator;
import org.flowable.job.service.JobProcessor;
import org.flowable.spring.SpringProcessEngineConfiguration;
import org.flowable.spring.boot.EngineConfigurationConfigurer;
@ -45,6 +46,8 @@ import java.time.Duration;
import java.util.List;
import java.util.Map;
import static org.flowable.common.engine.impl.AbstractEngineConfiguration.DB_SCHEMA_UPDATE_TRUE;
/**
* Flowable 引擎相关全局配置
*
@ -75,7 +78,7 @@ public class FlowableConfiguration {
configuration.setJobProcessors(jobProcessors);
configuration.setEventListeners(Lists.newArrayList(listeners));
configuration.setActivityBehaviorFactory(customActivityBehaviorFactory);
// configuration.setDatabaseSchemaUpdate(DB_SCHEMA_UPDATE_TRUE);
configuration.setDatabaseSchemaUpdate(DB_SCHEMA_UPDATE_TRUE);
configuration.setEnableSafeBpmnXml(false);
// configuration.setCreateDiagramOnDeploy(false);
// configuration.setIdGenerator(new TimeBasedIdGenerator());

View File

@ -32,6 +32,10 @@ public class ExtAxBpmnFormRelation extends BaseEntity<ExtAxBpmnFormRelation> {
* 发布的定义 ID
*/
private String formDeploymentId;
/**
* 租户 ID
*/
private String tenantId;
/**
* 创建者
*/

View File

@ -2,7 +2,9 @@ package cn.axzo.workflow.core.service;
import cn.axzo.workflow.common.model.dto.BpmnFormRelationCreateDTO;
import cn.axzo.workflow.common.model.dto.BpmnFormRelationSearchDTO;
import cn.axzo.workflow.common.model.response.BpmPageResult;
import cn.axzo.workflow.core.repository.entity.ExtAxBpmnFormRelation;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
@ -19,4 +21,6 @@ public interface ExtAxBpmnFormRelationService {
List<ExtAxBpmnFormRelation> genericQuery(BpmnFormRelationSearchDTO dto);
BpmPageResult<ExtAxBpmnFormRelation> genericPageQuery(BpmnFormRelationSearchDTO dto);
}

View File

@ -47,7 +47,7 @@ public class AggregateModelServiceImpl implements AggregateModelService {
public String createBpmnAndFormModel(BpmnModelCreateDTO dto) {
String bpmModelId = bpmnProcessModelService.createBpmModel(dto);
if (!CollectionUtils.isEmpty(dto.getFormJsonModel().getFormFields())) {
if (Objects.nonNull(dto.getFormJsonModel()) && !CollectionUtils.isEmpty(dto.getFormJsonModel().getFormFields())) {
Model formModel = repositoryService.createModelQuery().modelKey(dto.getKey()).modelCategory(FORM_FILE_SUFFIX).singleResult();
FormModelUpdateDTO formModelDto = new FormModelUpdateDTO();
formModelDto.setKey(dto.getKey());
@ -70,7 +70,7 @@ public class AggregateModelServiceImpl implements AggregateModelService {
bpmnProcessModelService.updateBpmModel(dto);
// 如果没有表单字段就操作表单模型
if (!CollectionUtils.isEmpty(dto.getFormJsonModel().getFormFields())) {
if (Objects.nonNull(dto.getFormJsonModel()) && !CollectionUtils.isEmpty(dto.getFormJsonModel().getFormFields())) {
FormModelUpdateDTO formModel = new FormModelUpdateDTO();
formModel.setKey(dto.getKey());
formModel.setName(dto.getName());
@ -101,7 +101,9 @@ public class AggregateModelServiceImpl implements AggregateModelService {
relation.setKey(model.getKey());
relation.setBpmnDefinitionId(definitionId);
relation.setFormDeploymentId(formDeploymentId);
relation.setTenantId(tenantId);
formRelationService.insert(relation);
return definitionId;
}
}

View File

@ -3,7 +3,7 @@ package cn.axzo.workflow.core.service.impl;
import cn.axzo.workflow.common.exception.WorkflowEngineException;
import cn.axzo.workflow.common.model.request.bpmn.definition.BpmnProcessDefinitionUpdateDTO;
import cn.axzo.workflow.common.model.request.bpmn.process.BpmnProcessDefinitionPageDTO;
import cn.axzo.workflow.common.model.request.form.definition.FromDefinitionSearchDTO;
import cn.axzo.workflow.common.model.request.form.definition.FormDefinitionSearchDTO;
import cn.axzo.workflow.common.model.response.BpmPageResult;
import cn.axzo.workflow.common.model.response.bpmn.process.BpmnProcessDefinitionVO;
import cn.axzo.workflow.common.model.response.form.definition.FormDefinitionVO;
@ -191,7 +191,7 @@ public class BpmnProcessDefinitionServiceImpl implements BpmnProcessDefinitionSe
BpmnProcessDefinitionVO vo = processDefinitionConverter.toVo(processDefinition);
vo.setJsonModel(BpmnJsonConverterUtil.convertToJson(repositoryService.getBpmnModel(id)));
FromDefinitionSearchDTO formDefinitionSearch = new FromDefinitionSearchDTO();
FormDefinitionSearchDTO formDefinitionSearch = new FormDefinitionSearchDTO();
formDefinitionSearch.setKey(processDefinition.getKey());
formDefinitionSearch.setTenantId(processDefinition.getTenantId());
FormDefinitionVO formDefinitionVO = formDefinitionService.get(formDefinitionSearch);

View File

@ -372,9 +372,12 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
.overrideProcessDefinitionTenantId(dto.getTenantId());
ExtAxBpmnFormRelation relation = bpmnFormRelationService.queryByBpmnDefinitionId(definition.getId());
if (Objects.nonNull(relation)) {
if (Objects.isNull(relation)) {
// 如果模型没有绑定表单则强制情况表单相关属性避免报错
instanceBuilder.startFormVariables(null).outcome(null);
}else {
instanceBuilder.startFormVariables(dto.getStartFormVariables())
.outcome(dto.getOutcome());
}
ProcessInstance instance;

View File

@ -2,10 +2,12 @@ package cn.axzo.workflow.core.service.impl;
import cn.axzo.workflow.common.model.dto.BpmnFormRelationCreateDTO;
import cn.axzo.workflow.common.model.dto.BpmnFormRelationSearchDTO;
import cn.axzo.workflow.common.model.response.BpmPageResult;
import cn.axzo.workflow.core.repository.entity.ExtAxBpmnFormRelation;
import cn.axzo.workflow.core.repository.mapper.ExtAxBpmnFormRelationMapper;
import cn.axzo.workflow.core.service.ExtAxBpmnFormRelationService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
@ -13,6 +15,8 @@ import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.List;
import static cn.axzo.workflow.common.constant.BpmnConstants.NO_TENANT_ID;
/**
* bpmn 模型与表单模型的关联关系
*
@ -31,6 +35,7 @@ public class ExtAxBpmnFormRelationServiceImpl implements ExtAxBpmnFormRelationSe
relation.setKey(dto.getKey());
relation.setBpmnDefinitionId(dto.getBpmnDefinitionId());
relation.setFormDeploymentId(dto.getFormDeploymentId());
relation.setTenantId(dto.getTenantId());
bpmnFormRelationMapper.insert(relation);
return relation.getId();
}
@ -47,11 +52,18 @@ public class ExtAxBpmnFormRelationServiceImpl implements ExtAxBpmnFormRelationSe
return bpmnFormRelationMapper.selectList(buildQueryWrapper(dto));
}
public BpmPageResult<ExtAxBpmnFormRelation> genericPageQuery(BpmnFormRelationSearchDTO dto) {
Page<ExtAxBpmnFormRelation> page = bpmnFormRelationMapper.selectPage(new Page<>(dto.getPageNo(), dto.getPageSize()), buildQueryWrapper(dto));
return new BpmPageResult<>(page.getRecords(), page.getTotal());
}
LambdaQueryWrapper<ExtAxBpmnFormRelation> buildQueryWrapper(BpmnFormRelationSearchDTO dto) {
return new LambdaQueryWrapper<ExtAxBpmnFormRelation>()
.eq(StringUtils.hasText(dto.getKey()), ExtAxBpmnFormRelation::getKey, dto.getKey())
.eq(StringUtils.hasText(dto.getBpmnDefinitionId()), ExtAxBpmnFormRelation::getBpmnDefinitionId, dto.getBpmnDefinitionId())
.eq(StringUtils.hasText(dto.getFormDeploymentId()), ExtAxBpmnFormRelation::getFormDeploymentId, dto.getFormDeploymentId())
;
.eq(!StringUtils.hasText(dto.getTenantId()), ExtAxBpmnFormRelation::getTenantId, NO_TENANT_ID)
.eq(StringUtils.hasText(dto.getTenantId()), ExtAxBpmnFormRelation::getTenantId, dto.getTenantId())
;
}
}

View File

@ -4,6 +4,7 @@ create table ext_ax_bpmn_form_relation
`key` varchar(64) default '' not null comment '业务标识',
bpmn_definition_id varchar(64) default '' not null comment 'BPMN定义 ID',
form_deployment_id varchar(64) default '' not null comment '表单部署 ID',
tenant_id varchar(64) default '' not null comment '租户 ID',
update_by bigint default 0 not null comment '更新人',
update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间',

View File

@ -22,6 +22,12 @@
</dependency>
<!-- 引入 Form 引擎(基于 Flowable) -->
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-form-spring</artifactId>
<version>${flowable.version}</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-form-spring-configurator</artifactId>

View File

@ -1,14 +1,10 @@
package cn.axzo.workflow.form.service;
import cn.axzo.workflow.common.model.request.form.definition.FormDefinitionUpdateDTO;
import cn.axzo.workflow.common.model.request.form.definition.FromDefinitionSearchDTO;
import cn.axzo.workflow.common.model.request.form.definition.FormDefinitionSearchDTO;
import cn.axzo.workflow.common.model.request.form.definition.FormContentSearchDTO;
import cn.axzo.workflow.common.model.response.form.definition.FormDefinitionVO;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Nullable;
import javax.validation.constraints.NotBlank;
import org.flowable.form.api.FormInfo;
/**
* 表单定义相关服务接口
@ -18,8 +14,12 @@ import javax.validation.constraints.NotBlank;
*/
public interface FormDefinitionService {
FormDefinitionVO getDraft(FromDefinitionSearchDTO dto);
FormDefinitionVO get(FromDefinitionSearchDTO dto);
FormDefinitionVO get(FormDefinitionSearchDTO dto);
/**
* 表单内容适用于发起时打开原始表单页面
* @param dto
* @return
*/
FormInfo getFormInfo(FormContentSearchDTO dto);
}

View File

@ -2,6 +2,8 @@ package cn.axzo.workflow.form.service;
import cn.axzo.workflow.common.model.request.form.instance.FormContentUpdateDTO;
import cn.axzo.workflow.common.model.request.form.instance.FormInstanceSearchDTO;
import org.flowable.form.api.FormInstanceInfo;
/**
* 表单实例相关接口
@ -17,4 +19,11 @@ public interface FormInstanceService {
* @param dto
*/
void updateFormContent(FormContentUpdateDTO dto);
/**
* 查询指定审批的表单已经填入的最新的内容
* @param dto
* @return
*/
FormInstanceInfo getFormInstanceInfo(FormInstanceSearchDTO dto);
}

View File

@ -1,7 +1,7 @@
package cn.axzo.workflow.form.service.converter;
/**
* TODO
* Object to List
*
* @author wangli
* @since 2024-11-11 13:42

View File

@ -9,7 +9,7 @@ import java.util.Arrays;
import static org.mapstruct.NullValueCheckStrategy.ALWAYS;
/**
* TODO
* Converter
*
* @author wangli
* @since 2024-11-11 11:27

View File

@ -1,33 +1,27 @@
package cn.axzo.workflow.form.service.impl;
import cn.axzo.framework.jackson.utility.JSON;
import cn.axzo.workflow.common.model.request.form.definition.FromDefinitionSearchDTO;
import cn.axzo.workflow.common.model.request.form.definition.FormContentSearchDTO;
import cn.axzo.workflow.common.model.request.form.definition.FormDefinitionSearchDTO;
import cn.axzo.workflow.common.model.response.form.definition.FormDefinitionVO;
import cn.axzo.workflow.form.service.FormDefinitionService;
import cn.axzo.workflow.form.service.converter.FormFieldConverter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.javassist.Loader;
import org.flowable.common.engine.api.FlowableObjectNotFoundException;
import org.flowable.common.engine.impl.util.IoUtil;
import org.flowable.form.api.FormDefinition;
import org.flowable.form.api.FormDefinitionQuery;
import org.flowable.engine.HistoryService;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.form.api.FormInfo;
import org.flowable.form.api.FormRepositoryService;
import org.flowable.form.api.FormService;
import org.flowable.form.model.FormField;
import org.flowable.form.model.SimpleFormModel;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Objects;
import static cn.axzo.workflow.common.constant.BpmnConstants.FORM_FILE_SUFFIX;
import static cn.axzo.workflow.common.constant.BpmnConstants.NO_TENANT_ID;
/**
* 表单定义 Service 实现
@ -43,18 +37,16 @@ public class FormDefinitionServiceImpl implements FormDefinitionService {
private FormRepositoryService formRepositoryService;
@Resource
private FormFieldConverter formFieldConverter;
@Resource
private HistoryService historyService;
@Resource
private FormService formService;
@Override
public FormDefinitionVO getDraft(FromDefinitionSearchDTO dto) {
return null;
}
@Override
public FormDefinitionVO get(FromDefinitionSearchDTO dto) {
public FormDefinitionVO get(FormDefinitionSearchDTO dto) {
FormInfo formModel;
try {
formModel = formRepositoryService.getFormModelByKey(dto.getKey(), dto.getTenantId(), true);
formModel = formRepositoryService.getFormModelByKey(dto.getKey(), dto.getTenantId(), false);
}catch (FlowableObjectNotFoundException e){
return null;
}
@ -70,5 +62,21 @@ public class FormDefinitionServiceImpl implements FormDefinitionService {
return formDefinitionVO;
}
@Override
public FormInfo getFormInfo(FormContentSearchDTO dto) {
if (StringUtils.hasText(dto.getProcessInstanceId()) && !StringUtils.hasText(dto.getKey())) {
HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery()
.includeProcessVariables()
.processInstanceId(dto.getProcessInstanceId())
.processInstanceTenantId(dto.getTenantId())
.singleResult();
if (Objects.nonNull(instance)) {
dto.setKey(instance.getProcessDefinitionKey());
dto.setVariables(instance.getProcessVariables());
} else {
return null;
}
}
return formService.getFormModelWithVariablesByKey(dto.getKey(), dto.getTaskId(), dto.getVariables(), dto.getTenantId(), true);
}
}

View File

@ -3,11 +3,14 @@ package cn.axzo.workflow.form.service.impl;
import cn.axzo.workflow.common.code.BpmnTaskRespCode;
import cn.axzo.workflow.common.exception.WorkflowEngineException;
import cn.axzo.workflow.common.model.request.form.instance.FormContentUpdateDTO;
import cn.axzo.workflow.common.model.request.form.instance.FormInstanceSearchDTO;
import cn.axzo.workflow.form.service.FormInstanceService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.HistoryService;
import org.flowable.engine.TaskService;
import org.flowable.form.api.FormInfo;
import org.flowable.form.api.FormInstanceInfo;
import org.flowable.form.api.FormRepositoryService;
import org.flowable.form.api.FormService;
import org.flowable.task.api.Task;
@ -18,7 +21,6 @@ import javax.annotation.Resource;
import java.util.Objects;
/**
* 表单实例 Service 实现
*
@ -36,6 +38,8 @@ public class FormInstanceServiceImpl implements FormInstanceService {
private FormService formService;
@Resource
private TaskService taskService;
@Resource
private HistoryService historyService;
@Override
public void updateFormContent(FormContentUpdateDTO dto) {
@ -62,4 +66,9 @@ public class FormInstanceServiceImpl implements FormInstanceService {
task.getScopeId(), task.getScopeType(), task.getScopeDefinitionId(), task.getTenantId(), null);
}
}
@Override
public FormInstanceInfo getFormInstanceInfo(FormInstanceSearchDTO dto) {
return formService.getFormInstanceModelByKey(dto.getKey(), dto.getTaskId(), dto.getProcessInstanceId(), dto.getVariables(), dto.getTenantId(), true);
}
}

View File

@ -3,10 +3,13 @@ package cn.axzo.workflow.server.controller.web;
import cn.axzo.workflow.client.feign.bpmn.ProcessInstanceApi;
import cn.axzo.workflow.common.model.request.bpmn.process.BpmnProcessInstanceAbortDTO;
import cn.axzo.workflow.common.model.request.bpmn.process.BpmnProcessInstanceQueryDTO;
import cn.axzo.workflow.common.model.request.form.definition.FormContentSearchDTO;
import cn.axzo.workflow.common.model.response.bpmn.process.BpmnProcessInstanceVO;
import cn.axzo.workflow.common.model.response.bpmn.process.ProcessNodeDetailVO;
import cn.axzo.workflow.core.service.BpmnProcessInstanceService;
import cn.axzo.workflow.core.service.support.FlowNodeForecastService;
import cn.axzo.workflow.form.service.FormDefinitionService;
import cn.axzo.workflow.form.service.FormInstanceService;
import cn.axzo.workflow.server.common.annotation.RepeatSubmit;
import cn.axzo.workflow.server.common.util.ShellUtil;
import cn.azxo.framework.common.model.CommonResponse;
@ -19,6 +22,7 @@ import org.flowable.engine.RuntimeService;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.repository.Deployment;
import org.flowable.form.api.FormInfo;
import org.flowable.form.api.FormInstanceInfo;
import org.flowable.form.api.FormRepositoryService;
import org.flowable.form.api.FormService;
import org.springframework.beans.factory.annotation.Autowired;
@ -71,6 +75,8 @@ public class TestController {
private FormService formService;
@Resource
private FormRepositoryService formRepositoryService;
@Resource
private FormDefinitionService formDefinitionService;
// @Autowired
// private WorkflowCoreService workflowCoreService;
// @Autowired
@ -264,10 +270,16 @@ public class TestController {
}
@GetMapping("form")
public CommonResponse<FormInfo> getForm(@RequestParam String definitionId, @RequestParam(required = false) String processInstanceId) {
public CommonResponse<FormInfo> getForm(@RequestParam String definitionId, @RequestParam(required = false) String processInstanceId, @RequestParam(required = false) String taskId) {
// FormInfo startFormModel = bpmnProcessInstanceService.getStartFormModel(definitionId, processInstanceId);
// formService.getFormInstanceModelByKey("we", null, null, null);
FormContentSearchDTO contentSearch = new FormContentSearchDTO();
contentSearch.setProcessInstanceId(processInstanceId);
contentSearch.setTaskId(taskId);
contentSearch.setTenantId("400");
FormInfo formInfo = formDefinitionService.getFormInfo(contentSearch);
FormInfo we = formService.getFormModelWithVariablesByKey("we", null, null);
FormInstanceInfo we1 = formService.getFormInstanceModelByKey("we", StringUtils.hasText(taskId)?taskId:null,null, null, "", false);
FormInfo formModelByKey = formRepositoryService.getFormModelByKey("we");
FormInfo startFormModel = runtimeService.getStartFormModel(definitionId, processInstanceId);
return CommonResponse.success(null);

View File

@ -4,12 +4,16 @@ import cn.axzo.workflow.client.feign.bpmn.ProcessDefinitionApi;
import cn.axzo.workflow.common.model.request.bpmn.definition.BpmnProcessDefinitionUpdateDTO;
import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelUpdateDTO;
import cn.axzo.workflow.common.model.request.bpmn.process.BpmnProcessDefinitionPageDTO;
import cn.axzo.workflow.common.model.request.form.FormJsonModel;
import cn.axzo.workflow.common.model.request.form.definition.FormDefinitionSearchDTO;
import cn.axzo.workflow.common.model.response.BpmPageResult;
import cn.axzo.workflow.common.model.response.bpmn.model.BpmnModelDetailVO;
import cn.axzo.workflow.common.model.response.bpmn.process.BpmnProcessDefinitionVO;
import cn.axzo.workflow.common.model.response.form.definition.FormDefinitionVO;
import cn.axzo.workflow.core.service.BpmnProcessDefinitionService;
import cn.axzo.workflow.core.service.BpmnProcessModelService;
import cn.axzo.workflow.core.service.converter.BpmnProcessDefinitionConverter;
import cn.axzo.workflow.form.service.FormDefinitionService;
import cn.axzo.workflow.server.common.annotation.ErrorReporter;
import cn.azxo.framework.common.model.CommonResponse;
import cn.hutool.json.JSONUtil;
@ -31,7 +35,9 @@ import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Map;
import java.util.Objects;
import static cn.axzo.workflow.common.constant.BpmnConstants.NO_TENANT_ID;
import static cn.axzo.workflow.common.constant.MetaInfoConstants.MODEL_DESCRIPTION;
import static cn.azxo.framework.common.model.CommonResponse.success;
@ -50,6 +56,8 @@ public class BpmnProcessDefinitionController implements ProcessDefinitionApi {
private BpmnProcessDefinitionConverter processDefinitionConverter;
@Resource
private BpmnProcessModelService bpmnProcessModelService;
@Resource
private FormDefinitionService formDefinitionService;
/**
@ -189,7 +197,7 @@ public class BpmnProcessDefinitionController implements ProcessDefinitionApi {
public CommonResponse<BpmnModelUpdateDTO> getActiveProcessDefinitionJsonModel(@NotBlank(message = "模型 ID 不能为空") @RequestParam(required = false) String modelId,
@NotBlank(message = "分类不能为空") @RequestParam(required = false) String key,
@RequestParam(required = false) String tenantId) {
String finalTenantId = StringUtils.hasText(tenantId) ? tenantId : "";
String finalTenantId = StringUtils.hasText(tenantId) ? tenantId : NO_TENANT_ID;
BpmnModelDetailVO modelDetail = bpmnProcessModelService.getById(modelId, finalTenantId);
String activeProcessDefinitionId = bpmnProcessDefinitionService.getActiveProcessDefinitionId(finalTenantId,
key);
@ -206,6 +214,14 @@ public class BpmnProcessDefinitionController implements ProcessDefinitionApi {
Map<String, String> metaInfoMap = JSON.parseObject(modelDetail.getMetaInfo(), Map.class);
updateDTO.setDescription(metaInfoMap.get(MODEL_DESCRIPTION));
FormDefinitionSearchDTO search = new FormDefinitionSearchDTO();
search.setKey(modelDetail.getKey());
search.setTenantId(finalTenantId);
FormDefinitionVO formDefinitionVO = formDefinitionService.get(search);
if(Objects.nonNull(formDefinitionVO)) {
updateDTO.setFormJsonModel(new FormJsonModel(modelDetail.getName(), formDefinitionVO.getFields()));
}
return success(updateDTO);
}

View File

@ -1,8 +1,7 @@
package cn.axzo.workflow.server.controller.web.form;
import cn.axzo.workflow.common.model.request.form.definition.FromDefinitionSearchDTO;
import cn.axzo.workflow.common.model.request.form.definition.FormDefinitionSearchDTO;
import cn.axzo.workflow.common.model.response.form.definition.FormDefinitionVO;
import cn.axzo.workflow.core.service.FormModelService;
import cn.axzo.workflow.form.service.FormDefinitionService;
import cn.axzo.workflow.server.common.annotation.ErrorReporter;
import cn.azxo.framework.common.model.CommonResponse;
@ -13,11 +12,9 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;
import static cn.azxo.framework.common.model.CommonResponse.success;
@ -41,15 +38,9 @@ public class FormDefinitionController {
@Resource
private FormDefinitionService formDefinitionService;
@Operation(summary = "通过指定表单模型 ID 获取表单定义草稿内容")
@GetMapping("/draft/get")
public CommonResponse<FormDefinitionVO> getDraft(@Validated @RequestBody FromDefinitionSearchDTO dto) {
return success(formDefinitionService.getDraft(dto));
}
@Operation(summary = "通过表单模型 ID 获取表单定义发布内容")
@GetMapping("/get")
public CommonResponse<FormDefinitionVO> get(@Validated @RequestBody FromDefinitionSearchDTO dto) {
public CommonResponse<FormDefinitionVO> get(@Validated @RequestBody FormDefinitionSearchDTO dto) {
return success(formDefinitionService.get(dto));
}

View File

@ -1,18 +1,28 @@
package cn.axzo.workflow.server.controller.web.form;
import cn.axzo.workflow.client.feign.manage.FormInstanceApi;
import cn.axzo.workflow.common.model.dto.BpmnFormRelationSearchDTO;
import cn.axzo.workflow.common.model.request.form.instance.FormContentUpdateDTO;
import cn.axzo.workflow.common.model.request.form.instance.FormSearchDTO;
import cn.axzo.workflow.common.model.response.BpmPageResult;
import cn.axzo.workflow.common.model.response.form.FormVO;
import cn.axzo.workflow.core.repository.entity.ExtAxBpmnFormRelation;
import cn.axzo.workflow.core.service.ExtAxBpmnFormRelationService;
import cn.axzo.workflow.form.service.FormInstanceService;
import cn.axzo.workflow.server.common.annotation.ErrorReporter;
import cn.azxo.framework.common.model.CommonResponse;
import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
import static cn.azxo.framework.common.model.CommonResponse.success;
/**
@ -22,14 +32,34 @@ import static cn.azxo.framework.common.model.CommonResponse.success;
* @since 2023/7/21 15:23
*/
@Slf4j
@RequestMapping("/web/v1/api/form/instance")
@RequestMapping({"/web/v1/api/form/instance", "/api/form/instance"})
@RestController
@ErrorReporter
@Validated
public class FormInstanceController {
public class FormInstanceController implements FormInstanceApi {
@Autowired
@Resource
private FormInstanceService formInstanceService;
@Resource
private ExtAxBpmnFormRelationService bpmnFormRelationService;
@Operation(summary = "表单列表")
@PostMapping("/form/page")
public CommonResponse<BpmPageResult<FormVO>> formPage(FormSearchDTO dto) {
BpmnFormRelationSearchDTO searchDTO = new BpmnFormRelationSearchDTO();
searchDTO.setKey(dto.getKey());
searchDTO.setTenantId(dto.getTenantId());
BpmPageResult<ExtAxBpmnFormRelation> page =
bpmnFormRelationService.genericPageQuery(searchDTO);
List<FormVO> result = page.getList()
.stream().map(e -> FormVO.builder()
.key(e.getKey())
.tenantId(e.getTenantId())
.build())
.collect(Collectors.toList());
return success(new BpmPageResult<>(result, page.getTotal()));
}
@Operation(summary = "更新表单内容")
@PostMapping("/content/update")

View File

@ -17,26 +17,16 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import cn.axzo.workflow.client.config.CommonFeignConfiguration;
import cn.axzo.workflow.common.model.request.bpmn.BpmnButtonMetaInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelCreateDTO;
import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelSearchDTO;
import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelUpdateDTO;
import cn.axzo.workflow.common.model.response.BpmPageResult;
import cn.axzo.workflow.common.model.response.bpmn.model.BpmnModelDetailVO;
import cn.axzo.workflow.common.model.response.bpmn.model.BpmnModelExtVO;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PutMapping;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import cn.axzo.workflow.common.model.request.bpmn.activity.BpmnActivityTimeoutCallbackDTO;
import cn.axzo.workflow.common.model.request.bpmn.activity.BpmnActivityTimeoutTriggerDTO;
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnActivitySetAssigneeDTO;
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnActivityTriggerDTO;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import javax.validation.constraints.NotBlank;
import cn.axzo.workflow.common.model.request.es.InstanceSearchReqDTO;
import cn.axzo.workflow.common.model.response.BpmPageResult;
import cn.axzo.workflow.common.model.response.es.ProcessInstanceDocumentVO;
import cn.axzo.workflow.common.model.request.bpmn.process.BpmnProcessInstanceAbortDTO;
import cn.axzo.workflow.common.model.request.bpmn.process.BpmnProcessInstanceAdminPageReqVO;
@ -55,8 +45,11 @@ import cn.axzo.workflow.common.model.response.bpmn.process.BpmnProcessInstancePa
import cn.axzo.workflow.common.model.response.bpmn.process.BpmnProcessInstanceVO;
import cn.axzo.workflow.common.model.response.bpmn.process.ProcessNodeDetailVO;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.springframework.web.bind.annotation.PutMapping;
import javax.annotation.Nullable;
import javax.validation.constraints.NotNull;
import java.util.Map;
import cn.axzo.workflow.client.config.CommonFeignConfiguration;
import cn.axzo.workflow.common.model.request.category.CategoryConfigCreateDTO;
import cn.axzo.workflow.common.model.request.category.CategoryConfigSearchDTO;
import cn.axzo.workflow.common.model.request.category.CategoryCreateDTO;
@ -64,7 +57,16 @@ import cn.axzo.workflow.common.model.request.category.CategorySearchDTO;
import cn.axzo.workflow.common.model.request.category.CategoryUpdateDTO;
import cn.axzo.workflow.common.model.response.category.CategoryConfigItemVO;
import cn.axzo.workflow.common.model.response.category.CategoryItemVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import cn.axzo.workflow.common.model.request.form.instance.FormSearchDTO;
import cn.axzo.workflow.common.model.response.form.FormVO;
import cn.axzo.workflow.common.model.request.bpmn.BpmnButtonMetaInfo;
import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelCreateDTO;
import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelSearchDTO;
import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelUpdateDTO;
import cn.axzo.workflow.common.model.response.bpmn.model.BpmnModelDetailVO;
import cn.axzo.workflow.common.model.response.bpmn.model.BpmnModelExtVO;
import cn.axzo.workflow.common.model.request.bpmn.RestBpmnProcessVariable;
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnOptionalNodeDTO;
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnRobotTaskCompleteDTO;
@ -161,157 +163,6 @@ public interface WorkflowManageService {
@InvokeMode(SYNC)
Integer batchDeleteProcessAdmin(@RequestBody List<Long> ids);
/**
* 获取流程操作按钮列表
*
* @return 流程操作按钮列表
*/
@GetMapping("/api/process/config/button/list")
@InvokeMode(SYNC)
List<BpmnButtonMetaInfo> getDefaultButtons();
/**
* 流程模型列表
*
* @param dto
* @return
*/
@Operation(summary = "流程模型列表")
@GetMapping("/api/process/model/page")
@InvokeMode(SYNC)
BpmPageResult<BpmnModelDetailVO> page(@Validated @RequestBody BpmnModelSearchDTO dto);
/**
* 创建流程,
* return modelId的主键
*/
@Operation(summary = "创建流程模型")
@PostMapping("/api/process/model/create")
@InvokeMode(SYNC)
String create(@Validated @RequestBody BpmnModelCreateDTO dto);
/**
* 通过模型 ID 获取模型
*/
@Operation(summary = "通过模型ID查询指定流程模型")
@GetMapping("/api/process/model/get")
@InvokeMode(SYNC)
BpmnModelDetailVO getById(@NotBlank(message = "流程模型 ID 不能为空") @RequestParam(required = false) String processModelId, @RequestParam(required = false) String tenantId);
/**
* 通过模型 KEY 获取模型
*/
@Operation(summary = "通过模型KEY查询指定流程模型")
@GetMapping("/api/process/model/getByKey")
@InvokeMode(SYNC)
BpmnModelDetailVO getByKey(@NotBlank(message = "流程模型 KEY 不能为空") @RequestParam(required = false) String processModelKey, @NotBlank(message = "租户不能为空") @RequestParam(required = false) String tenantId);
/**
* 校验是否能更新模型即其关联的流程定义内容
* <p>
* 偏向业务的接口,flowable 引擎是站在流程定义维度进行激活和挂起
*
* @return true 能更新,表明该模型关联的所有定义版本都是挂起状态
*/
@Operation(summary = "获取指定模型的扩展属性")
@GetMapping("/api/process/model/ext")
@InvokeMode(SYNC)
BpmnModelExtVO getModelExt(@NotBlank(message = "模型 ID 不能为空") @RequestParam(required = false) String modelId);
/**
* 修改流程信息
*/
@Operation(summary = "更新流程模型")
@PutMapping("/api/process/model/update")
@InvokeMode(SYNC)
String update(@RequestBody BpmnModelUpdateDTO dto);
/**
* 通过模型 ID 部署模型
*
* @return 部署完成的流程定义Id
*/
@Operation(summary = "通过模型 ID 部署流程模型")
@PostMapping("/api/process/model/deploy")
@InvokeMode(SYNC)
String deployById(@NotBlank(message = "流程模型 ID 不能为空") @RequestParam(required = false) String processModelId, @RequestParam(required = false, defaultValue = "") String modelTenantId, @RequestParam(required = false) String operator);
/**
* 通过模型 KEY 部署模型
*
* @return 部署完成的流程定义Id
*/
@Operation(summary = "通过模型 KEY 部署流程模型")
@PostMapping("/api/process/model/deployByKey")
@InvokeMode(SYNC)
String deployByKey(@NotBlank(message = "流程模型 KEY 不能为空") @RequestParam(required = false) String processModelKey, @NotBlank(message = "租户不能为空") @RequestParam(required = false) String modelTenantId, @RequestParam(required = false) String operator);
/**
* 通过模型 ID 取消部署流程模型
*
* @param processModelId
* @param tenantId
* @param operator
* @return
*/
@Operation(summary = "通过模型 ID 取消部署流程模型")
@PostMapping("/api/process/model/undeploy")
@InvokeMode(SYNC)
Void unDeployById(@NotBlank(message = "流程模型 ID 不能为空") @RequestParam(required = false) String processModelId, @RequestParam(required = false, defaultValue = "") String tenantId, @RequestParam(required = false) String operator);
/**
* 通过模型 ID 删除模型
*/
@Operation(summary = "删除指定模型 ID 的流程模型")
@DeleteMapping("/api/process/model/delete")
@InvokeMode(SYNC)
Void deleteById(@NotBlank(message = "流程模型 ID 不能为空") @RequestParam String processModelId, @RequestParam(required = false, defaultValue = "") String tenantId);
/**
* 通过模型 KEY 删除模型
*
* @param processModelKey
* @param tenantId
* @return
*/
@Operation(summary = "删除指定模型 KEY 的流程模型")
@DeleteMapping("/api/process/model/deleteByKey")
@InvokeMode(SYNC)
Void deleteByKey(@NotBlank(message = "流程模型 KEY 不能为空") @RequestParam String processModelKey, @RequestParam(required = false, defaultValue = "") String tenantId);
/**
* 通过模型 ID 修改模型状态
*
* @param modelId
* @param status
* @param operator
* @return
*/
@Operation(summary = "修改模型状态")
@PostMapping("/api/process/model/changeStatus")
@InvokeMode(SYNC)
Void changeStatus(@NotBlank(message = "模型 ID 不能为空") @RequestParam String modelId, @NotNull(message = "状态不能为空") @RequestParam Integer status, @RequestParam(required = false) String operator);
/**
* 查询流程模型使用的分类列表
*
* @return
*/
@Operation(summary = "查询流程模型使用的分类列表")
@GetMapping("/api/process/model/category/ids")
@InvokeMode(SYNC)
List<String> getModelCategoryList();
/**
* 查询模型的租户集合
*
* @return
*/
@Operation(summary = "查询模型的租户集合")
@GetMapping("/api/process/model/tenant/ids")
@InvokeMode(SYNC)
List<String> getModelTenantIds();
/**
* 该功能应该利用引擎的 TimerBoundaryEvent 来实现但为了简便先利用引擎的任务调度来实现
*
@ -602,6 +453,160 @@ public interface WorkflowManageService {
@InvokeMode(SYNC)
Boolean checkCategoryStatus(@RequestParam Long tenantId, @RequestParam String categoryCode);
@PostMapping("/api/form/instance/form/page")
BpmPageResult<FormVO> formPage(@Validated @RequestBody FormSearchDTO dto);
/**
* 获取流程操作按钮列表
*
* @return 流程操作按钮列表
*/
@GetMapping("/api/process/config/button/list")
@InvokeMode(SYNC)
List<BpmnButtonMetaInfo> getDefaultButtons();
/**
* 流程模型列表
*
* @param dto
* @return
*/
@Operation(summary = "流程模型列表")
@GetMapping("/api/process/model/page")
@InvokeMode(SYNC)
BpmPageResult<BpmnModelDetailVO> page(@Validated @RequestBody BpmnModelSearchDTO dto);
/**
* 创建流程,
* return modelId的主键
*/
@Operation(summary = "创建流程模型")
@PostMapping("/api/process/model/create")
@InvokeMode(SYNC)
String create(@Validated @RequestBody BpmnModelCreateDTO dto);
/**
* 通过模型 ID 获取模型
*/
@Operation(summary = "通过模型ID查询指定流程模型")
@GetMapping("/api/process/model/get")
@InvokeMode(SYNC)
BpmnModelDetailVO getById(@NotBlank(message = "流程模型 ID 不能为空") @RequestParam(required = false) String processModelId, @RequestParam(required = false) String tenantId);
/**
* 通过模型 KEY 获取模型
*/
@Operation(summary = "通过模型KEY查询指定流程模型")
@GetMapping("/api/process/model/getByKey")
@InvokeMode(SYNC)
BpmnModelDetailVO getByKey(@NotBlank(message = "流程模型 KEY 不能为空") @RequestParam(required = false) String processModelKey, @NotBlank(message = "租户不能为空") @RequestParam(required = false) String tenantId);
/**
* 校验是否能更新模型即其关联的流程定义内容
* <p>
* 偏向业务的接口,flowable 引擎是站在流程定义维度进行激活和挂起
*
* @return true 能更新,表明该模型关联的所有定义版本都是挂起状态
*/
@Operation(summary = "获取指定模型的扩展属性")
@GetMapping("/api/process/model/ext")
@InvokeMode(SYNC)
BpmnModelExtVO getModelExt(@NotBlank(message = "模型 ID 不能为空") @RequestParam(required = false) String modelId);
/**
* 修改流程信息
*/
@Operation(summary = "更新流程模型")
@PutMapping("/api/process/model/update")
@InvokeMode(SYNC)
String update(@RequestBody BpmnModelUpdateDTO dto);
/**
* 通过模型 ID 部署模型
*
* @return 部署完成的流程定义Id
*/
@Operation(summary = "通过模型 ID 部署流程模型")
@PostMapping("/api/process/model/deploy")
@InvokeMode(SYNC)
String deployById(@NotBlank(message = "流程模型 ID 不能为空") @RequestParam(required = false) String processModelId, @RequestParam(required = false, defaultValue = "") String modelTenantId, @RequestParam(required = false) String operator);
/**
* 通过模型 KEY 部署模型
*
* @return 部署完成的流程定义Id
*/
@Operation(summary = "通过模型 KEY 部署流程模型")
@PostMapping("/api/process/model/deployByKey")
@InvokeMode(SYNC)
String deployByKey(@NotBlank(message = "流程模型 KEY 不能为空") @RequestParam(required = false) String processModelKey, @NotBlank(message = "租户不能为空") @RequestParam(required = false) String modelTenantId, @RequestParam(required = false) String operator);
/**
* 通过模型 ID 取消部署流程模型
*
* @param processModelId
* @param tenantId
* @param operator
* @return
*/
@Operation(summary = "通过模型 ID 取消部署流程模型")
@PostMapping("/api/process/model/undeploy")
@InvokeMode(SYNC)
Void unDeployById(@NotBlank(message = "流程模型 ID 不能为空") @RequestParam(required = false) String processModelId, @RequestParam(required = false, defaultValue = "") String tenantId, @RequestParam(required = false) String operator);
/**
* 通过模型 ID 删除模型
*/
@Operation(summary = "删除指定模型 ID 的流程模型")
@DeleteMapping("/api/process/model/delete")
@InvokeMode(SYNC)
Void deleteById(@NotBlank(message = "流程模型 ID 不能为空") @RequestParam String processModelId, @RequestParam(required = false, defaultValue = "") String tenantId);
/**
* 通过模型 KEY 删除模型
*
* @param processModelKey
* @param tenantId
* @return
*/
@Operation(summary = "删除指定模型 KEY 的流程模型")
@DeleteMapping("/api/process/model/deleteByKey")
@InvokeMode(SYNC)
Void deleteByKey(@NotBlank(message = "流程模型 KEY 不能为空") @RequestParam String processModelKey, @RequestParam(required = false, defaultValue = "") String tenantId);
/**
* 通过模型 ID 修改模型状态
*
* @param modelId
* @param status
* @param operator
* @return
*/
@Operation(summary = "修改模型状态")
@PostMapping("/api/process/model/changeStatus")
@InvokeMode(SYNC)
Void changeStatus(@NotBlank(message = "模型 ID 不能为空") @RequestParam String modelId, @NotNull(message = "状态不能为空") @RequestParam Integer status, @RequestParam(required = false) String operator);
/**
* 查询流程模型使用的分类列表
*
* @return
*/
@Operation(summary = "查询流程模型使用的分类列表")
@GetMapping("/api/process/model/category/ids")
@InvokeMode(SYNC)
List<String> getModelCategoryList();
/**
* 查询模型的租户集合
*
* @return
*/
@Operation(summary = "查询模型的租户集合")
@GetMapping("/api/process/model/tenant/ids")
@InvokeMode(SYNC)
List<String> getModelTenantIds();
/**
* 为指定流程新增变量
*/