BPM:流程实例的 status 状态实现,使用 Flowable 的 variables 存储,移除 bpm_process_instance_ext

This commit is contained in:
YunaiV 2024-03-16 16:43:53 +08:00
parent a1defeb48a
commit 7967a2a195
17 changed files with 150 additions and 242 deletions

View File

@ -4,7 +4,7 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 流程实例的状态
* 流程实例 ProcessInstance 的状态
*
* @author 芋道源码
*/
@ -13,7 +13,9 @@ import lombok.Getter;
public enum BpmProcessInstanceStatusEnum {
RUNNING(1, "进行中"),
FINISH(2, "已完成");
APPROVE(2, "通过"),
REJECT(3, "不通过"),
CANCEL(4, "已取消");
/**
* 状态

View File

@ -0,0 +1,28 @@
package cn.iocoder.yudao.module.bpm.enums.task;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 流程实例的状态
*
* @author 芋道源码
*/
@Deprecated
@Getter
@AllArgsConstructor
public enum BpmProcessInstanceStatusOldEnum {
RUNNING(1, "进行中"),
FINISH(2, "已完成");
/**
* 状态
*/
private final Integer status;
/**
* 描述
*/
private final String desc;
}

View File

@ -1,24 +0,0 @@
package cn.iocoder.yudao.module.bpm.controller.admin.candidate.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.util.Set;
/**
* 流程任务分配规则 Base VO提供给添加修改详细的子 VO 使用
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/
@Data
public class BpmTaskCandidateRuleVO {
@Schema(description = "规则类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "bpm_task_assign_rule_type")
@NotNull(message = "规则类型不能为空")
private Integer type;
@Schema(description = "规则值数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1,2,3")
@NotNull(message = "规则值数组不能为空")
private Set<Long> options;
}

View File

@ -1,19 +1,31 @@
package cn.iocoder.yudao.module.bpm.controller.admin.task;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.*;
import cn.iocoder.yudao.module.bpm.convert.task.BpmProcessInstanceConvert;
import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService;
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.task.api.Task;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@Tag(name = "管理后台 - 流程实例") // 流程实例通过流程定义创建的一次申请
@ -24,13 +36,27 @@ public class BpmProcessInstanceController {
@Resource
private BpmProcessInstanceService processInstanceService;
@Resource
private BpmTaskService taskService;
@Resource
private BpmProcessDefinitionService processDefinitionService;
@GetMapping("/my-page")
@Operation(summary = "获得我的实例分页列表", description = "在【我的流程】菜单中,进行调用")
@PreAuthorize("@ss.hasPermission('bpm:process-instance:query')")
public CommonResult<PageResult<BpmProcessInstancePageItemRespVO>> getMyProcessInstancePage(
@Valid BpmProcessInstanceMyPageReqVO pageReqVO) {
return success(processInstanceService.getMyProcessInstancePage(getLoginUserId(), pageReqVO));
PageResult<HistoricProcessInstance> pageResult = processInstanceService.getMyProcessInstancePage(getLoginUserId(), pageReqVO);
if (CollUtil.isEmpty(pageResult.getList())) {
return success(PageResult.empty(pageResult.getTotal()));
}
// 拼接返回
Map<String, List<Task>> taskMap = taskService.getTaskMapByProcessInstanceIds(
convertList(pageResult.getList(), HistoricProcessInstance::getId));
Map<String, ProcessDefinition> processDefinitionMap = processDefinitionService.getProcessDefinitionMap(
convertSet(pageResult.getList(), HistoricProcessInstance::getProcessDefinitionId));
return success(BpmProcessInstanceConvert.INSTANCE.convertPage(pageResult, processDefinitionMap, taskMap));
}
@PostMapping("/create")

View File

@ -23,13 +23,10 @@ public class BpmProcessInstancePageItemRespVO {
private String category;
@Schema(description = "流程实例的状态-参见 bpm_process_instance_status", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer status;
@Schema(description = "流程实例的结果-参见 bpm_process_instance_result", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Integer result;
private Integer status; // 参见 BpmProcessInstanceStatusEnum 枚举
@Schema(description = "提交时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
private LocalDateTime startTime;
@Schema(description = "结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime endTime;

View File

@ -20,8 +20,8 @@ public class BpmProcessInstanceRespVO {
@Schema(description = "流程分类-参见 bpm_model_category 数据字典", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private String category;
@Schema(description = "流程实例的状态-参见 bpm_process_instance_status", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer status;
@Schema(description = "流程实例的状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer status; // 参见 BpmProcessInstanceStatusEnum 枚举
@Schema(description = "流程实例的结果-参见 bpm_process_instance_result", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Integer result;

View File

@ -1,6 +1,5 @@
package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task;
import cn.iocoder.yudao.module.bpm.controller.admin.candidate.vo.BpmTaskCandidateRuleVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

View File

@ -1,13 +1,15 @@
package cn.iocoder.yudao.module.bpm.convert.task;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstancePageItemRespVO;
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceRespVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionExtDO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceExtDO;
import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceResultEvent;
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmConstants;
import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceApproveReqDTO;
import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceRejectReqDTO;
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
@ -34,25 +36,26 @@ public interface BpmProcessInstanceConvert {
BpmProcessInstanceConvert INSTANCE = Mappers.getMapper(BpmProcessInstanceConvert.class);
default PageResult<BpmProcessInstancePageItemRespVO> convertPage(PageResult<BpmProcessInstanceExtDO> page,
default PageResult<BpmProcessInstancePageItemRespVO> convertPage(PageResult<HistoricProcessInstance> pageResult,
Map<String, ProcessDefinition> processDefinitionMap,
Map<String, List<Task>> taskMap) {
List<BpmProcessInstancePageItemRespVO> list = convertList(page.getList());
list.forEach(respVO -> respVO.setTasks(convertList2(taskMap.get(respVO.getId()))));
return new PageResult<>(list, page.getTotal());
PageResult<BpmProcessInstancePageItemRespVO> vpPageResult = BeanUtils.toBean(pageResult, BpmProcessInstancePageItemRespVO.class);
for (int i = 0; i < pageResult.getList().size(); i++) {
BpmProcessInstancePageItemRespVO respVO = vpPageResult.getList().get(i);
respVO.setStatus((Integer) pageResult.getList().get(i).getProcessVariables().get(BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS));
MapUtils.findAndThen(processDefinitionMap, respVO.getProcessDefinitionId(),
processDefinition -> respVO.setCategory(processDefinition.getCategory()));
respVO.setTasks(BeanUtils.toBean(taskMap.get(respVO.getId()), BpmProcessInstancePageItemRespVO.Task.class));
}
return vpPageResult;
}
List<BpmProcessInstancePageItemRespVO> convertList(List<BpmProcessInstanceExtDO> list);
@Mapping(source = "processInstanceId", target = "id")
BpmProcessInstancePageItemRespVO convert(BpmProcessInstanceExtDO bean);
List<BpmProcessInstancePageItemRespVO.Task> convertList2(List<Task> tasks);
default BpmProcessInstanceRespVO convert2(HistoricProcessInstance processInstance, BpmProcessInstanceExtDO processInstanceExt,
default BpmProcessInstanceRespVO convert2(HistoricProcessInstance processInstance,
ProcessDefinition processDefinition, BpmProcessDefinitionExtDO processDefinitionExt,
String bpmnXml, AdminUserRespDTO startUser, DeptRespDTO dept) {
BpmProcessInstanceRespVO respVO = convert2(processInstance);
copyTo(processInstanceExt, respVO);
respVO.setStatus((Integer) processInstance.getProcessVariables().get(BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS));
respVO.setFormVariables(processInstance.getProcessVariables()); // TODO 芋艿真的这么搞么formVariable 要不要换个 key 之类的
// definition
respVO.setProcessDefinition(convert2(processDefinition));
copyTo(processDefinitionExt, respVO.getProcessDefinition());
@ -69,9 +72,6 @@ public interface BpmProcessInstanceConvert {
BpmProcessInstanceRespVO convert2(HistoricProcessInstance bean);
@Mapping(source = "from.id", target = "to.id", ignore = true)
void copyTo(BpmProcessInstanceExtDO from, @MappingTarget BpmProcessInstanceRespVO to);
BpmProcessInstanceRespVO.ProcessDefinition convert2(ProcessDefinition bean);
@Mapping(source = "from.id", target = "to.id", ignore = true)
@ -88,6 +88,7 @@ public interface BpmProcessInstanceConvert {
return event;
}
// TODO @芋艿需要改下 key
default BpmProcessInstanceResultEvent convert(Object source, ProcessInstance instance, Integer result) {
BpmProcessInstanceResultEvent event = new BpmProcessInstanceResultEvent(source);
event.setId(instance.getId());

View File

@ -1,98 +0,0 @@
package cn.iocoder.yudao.module.bpm.dal.dataobject.task;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceStatusEnum;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
/**
* Bpm 流程实例的拓展表
* 主要解决 Activiti ProcessInstance HistoricProcessInstance 不支持拓展字段所以新建拓展表
*
* @author 芋道源码
*/
@TableName(value = "bpm_process_instance_ext", autoResultMap = true)
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class BpmProcessInstanceExtDO extends BaseDO {
/**
* 编号自增
*/
@TableId
private Long id;
/**
* 发起流程的用户编号
*
* 冗余 HistoricProcessInstance startUserId 属性
*/
private Long startUserId;
/**
* 流程实例的名字
*
* 冗余 ProcessInstance name 属性用于筛选
*/
private String name;
/**
* 流程实例的编号
*
* 关联 ProcessInstance id 属性
*/
private String processInstanceId;
/**
* 流程定义的编号
*
* 关联 ProcessDefinition id 属性
*/
private String processDefinitionId;
/**
* 流程分类
*
* 冗余 ProcessDefinition category 属性
* 数据字典 bpm_model_category
*/
private String category;
/**
* 流程实例的状态
*
* 枚举 {@link BpmProcessInstanceStatusEnum}
*/
private Integer status;
/**
* 流程实例的结果
*
* 枚举 {@link BpmProcessInstanceResultEnum}
*/
private Integer result;
/**
* 结束时间
*
* 冗余 HistoricProcessInstance endTime 属性
*/
private LocalDateTime endTime;
/**
* 提交的表单值
*/
@TableField(typeHandler = JacksonTypeHandler.class)
private Map<String, Object> formVariables;
// TODO @haiassignees 复数
/**
* 提前设定好的审批人
*/
@TableField(typeHandler = JacksonTypeHandler.class, exist = false) // TODO 芋艿临时 exist = false避免 db 报错
private Map<String, List<Long>> assignee;
}

View File

@ -1,34 +0,0 @@
package cn.iocoder.yudao.module.bpm.dal.mysql.task;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceMyPageReqVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceExtDO;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface BpmProcessInstanceExtMapper extends BaseMapperX<BpmProcessInstanceExtDO> {
default PageResult<BpmProcessInstanceExtDO> selectPage(Long userId, BpmProcessInstanceMyPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<BpmProcessInstanceExtDO>()
.eqIfPresent(BpmProcessInstanceExtDO::getStartUserId, userId)
.likeIfPresent(BpmProcessInstanceExtDO::getName, reqVO.getName())
.eqIfPresent(BpmProcessInstanceExtDO::getProcessDefinitionId, reqVO.getProcessDefinitionId())
.eqIfPresent(BpmProcessInstanceExtDO::getCategory, reqVO.getCategory())
.eqIfPresent(BpmProcessInstanceExtDO::getStatus, reqVO.getStatus())
.eqIfPresent(BpmProcessInstanceExtDO::getResult, reqVO.getResult())
.betweenIfPresent(BpmProcessInstanceExtDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(BpmProcessInstanceExtDO::getId));
}
default BpmProcessInstanceExtDO selectByProcessInstanceId(String processInstanceId) {
return selectOne(BpmProcessInstanceExtDO::getProcessInstanceId, processInstanceId);
}
default void updateByProcessInstanceId(BpmProcessInstanceExtDO updateObj) {
update(updateObj, new LambdaQueryWrapperX<BpmProcessInstanceExtDO>()
.eq(BpmProcessInstanceExtDO::getProcessInstanceId, updateObj.getProcessInstanceId()));
}
}

View File

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.bpm.framework.flowable.core.enums;
import org.flowable.engine.runtime.ProcessInstance;
/**
* BPM 通用常量
*
* @author 芋道源码
*/
public class BpmConstants {
/**
* 流程实例的变量 - 状态
*
* @see ProcessInstance#getProcessVariables()
*/
public static final String PROCESS_INSTANCE_VARIABLE_STATUS = "PROCESS_STATUS";
}

View File

@ -1,7 +1,9 @@
package cn.iocoder.yudao.module.bpm.framework.flowable.core.enums;
/**
* 流程常量信息
* BPMN XML 常量信息
*
* @author 芋道源码
*/
public interface BpmnModelConstants {

View File

@ -1,8 +1,8 @@
package cn.iocoder.yudao.module.bpm.framework.flowable.core.listener;
import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceExtDO;
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
import com.google.common.collect.ImmutableSet;
import jakarta.annotation.Resource;
import org.flowable.common.engine.api.delegate.event.FlowableEngineEntityEvent;
import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType;
import org.flowable.engine.delegate.event.AbstractFlowableEngineEventListener;
@ -11,11 +11,10 @@ import org.flowable.engine.runtime.ProcessInstance;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import jakarta.annotation.Resource;
import java.util.Set;
/**
* 监听 {@link ProcessInstance} 开始与完成创建与更新对应的 {@link BpmProcessInstanceExtDO} 记录
* 监听 {@link ProcessInstance} 状态变更更新其对应的 status 状态
*
* @author jason
*/
@ -27,7 +26,6 @@ public class BpmProcessInstanceEventListener extends AbstractFlowableEngineEvent
private BpmProcessInstanceService processInstanceService;
public static final Set<FlowableEngineEventType> PROCESS_INSTANCE_EVENTS = ImmutableSet.<FlowableEngineEventType>builder()
.add(FlowableEngineEventType.PROCESS_CREATED)
.add(FlowableEngineEventType.PROCESS_CANCELLED)
.add(FlowableEngineEventType.PROCESS_COMPLETED)
.build();
@ -36,11 +34,6 @@ public class BpmProcessInstanceEventListener extends AbstractFlowableEngineEvent
super(PROCESS_INSTANCE_EVENTS);
}
@Override
protected void processCreated(FlowableEngineEntityEvent event) {
processInstanceService.createProcessInstanceExt((ProcessInstance)event.getEntity());
}
@Override
protected void processCancelled(FlowableCancelledEvent event) {
processInstanceService.updateProcessInstanceExtCancel(event);

View File

@ -1,21 +1,23 @@
package cn.iocoder.yudao.module.bpm.service.definition;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionListReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionPageItemRespVO;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionPageReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionRespVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionExtDO;
import cn.iocoder.yudao.module.bpm.service.definition.dto.BpmProcessDefinitionCreateReqDTO;
import jakarta.validation.Valid;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.engine.repository.Deployment;
import org.flowable.engine.repository.ProcessDefinition;
import jakarta.validation.Valid;
import java.util.List;
import java.util.Map;
import java.util.Set;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
/**
* Flowable流程定义接口
*
@ -90,14 +92,16 @@ public interface BpmProcessDefinitionService {
ProcessDefinition getProcessDefinition(String id);
/**
* 获得编号对应的 ProcessDefinition
* 获得 ids 对应的 ProcessDefinition 数组
*
* 相比 {@link #getProcessDefinition(String)} 方法category 的取值是正确
*
* @param id 编号
* @return 流程定义
* @param ids 编号的数组
* @return 流程定义的数组
*/
ProcessDefinition getProcessDefinition2(String id);
List<ProcessDefinition> getProcessDefinitionList(Set<String> ids);
default Map<String, ProcessDefinition> getProcessDefinitionMap(Set<String> ids) {
return convertMap(getProcessDefinitionList(ids), ProcessDefinition::getId);
}
/**
* 获得 deploymentId 对应的 ProcessDefinition
@ -130,7 +134,7 @@ public interface BpmProcessDefinitionService {
* @return 流程部署 Map
*/
default Map<String, Deployment> getDeploymentMap(Set<String> ids) {
return CollectionUtils.convertMap(getDeployments(ids), Deployment::getId);
return convertMap(getDeployments(ids), Deployment::getId);
}
/**

View File

@ -66,8 +66,8 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
}
@Override
public ProcessDefinition getProcessDefinition2(String id) {
return repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult();
public List<ProcessDefinition> getProcessDefinitionList(Set<String> ids) {
return repositoryService.createProcessDefinitionQuery().processDefinitionIds(ids).list();
}
@Override

View File

@ -4,11 +4,11 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.*;
import jakarta.validation.Valid;
import org.flowable.engine.delegate.event.FlowableCancelledEvent;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.runtime.ProcessInstance;
import jakarta.validation.Valid;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -57,6 +57,32 @@ public interface BpmProcessInstanceService {
ProcessInstance::getProcessInstanceId, ProcessInstance::getName);
}
/**
* 获得历史的流程实例
*
* @param id 流程实例的编号
* @return 历史的流程实例
*/
HistoricProcessInstance getHistoricProcessInstance(String id);
/**
* 获得历史的流程实例列表
*
* @param ids 流程实例的编号集合
* @return 历史的流程实例列表
*/
List<HistoricProcessInstance> getHistoricProcessInstances(Set<String> ids);
/**
* 获得历史的流程实例 Map
*
* @param ids 流程实例的编号集合
* @return 历史的流程实例列表 Map
*/
default Map<String, HistoricProcessInstance> getHistoricProcessInstanceMap(Set<String> ids) {
return CollectionUtils.convertMap(getHistoricProcessInstances(ids), HistoricProcessInstance::getId);
}
/**
* 获得流程实例的分页
*
@ -64,8 +90,8 @@ public interface BpmProcessInstanceService {
* @param pageReqVO 分页请求
* @return 流程实例的分页
*/
PageResult<BpmProcessInstancePageItemRespVO> getMyProcessInstancePage(Long userId,
@Valid BpmProcessInstanceMyPageReqVO pageReqVO);
PageResult<HistoricProcessInstance> getMyProcessInstancePage(Long userId,
@Valid BpmProcessInstanceMyPageReqVO pageReqVO);
/**
* 创建流程实例提供给前端
@ -101,39 +127,6 @@ public interface BpmProcessInstanceService {
*/
void cancelProcessInstance(Long userId, @Valid BpmProcessInstanceCancelReqVO cancelReqVO);
/**
* 获得历史的流程实例
*
* @param id 流程实例的编号
* @return 历史的流程实例
*/
HistoricProcessInstance getHistoricProcessInstance(String id);
/**
* 获得历史的流程实例列表
*
* @param ids 流程实例的编号集合
* @return 历史的流程实例列表
*/
List<HistoricProcessInstance> getHistoricProcessInstances(Set<String> ids);
/**
* 获得历史的流程实例 Map
*
* @param ids 流程实例的编号集合
* @return 历史的流程实例列表 Map
*/
default Map<String, HistoricProcessInstance> getHistoricProcessInstanceMap(Set<String> ids) {
return CollectionUtils.convertMap(getHistoricProcessInstances(ids), HistoricProcessInstance::getId);
}
/**
* 创建 ProcessInstance 拓展记录
*
* @param instance 流程任务
*/
void createProcessInstanceExt(ProcessInstance instance);
/**
* 更新 ProcessInstance 拓展记录为取消
*