mirror of
https://gitee.com/orangeform/orange-admin.git
synced 2026-01-18 02:56:30 +08:00
commit:同步2.1版本
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
package com.flow.demo.common.flow.listener;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.flow.demo.common.core.util.ApplicationContextHolder;
|
||||
import com.flow.demo.common.flow.service.FlowWorkOrderService;
|
||||
import com.flow.demo.common.flow.constant.FlowTaskStatus;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.engine.delegate.DelegateExecution;
|
||||
import org.activiti.engine.delegate.ExecutionListener;
|
||||
|
||||
/**
|
||||
* 流程实例监听器,在流程实例结束的时候更新流程工单表的审批状态字段。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
@Slf4j
|
||||
public class UpdateFlowStatusListener implements ExecutionListener {
|
||||
|
||||
private final FlowWorkOrderService flowWorkOrderService =
|
||||
ApplicationContextHolder.getBean(FlowWorkOrderService.class);
|
||||
|
||||
@Override
|
||||
public void notify(DelegateExecution execution) {
|
||||
if (!StrUtil.equals("end", execution.getEventName())) {
|
||||
return;
|
||||
}
|
||||
String processInstanceId = execution.getProcessInstanceId();
|
||||
flowWorkOrderService.updateFlowStatusByProcessInstanceId(processInstanceId, FlowTaskStatus.FINISHED);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.flow.demo.common.flow.object;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 流程任务扩展属性中,表示多实例任务的扩展对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
@Data
|
||||
public class FlowTaskExtMultiInstance {
|
||||
|
||||
public static final String ASSIGNEE_TYPE_ASSIGNEE = "assignee";
|
||||
public static final String ASSIGNEE_TYPE_GROUPID = "groupId";
|
||||
|
||||
/**
|
||||
* 指派人类型。目前支持 assignee、groupId。
|
||||
*/
|
||||
private String assigneeType;
|
||||
|
||||
/**
|
||||
* 指派人登录名列表。
|
||||
*/
|
||||
private List<String> assigneeList;
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.flow.demo.common.flow.service;
|
||||
|
||||
import com.flow.demo.common.flow.model.*;
|
||||
import com.flow.demo.common.core.base.service.IBaseService;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 流程任务批注数据操作服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
public interface FlowTaskCommentService extends IBaseService<FlowTaskComment, Long> {
|
||||
|
||||
/**
|
||||
* 保存新增对象。
|
||||
*
|
||||
* @param flowTaskComment 新增对象。
|
||||
* @return 返回新增对象。
|
||||
*/
|
||||
FlowTaskComment saveNew(FlowTaskComment flowTaskComment);
|
||||
|
||||
/**
|
||||
* 查询指定流程实例Id下的所有审批任务的批注。
|
||||
*
|
||||
* @param processInstanceId 流程实例Id。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<FlowTaskComment> getFlowTaskCommentList(String processInstanceId);
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
package com.flow.demo.common.flow.util;
|
||||
|
||||
import com.flow.demo.common.flow.listener.DeptPostLeaderListener;
|
||||
import com.flow.demo.common.flow.listener.UpDeptPostLeaderListener;
|
||||
import org.activiti.engine.delegate.TaskListener;
|
||||
|
||||
/**
|
||||
* 工作流与部门岗位相关的自定义扩展接口,需要业务模块自行实现该接口。也可以根据实际需求扩展该接口的方法。
|
||||
* 目前支持的主键类型为字符型和长整型,所以这里提供了两套实现接口。可根据实际情况实现其中一套即可。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
public interface BaseFlowDeptPostExtHelper {
|
||||
|
||||
/**
|
||||
* 根据(字符型)部门Id,获取当前用户部门领导所有的部门岗位Id。
|
||||
*
|
||||
* @param deptId 用户所在部门Id。
|
||||
* @return 当前用户部门领导所有的部门岗位Id。
|
||||
*/
|
||||
default String getLeaderDeptPostId(String deptId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据(字符型)部门Id,获取当前用户上级部门领导所有的部门岗位Id。
|
||||
*
|
||||
* @param deptId 用户所在部门Id。
|
||||
* @return 当前用户上级部门领导所有的部门岗位Id。
|
||||
*/
|
||||
default String getUpLeaderDeptPostId(String deptId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据(长整型)部门Id,获取当前用户部门领导所有的部门岗位Id。
|
||||
*
|
||||
* @param deptId 用户所在部门Id。
|
||||
* @return 当前用户部门领导所有的部门岗位Id。
|
||||
*/
|
||||
default Long getLeaderDeptPostId(Long deptId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据(长整型)部门Id,获取当前用户上级部门领导所有的部门岗位Id。
|
||||
*
|
||||
* @param deptId 用户所在部门Id。
|
||||
* @return 当前用户上级部门领导所有的部门岗位Id。
|
||||
*/
|
||||
default Long getUpLeaderDeptPostId(Long deptId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取任务执行人是当前部门领导岗位的任务监听器。
|
||||
* 通常会在没有找到领导部门岗位Id的时候,为当前任务指定其他的指派人、候选人或候选组。
|
||||
*
|
||||
* @return 任务监听器。
|
||||
*/
|
||||
default Class<? extends TaskListener> getDeptPostLeaderListener() {
|
||||
return DeptPostLeaderListener.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取任务执行人是上级部门领导岗位的任务监听器。
|
||||
* 通常会在没有找到领导部门岗位Id的时候,为当前任务指定其他的指派人、候选人或候选组。
|
||||
*
|
||||
* @return 任务监听器。
|
||||
*/
|
||||
default Class<? extends TaskListener> getUpDeptPostLeaderListener() {
|
||||
return UpDeptPostLeaderListener.class;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.flow.demo.common.flow.util;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 工作流自定义扩展工厂类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
@Component
|
||||
public class FlowCustomExtFactory {
|
||||
|
||||
private BaseFlowDeptPostExtHelper flowDeptPostExtHelper;
|
||||
|
||||
/**
|
||||
* 获取业务模块自行实现的部门岗位扩展帮助实现类。
|
||||
*
|
||||
* @return 业务模块自行实现的部门岗位扩展帮助实现类。
|
||||
*/
|
||||
public BaseFlowDeptPostExtHelper getFlowDeptPostExtHelper() {
|
||||
return flowDeptPostExtHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册业务模块自行实现的部门岗位扩展帮助实现类。
|
||||
*
|
||||
* @param helper 业务模块自行实现的部门岗位扩展帮助实现类。
|
||||
*/
|
||||
public void registerFlowDeptPostExtHelper(BaseFlowDeptPostExtHelper helper) {
|
||||
this.flowDeptPostExtHelper = helper;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.flow.demo.common.flow.base.service;
|
||||
package com.orangeforms.common.flow.base.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.flow.demo.common.core.base.service.BaseService;
|
||||
import com.flow.demo.common.flow.constant.FlowApprovalType;
|
||||
import com.flow.demo.common.flow.constant.FlowTaskStatus;
|
||||
import com.flow.demo.common.flow.model.FlowTaskComment;
|
||||
import com.flow.demo.common.flow.service.FlowApiService;
|
||||
import com.flow.demo.common.flow.service.FlowWorkOrderService;
|
||||
import com.orangeforms.common.core.base.service.BaseService;
|
||||
import com.orangeforms.common.flow.constant.FlowApprovalType;
|
||||
import com.orangeforms.common.flow.constant.FlowTaskStatus;
|
||||
import com.orangeforms.common.flow.model.FlowTaskComment;
|
||||
import com.orangeforms.common.flow.service.FlowApiService;
|
||||
import com.orangeforms.common.flow.service.FlowWorkOrderService;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -20,11 +20,16 @@ public abstract class BaseFlowService<M, K extends Serializable> extends BaseSer
|
||||
@Autowired
|
||||
private FlowWorkOrderService flowWorkOrderService;
|
||||
|
||||
public void startWithBusinessKey(String processDefinitionId, K dataId) {
|
||||
ProcessInstance instance = flowApiService.start(processDefinitionId, dataId);
|
||||
flowWorkOrderService.saveNew(instance, dataId, null, super.tableName);
|
||||
}
|
||||
|
||||
public void startAndTakeFirst(
|
||||
String processDefinitionId, K dataId, FlowTaskComment comment, JSONObject variables) {
|
||||
ProcessInstance instance = flowApiService.startAndTakeFirst(
|
||||
processDefinitionId, dataId, comment, variables);
|
||||
flowWorkOrderService.saveNew(instance, dataId, null);
|
||||
flowWorkOrderService.saveNew(instance, dataId, null, super.tableName);
|
||||
}
|
||||
|
||||
public void takeFirstTask(
|
||||
@@ -33,7 +38,7 @@ public abstract class BaseFlowService<M, K extends Serializable> extends BaseSer
|
||||
flowApiService.setBusinessKeyForProcessInstance(processInstanceId, dataId);
|
||||
flowApiService.completeTask(task, comment, variables);
|
||||
ProcessInstance instance = flowApiService.getProcessInstance(processInstanceId);
|
||||
flowWorkOrderService.saveNew(instance, dataId, null);
|
||||
flowWorkOrderService.saveNew(instance, dataId, null, super.tableName);
|
||||
}
|
||||
|
||||
public void takeTask(Task task, K dataId, FlowTaskComment comment, JSONObject variables) {
|
||||
@@ -41,7 +46,17 @@ public abstract class BaseFlowService<M, K extends Serializable> extends BaseSer
|
||||
if (comment.getApprovalType().equals(FlowApprovalType.REFUSE)) {
|
||||
flowStatus = FlowTaskStatus.REFUSED;
|
||||
}
|
||||
flowWorkOrderService.updateFlowStatusByBusinessKey(dataId.toString(), flowStatus);
|
||||
flowWorkOrderService.updateFlowStatusByProcessInstanceId(task.getProcessInstanceId(), flowStatus);
|
||||
flowApiService.completeTask(task, comment, variables);
|
||||
}
|
||||
|
||||
/**
|
||||
* 在流程实例审批结束后,需要进行审批表到发布表数据同步的服务实现子类,需要实现该方法。
|
||||
*
|
||||
* @param processInstanceId 流程实例Id。
|
||||
* @param businessKey 业务主键Id。如果与实际主键值类型不同,需要在子类中自行完成类型转换。
|
||||
*/
|
||||
public void doSyncBusinessData(String processInstanceId, String businessKey) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.flow.demo.common.flow.command;
|
||||
package com.orangeforms.common.flow.command;
|
||||
|
||||
import com.flow.demo.common.core.exception.MyRuntimeException;
|
||||
import com.flow.demo.common.flow.constant.FlowConstant;
|
||||
import com.orangeforms.common.core.exception.MyRuntimeException;
|
||||
import com.orangeforms.common.flow.constant.FlowConstant;
|
||||
import org.activiti.bpmn.model.Activity;
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.bpmn.model.MultiInstanceLoopCharacteristics;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.config;
|
||||
package com.orangeforms.common.flow.config;
|
||||
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.config;
|
||||
package com.orangeforms.common.flow.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.constant;
|
||||
package com.orangeforms.common.flow.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -23,6 +23,14 @@ public final class FlowApprovalType {
|
||||
* 拒绝。
|
||||
*/
|
||||
public static final String REFUSE = "refuse";
|
||||
/**
|
||||
* 驳回。
|
||||
*/
|
||||
public static final String REJECT = "reject";
|
||||
/**
|
||||
* 撤销。
|
||||
*/
|
||||
public static final String REVOKE = "revoke";
|
||||
/**
|
||||
* 指派。
|
||||
*/
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.constant;
|
||||
package com.orangeforms.common.flow.constant;
|
||||
|
||||
/**
|
||||
* 工作流中的常量数据。
|
||||
@@ -73,6 +73,31 @@ public class FlowConstant {
|
||||
*/
|
||||
public final static String GROUP_TYPE_DEPT_POST_LEADER_VAR = "deptPostLeader";
|
||||
|
||||
/**
|
||||
* 所有部门岗位审批变量
|
||||
*/
|
||||
public final static String GROUP_TYPE_ALL_DEPT_POST_VAR = "allDeptPost";
|
||||
|
||||
/**
|
||||
* 本部门岗位审批变量
|
||||
*/
|
||||
public final static String GROUP_TYPE_SELF_DEPT_POST_VAR = "selfDeptPost";
|
||||
|
||||
/**
|
||||
* 上级部门岗位审批变量
|
||||
*/
|
||||
public final static String GROUP_TYPE_UP_DEPT_POST_VAR = "upDeptPost";
|
||||
|
||||
/**
|
||||
* 任意部门关联的岗位审批变量
|
||||
*/
|
||||
public final static String GROUP_TYPE_DEPT_POST_VAR = "deptPost";
|
||||
|
||||
/**
|
||||
* 岗位
|
||||
*/
|
||||
public final static String GROUP_TYPE_POST = "POST";
|
||||
|
||||
/**
|
||||
* 上级部门领导审批
|
||||
*/
|
||||
@@ -82,4 +107,14 @@ public class FlowConstant {
|
||||
* 本部门岗位领导审批
|
||||
*/
|
||||
public final static String GROUP_TYPE_DEPT_POST_LEADER = "DEPT_POST_LEADER";
|
||||
|
||||
/**
|
||||
* 本部门岗位前缀。
|
||||
*/
|
||||
public final static String SELF_DEPT_POST_PREFIX = "SELF_DEPT_";
|
||||
|
||||
/**
|
||||
* 本部门岗位前缀。
|
||||
*/
|
||||
public final static String UP_DEPT_POST_PREFIX = "UP_DEPT_";
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.constant;
|
||||
package com.orangeforms.common.flow.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.constant;
|
||||
package com.orangeforms.common.flow.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -1,21 +1,21 @@
|
||||
package com.flow.demo.common.flow.controller;
|
||||
package com.orangeforms.common.flow.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.jimmyshi.beanquery.BeanQuery;
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import com.flow.demo.common.core.annotation.MyRequestBody;
|
||||
import com.flow.demo.common.core.constant.ErrorCodeEnum;
|
||||
import com.flow.demo.common.core.object.*;
|
||||
import com.flow.demo.common.core.util.MyCommonUtil;
|
||||
import com.flow.demo.common.core.util.MyModelUtil;
|
||||
import com.flow.demo.common.core.util.MyPageUtil;
|
||||
import com.flow.demo.common.core.validator.UpdateGroup;
|
||||
import com.flow.demo.common.flow.dto.*;
|
||||
import com.flow.demo.common.flow.model.*;
|
||||
import com.flow.demo.common.flow.model.constant.FlowEntryStatus;
|
||||
import com.flow.demo.common.flow.service.*;
|
||||
import com.flow.demo.common.flow.vo.*;
|
||||
import com.orangeforms.common.core.annotation.MyRequestBody;
|
||||
import com.orangeforms.common.core.constant.ErrorCodeEnum;
|
||||
import com.orangeforms.common.core.object.*;
|
||||
import com.orangeforms.common.core.util.MyCommonUtil;
|
||||
import com.orangeforms.common.core.util.MyModelUtil;
|
||||
import com.orangeforms.common.core.util.MyPageUtil;
|
||||
import com.orangeforms.common.core.validator.UpdateGroup;
|
||||
import com.orangeforms.common.flow.dto.*;
|
||||
import com.orangeforms.common.flow.model.*;
|
||||
import com.orangeforms.common.flow.model.constant.FlowEntryStatus;
|
||||
import com.orangeforms.common.flow.service.*;
|
||||
import com.orangeforms.common.flow.vo.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.controller;
|
||||
package com.orangeforms.common.flow.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
@@ -9,34 +9,28 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import com.flow.demo.common.core.annotation.MyRequestBody;
|
||||
import com.flow.demo.common.core.constant.ErrorCodeEnum;
|
||||
import com.flow.demo.common.core.object.*;
|
||||
import com.flow.demo.common.core.util.MyCommonUtil;
|
||||
import com.flow.demo.common.core.util.MyModelUtil;
|
||||
import com.flow.demo.common.core.util.MyPageUtil;
|
||||
import com.flow.demo.common.core.validator.UpdateGroup;
|
||||
import com.flow.demo.common.flow.constant.FlowTaskType;
|
||||
import com.flow.demo.common.flow.dto.*;
|
||||
import com.flow.demo.common.flow.model.*;
|
||||
import com.flow.demo.common.flow.model.constant.FlowEntryStatus;
|
||||
import com.flow.demo.common.flow.service.*;
|
||||
import com.flow.demo.common.flow.vo.*;
|
||||
import lombok.Cleanup;
|
||||
import com.orangeforms.common.core.annotation.MyRequestBody;
|
||||
import com.orangeforms.common.core.constant.ErrorCodeEnum;
|
||||
import com.orangeforms.common.core.object.*;
|
||||
import com.orangeforms.common.core.util.MyCommonUtil;
|
||||
import com.orangeforms.common.core.util.MyModelUtil;
|
||||
import com.orangeforms.common.core.util.MyPageUtil;
|
||||
import com.orangeforms.common.core.validator.UpdateGroup;
|
||||
import com.orangeforms.common.flow.object.FlowTaskMultiSignAssign;
|
||||
import com.orangeforms.common.flow.constant.FlowTaskType;
|
||||
import com.orangeforms.common.flow.dto.*;
|
||||
import com.orangeforms.common.flow.model.*;
|
||||
import com.orangeforms.common.flow.model.constant.FlowEntryStatus;
|
||||
import com.orangeforms.common.flow.service.*;
|
||||
import com.orangeforms.common.flow.vo.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.bpmn.converter.BpmnXMLConverter;
|
||||
import org.activiti.bpmn.model.*;
|
||||
import org.activiti.bpmn.model.Process;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -56,6 +50,8 @@ public class FlowEntryController {
|
||||
private FlowCategoryService flowCategoryService;
|
||||
@Autowired
|
||||
private FlowEntryVariableService flowEntryVariableService;
|
||||
@Autowired
|
||||
private FlowApiService flowApiService;
|
||||
|
||||
/**
|
||||
* 新增工作流对象数据。
|
||||
@@ -355,25 +351,47 @@ public class FlowEntryController {
|
||||
}
|
||||
Map<String, List<ExtensionElement>> extensionMap = userTask.getExtensionElements();
|
||||
if (MapUtil.isNotEmpty(extensionMap)) {
|
||||
List<JSONObject> operationList = this.buildUserTaskOperationListExtensionElement(extensionMap);
|
||||
List<JSONObject> operationList = this.buildOperationListExtensionElement(extensionMap);
|
||||
if (CollUtil.isNotEmpty(operationList)) {
|
||||
flowTaskExt.setOperationListJson(JSON.toJSONString(operationList));
|
||||
}
|
||||
List<JSONObject> variableList = this.buildUserTaskVariableListExtensionElement(extensionMap);
|
||||
List<JSONObject> variableList = this.buildVariableListExtensionElement(extensionMap);
|
||||
if (CollUtil.isNotEmpty(variableList)) {
|
||||
flowTaskExt.setVariableListJson(JSON.toJSONString(variableList));
|
||||
}
|
||||
JSONObject assigneeListObject = this.buildUserTaskAssigneeListExtensionElement(extensionMap);
|
||||
JSONObject assigneeListObject = this.buildAssigneeListExtensionElement(extensionMap);
|
||||
if (assigneeListObject != null) {
|
||||
flowTaskExt.setAssigneeListJson(JSON.toJSONString(assigneeListObject));
|
||||
}
|
||||
List<JSONObject> deptPostList = this.buildDeptPostListExtensionElement(extensionMap);
|
||||
if (deptPostList != null) {
|
||||
flowTaskExt.setDeptPostListJson(JSON.toJSONString(deptPostList));
|
||||
}
|
||||
JSONObject candidateGroupObject = this.buildUserCandidateGroupsExtensionElement(extensionMap);
|
||||
if (candidateGroupObject != null) {
|
||||
String type = candidateGroupObject.getString("type");
|
||||
String value = candidateGroupObject.getString("value");
|
||||
switch (type) {
|
||||
case "DEPT":
|
||||
flowTaskExt.setDeptIds(value);
|
||||
break;
|
||||
case "ROLE":
|
||||
flowTaskExt.setRoleIds(value);
|
||||
break;
|
||||
case "USERS":
|
||||
flowTaskExt.setCandidateUsernames(value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flowTaskExt;
|
||||
}
|
||||
|
||||
private List<FlowTaskExt> buildTaskExtList(FlowEntry flowEntry) throws XMLStreamException {
|
||||
List<FlowTaskExt> flowTaskExtList = new LinkedList<>();
|
||||
BpmnModel bpmnModel = this.convertToBpmnModel(flowEntry.getBpmnXml());
|
||||
BpmnModel bpmnModel = flowApiService.convertToBpmnModel(flowEntry.getBpmnXml());
|
||||
List<Process> processList = bpmnModel.getProcesses();
|
||||
for (Process process : processList) {
|
||||
for (FlowElement element : process.getFlowElements()) {
|
||||
@@ -388,7 +406,7 @@ public class FlowEntryController {
|
||||
|
||||
private ResponseResult<TaskInfoVo> verifyAndGetInitialTaskInfo(FlowEntry flowEntry) throws XMLStreamException {
|
||||
String errorMessage;
|
||||
BpmnModel bpmnModel = this.convertToBpmnModel(flowEntry.getBpmnXml());
|
||||
BpmnModel bpmnModel = flowApiService.convertToBpmnModel(flowEntry.getBpmnXml());
|
||||
Process process = bpmnModel.getMainProcess();
|
||||
if (process == null) {
|
||||
errorMessage = "数据验证失败,当前流程标识 [" + flowEntry.getProcessDefinitionKey() + "] 关联的流程模型并不存在!";
|
||||
@@ -435,8 +453,8 @@ public class FlowEntryController {
|
||||
taskInfoVo.setTaskType(FlowTaskType.USER_TYPE);
|
||||
Map<String, List<ExtensionElement>> extensionMap = userTask.getExtensionElements();
|
||||
if (MapUtil.isNotEmpty(extensionMap)) {
|
||||
taskInfoVo.setOperationList(this.buildUserTaskOperationListExtensionElement(extensionMap));
|
||||
taskInfoVo.setVariableList(this.buildUserTaskVariableListExtensionElement(extensionMap));
|
||||
taskInfoVo.setOperationList(this.buildOperationListExtensionElement(extensionMap));
|
||||
taskInfoVo.setVariableList(this.buildVariableListExtensionElement(extensionMap));
|
||||
}
|
||||
} else {
|
||||
taskInfoVo = new TaskInfoVo();
|
||||
@@ -445,8 +463,20 @@ public class FlowEntryController {
|
||||
return ResponseResult.success(taskInfoVo);
|
||||
}
|
||||
|
||||
private JSONObject buildUserTaskAssigneeListExtensionElement(
|
||||
Map<String, List<ExtensionElement>> extensionMap) {
|
||||
private JSONObject buildUserCandidateGroupsExtensionElement(Map<String, List<ExtensionElement>> extensionMap) {
|
||||
JSONObject jsonData = null;
|
||||
List<ExtensionElement> elementCandidateGroupsList = extensionMap.get("userCandidateGroups");
|
||||
if (CollUtil.isEmpty(elementCandidateGroupsList)) {
|
||||
return jsonData;
|
||||
}
|
||||
jsonData = new JSONObject();
|
||||
ExtensionElement ee = elementCandidateGroupsList.get(0);
|
||||
jsonData.put("type", ee.getAttributeValue(null, "type"));
|
||||
jsonData.put("value", ee.getAttributeValue(null, "value"));
|
||||
return jsonData;
|
||||
}
|
||||
|
||||
private JSONObject buildAssigneeListExtensionElement(Map<String, List<ExtensionElement>> extensionMap) {
|
||||
JSONObject jsonData = null;
|
||||
List<ExtensionElement> elementAssigneeList = extensionMap.get("assigneeList");
|
||||
if (CollUtil.isEmpty(elementAssigneeList)) {
|
||||
@@ -472,46 +502,32 @@ public class FlowEntryController {
|
||||
return jsonData;
|
||||
}
|
||||
|
||||
private List<JSONObject> buildUserTaskOperationListExtensionElement(
|
||||
Map<String, List<ExtensionElement>> extensionMap) {
|
||||
List<JSONObject> resultList = null;
|
||||
List<ExtensionElement> elementOperationList = extensionMap.get("operationList");
|
||||
if (CollUtil.isEmpty(elementOperationList)) {
|
||||
return resultList;
|
||||
}
|
||||
ExtensionElement ee = elementOperationList.get(0);
|
||||
Map<String, List<ExtensionElement>> childExtensionMap = ee.getChildElements();
|
||||
if (MapUtil.isEmpty(childExtensionMap)) {
|
||||
return resultList;
|
||||
}
|
||||
List<ExtensionElement> formOperationElements = childExtensionMap.get("formOperation");
|
||||
private List<JSONObject> buildOperationListExtensionElement(Map<String, List<ExtensionElement>> extensionMap) {
|
||||
List<ExtensionElement> formOperationElements =
|
||||
this.getMyExtensionElementList(extensionMap, "operationList", "formOperation");
|
||||
if (CollUtil.isEmpty(formOperationElements)) {
|
||||
return resultList;
|
||||
return null;
|
||||
}
|
||||
resultList = new LinkedList<>();
|
||||
List<JSONObject> resultList = new LinkedList<>();
|
||||
for (ExtensionElement e : formOperationElements) {
|
||||
JSONObject operationJsonData = new JSONObject();
|
||||
operationJsonData.put("id", e.getAttributeValue(null, "id"));
|
||||
operationJsonData.put("label", e.getAttributeValue(null, "label"));
|
||||
operationJsonData.put("type", e.getAttributeValue(null, "type"));
|
||||
operationJsonData.put("showOrder", e.getAttributeValue(null, "showOrder"));
|
||||
String multiSignAssignee = e.getAttributeValue(null, "multiSignAssignee");
|
||||
if (StrUtil.isNotBlank(multiSignAssignee)) {
|
||||
operationJsonData.put("multiSignAssignee",
|
||||
JSON.parseObject(multiSignAssignee, FlowTaskMultiSignAssign.class));
|
||||
}
|
||||
resultList.add(operationJsonData);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
private List<JSONObject> buildUserTaskVariableListExtensionElement(
|
||||
Map<String, List<ExtensionElement>> extensionMap) {
|
||||
List<ExtensionElement> elementVariableList = extensionMap.get("variableList");
|
||||
if (CollUtil.isEmpty(elementVariableList)) {
|
||||
return null;
|
||||
}
|
||||
ExtensionElement ee = elementVariableList.get(0);
|
||||
Map<String, List<ExtensionElement>> childExtensionMap = ee.getChildElements();
|
||||
if (MapUtil.isEmpty(childExtensionMap)) {
|
||||
return null;
|
||||
}
|
||||
List<ExtensionElement> formVariableElements = childExtensionMap.get("formVariable");
|
||||
private List<JSONObject> buildVariableListExtensionElement(Map<String, List<ExtensionElement>> extensionMap) {
|
||||
List<ExtensionElement> formVariableElements =
|
||||
this.getMyExtensionElementList(extensionMap, "variableList", "formVariable");
|
||||
if (CollUtil.isEmpty(formVariableElements)) {
|
||||
return null;
|
||||
}
|
||||
@@ -528,10 +544,45 @@ public class FlowEntryController {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
private BpmnModel convertToBpmnModel(String bpmnXml) throws XMLStreamException {
|
||||
BpmnXMLConverter converter = new BpmnXMLConverter();
|
||||
InputStream in = new ByteArrayInputStream(bpmnXml.getBytes(StandardCharsets.UTF_8));
|
||||
@Cleanup XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(in);
|
||||
return converter.convertToBpmnModel(reader);
|
||||
private List<JSONObject> buildDeptPostListExtensionElement(Map<String, List<ExtensionElement>> extensionMap) {
|
||||
List<ExtensionElement> deptPostElements =
|
||||
this.getMyExtensionElementList(extensionMap, "deptPostList", "deptPost");
|
||||
if (CollUtil.isEmpty(deptPostElements)) {
|
||||
return null;
|
||||
}
|
||||
List<JSONObject> resultList = new LinkedList<>();
|
||||
for (ExtensionElement e : deptPostElements) {
|
||||
JSONObject deptPostJsonData = new JSONObject();
|
||||
deptPostJsonData.put("id", e.getAttributeValue(null, "id"));
|
||||
deptPostJsonData.put("type", e.getAttributeValue(null, "type"));
|
||||
String postId = e.getAttributeValue(null, "postId");
|
||||
if (postId != null) {
|
||||
deptPostJsonData.put("postId", postId);
|
||||
}
|
||||
String deptPostId = e.getAttributeValue(null, "deptPostId");
|
||||
if (deptPostId != null) {
|
||||
deptPostJsonData.put("deptPostId", deptPostId);
|
||||
}
|
||||
resultList.add(deptPostJsonData);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
private List<ExtensionElement> getMyExtensionElementList(
|
||||
Map<String, List<ExtensionElement>> extensionMap, String rootName, String childName) {
|
||||
List<ExtensionElement> elementList = extensionMap.get(rootName);
|
||||
if (CollUtil.isEmpty(elementList)) {
|
||||
return null;
|
||||
}
|
||||
ExtensionElement ee = elementList.get(0);
|
||||
Map<String, List<ExtensionElement>> childExtensionMap = ee.getChildElements();
|
||||
if (MapUtil.isEmpty(childExtensionMap)) {
|
||||
return null;
|
||||
}
|
||||
List<ExtensionElement> childrenElements = childExtensionMap.get(childName);
|
||||
if (CollUtil.isEmpty(childrenElements)) {
|
||||
return null;
|
||||
}
|
||||
return childrenElements;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.flow.demo.common.flow.controller;
|
||||
package com.orangeforms.common.flow.controller;
|
||||
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import com.flow.demo.common.flow.vo.*;
|
||||
import com.flow.demo.common.flow.dto.*;
|
||||
import com.flow.demo.common.flow.model.*;
|
||||
import com.flow.demo.common.flow.service.*;
|
||||
import com.flow.demo.common.core.object.*;
|
||||
import com.flow.demo.common.core.util.*;
|
||||
import com.flow.demo.common.core.constant.*;
|
||||
import com.flow.demo.common.core.annotation.MyRequestBody;
|
||||
import com.flow.demo.common.core.validator.UpdateGroup;
|
||||
import com.orangeforms.common.flow.vo.*;
|
||||
import com.orangeforms.common.flow.dto.*;
|
||||
import com.orangeforms.common.flow.model.*;
|
||||
import com.orangeforms.common.flow.service.*;
|
||||
import com.orangeforms.common.core.object.*;
|
||||
import com.orangeforms.common.core.util.*;
|
||||
import com.orangeforms.common.core.constant.*;
|
||||
import com.orangeforms.common.core.annotation.MyRequestBody;
|
||||
import com.orangeforms.common.core.validator.UpdateGroup;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.orangeforms.common.flow.controller;
|
||||
|
||||
import com.orangeforms.common.core.annotation.MyRequestBody;
|
||||
import com.orangeforms.common.core.object.*;
|
||||
import com.orangeforms.common.core.util.MyPageUtil;
|
||||
import com.orangeforms.common.flow.model.FlowMessage;
|
||||
import com.orangeforms.common.flow.service.FlowMessageService;
|
||||
import com.orangeforms.common.flow.vo.FlowMessageVo;
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工作流消息操作控制器类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("${common-flow.urlPrefix}/flowMessage")
|
||||
public class FlowMessageController {
|
||||
|
||||
@Autowired
|
||||
private FlowMessageService flowMessageService;
|
||||
|
||||
/**
|
||||
* 获取当前用户的催办消息列表。
|
||||
* 不仅仅包含,其中包括当前用户所属角色、部门和岗位的候选组催办消息。
|
||||
*
|
||||
* @return 应答结果对象,包含查询结果集。
|
||||
*/
|
||||
@PostMapping("/listRemindingTask")
|
||||
public ResponseResult<MyPageData<FlowMessageVo>> listRemindingTask(@MyRequestBody MyPageParam pageParam) {
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
List<FlowMessage> flowMessageList = flowMessageService.getRemindingMessageListByUser();
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(flowMessageList, FlowMessage.INSTANCE));
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.controller;
|
||||
package com.orangeforms.common.flow.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
@@ -6,18 +6,18 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.flow.demo.common.core.annotation.MyRequestBody;
|
||||
import com.flow.demo.common.core.constant.ErrorCodeEnum;
|
||||
import com.flow.demo.common.core.object.*;
|
||||
import com.flow.demo.common.core.util.MyPageUtil;
|
||||
import com.flow.demo.common.flow.constant.FlowConstant;
|
||||
import com.flow.demo.common.flow.constant.FlowTaskStatus;
|
||||
import com.flow.demo.common.flow.model.*;
|
||||
import com.flow.demo.common.flow.service.*;
|
||||
import com.flow.demo.common.flow.util.FlowOperationHelper;
|
||||
import com.flow.demo.common.flow.vo.FlowTaskCommentVo;
|
||||
import com.flow.demo.common.flow.vo.FlowTaskVo;
|
||||
import com.flow.demo.common.flow.vo.TaskInfoVo;
|
||||
import com.orangeforms.common.core.annotation.MyRequestBody;
|
||||
import com.orangeforms.common.core.constant.ErrorCodeEnum;
|
||||
import com.orangeforms.common.core.object.*;
|
||||
import com.orangeforms.common.core.util.MyPageUtil;
|
||||
import com.orangeforms.common.flow.constant.FlowConstant;
|
||||
import com.orangeforms.common.flow.constant.FlowTaskStatus;
|
||||
import com.orangeforms.common.flow.model.*;
|
||||
import com.orangeforms.common.flow.service.*;
|
||||
import com.orangeforms.common.flow.util.FlowOperationHelper;
|
||||
import com.orangeforms.common.flow.vo.FlowTaskCommentVo;
|
||||
import com.orangeforms.common.flow.vo.FlowTaskVo;
|
||||
import com.orangeforms.common.flow.vo.TaskInfoVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.bpmn.converter.BpmnXMLConverter;
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
@@ -62,6 +62,8 @@ public class FlowOperationController {
|
||||
@Autowired
|
||||
private FlowWorkOrderService flowWorkOrderService;
|
||||
@Autowired
|
||||
private FlowMessageService flowMessageService;
|
||||
@Autowired
|
||||
private FlowOperationHelper flowOperationHelper;
|
||||
|
||||
/**
|
||||
@@ -84,7 +86,7 @@ public class FlowOperationController {
|
||||
if (!taskInfoResult.isSuccess()) {
|
||||
return ResponseResult.errorFrom(taskInfoResult);
|
||||
}
|
||||
flowApiService.start(flowEntryPublish.getProcessDefinitionId());
|
||||
flowApiService.start(flowEntryPublish.getProcessDefinitionId(), null);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@@ -255,16 +257,21 @@ public class FlowOperationController {
|
||||
/**
|
||||
* 返回当前用户待办的任务列表。
|
||||
*
|
||||
* @param processDefinitionKey 流程标识。
|
||||
* @param pageParam 分页对象。
|
||||
* @param processDefinitionKey 流程标识。
|
||||
* @param processDefinitionName 流程定义名 (模糊查询)。
|
||||
* @param taskName 任务名称 (魔术查询。
|
||||
* @param pageParam 分页对象。
|
||||
* @return 返回当前用户待办的任务列表。如果指定流程标识,则仅返回该流程的待办任务列表。
|
||||
*/
|
||||
@PostMapping("/listRuntimeTask")
|
||||
public ResponseResult<MyPageData<FlowTaskVo>> listRuntimeTask(
|
||||
@MyRequestBody String processDefinitionKey,
|
||||
@MyRequestBody String processDefinitionName,
|
||||
@MyRequestBody String taskName,
|
||||
@MyRequestBody(required = true) MyPageParam pageParam) {
|
||||
String username = TokenData.takeFromRequest().getLoginName();
|
||||
MyPageData<Task> pageData = flowApiService.getTaskListByUserName(username, processDefinitionKey, pageParam);
|
||||
MyPageData<Task> pageData = flowApiService.getTaskListByUserName(
|
||||
username, processDefinitionKey, processDefinitionName, taskName, pageParam);
|
||||
List<FlowTaskVo> flowTaskVoList = flowApiService.convertToFlowTaskList(pageData.getDataList());
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(flowTaskVoList, pageData.getTotalCount()));
|
||||
}
|
||||
@@ -392,6 +399,19 @@ public class FlowOperationController {
|
||||
result.put("processDefinitionKey", instance.getProcessDefinitionKey());
|
||||
result.put("processDefinitionName", instance.getProcessDefinitionName());
|
||||
result.put("startUser", instance.getStartUserId());
|
||||
result.put("businessKey", instance.getBusinessKey());
|
||||
});
|
||||
Set<String> taskIdSet =
|
||||
taskInstanceList.stream().map(HistoricTaskInstance::getId).collect(Collectors.toSet());
|
||||
List<FlowTaskComment> commentList = flowTaskCommentService.getFlowTaskCommentListByTaskIds(taskIdSet);
|
||||
Map<String, List<FlowTaskComment>> commentMap =
|
||||
commentList.stream().collect(Collectors.groupingBy(FlowTaskComment::getTaskId));
|
||||
resultList.forEach(result -> {
|
||||
List<FlowTaskComment> comments = commentMap.get(result.get("id").toString());
|
||||
if (CollUtil.isNotEmpty(comments)) {
|
||||
result.put("approvalType", comments.get(0).getApprovalType());
|
||||
comments.remove(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(resultList, pageData.getTotalCount()));
|
||||
@@ -444,6 +464,31 @@ public class FlowOperationController {
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(resultList, pageData.getTotalCount()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 催办工单,只有流程发起人才可以催办工单。
|
||||
*
|
||||
* @param workOrderId 工单Id。
|
||||
* @return 应答结果。
|
||||
*/
|
||||
@PostMapping("/remindRuntimeTask")
|
||||
public ResponseResult<Void> remindRuntimeTask(@MyRequestBody(required = true) Long workOrderId) {
|
||||
FlowWorkOrder flowWorkOrder = flowWorkOrderService.getById(workOrderId);
|
||||
if (flowWorkOrder == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
String errorMessage;
|
||||
if (!flowWorkOrder.getCreateUserId().equals(TokenData.takeFromRequest().getUserId())) {
|
||||
errorMessage = "数据验证失败,只有流程发起人才能催办工单!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
if (flowWorkOrder.getFlowStatus().equals(FlowTaskStatus.FINISHED)) {
|
||||
errorMessage = "数据验证失败,已经结束的流程,不能催办工单!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
flowMessageService.saveNewRemindMessage(flowWorkOrder);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消工作流工单,仅当没有进入任何审批流程之前,才可以取消工单。
|
||||
*
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.custom;
|
||||
package com.orangeforms.common.flow.custom;
|
||||
|
||||
import org.activiti.api.runtime.shared.identity.UserGroupManager;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.flow.demo.common.flow.dao;
|
||||
package com.orangeforms.common.flow.dao;
|
||||
|
||||
import com.flow.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.flow.demo.common.flow.model.FlowCategory;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.flow.model.FlowCategory;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.flow.demo.common.flow.dao;
|
||||
package com.orangeforms.common.flow.dao;
|
||||
|
||||
import com.flow.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.flow.demo.common.flow.model.FlowEntry;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.flow.model.FlowEntry;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.flow.demo.common.flow.dao;
|
||||
package com.orangeforms.common.flow.dao;
|
||||
|
||||
import com.flow.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.flow.demo.common.flow.model.FlowEntryPublish;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.flow.model.FlowEntryPublish;
|
||||
|
||||
/**
|
||||
* 数据操作访问接口。
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.flow.demo.common.flow.dao;
|
||||
package com.orangeforms.common.flow.dao;
|
||||
|
||||
import com.flow.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.flow.demo.common.flow.model.FlowEntryPublishVariable;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.flow.model.FlowEntryPublishVariable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.flow.demo.common.flow.dao;
|
||||
package com.orangeforms.common.flow.dao;
|
||||
|
||||
import com.flow.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.flow.demo.common.flow.model.FlowEntryVariable;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.flow.model.FlowEntryVariable;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.*;
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.orangeforms.common.flow.dao;
|
||||
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.flow.model.FlowMessageCandidateIdentity;
|
||||
|
||||
/**
|
||||
* 流程任务消息的候选身份数据操作访问接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
public interface FlowMessageCandidateIdentityMapper extends BaseDaoMapper<FlowMessageCandidateIdentity> {
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.orangeforms.common.flow.dao;
|
||||
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.flow.model.FlowMessage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 工作流消息数据操作访问接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
public interface FlowMessageMapper extends BaseDaoMapper<FlowMessage> {
|
||||
|
||||
/**
|
||||
* 获取指定用户和身份分组Id集合的催办消息列表。
|
||||
*
|
||||
* @param loginName 用户的登录名。与流程任务的assignee精确匹配。
|
||||
* @param groupIdSet 用户身份分组Id集合。
|
||||
* @return 查询后的催办消息列表。
|
||||
*/
|
||||
List<FlowMessage> getRemindingMessageListByUser(
|
||||
@Param("loginName") String loginName, @Param("groupIdSet") Set<String> groupIdSet);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.flow.demo.common.flow.dao;
|
||||
package com.orangeforms.common.flow.dao;
|
||||
|
||||
import com.flow.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.flow.demo.common.flow.model.FlowTaskComment;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.flow.model.FlowTaskComment;
|
||||
|
||||
/**
|
||||
* 流程任务批注数据操作访问接口。
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.flow.demo.common.flow.dao;
|
||||
package com.orangeforms.common.flow.dao;
|
||||
|
||||
import com.flow.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.flow.demo.common.flow.model.FlowTaskExt;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.flow.model.FlowTaskExt;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.flow.demo.common.flow.dao;
|
||||
package com.orangeforms.common.flow.dao;
|
||||
|
||||
import com.flow.demo.common.core.annotation.EnableDataPerm;
|
||||
import com.flow.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.flow.demo.common.flow.model.FlowWorkOrder;
|
||||
import com.orangeforms.common.core.annotation.EnableDataPerm;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.flow.model.FlowWorkOrder;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.*;
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.flow.demo.common.flow.dao.FlowCategoryMapper">
|
||||
<resultMap id="BaseResultMap" type="com.flow.demo.common.flow.model.FlowCategory">
|
||||
<mapper namespace="com.orangeforms.common.flow.dao.FlowCategoryMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.common.flow.model.FlowCategory">
|
||||
<id column="category_id" jdbcType="BIGINT" property="categoryId"/>
|
||||
<result column="name" jdbcType="VARCHAR" property="name"/>
|
||||
<result column="code" jdbcType="VARCHAR" property="code"/>
|
||||
@@ -12,7 +12,7 @@
|
||||
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getFlowCategoryList" resultMap="BaseResultMap" parameterType="com.flow.demo.common.flow.model.FlowCategory">
|
||||
<select id="getFlowCategoryList" resultMap="BaseResultMap" parameterType="com.orangeforms.common.flow.model.FlowCategory">
|
||||
SELECT * FROM zz_flow_category
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.flow.demo.common.flow.dao.FlowEntryMapper">
|
||||
<resultMap id="BaseResultMap" type="com.flow.demo.common.flow.model.FlowEntry">
|
||||
<mapper namespace="com.orangeforms.common.flow.dao.FlowEntryMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.common.flow.model.FlowEntry">
|
||||
<id column="entry_id" jdbcType="BIGINT" property="entryId"/>
|
||||
<result column="process_definition_name" jdbcType="VARCHAR" property="processDefinitionName"/>
|
||||
<result column="process_definition_key" jdbcType="VARCHAR" property="processDefinitionKey"/>
|
||||
@@ -23,7 +23,7 @@
|
||||
<!-- 如果有逻辑删除字段过滤,请写到这里 -->
|
||||
<sql id="filterRef">
|
||||
<!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
|
||||
<include refid="com.flow.demo.common.flow.dao.FlowEntryMapper.inputFilterRef"/>
|
||||
<include refid="com.orangeforms.common.flow.dao.FlowEntryMapper.inputFilterRef"/>
|
||||
</sql>
|
||||
|
||||
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
|
||||
@@ -44,7 +44,7 @@
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getFlowEntryList" resultMap="BaseResultMap" parameterType="com.flow.demo.common.flow.model.FlowEntry">
|
||||
<select id="getFlowEntryList" resultMap="BaseResultMap" parameterType="com.orangeforms.common.flow.model.FlowEntry">
|
||||
SELECT
|
||||
entry_id,
|
||||
process_definition_name,
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.flow.demo.common.flow.dao.FlowEntryPublishMapper">
|
||||
<resultMap id="BaseResultMap" type="com.flow.demo.common.flow.model.FlowEntryPublish">
|
||||
<mapper namespace="com.orangeforms.common.flow.dao.FlowEntryPublishMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.common.flow.model.FlowEntryPublish">
|
||||
<id column="entry_publish_id" jdbcType="BIGINT" property="entryPublishId"/>
|
||||
<result column="entry_id" jdbcType="BIGINT" property="entryId"/>
|
||||
<result column="deploy_id" jdbcType="VARCHAR" property="deployId"/>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.flow.demo.common.flow.dao.FlowEntryPublishVariableMapper">
|
||||
<resultMap id="BaseResultMap" type="com.flow.demo.common.flow.model.FlowEntryPublishVariable">
|
||||
<mapper namespace="com.orangeforms.common.flow.dao.FlowEntryPublishVariableMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.common.flow.model.FlowEntryPublishVariable">
|
||||
<id column="variable_id" jdbcType="BIGINT" property="variableId"/>
|
||||
<result column="entry_publish_id" jdbcType="BIGINT" property="entryPublishId"/>
|
||||
<result column="variable_name" jdbcType="VARCHAR" property="variableName"/>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.flow.demo.common.flow.dao.FlowEntryVariableMapper">
|
||||
<resultMap id="BaseResultMap" type="com.flow.demo.common.flow.model.FlowEntryVariable">
|
||||
<mapper namespace="com.orangeforms.common.flow.dao.FlowEntryVariableMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.common.flow.model.FlowEntryVariable">
|
||||
<id column="variable_id" jdbcType="BIGINT" property="variableId"/>
|
||||
<result column="entry_id" jdbcType="BIGINT" property="entryId"/>
|
||||
<result column="variable_name" jdbcType="VARCHAR" property="variableName"/>
|
||||
@@ -17,7 +17,7 @@
|
||||
<!-- 如果有逻辑删除字段过滤,请写到这里 -->
|
||||
<sql id="filterRef">
|
||||
<!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
|
||||
<include refid="com.flow.demo.common.flow.dao.FlowEntryVariableMapper.inputFilterRef"/>
|
||||
<include refid="com.orangeforms.common.flow.dao.FlowEntryVariableMapper.inputFilterRef"/>
|
||||
</sql>
|
||||
|
||||
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
|
||||
@@ -29,7 +29,7 @@
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getFlowEntryVariableList" resultMap="BaseResultMap" parameterType="com.flow.demo.common.flow.model.FlowEntryVariable">
|
||||
<select id="getFlowEntryVariableList" resultMap="BaseResultMap" parameterType="com.orangeforms.common.flow.model.FlowEntryVariable">
|
||||
SELECT * FROM zz_flow_entry_variable
|
||||
<where>
|
||||
<include refid="filterRef"/>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orangeforms.common.flow.dao.FlowMessageCandidateIdentityMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.common.flow.model.FlowMessageCandidateIdentity">
|
||||
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||
<result column="message_id" jdbcType="BIGINT" property="messageId"/>
|
||||
<result column="candidate_type" jdbcType="VARCHAR" property="candidateType"/>
|
||||
<result column="candidate_id" jdbcType="VARCHAR" property="candidateId"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orangeforms.common.flow.dao.FlowMessageMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.common.flow.model.FlowMessage">
|
||||
<id column="message_id" jdbcType="BIGINT" property="messageId"/>
|
||||
<id column="message_type" jdbcType="TINYINT" property="messageType"/>
|
||||
<id column="message_content" jdbcType="VARCHAR" property="messageContent"/>
|
||||
<id column="remind_count" jdbcType="INTEGER" property="remindCount"/>
|
||||
<result column="work_order_id" jdbcType="BIGINT" property="workOrderId"/>
|
||||
<result column="process_definition_id" jdbcType="VARCHAR" property="processDefinitionId"/>
|
||||
<result column="process_definition_key" jdbcType="VARCHAR" property="processDefinitionKey"/>
|
||||
<result column="process_definition_name" jdbcType="VARCHAR" property="processDefinitionName"/>
|
||||
<result column="process_instance_id" jdbcType="VARCHAR" property="processInstanceId"/>
|
||||
<result column="process_instance_initiator" jdbcType="VARCHAR" property="processInstanceInitiator"/>
|
||||
<result column="task_id" jdbcType="VARCHAR" property="taskId"/>
|
||||
<result column="task_definition_key" jdbcType="VARCHAR" property="taskDefinitionKey"/>
|
||||
<result column="task_name" jdbcType="VARCHAR" property="taskName"/>
|
||||
<result column="task_start_time" jdbcType="TIMESTAMP" property="taskStartTime"/>
|
||||
<result column="task_assignee" jdbcType="VARCHAR" property="taskAssignee"/>
|
||||
<result column="task_finished" jdbcType="BIT" property="taskFinished"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
<result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
|
||||
<result column="create_username" jdbcType="VARCHAR" property="createUsername"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getRemindingMessageListByUser" resultMap="BaseResultMap">
|
||||
SELECT a.* FROM zz_flow_message a
|
||||
<where>
|
||||
a.task_finished = 0
|
||||
AND a.message_type = 0
|
||||
<if test="groupIdSet == null">
|
||||
AND a.task_assignee = #{loginName}
|
||||
</if>
|
||||
<if test="groupIdSet != null">
|
||||
AND (a.task_assignee = #{loginName} OR EXISTS (SELECT * FROM zz_flow_message_candicate_identity b
|
||||
WHERE a.message_id = b.message_id AND b.candidate_id in
|
||||
<foreach collection="groupIdSet" index="index" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>))
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY a.update_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.flow.demo.common.flow.dao.FlowTaskCommentMapper">
|
||||
<resultMap id="BaseResultMap" type="com.flow.demo.common.flow.model.FlowTaskComment">
|
||||
<mapper namespace="com.orangeforms.common.flow.dao.FlowTaskCommentMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.common.flow.model.FlowTaskComment">
|
||||
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||
<result column="process_instance_id" jdbcType="VARCHAR" property="processInstanceId"/>
|
||||
<result column="task_id" jdbcType="VARCHAR" property="taskId"/>
|
||||
@@ -1,13 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.flow.demo.common.flow.dao.FlowTaskExtMapper">
|
||||
<resultMap id="BaseResultMap" type="com.flow.demo.common.flow.model.FlowTaskExt">
|
||||
<mapper namespace="com.orangeforms.common.flow.dao.FlowTaskExtMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.common.flow.model.FlowTaskExt">
|
||||
<result column="process_definition_id" jdbcType="VARCHAR" property="processDefinitionId"/>
|
||||
<result column="task_id" jdbcType="VARCHAR" property="taskId"/>
|
||||
<result column="operation_list_json" jdbcType="LONGVARCHAR" property="operationListJson"/>
|
||||
<result column="variable_list_json" jdbcType="LONGVARCHAR" property="variableListJson"/>
|
||||
<result column="assignee_list_json" jdbcType="LONGVARCHAR" property="assigneeListJson"/>
|
||||
<result column="group_type" jdbcType="VARCHAR" property="groupType"/>
|
||||
<result column="dept_post_list_json" jdbcType="VARCHAR" property="deptPostListJson"/>
|
||||
<result column="role_ids" jdbcType="VARCHAR" property="roleIds"/>
|
||||
<result column="dept_ids" jdbcType="VARCHAR" property="deptIds"/>
|
||||
<result column="candidate_usernames" jdbcType="VARCHAR" property="candidateUsernames"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertList">
|
||||
@@ -18,7 +22,11 @@
|
||||
#{item.operationListJson},
|
||||
#{item.variableListJson},
|
||||
#{item.assigneeListJson},
|
||||
#{item.groupType})
|
||||
#{item.groupType},
|
||||
#{item.deptPostListJson},
|
||||
#{item.roleIds},
|
||||
#{item.deptIds},
|
||||
#{item.candidateUsernames})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -1,13 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.flow.demo.common.flow.dao.FlowWorkOrderMapper">
|
||||
<resultMap id="BaseResultMap" type="com.flow.demo.common.flow.model.FlowWorkOrder">
|
||||
<mapper namespace="com.orangeforms.common.flow.dao.FlowWorkOrderMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.common.flow.model.FlowWorkOrder">
|
||||
<id column="work_order_id" jdbcType="BIGINT" property="workOrderId"/>
|
||||
<result column="process_definition_key" jdbcType="VARCHAR" property="processDefinitionKey"/>
|
||||
<result column="process_definition_name" jdbcType="VARCHAR" property="processDefinitionName"/>
|
||||
<result column="process_definition_id" jdbcType="VARCHAR" property="processDefinitionId"/>
|
||||
<result column="process_instance_id" jdbcType="VARCHAR" property="processInstanceId"/>
|
||||
<result column="online_table_id" jdbcType="BIGINT" property="onlineTableId"/>
|
||||
<result column="table_name" jdbcType="VARCHAR" property="tableName"/>
|
||||
<result column="business_key" jdbcType="VARCHAR" property="businessKey"/>
|
||||
<result column="flow_status" jdbcType="INTEGER" property="flowStatus"/>
|
||||
<result column="submit_username" jdbcType="VARCHAR" property="submitUsername"/>
|
||||
@@ -23,7 +24,7 @@
|
||||
<sql id="filterRef">
|
||||
<!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
|
||||
<include refid="inputFilterRef"/>
|
||||
AND zz_flow_work_order.deleted_flag = ${@com.flow.demo.common.core.constant.GlobalDeletedFlag@NORMAL}
|
||||
AND zz_flow_work_order.deleted_flag = ${@com.orangeforms.common.core.constant.GlobalDeletedFlag@NORMAL}
|
||||
</sql>
|
||||
|
||||
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
|
||||
@@ -47,7 +48,7 @@
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getFlowWorkOrderList" resultMap="BaseResultMap" parameterType="com.flow.demo.common.flow.model.FlowWorkOrder">
|
||||
<select id="getFlowWorkOrderList" resultMap="BaseResultMap" parameterType="com.orangeforms.common.flow.model.FlowWorkOrder">
|
||||
SELECT * FROM zz_flow_work_order
|
||||
<where>
|
||||
<include refid="filterRef"/>
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.flow.demo.common.flow.dto;
|
||||
package com.orangeforms.common.flow.dto;
|
||||
|
||||
import com.flow.demo.common.core.validator.UpdateGroup;
|
||||
import com.orangeforms.common.core.validator.UpdateGroup;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.flow.demo.common.flow.dto;
|
||||
package com.orangeforms.common.flow.dto;
|
||||
|
||||
import com.flow.demo.common.core.validator.ConstDictRef;
|
||||
import com.flow.demo.common.core.validator.UpdateGroup;
|
||||
import com.flow.demo.common.flow.model.constant.FlowBindFormType;
|
||||
import com.flow.demo.common.flow.model.constant.FlowEntryStatus;
|
||||
import com.orangeforms.common.core.validator.ConstDictRef;
|
||||
import com.orangeforms.common.core.validator.UpdateGroup;
|
||||
import com.orangeforms.common.flow.model.constant.FlowBindFormType;
|
||||
import com.orangeforms.common.flow.model.constant.FlowEntryStatus;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.flow.demo.common.flow.dto;
|
||||
package com.orangeforms.common.flow.dto;
|
||||
|
||||
import com.flow.demo.common.core.validator.ConstDictRef;
|
||||
import com.flow.demo.common.core.validator.UpdateGroup;
|
||||
import com.flow.demo.common.flow.model.constant.FlowVariableType;
|
||||
import com.orangeforms.common.core.validator.ConstDictRef;
|
||||
import com.orangeforms.common.core.validator.UpdateGroup;
|
||||
import com.orangeforms.common.flow.model.constant.FlowVariableType;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.orangeforms.common.flow.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 工作流通知消息Dto对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
@Data
|
||||
public class FlowMessageDto {
|
||||
|
||||
/**
|
||||
* 消息类型。
|
||||
*/
|
||||
private Integer messageType;
|
||||
|
||||
/**
|
||||
* 工单Id。
|
||||
*/
|
||||
private Long workOrderId;
|
||||
|
||||
/**
|
||||
* 流程名称。
|
||||
*/
|
||||
private String processDefinitionName;
|
||||
|
||||
/**
|
||||
* 流程任务名称。
|
||||
*/
|
||||
private String taskName;
|
||||
|
||||
/**
|
||||
* 更新时间范围过滤起始值(>=)。
|
||||
*/
|
||||
private String updateTimeStart;
|
||||
|
||||
/**
|
||||
* 更新时间范围过滤结束值(<=)。
|
||||
*/
|
||||
private String updateTimeEnd;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.dto;
|
||||
package com.orangeforms.common.flow.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.dto;
|
||||
package com.orangeforms.common.flow.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.exception;
|
||||
package com.orangeforms.common.flow.exception;
|
||||
|
||||
/**
|
||||
* 流程操作异常。
|
||||
@@ -1,12 +1,9 @@
|
||||
package com.flow.demo.common.flow.listener;
|
||||
package com.orangeforms.common.flow.listener;
|
||||
|
||||
import com.flow.demo.common.core.util.ApplicationContextHolder;
|
||||
import com.flow.demo.common.flow.constant.FlowConstant;
|
||||
import com.flow.demo.common.flow.service.FlowApiService;
|
||||
import com.orangeforms.common.flow.constant.FlowConstant;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.engine.delegate.DelegateTask;
|
||||
import org.activiti.engine.delegate.TaskListener;
|
||||
import org.activiti.engine.history.HistoricProcessInstance;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -20,12 +17,8 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
public class DeptPostLeaderListener implements TaskListener {
|
||||
|
||||
private final FlowApiService flowApiService = ApplicationContextHolder.getBean(FlowApiService.class);
|
||||
|
||||
@Override
|
||||
public void notify(DelegateTask delegateTask) {
|
||||
HistoricProcessInstance instance =
|
||||
flowApiService.getHistoricProcessInstance(delegateTask.getProcessInstanceId());
|
||||
Map<String, Object> variables = delegateTask.getVariables();
|
||||
if (variables.get(FlowConstant.GROUP_TYPE_DEPT_POST_LEADER_VAR) == null) {
|
||||
delegateTask.setAssignee(variables.get(FlowConstant.PROC_INSTANCE_START_USER_NAME_VAR).toString());
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.orangeforms.common.flow.listener;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.orangeforms.common.core.util.ApplicationContextHolder;
|
||||
import com.orangeforms.common.flow.model.FlowWorkOrder;
|
||||
import com.orangeforms.common.flow.service.FlowWorkOrderService;
|
||||
import com.orangeforms.common.flow.constant.FlowTaskStatus;
|
||||
import com.orangeforms.common.flow.util.FlowCustomExtFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.engine.delegate.DelegateExecution;
|
||||
import org.activiti.engine.delegate.ExecutionListener;
|
||||
|
||||
/**
|
||||
* 流程实例监听器,在流程实例结束的时候,需要完成一些自定义的业务行为。如:
|
||||
* 1. 更新流程工单表的审批状态字段。
|
||||
* 2. 业务数据同步。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
@Slf4j
|
||||
public class FlowFinishedListener implements ExecutionListener {
|
||||
|
||||
private final FlowWorkOrderService flowWorkOrderService =
|
||||
ApplicationContextHolder.getBean(FlowWorkOrderService.class);
|
||||
private final FlowCustomExtFactory flowCustomExtFactory =
|
||||
ApplicationContextHolder.getBean(FlowCustomExtFactory.class);
|
||||
|
||||
@Override
|
||||
public void notify(DelegateExecution execution) {
|
||||
if (!StrUtil.equals("end", execution.getEventName())) {
|
||||
return;
|
||||
}
|
||||
String processInstanceId = execution.getProcessInstanceId();
|
||||
flowWorkOrderService.updateFlowStatusByProcessInstanceId(processInstanceId, FlowTaskStatus.FINISHED);
|
||||
String businessKey = execution.getProcessInstanceBusinessKey();
|
||||
FlowWorkOrder workOrder = flowWorkOrderService.getFlowWorkOrderByProcessInstanceId(processInstanceId);
|
||||
flowCustomExtFactory.getDataSyncExtHelper()
|
||||
.triggerSync(workOrder.getProcessDefinitionKey(), processInstanceId, businessKey);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,9 @@
|
||||
package com.flow.demo.common.flow.listener;
|
||||
package com.orangeforms.common.flow.listener;
|
||||
|
||||
import com.flow.demo.common.core.util.ApplicationContextHolder;
|
||||
import com.flow.demo.common.flow.constant.FlowConstant;
|
||||
import com.flow.demo.common.flow.service.FlowApiService;
|
||||
import com.orangeforms.common.flow.constant.FlowConstant;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.engine.delegate.DelegateTask;
|
||||
import org.activiti.engine.delegate.TaskListener;
|
||||
import org.activiti.engine.history.HistoricProcessInstance;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -20,12 +17,8 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
public class UpDeptPostLeaderListener implements TaskListener {
|
||||
|
||||
private final FlowApiService flowApiService = ApplicationContextHolder.getBean(FlowApiService.class);
|
||||
|
||||
@Override
|
||||
public void notify(DelegateTask delegateTask) {
|
||||
HistoricProcessInstance instance =
|
||||
flowApiService.getHistoricProcessInstance(delegateTask.getProcessInstanceId());
|
||||
Map<String, Object> variables = delegateTask.getVariables();
|
||||
if (variables.get(FlowConstant.GROUP_TYPE_UP_DEPT_POST_LEADER_VAR) == null) {
|
||||
delegateTask.setAssignee(variables.get(FlowConstant.PROC_INSTANCE_START_USER_NAME_VAR).toString());
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.flow.demo.common.flow.model;
|
||||
package com.orangeforms.common.flow.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.flow.demo.common.core.base.mapper.BaseModelMapper;
|
||||
import com.flow.demo.common.flow.vo.FlowCategoryVo;
|
||||
import com.orangeforms.common.core.base.mapper.BaseModelMapper;
|
||||
import com.orangeforms.common.flow.vo.FlowCategoryVo;
|
||||
import lombok.Data;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.flow.demo.common.flow.model;
|
||||
package com.orangeforms.common.flow.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.flow.demo.common.core.annotation.RelationOneToOne;
|
||||
import com.flow.demo.common.core.base.mapper.BaseModelMapper;
|
||||
import com.flow.demo.common.flow.vo.FlowEntryVo;
|
||||
import com.orangeforms.common.core.annotation.RelationOneToOne;
|
||||
import com.orangeforms.common.core.base.mapper.BaseModelMapper;
|
||||
import com.orangeforms.common.flow.vo.FlowEntryVo;
|
||||
import lombok.Data;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
@@ -136,8 +136,8 @@ public class FlowEntry {
|
||||
* @param flowEntryVo 域对象。
|
||||
* @return 实体对象。
|
||||
*/
|
||||
@Mapping(target = "mainFlowEntryPublish", expression = "java(mapToBean(flowEntryVo.getMainFlowEntryPublish(), com.flow.demo.common.flow.model.FlowEntryPublish.class))")
|
||||
@Mapping(target = "flowCategory", expression = "java(mapToBean(flowEntryVo.getFlowCategory(), com.flow.demo.common.flow.model.FlowCategory.class))")
|
||||
@Mapping(target = "mainFlowEntryPublish", expression = "java(mapToBean(flowEntryVo.getMainFlowEntryPublish(), com.orangeforms.common.flow.model.FlowEntryPublish.class))")
|
||||
@Mapping(target = "flowCategory", expression = "java(mapToBean(flowEntryVo.getFlowCategory(), com.orangeforms.common.flow.model.FlowCategory.class))")
|
||||
@Override
|
||||
FlowEntry toModel(FlowEntryVo flowEntryVo);
|
||||
/**
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.model;
|
||||
package com.orangeforms.common.flow.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.model;
|
||||
package com.orangeforms.common.flow.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.flow.demo.common.flow.model;
|
||||
package com.orangeforms.common.flow.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.flow.demo.common.core.base.mapper.BaseModelMapper;
|
||||
import com.flow.demo.common.flow.vo.FlowEntryVariableVo;
|
||||
import com.orangeforms.common.core.base.mapper.BaseModelMapper;
|
||||
import com.orangeforms.common.flow.vo.FlowEntryVariableVo;
|
||||
import lombok.Data;
|
||||
import org.mapstruct.*;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
@@ -0,0 +1,154 @@
|
||||
package com.orangeforms.common.flow.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.orangeforms.common.core.base.mapper.BaseModelMapper;
|
||||
import com.orangeforms.common.flow.vo.FlowMessageVo;
|
||||
import lombok.Data;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 工作流通知消息实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "zz_flow_message")
|
||||
public class FlowMessage {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@TableId(value = "message_id")
|
||||
private Long messageId;
|
||||
|
||||
/**
|
||||
* 消息类型。
|
||||
*/
|
||||
@TableField(value = "message_type")
|
||||
private Integer messageType;
|
||||
|
||||
/**
|
||||
* 消息内容。
|
||||
*/
|
||||
@TableField(value = "message_content")
|
||||
private String messageContent;
|
||||
|
||||
/**
|
||||
* 催办次数。
|
||||
*/
|
||||
@TableField(value = "remind_count")
|
||||
private Integer remindCount;
|
||||
|
||||
/**
|
||||
* 工单Id。
|
||||
*/
|
||||
@TableField(value = "work_order_id")
|
||||
private Long workOrderId;
|
||||
|
||||
/**
|
||||
* 流程定义Id。
|
||||
*/
|
||||
@TableField(value = "process_definition_id")
|
||||
private String processDefinitionId;
|
||||
|
||||
/**
|
||||
* 流程定义标识。
|
||||
*/
|
||||
@TableField(value = "process_definition_key")
|
||||
private String processDefinitionKey;
|
||||
|
||||
/**
|
||||
* 流程名称。
|
||||
*/
|
||||
@TableField(value = "process_definition_name")
|
||||
private String processDefinitionName;
|
||||
|
||||
/**
|
||||
* 流程实例Id。
|
||||
*/
|
||||
@TableField(value = "process_instance_id")
|
||||
private String processInstanceId;
|
||||
|
||||
/**
|
||||
* 流程实例发起者。
|
||||
*/
|
||||
@TableField(value = "process_instance_initiator")
|
||||
private String processInstanceInitiator;
|
||||
|
||||
/**
|
||||
* 流程任务Id。
|
||||
*/
|
||||
@TableField(value = "task_id")
|
||||
private String taskId;
|
||||
|
||||
/**
|
||||
* 流程任务定义标识。
|
||||
*/
|
||||
@TableField(value = "task_definition_key")
|
||||
private String taskDefinitionKey;
|
||||
|
||||
/**
|
||||
* 流程任务名称。
|
||||
*/
|
||||
@TableField(value = "task_name")
|
||||
private String taskName;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@TableField(value = "task_start_time")
|
||||
private Date taskStartTime;
|
||||
|
||||
/**
|
||||
* 任务指派人登录名。
|
||||
*/
|
||||
@TableField(value = "task_assignee")
|
||||
private String taskAssignee;
|
||||
|
||||
/**
|
||||
* 任务是否已完成。
|
||||
*/
|
||||
@TableField(value = "task_finished")
|
||||
private Boolean taskFinished;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@TableField(value = "update_time")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@TableField(value = "update_user_id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@TableField(value = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@TableField(value = "create_user_id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建者显示名。
|
||||
*/
|
||||
@TableField(value = "create_username")
|
||||
private String createUsername;
|
||||
|
||||
@Mapper
|
||||
public interface FlowMessageModelMapper extends BaseModelMapper<FlowMessageVo, FlowMessage> {
|
||||
}
|
||||
public static final FlowMessage.FlowMessageModelMapper INSTANCE = Mappers.getMapper(FlowMessage.FlowMessageModelMapper.class);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.orangeforms.common.flow.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 流程任务消息的候选身份实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "zz_flow_message_candicate_identity")
|
||||
public class FlowMessageCandidateIdentity {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 任务消息Id。
|
||||
*/
|
||||
@TableField(value = "message_id")
|
||||
private Long messageId;
|
||||
|
||||
/**
|
||||
* 候选身份类型。
|
||||
*/
|
||||
@TableField(value = "candidate_type")
|
||||
private String candidateType;
|
||||
|
||||
/**
|
||||
* 候选身份Id。
|
||||
*/
|
||||
@TableField(value = "candidate_id")
|
||||
private String candidateId;
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.flow.demo.common.flow.model;
|
||||
package com.orangeforms.common.flow.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.flow.demo.common.core.base.mapper.BaseModelMapper;
|
||||
import com.flow.demo.common.flow.vo.FlowTaskCommentVo;
|
||||
import com.orangeforms.common.core.base.mapper.BaseModelMapper;
|
||||
import com.orangeforms.common.flow.vo.FlowTaskCommentVo;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.activiti.engine.task.TaskInfo;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.model;
|
||||
package com.orangeforms.common.flow.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
@@ -48,4 +48,28 @@ public class FlowTaskExt {
|
||||
*/
|
||||
@TableField(value = "group_type")
|
||||
private String groupType;
|
||||
|
||||
/**
|
||||
* 保存岗位相关的数据。
|
||||
*/
|
||||
@TableField(value = "dept_post_list_json")
|
||||
private String deptPostListJson;
|
||||
|
||||
/**
|
||||
* 逗号分隔的角色Id。
|
||||
*/
|
||||
@TableField(value = "role_ids")
|
||||
private String roleIds;
|
||||
|
||||
/**
|
||||
* 逗号分隔的部门Id。
|
||||
*/
|
||||
@TableField(value = "dept_ids")
|
||||
private String deptIds;
|
||||
|
||||
/**
|
||||
* 逗号分隔候选用户名。
|
||||
*/
|
||||
@TableField(value = "candidate_usernames")
|
||||
private String candidateUsernames;
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package com.flow.demo.common.flow.model;
|
||||
package com.orangeforms.common.flow.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.flow.demo.common.core.annotation.DeptFilterColumn;
|
||||
import com.flow.demo.common.core.annotation.RelationConstDict;
|
||||
import com.flow.demo.common.core.base.mapper.BaseModelMapper;
|
||||
import com.flow.demo.common.flow.constant.FlowTaskStatus;
|
||||
import com.flow.demo.common.flow.vo.FlowWorkOrderVo;
|
||||
import com.orangeforms.common.core.annotation.DeptFilterColumn;
|
||||
import com.orangeforms.common.core.annotation.UserFilterColumn;
|
||||
import com.orangeforms.common.core.annotation.RelationConstDict;
|
||||
import com.orangeforms.common.core.base.mapper.BaseModelMapper;
|
||||
import com.orangeforms.common.flow.constant.FlowTaskStatus;
|
||||
import com.orangeforms.common.flow.vo.FlowWorkOrderVo;
|
||||
import lombok.Data;
|
||||
import org.mapstruct.*;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
@@ -59,6 +60,12 @@ public class FlowWorkOrder {
|
||||
@TableField(value = "online_table_id")
|
||||
private Long onlineTableId;
|
||||
|
||||
/**
|
||||
* 静态表单所使用的数据表名。
|
||||
*/
|
||||
@TableField(value = "table_name")
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 业务主键值。
|
||||
*/
|
||||
@@ -105,6 +112,7 @@ public class FlowWorkOrder {
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@UserFilterColumn
|
||||
@TableField(value = "create_user_id")
|
||||
private Long createUserId;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.model.constant;
|
||||
package com.orangeforms.common.flow.model.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.model.constant;
|
||||
package com.orangeforms.common.flow.model.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.orangeforms.common.flow.model.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 工作流消息类型。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
public final class FlowMessageType {
|
||||
|
||||
/**
|
||||
* 催办消息。
|
||||
*/
|
||||
public static final int REMIND_TYPE = 0;
|
||||
|
||||
private static final Map<Object, String> DICT_MAP = new HashMap<>(2);
|
||||
static {
|
||||
DICT_MAP.put(REMIND_TYPE, "催办消息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断参数是否为当前常量字典的合法值。
|
||||
*
|
||||
* @param value 待验证的参数值。
|
||||
* @return 合法返回true,否则false。
|
||||
*/
|
||||
public static boolean isValid(Integer value) {
|
||||
return value != null && DICT_MAP.containsKey(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私有构造函数,明确标识该常量类的作用。
|
||||
*/
|
||||
private FlowMessageType() {
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.model.constant;
|
||||
package com.orangeforms.common.flow.model.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.orangeforms.common.flow.object;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 表示多实例任务的指派人信息。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
@Data
|
||||
public class FlowTaskMultiSignAssign {
|
||||
|
||||
public static final String ASSIGN_TYPE_USER = "USER_GROUP";
|
||||
public static final String ASSIGN_TYPE_ROLE = "ROLE_GROUP";
|
||||
public static final String ASSIGN_TYPE_DEPT = "DEPT_GROUP";
|
||||
public static final String ASSIGN_TYPE_POST = "POST_GROUP";
|
||||
public static final String ASSIGN_TYPE_DEPT_POST = "DEPT_POST_GROUP";
|
||||
|
||||
/**
|
||||
* 指派人类型。
|
||||
*/
|
||||
private String assigneeType;
|
||||
/**
|
||||
* 逗号分隔的指派人列表。
|
||||
*/
|
||||
private String assigneeList;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.orangeforms.common.flow.object;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 流程图中的用户任务操作数据。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
@Data
|
||||
public class FlowTaskOperation {
|
||||
|
||||
/**
|
||||
* 操作Id。
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 操作的标签名。
|
||||
*/
|
||||
private String label;
|
||||
/**
|
||||
* 操作类型。
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 显示顺序。
|
||||
*/
|
||||
private Integer showOrder;
|
||||
/**
|
||||
* 在流程图中定义的多实例会签的指定人员信息。
|
||||
*/
|
||||
private FlowTaskMultiSignAssign multiSignAssignee;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.orangeforms.common.flow.object;
|
||||
|
||||
import com.orangeforms.common.flow.constant.FlowConstant;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程任务岗位候选组数据。仅用于流程任务的候选组类型为岗位时。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
@Data
|
||||
public class FlowTaskPostCandidateGroup {
|
||||
|
||||
/**
|
||||
* 唯一值,目前仅前端使用。
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 岗位类型。
|
||||
* 1. 所有部门岗位审批变量,值为 (allDeptPost)。
|
||||
* 2. 本部门岗位审批变量,值为 (selfDeptPost)。
|
||||
* 3. 上级部门岗位审批变量,值为 (upDeptPost)。
|
||||
* 4. 任意部门关联的岗位审批变量,值为 (deptPost)。
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 岗位Id。type为(1,2,3)时使用该值。
|
||||
*/
|
||||
private String postId;
|
||||
/**
|
||||
* 部门岗位Id。type为(4)时使用该值。
|
||||
*/
|
||||
private String deptPostId;
|
||||
|
||||
public static List<String> buildCandidateGroupList(List<FlowTaskPostCandidateGroup> groupDataList) {
|
||||
List<String> candidateGroupList = new LinkedList<>();
|
||||
for (FlowTaskPostCandidateGroup groupData : groupDataList) {
|
||||
switch (groupData.getType()) {
|
||||
case FlowConstant.GROUP_TYPE_ALL_DEPT_POST_VAR:
|
||||
candidateGroupList.add(groupData.getPostId());
|
||||
break;
|
||||
case FlowConstant.GROUP_TYPE_DEPT_POST_VAR:
|
||||
candidateGroupList.add(groupData.getDeptPostId());
|
||||
break;
|
||||
case FlowConstant.GROUP_TYPE_SELF_DEPT_POST_VAR:
|
||||
candidateGroupList.add("${" + FlowConstant.SELF_DEPT_POST_PREFIX + groupData.getPostId() + "}");
|
||||
break;
|
||||
case FlowConstant.GROUP_TYPE_UP_DEPT_POST_VAR:
|
||||
candidateGroupList.add("${" + FlowConstant.UP_DEPT_POST_PREFIX + groupData.getPostId() + "}");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return candidateGroupList;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
package com.flow.demo.common.flow.service;
|
||||
package com.orangeforms.common.flow.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.flow.demo.common.core.object.CallResult;
|
||||
import com.flow.demo.common.core.object.MyPageData;
|
||||
import com.flow.demo.common.core.object.MyPageParam;
|
||||
import com.flow.demo.common.flow.model.FlowTaskComment;
|
||||
import com.flow.demo.common.flow.vo.FlowTaskVo;
|
||||
import com.orangeforms.common.core.object.CallResult;
|
||||
import com.orangeforms.common.core.object.MyPageData;
|
||||
import com.orangeforms.common.core.object.MyPageParam;
|
||||
import com.orangeforms.common.flow.model.FlowTaskComment;
|
||||
import com.orangeforms.common.flow.vo.FlowTaskVo;
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.bpmn.model.FlowElement;
|
||||
import org.activiti.bpmn.model.UserTask;
|
||||
import org.activiti.engine.delegate.ExecutionListener;
|
||||
import org.activiti.engine.delegate.TaskListener;
|
||||
@@ -18,7 +19,9 @@ import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.activiti.engine.task.TaskInfo;
|
||||
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import java.text.ParseException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -35,8 +38,10 @@ public interface FlowApiService {
|
||||
* 启动流程实例。
|
||||
*
|
||||
* @param processDefinitionId 流程定义Id。
|
||||
* @param dataId 业务主键Id。
|
||||
* @return 新启动的流程实例。
|
||||
*/
|
||||
void start(String processDefinitionId);
|
||||
ProcessInstance start(String processDefinitionId, Object dataId);
|
||||
|
||||
/**
|
||||
* 启动流程实例,如果当前登录用户为第一个用户任务的指派者,或者Assginee为流程启动人变量时,
|
||||
@@ -93,6 +98,14 @@ public interface FlowApiService {
|
||||
*/
|
||||
boolean isAssigneeOrCandidate(TaskInfo task);
|
||||
|
||||
/**
|
||||
* 获取指定流程定义的全部流程节点。
|
||||
*
|
||||
* @param processDefinitionId 流程定义Id。
|
||||
* @return 当前流程定义的全部节点集合。
|
||||
*/
|
||||
Collection<FlowElement> getProcessAllElements(String processDefinitionId);
|
||||
|
||||
/**
|
||||
* 判断当前登录用户是否为流程实例的发起人。
|
||||
*
|
||||
@@ -133,6 +146,14 @@ public interface FlowApiService {
|
||||
*/
|
||||
List<ProcessInstance> getProcessInstanceList(Set<String> processInstanceIdSet);
|
||||
|
||||
/**
|
||||
* 根据流程定义Id查询流程定义对象。
|
||||
*
|
||||
* @param processDefinitionId 流程定义Id。
|
||||
* @return 流程定义对象。
|
||||
*/
|
||||
ProcessDefinition getProcessDefinitionById(String processDefinitionId);
|
||||
|
||||
/**
|
||||
* 根据流程部署Id查询流程定义对象。
|
||||
*
|
||||
@@ -197,15 +218,26 @@ public interface FlowApiService {
|
||||
*/
|
||||
List<Task> getProcessInstanceActiveTaskList(String processInstanceId);
|
||||
|
||||
/**
|
||||
* 根据任务Id,获取当前运行时任务。
|
||||
*
|
||||
* @param taskId 任务Id。
|
||||
* @return 运行时任务对象。
|
||||
*/
|
||||
Task getTaskById(String taskId);
|
||||
|
||||
/**
|
||||
* 获取用户的任务列表。这其中包括当前用户作为指派人和候选人。
|
||||
*
|
||||
* @param username 指派人。
|
||||
* @param definitionKey 流程定义的标识。
|
||||
* @param pageParam 分页对象。
|
||||
* @param username 指派人。
|
||||
* @param definitionKey 流程定义的标识。
|
||||
* @param definitionName 流程定义名。
|
||||
* @param taskName 任务名称。
|
||||
* @param pageParam 分页对象。
|
||||
* @return 用户的任务列表。
|
||||
*/
|
||||
MyPageData<Task> getTaskListByUserName(String username, String definitionKey, MyPageParam pageParam);
|
||||
MyPageData<Task> getTaskListByUserName(
|
||||
String username, String definitionKey, String definitionName, String taskName, MyPageParam pageParam);
|
||||
|
||||
/**
|
||||
* 获取用户的任务数量。这其中包括当前用户作为指派人和候选人。
|
||||
@@ -293,6 +325,14 @@ public interface FlowApiService {
|
||||
*/
|
||||
List<HistoricActivityInstance> getHistoricActivityInstanceList(String processInstanceId);
|
||||
|
||||
/**
|
||||
* 获取流程实例的已完成历史任务列表,同时按照每个活动实例的开始时间升序排序。
|
||||
*
|
||||
* @param processInstanceId 流程实例Id。
|
||||
* @return 流程实例已完成的历史任务列表。
|
||||
*/
|
||||
List<HistoricActivityInstance> getHistoricActivityInstanceListOrderByStartTime(String processInstanceId);
|
||||
|
||||
/**
|
||||
* 获取当前用户的历史已办理任务列表。
|
||||
*
|
||||
@@ -351,4 +391,13 @@ public interface FlowApiService {
|
||||
* @return 变量值。
|
||||
*/
|
||||
Object getTaskVariable(String taskId, String variableName);
|
||||
|
||||
/**
|
||||
* 将xml格式的流程模型字符串,转换为标准的流程模型。
|
||||
*
|
||||
* @param bpmnXml xml格式的流程模型字符串。
|
||||
* @return 转换后的标准的流程模型。
|
||||
* @throws XMLStreamException XML流处理异常
|
||||
*/
|
||||
BpmnModel convertToBpmnModel(String bpmnXml) throws XMLStreamException;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.flow.demo.common.flow.service;
|
||||
package com.orangeforms.common.flow.service;
|
||||
|
||||
import com.flow.demo.common.core.base.service.IBaseService;
|
||||
import com.flow.demo.common.flow.model.*;
|
||||
import com.orangeforms.common.core.base.service.IBaseService;
|
||||
import com.orangeforms.common.flow.model.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.flow.demo.common.flow.service;
|
||||
package com.orangeforms.common.flow.service;
|
||||
|
||||
import com.flow.demo.common.core.base.service.IBaseService;
|
||||
import com.flow.demo.common.core.object.CallResult;
|
||||
import com.flow.demo.common.flow.model.*;
|
||||
import com.orangeforms.common.core.base.service.IBaseService;
|
||||
import com.orangeforms.common.core.object.CallResult;
|
||||
import com.orangeforms.common.flow.model.*;
|
||||
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import java.util.List;
|
||||
@@ -133,13 +133,4 @@ public interface FlowEntryService extends IBaseService<FlowEntry, Long> {
|
||||
* @param flowEntryPublish 待恢复的工作流发布对象。
|
||||
*/
|
||||
void activateFlowEntryPublish(FlowEntryPublish flowEntryPublish);
|
||||
|
||||
/**
|
||||
* 主表的关联数据验证。
|
||||
*
|
||||
* @param flowEntry 最新数据对象。
|
||||
* @param originalFlowEntry 原有数据对象。
|
||||
* @return 数据全部正确返回true,否则false。
|
||||
*/
|
||||
CallResult verifyRelatedData(FlowEntry flowEntry, FlowEntry originalFlowEntry);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.flow.demo.common.flow.service;
|
||||
package com.orangeforms.common.flow.service;
|
||||
|
||||
import com.flow.demo.common.flow.model.*;
|
||||
import com.flow.demo.common.core.base.service.IBaseService;
|
||||
import com.orangeforms.common.flow.model.*;
|
||||
import com.orangeforms.common.core.base.service.IBaseService;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.orangeforms.common.flow.service;
|
||||
|
||||
import com.orangeforms.common.core.base.service.IBaseService;
|
||||
import com.orangeforms.common.flow.model.FlowMessage;
|
||||
import com.orangeforms.common.flow.model.FlowWorkOrder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工作流消息数据操作服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
public interface FlowMessageService extends IBaseService<FlowMessage, Long> {
|
||||
|
||||
/**
|
||||
* 保存新增对象。
|
||||
*
|
||||
* @param flowMessage 新增对象。
|
||||
* @return 保存后的消息对象。
|
||||
*/
|
||||
FlowMessage saveNew(FlowMessage flowMessage);
|
||||
|
||||
/**
|
||||
* 根据工单参数,保存催单消息对象。如果当前工单存在多个待办任务,则插入多条催办消息数据。
|
||||
*
|
||||
* @param flowWorkOrder 待催办的工单。
|
||||
*/
|
||||
void saveNewRemindMessage(FlowWorkOrder flowWorkOrder);
|
||||
|
||||
/**
|
||||
* 更新指定运行时任务Id的消费为已完成状态。
|
||||
*
|
||||
* @param taskId 运行时任务Id。
|
||||
*/
|
||||
void updateFinishedStatusByTaskId(String taskId);
|
||||
|
||||
/**
|
||||
* 更新指定流程实例Id的消费为已完成状态。
|
||||
*
|
||||
* @param processInstanceId 流程实例IdId。
|
||||
*/
|
||||
void updateFinishedStatusByProcessInstanceId(String processInstanceId);
|
||||
|
||||
/**
|
||||
* 获取当前用户的催办消息列表。
|
||||
*
|
||||
* @return 查询后的催办消息列表。
|
||||
*/
|
||||
List<FlowMessage> getRemindingMessageListByUser();
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.orangeforms.common.flow.service;
|
||||
|
||||
import com.orangeforms.common.flow.model.*;
|
||||
import com.orangeforms.common.core.base.service.IBaseService;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 流程任务批注数据操作服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
public interface FlowTaskCommentService extends IBaseService<FlowTaskComment, Long> {
|
||||
|
||||
/**
|
||||
* 保存新增对象。
|
||||
*
|
||||
* @param flowTaskComment 新增对象。
|
||||
* @return 返回新增对象。
|
||||
*/
|
||||
FlowTaskComment saveNew(FlowTaskComment flowTaskComment);
|
||||
|
||||
/**
|
||||
* 查询指定流程实例Id下的所有审批任务的批注。
|
||||
*
|
||||
* @param processInstanceId 流程实例Id。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<FlowTaskComment> getFlowTaskCommentList(String processInstanceId);
|
||||
|
||||
/**
|
||||
* 查询与指定流程任务Id集合关联的所有审批任务的批注。
|
||||
*
|
||||
* @param taskIdSet 流程任务Id集合。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<FlowTaskComment> getFlowTaskCommentListByTaskIds(Set<String> taskIdSet);
|
||||
|
||||
/**
|
||||
* 获取指定流程实例的最后一条审批任务。
|
||||
*
|
||||
* @param processInstanceId 流程实例Id。
|
||||
* @return 查询结果。
|
||||
*/
|
||||
FlowTaskComment getLatestFlowTaskComment(String processInstanceId);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.flow.demo.common.flow.service;
|
||||
package com.orangeforms.common.flow.service;
|
||||
|
||||
import com.flow.demo.common.flow.model.*;
|
||||
import com.flow.demo.common.core.base.service.IBaseService;
|
||||
import com.orangeforms.common.flow.model.*;
|
||||
import com.orangeforms.common.core.base.service.IBaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.flow.demo.common.flow.service;
|
||||
package com.orangeforms.common.flow.service;
|
||||
|
||||
import com.flow.demo.common.core.base.service.IBaseService;
|
||||
import com.flow.demo.common.flow.model.FlowWorkOrder;
|
||||
import com.orangeforms.common.core.base.service.IBaseService;
|
||||
import com.orangeforms.common.flow.model.FlowWorkOrder;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
|
||||
import java.util.*;
|
||||
@@ -20,9 +20,10 @@ public interface FlowWorkOrderService extends IBaseService<FlowWorkOrder, Long>
|
||||
* @param instance 流程实例对象。
|
||||
* @param dataId 流程实例的BusinessKey。
|
||||
* @param onlineTableId 在线数据表的主键Id。
|
||||
* @param tableName 面向静态表单所使用的表名。
|
||||
* @return 新增的工作流工单对象。
|
||||
*/
|
||||
FlowWorkOrder saveNew(ProcessInstance instance, Object dataId, Long onlineTableId);
|
||||
FlowWorkOrder saveNew(ProcessInstance instance, Object dataId, Long onlineTableId, String tableName);
|
||||
|
||||
/**
|
||||
* 删除指定数据。
|
||||
@@ -68,18 +69,12 @@ public interface FlowWorkOrderService extends IBaseService<FlowWorkOrder, Long>
|
||||
/**
|
||||
* 根据业务主键,查询是否存在指定的工单。
|
||||
*
|
||||
* @param tableName 静态表单工作流使用的数据表。
|
||||
* @param businessKey 业务数据主键Id。
|
||||
* @param unfinished 是否为没有结束工单。
|
||||
* @return 存在返回true,否则false。
|
||||
*/
|
||||
boolean existByBusinessKey(Object businessKey, boolean unfinished);
|
||||
|
||||
/**
|
||||
* 根据业务数据的主键Id,更新流程状态。
|
||||
* @param businessKey 业务数据主键Id。
|
||||
* @param flowStatus 新的流程状态值。
|
||||
*/
|
||||
void updateFlowStatusByBusinessKey(String businessKey, int flowStatus);
|
||||
boolean existByBusinessKey(String tableName, Object businessKey, boolean unfinished);
|
||||
|
||||
/**
|
||||
* 根据流程实例Id,更新流程状态。
|
||||
@@ -1,28 +1,34 @@
|
||||
package com.flow.demo.common.flow.service.impl;
|
||||
package com.orangeforms.common.flow.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.flow.demo.common.core.object.CallResult;
|
||||
import com.flow.demo.common.core.object.MyPageData;
|
||||
import com.flow.demo.common.core.object.MyPageParam;
|
||||
import com.flow.demo.common.core.object.TokenData;
|
||||
import com.flow.demo.common.flow.command.AddMultiInstanceExecutionCmd;
|
||||
import com.flow.demo.common.flow.constant.FlowConstant;
|
||||
import com.flow.demo.common.flow.constant.FlowApprovalType;
|
||||
import com.flow.demo.common.flow.constant.FlowTaskStatus;
|
||||
import com.flow.demo.common.flow.model.FlowEntryPublish;
|
||||
import com.flow.demo.common.flow.model.FlowTaskComment;
|
||||
import com.flow.demo.common.flow.model.FlowTaskExt;
|
||||
import com.flow.demo.common.flow.service.*;
|
||||
import com.flow.demo.common.flow.util.BaseFlowDeptPostExtHelper;
|
||||
import com.flow.demo.common.flow.util.FlowCustomExtFactory;
|
||||
import com.flow.demo.common.flow.vo.FlowTaskVo;
|
||||
import com.orangeforms.common.flow.object.FlowTaskMultiSignAssign;
|
||||
import com.orangeforms.common.flow.object.FlowTaskOperation;
|
||||
import com.orangeforms.common.flow.object.FlowTaskPostCandidateGroup;
|
||||
import com.orangeforms.common.core.object.CallResult;
|
||||
import com.orangeforms.common.core.object.MyPageData;
|
||||
import com.orangeforms.common.core.object.MyPageParam;
|
||||
import com.orangeforms.common.core.object.TokenData;
|
||||
import com.orangeforms.common.flow.command.AddMultiInstanceExecutionCmd;
|
||||
import com.orangeforms.common.flow.constant.FlowConstant;
|
||||
import com.orangeforms.common.flow.constant.FlowApprovalType;
|
||||
import com.orangeforms.common.flow.constant.FlowTaskStatus;
|
||||
import com.orangeforms.common.flow.model.FlowEntryPublish;
|
||||
import com.orangeforms.common.flow.model.FlowTaskComment;
|
||||
import com.orangeforms.common.flow.model.FlowTaskExt;
|
||||
import com.orangeforms.common.flow.service.*;
|
||||
import com.orangeforms.common.flow.util.BaseFlowIdentityExtHelper;
|
||||
import com.orangeforms.common.flow.util.FlowCustomExtFactory;
|
||||
import com.orangeforms.common.flow.vo.FlowTaskVo;
|
||||
import lombok.Cleanup;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.bpmn.converter.BpmnXMLConverter;
|
||||
import org.activiti.bpmn.model.*;
|
||||
import org.activiti.bpmn.model.Process;
|
||||
import org.activiti.engine.*;
|
||||
@@ -39,6 +45,12 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
@@ -67,17 +79,20 @@ public class FlowApiServiceImpl implements FlowApiService {
|
||||
@Autowired
|
||||
private FlowWorkOrderService flowWorkOrderService;
|
||||
@Autowired
|
||||
private FlowMessageService flowMessageService;
|
||||
@Autowired
|
||||
private FlowCustomExtFactory flowCustomExtFactory;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void start(String processDefinitionId) {
|
||||
public ProcessInstance start(String processDefinitionId, Object dataId) {
|
||||
String loginName = TokenData.takeFromRequest().getLoginName();
|
||||
Map<String, Object> variableMap = new HashMap<>(4);
|
||||
variableMap.put(FlowConstant.PROC_INSTANCE_INITIATOR_VAR, loginName);
|
||||
variableMap.put(FlowConstant.PROC_INSTANCE_START_USER_NAME_VAR, loginName);
|
||||
Authentication.setAuthenticatedUserId(loginName);
|
||||
runtimeService.startProcessInstanceById(processDefinitionId, null, variableMap);
|
||||
String businessKey = dataId == null ? null : dataId.toString();
|
||||
return runtimeService.startProcessInstanceById(processDefinitionId, businessKey, variableMap);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -126,9 +141,19 @@ public class FlowApiServiceImpl implements FlowApiService {
|
||||
// 这里处理多实例会签逻辑。
|
||||
if (flowTaskComment.getApprovalType().equals(FlowApprovalType.MULTI_SIGN)) {
|
||||
String loginName = TokenData.takeFromRequest().getLoginName();
|
||||
if (taskVariableData == null) {
|
||||
taskVariableData = new JSONObject();
|
||||
}
|
||||
String assigneeList = taskVariableData.getString(FlowConstant.MULTI_ASSIGNEE_LIST_VAR);
|
||||
Assert.notNull(taskVariableData);
|
||||
Assert.notNull(assigneeList);
|
||||
if (StrUtil.isBlank(assigneeList)) {
|
||||
FlowTaskExt flowTaskExt = flowTaskExtService.getByProcessDefinitionIdAndTaskId(
|
||||
task.getProcessDefinitionId(), task.getTaskDefinitionKey());
|
||||
assigneeList = this.buildMutiSignAssigneeList(flowTaskExt.getOperationListJson());
|
||||
if (assigneeList != null) {
|
||||
taskVariableData.put(FlowConstant.MULTI_ASSIGNEE_LIST_VAR, StrUtil.split(assigneeList,','));
|
||||
}
|
||||
}
|
||||
Assert.isTrue(StrUtil.isNotBlank(assigneeList));
|
||||
taskVariableData.put(FlowConstant.MULTI_AGREE_COUNT_VAR, 0);
|
||||
taskVariableData.put(FlowConstant.MULTI_REFUSE_COUNT_VAR, 0);
|
||||
taskVariableData.put(FlowConstant.MULTI_ABSTAIN_COUNT_VAR, 0);
|
||||
@@ -156,6 +181,7 @@ public class FlowApiServiceImpl implements FlowApiService {
|
||||
} else {
|
||||
taskService.complete(task.getId(), taskVariableData, true);
|
||||
}
|
||||
flowMessageService.updateFinishedStatusByTaskId(task.getId());
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -192,33 +218,88 @@ public class FlowApiServiceImpl implements FlowApiService {
|
||||
List<FlowTaskExt> flowTaskExtList = flowTaskExtService.getByProcessDefinitionId(processDefinitionId);
|
||||
boolean hasDeptPostLeader = false;
|
||||
boolean hasUpDeptPostLeader = false;
|
||||
boolean hasPostCandidateGroup = false;
|
||||
for (FlowTaskExt flowTaskExt : flowTaskExtList) {
|
||||
if (StrUtil.equals(flowTaskExt.getGroupType(), FlowConstant.GROUP_TYPE_UP_DEPT_POST_LEADER)) {
|
||||
hasUpDeptPostLeader = true;
|
||||
} else if (StrUtil.equals(flowTaskExt.getGroupType(), FlowConstant.GROUP_TYPE_DEPT_POST_LEADER)) {
|
||||
hasDeptPostLeader = true;
|
||||
} else if (StrUtil.equals(flowTaskExt.getGroupType(), FlowConstant.GROUP_TYPE_POST)) {
|
||||
hasPostCandidateGroup = true;
|
||||
}
|
||||
}
|
||||
// 如果流程图的配置中包含部门岗位相关的变量(如:部门领导和上级领导审批),flowDeptPostExtHelper就不能为null。
|
||||
// 这个需要子类去实现 BaseFlowDeptPostExtHelper 接口,并注册到FlowCustomExtFactory的工厂中。
|
||||
BaseFlowDeptPostExtHelper flowDeptPostExtHelper = flowCustomExtFactory.getFlowDeptPostExtHelper();
|
||||
// 如果流程图的配置中包含用户身份相关的变量(如:部门领导和上级领导审批),flowIdentityExtHelper就不能为null。
|
||||
// 这个需要子类去实现 BaseFlowIdentityExtHelper 接口,并注册到FlowCustomExtFactory的工厂中。
|
||||
BaseFlowIdentityExtHelper flowIdentityExtHelper = flowCustomExtFactory.getFlowIdentityExtHelper();
|
||||
if (hasUpDeptPostLeader) {
|
||||
Assert.notNull(flowDeptPostExtHelper);
|
||||
Object upLeaderDeptPostId = flowDeptPostExtHelper.getUpLeaderDeptPostId(tokenData.getDeptId());
|
||||
Assert.notNull(flowIdentityExtHelper);
|
||||
Object upLeaderDeptPostId = flowIdentityExtHelper.getUpLeaderDeptPostId(tokenData.getDeptId());
|
||||
if (upLeaderDeptPostId != null) {
|
||||
variableMap.put(FlowConstant.GROUP_TYPE_UP_DEPT_POST_LEADER_VAR, upLeaderDeptPostId.toString());
|
||||
}
|
||||
}
|
||||
if (hasDeptPostLeader) {
|
||||
Assert.notNull(flowDeptPostExtHelper);
|
||||
Object leaderDeptPostId = flowDeptPostExtHelper.getLeaderDeptPostId(tokenData.getDeptId());
|
||||
Assert.notNull(flowIdentityExtHelper);
|
||||
Object leaderDeptPostId = flowIdentityExtHelper.getLeaderDeptPostId(tokenData.getDeptId());
|
||||
if (leaderDeptPostId != null) {
|
||||
variableMap.put(FlowConstant.GROUP_TYPE_DEPT_POST_LEADER_VAR, leaderDeptPostId.toString());
|
||||
}
|
||||
}
|
||||
if (hasPostCandidateGroup) {
|
||||
Assert.notNull(flowIdentityExtHelper);
|
||||
Map<String, Object> postGroupDataMap =
|
||||
this.buildPostCandidateGroupData(flowIdentityExtHelper, flowTaskExtList);
|
||||
variableMap.putAll(postGroupDataMap);
|
||||
}
|
||||
return variableMap;
|
||||
}
|
||||
|
||||
private Map<String, Object> buildPostCandidateGroupData(
|
||||
BaseFlowIdentityExtHelper flowIdentityExtHelper, List<FlowTaskExt> flowTaskExtList) {
|
||||
Map<String, Object> postVariableMap = new HashMap<>();
|
||||
Set<String> selfPostIdSet = new HashSet<>();
|
||||
Set<String> upPostIdSet = new HashSet<>();
|
||||
for (FlowTaskExt flowTaskExt : flowTaskExtList) {
|
||||
if (flowTaskExt.getGroupType().equals(FlowConstant.GROUP_TYPE_POST)) {
|
||||
Assert.notNull(flowTaskExt.getDeptPostListJson());
|
||||
List<FlowTaskPostCandidateGroup> groupDataList =
|
||||
JSONArray.parseArray(flowTaskExt.getDeptPostListJson(), FlowTaskPostCandidateGroup.class);
|
||||
for (FlowTaskPostCandidateGroup groupData : groupDataList) {
|
||||
if (groupData.getType().equals(FlowConstant.GROUP_TYPE_SELF_DEPT_POST_VAR)) {
|
||||
selfPostIdSet.add(groupData.getPostId());
|
||||
} else if (groupData.getType().equals(FlowConstant.GROUP_TYPE_UP_DEPT_POST_VAR)) {
|
||||
upPostIdSet.add(groupData.getPostId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(selfPostIdSet)) {
|
||||
Map<String, String> deptPostIdMap =
|
||||
flowIdentityExtHelper.getDeptPostIdMap(TokenData.takeFromRequest().getDeptId(), selfPostIdSet);
|
||||
for (String postId : selfPostIdSet) {
|
||||
if (MapUtil.isNotEmpty(deptPostIdMap) && deptPostIdMap.containsKey(postId)) {
|
||||
String deptPostId = deptPostIdMap.get(postId);
|
||||
postVariableMap.put(FlowConstant.SELF_DEPT_POST_PREFIX + postId, deptPostId);
|
||||
} else {
|
||||
postVariableMap.put(FlowConstant.SELF_DEPT_POST_PREFIX + postId, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(upPostIdSet)) {
|
||||
Map<String, String> upDeptPostIdMap =
|
||||
flowIdentityExtHelper.getUpDeptPostIdMap(TokenData.takeFromRequest().getDeptId(), upPostIdSet);
|
||||
for (String postId : upPostIdSet) {
|
||||
if (MapUtil.isNotEmpty(upDeptPostIdMap) && upDeptPostIdMap.containsKey(postId)) {
|
||||
String upDeptPostId = upDeptPostIdMap.get(postId);
|
||||
postVariableMap.put(FlowConstant.UP_DEPT_POST_PREFIX + postId, upDeptPostId);
|
||||
} else {
|
||||
postVariableMap.put(FlowConstant.UP_DEPT_POST_PREFIX + postId, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
return postVariableMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAssigneeOrCandidate(TaskInfo task) {
|
||||
String loginName = TokenData.takeFromRequest().getLoginName();
|
||||
@@ -230,6 +311,12 @@ public class FlowApiServiceImpl implements FlowApiService {
|
||||
return query.active().count() != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<FlowElement> getProcessAllElements(String processDefinitionId) {
|
||||
Process process = repositoryService.getBpmnModel(processDefinitionId).getProcesses().get(0);
|
||||
return this.getAllElements(process.getFlowElements(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isProcessInstanceStarter(String processInstanceId) {
|
||||
String loginName = TokenData.takeFromRequest().getLoginName();
|
||||
@@ -269,14 +356,26 @@ public class FlowApiServiceImpl implements FlowApiService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MyPageData<Task> getTaskListByUserName(String username, String definitionKey, MyPageParam pageParam) {
|
||||
public Task getTaskById(String taskId) {
|
||||
return taskService.createTaskQuery().taskId(taskId).singleResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MyPageData<Task> getTaskListByUserName(
|
||||
String username, String definitionKey, String definitionName, String taskName, MyPageParam pageParam) {
|
||||
TaskQuery query = taskService.createTaskQuery().active();
|
||||
if (StrUtil.isNotBlank(definitionKey)) {
|
||||
query.processDefinitionKey(definitionKey);
|
||||
}
|
||||
if (StrUtil.isNotBlank(definitionName)) {
|
||||
query.processDefinitionNameLike("%" + definitionName + "%");
|
||||
}
|
||||
if (StrUtil.isNotBlank(taskName)) {
|
||||
query.taskNameLike("%" + taskName + "%");
|
||||
}
|
||||
this.buildCandidateCondition(query, username);
|
||||
query.orderByTaskCreateTime().desc();
|
||||
long totalCount = query.count();
|
||||
query.orderByTaskCreateTime().desc();
|
||||
int firstResult = (pageParam.getPageNum() - 1) * pageParam.getPageSize();
|
||||
List<Task> taskList = query.listPage(firstResult, pageParam.getPageSize());
|
||||
return new MyPageData<>(taskList, totalCount);
|
||||
@@ -297,6 +396,11 @@ public class FlowApiServiceImpl implements FlowApiService {
|
||||
return runtimeService.createProcessInstanceQuery().processInstanceIds(processInstanceIdSet).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcessDefinition getProcessDefinitionById(String processDefinitionId) {
|
||||
return repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProcessDefinition> getProcessDefinitionList(Set<String> processDefinitionIdSet) {
|
||||
return repositoryService.createProcessDefinitionQuery().processDefinitionIds(processDefinitionIdSet).list();
|
||||
@@ -367,6 +471,7 @@ public class FlowApiServiceImpl implements FlowApiService {
|
||||
processInstance.getId(), FlowConstant.PROC_INSTANCE_INITIATOR_VAR);
|
||||
flowTaskVo.setProcessInstanceInitiator(initiator.toString());
|
||||
flowTaskVo.setProcessInstanceStartTime(processInstance.getStartTime());
|
||||
flowTaskVo.setBusinessKey(processInstance.getBusinessKey());
|
||||
flowTaskVoList.add(flowTaskVo);
|
||||
}
|
||||
return flowTaskVoList;
|
||||
@@ -473,6 +578,12 @@ public class FlowApiServiceImpl implements FlowApiService {
|
||||
return historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HistoricActivityInstance> getHistoricActivityInstanceListOrderByStartTime(String processInstanceId) {
|
||||
return historyService.createHistoricActivityInstanceQuery()
|
||||
.processInstanceId(processInstanceId).orderByHistoricActivityInstanceStartTime().asc().list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HistoricTaskInstance getHistoricTaskInstance(String processInstanceId, String taskId) {
|
||||
return historyService.createHistoricTaskInstanceQuery()
|
||||
@@ -507,8 +618,8 @@ public class FlowApiServiceImpl implements FlowApiService {
|
||||
}
|
||||
}
|
||||
}
|
||||
EndEvent endEvent =
|
||||
bpmnModel.getMainProcess().findFlowElementsOfType(EndEvent.class, false).get(0);
|
||||
EndEvent endEvent = bpmnModel.getMainProcess()
|
||||
.findFlowElementsOfType(EndEvent.class, false).get(0);
|
||||
if (!(currFlow.getParentContainer().equals(endEvent.getParentContainer()))) {
|
||||
return CallResult.error("数据验证失败,不能从子流程直接中止!");
|
||||
}
|
||||
@@ -538,6 +649,7 @@ public class FlowApiServiceImpl implements FlowApiService {
|
||||
status = FlowTaskStatus.CANCELLED;
|
||||
}
|
||||
flowWorkOrderService.updateFlowStatusByProcessInstanceId(processInstanceId, status);
|
||||
flowMessageService.updateFinishedStatusByProcessInstanceId(processInstanceId);
|
||||
return CallResult.ok();
|
||||
}
|
||||
|
||||
@@ -553,6 +665,14 @@ public class FlowApiServiceImpl implements FlowApiService {
|
||||
return taskService.getVariable(taskId, variableName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BpmnModel convertToBpmnModel(String bpmnXml) throws XMLStreamException {
|
||||
BpmnXMLConverter converter = new BpmnXMLConverter();
|
||||
InputStream in = new ByteArrayInputStream(bpmnXml.getBytes(StandardCharsets.UTF_8));
|
||||
@Cleanup XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(in);
|
||||
return converter.convertToBpmnModel(reader);
|
||||
}
|
||||
|
||||
private void handleMultiInstanceApprovalType(String executionId, String approvalType, JSONObject taskVariableData) {
|
||||
if (StrUtil.isBlank(approvalType)) {
|
||||
return;
|
||||
@@ -597,13 +717,20 @@ public class FlowApiServiceImpl implements FlowApiService {
|
||||
|
||||
private void buildCandidateCondition(TaskQuery query, String loginName) {
|
||||
Set<String> groupIdSet = new HashSet<>();
|
||||
// NOTE: 目前已经支持部门和岗位,如果今后需要支持角色,可将角色Id也加到groupIdSet中即可。
|
||||
// 需要注意的是,部门Id、部门岗位Id,或者其他类型的分组Id,他们之间一定不能重复。
|
||||
// NOTE: 需要注意的是,部门Id、部门岗位Id,或者其他类型的分组Id,他们之间一定不能重复。
|
||||
TokenData tokenData = TokenData.takeFromRequest();
|
||||
Object deptId = tokenData.getDeptId();
|
||||
if (deptId != null) {
|
||||
groupIdSet.add(deptId.toString());
|
||||
}
|
||||
String roleIds = tokenData.getRoleIds();
|
||||
if (StrUtil.isNotBlank(tokenData.getRoleIds())) {
|
||||
groupIdSet.addAll(Arrays.asList(StrUtil.split(roleIds, ",")));
|
||||
}
|
||||
String postIds = tokenData.getPostIds();
|
||||
if (StrUtil.isNotBlank(tokenData.getPostIds())) {
|
||||
groupIdSet.addAll(Arrays.asList(StrUtil.split(postIds, ",")));
|
||||
}
|
||||
String deptPostIds = tokenData.getDeptPostIds();
|
||||
if (StrUtil.isNotBlank(deptPostIds)) {
|
||||
groupIdSet.addAll(Arrays.asList(StrUtil.split(deptPostIds, ",")));
|
||||
@@ -615,4 +742,50 @@ public class FlowApiServiceImpl implements FlowApiService {
|
||||
query.taskCandidateOrAssigned(loginName);
|
||||
}
|
||||
}
|
||||
|
||||
private String buildMutiSignAssigneeList(String operationListJson) {
|
||||
FlowTaskMultiSignAssign multiSignAssignee = null;
|
||||
List<FlowTaskOperation> taskOperationList = JSONArray.parseArray(operationListJson, FlowTaskOperation.class);
|
||||
for (FlowTaskOperation taskOperation : taskOperationList) {
|
||||
if ("multi_sign".equals(taskOperation.getType())) {
|
||||
multiSignAssignee = taskOperation.getMultiSignAssignee();
|
||||
break;
|
||||
}
|
||||
}
|
||||
Assert.notNull(multiSignAssignee);
|
||||
if (FlowTaskMultiSignAssign.ASSIGN_TYPE_USER.equals(multiSignAssignee.getAssigneeType())) {
|
||||
return multiSignAssignee.getAssigneeList();
|
||||
}
|
||||
Set<String> usernameSet = null;
|
||||
BaseFlowIdentityExtHelper extHelper = flowCustomExtFactory.getFlowIdentityExtHelper();
|
||||
Set<String> idSet = CollUtil.newHashSet(StrUtil.split(multiSignAssignee.getAssigneeList(), ","));
|
||||
switch (multiSignAssignee.getAssigneeType()) {
|
||||
case FlowTaskMultiSignAssign.ASSIGN_TYPE_ROLE:
|
||||
usernameSet = extHelper.getUsernameListByRoleIds(idSet);
|
||||
break;
|
||||
case FlowTaskMultiSignAssign.ASSIGN_TYPE_DEPT:
|
||||
usernameSet = extHelper.getUsernameListByDeptIds(idSet);
|
||||
break;
|
||||
case FlowTaskMultiSignAssign.ASSIGN_TYPE_POST:
|
||||
usernameSet = extHelper.getUsernameListByPostIds(idSet);
|
||||
break;
|
||||
case FlowTaskMultiSignAssign.ASSIGN_TYPE_DEPT_POST:
|
||||
usernameSet = extHelper.getUsernameListByDeptPostIds(idSet);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return CollUtil.isEmpty(usernameSet) ? null : CollUtil.join(usernameSet, ",");
|
||||
}
|
||||
|
||||
private Collection<FlowElement> getAllElements(Collection<FlowElement> flowElements, Collection<FlowElement> allElements) {
|
||||
allElements = allElements == null ? new ArrayList<>() : allElements;
|
||||
for (FlowElement flowElement : flowElements) {
|
||||
allElements.add(flowElement);
|
||||
if (flowElement instanceof SubProcess) {
|
||||
allElements = getAllElements(((SubProcess) flowElement).getFlowElements(), allElements);
|
||||
}
|
||||
}
|
||||
return allElements;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.flow.demo.common.flow.service.impl;
|
||||
package com.orangeforms.common.flow.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.flow.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.flow.demo.common.core.base.service.BaseService;
|
||||
import com.flow.demo.common.core.object.MyRelationParam;
|
||||
import com.flow.demo.common.core.object.TokenData;
|
||||
import com.flow.demo.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.flow.demo.common.flow.dao.*;
|
||||
import com.flow.demo.common.flow.model.*;
|
||||
import com.flow.demo.common.flow.service.*;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.core.base.service.BaseService;
|
||||
import com.orangeforms.common.core.object.MyRelationParam;
|
||||
import com.orangeforms.common.core.object.TokenData;
|
||||
import com.orangeforms.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.orangeforms.common.flow.dao.*;
|
||||
import com.orangeforms.common.flow.model.*;
|
||||
import com.orangeforms.common.flow.service.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -1,26 +1,28 @@
|
||||
package com.flow.demo.common.flow.service.impl;
|
||||
package com.orangeforms.common.flow.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.flow.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.flow.demo.common.core.base.service.BaseService;
|
||||
import com.flow.demo.common.core.object.CallResult;
|
||||
import com.flow.demo.common.core.object.MyRelationParam;
|
||||
import com.flow.demo.common.core.object.TokenData;
|
||||
import com.flow.demo.common.core.util.MyModelUtil;
|
||||
import com.flow.demo.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.flow.demo.common.flow.util.BaseFlowDeptPostExtHelper;
|
||||
import com.flow.demo.common.flow.util.FlowCustomExtFactory;
|
||||
import com.flow.demo.common.flow.constant.FlowConstant;
|
||||
import com.flow.demo.common.flow.dao.*;
|
||||
import com.flow.demo.common.flow.model.*;
|
||||
import com.flow.demo.common.flow.service.*;
|
||||
import com.flow.demo.common.flow.model.constant.FlowEntryStatus;
|
||||
import com.flow.demo.common.flow.model.constant.FlowVariableType;
|
||||
import com.flow.demo.common.flow.listener.UpdateFlowStatusListener;
|
||||
import com.orangeforms.common.flow.object.FlowTaskPostCandidateGroup;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.core.base.service.BaseService;
|
||||
import com.orangeforms.common.core.object.CallResult;
|
||||
import com.orangeforms.common.core.object.MyRelationParam;
|
||||
import com.orangeforms.common.core.object.TokenData;
|
||||
import com.orangeforms.common.core.util.MyModelUtil;
|
||||
import com.orangeforms.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.orangeforms.common.flow.util.BaseFlowIdentityExtHelper;
|
||||
import com.orangeforms.common.flow.util.FlowCustomExtFactory;
|
||||
import com.orangeforms.common.flow.constant.FlowConstant;
|
||||
import com.orangeforms.common.flow.dao.*;
|
||||
import com.orangeforms.common.flow.model.*;
|
||||
import com.orangeforms.common.flow.service.*;
|
||||
import com.orangeforms.common.flow.model.constant.FlowEntryStatus;
|
||||
import com.orangeforms.common.flow.model.constant.FlowVariableType;
|
||||
import com.orangeforms.common.flow.listener.FlowFinishedListener;
|
||||
import lombok.Cleanup;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.bpmn.converter.BpmnXMLConverter;
|
||||
@@ -122,26 +124,33 @@ public class FlowEntryServiceImpl extends BaseService<FlowEntry, Long> implement
|
||||
@Cleanup XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(xmlStream);
|
||||
BpmnXMLConverter converter = new BpmnXMLConverter();
|
||||
BpmnModel bpmnModel = converter.convertToBpmnModel(reader);
|
||||
flowApiService.addProcessInstanceEndListener(bpmnModel, UpdateFlowStatusListener.class);
|
||||
flowApiService.addProcessInstanceEndListener(bpmnModel, FlowFinishedListener.class);
|
||||
Collection<FlowElement> elementList = bpmnModel.getMainProcess().getFlowElements();
|
||||
Map<String, FlowElement> elementMap =
|
||||
elementList.stream().filter(e -> e instanceof UserTask).collect(Collectors.toMap(FlowElement::getId, c -> c));
|
||||
if (CollUtil.isNotEmpty(flowTaskExtList)) {
|
||||
BaseFlowDeptPostExtHelper flowDeptPostExtHelper = flowCustomExtFactory.getFlowDeptPostExtHelper();
|
||||
BaseFlowIdentityExtHelper flowIdentityExtHelper = flowCustomExtFactory.getFlowIdentityExtHelper();
|
||||
for (FlowTaskExt t : flowTaskExtList) {
|
||||
UserTask userTask = (UserTask) elementMap.get(t.getTaskId());
|
||||
// 如果流程图中包含部门领导审批和上级部门领导审批的选项,就需要注册 FlowCustomExtFactory 工厂中的
|
||||
// BaseFlowDeptPostExtHelper 对象,该注册操作需要业务模块中实现。
|
||||
// BaseFlowIdentityExtHelper 对象,该注册操作需要业务模块中实现。
|
||||
if (StrUtil.equals(t.getGroupType(), FlowConstant.GROUP_TYPE_UP_DEPT_POST_LEADER)) {
|
||||
userTask.setCandidateGroups(
|
||||
CollUtil.newArrayList("${" + FlowConstant.GROUP_TYPE_UP_DEPT_POST_LEADER_VAR + "}"));
|
||||
Assert.notNull(flowDeptPostExtHelper);
|
||||
flowApiService.addTaskCreateListener(userTask, flowDeptPostExtHelper.getUpDeptPostLeaderListener());
|
||||
Assert.notNull(flowIdentityExtHelper);
|
||||
flowApiService.addTaskCreateListener(userTask, flowIdentityExtHelper.getUpDeptPostLeaderListener());
|
||||
} else if (StrUtil.equals(t.getGroupType(), FlowConstant.GROUP_TYPE_DEPT_POST_LEADER)) {
|
||||
userTask.setCandidateGroups(
|
||||
CollUtil.newArrayList("${" + FlowConstant.GROUP_TYPE_DEPT_POST_LEADER_VAR + "}"));
|
||||
Assert.notNull(flowDeptPostExtHelper);
|
||||
flowApiService.addTaskCreateListener(userTask, flowDeptPostExtHelper.getDeptPostLeaderListener());
|
||||
Assert.notNull(flowIdentityExtHelper);
|
||||
flowApiService.addTaskCreateListener(userTask, flowIdentityExtHelper.getDeptPostLeaderListener());
|
||||
} else if (StrUtil.equals(t.getGroupType(), FlowConstant.GROUP_TYPE_POST)) {
|
||||
Assert.notNull(t.getDeptPostListJson());
|
||||
List<FlowTaskPostCandidateGroup> groupDataList =
|
||||
JSONArray.parseArray(t.getDeptPostListJson(), FlowTaskPostCandidateGroup.class);
|
||||
List<String> candidateGroupList =
|
||||
FlowTaskPostCandidateGroup.buildCandidateGroupList(groupDataList);
|
||||
userTask.setCandidateGroups(candidateGroupList);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.flow.demo.common.flow.service.impl;
|
||||
package com.orangeforms.common.flow.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.flow.demo.common.flow.service.*;
|
||||
import com.flow.demo.common.flow.dao.*;
|
||||
import com.flow.demo.common.flow.model.*;
|
||||
import com.flow.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.flow.demo.common.core.object.MyRelationParam;
|
||||
import com.flow.demo.common.core.base.service.BaseService;
|
||||
import com.flow.demo.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.orangeforms.common.flow.service.*;
|
||||
import com.orangeforms.common.flow.dao.*;
|
||||
import com.orangeforms.common.flow.model.*;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.core.object.MyRelationParam;
|
||||
import com.orangeforms.common.core.base.service.BaseService;
|
||||
import com.orangeforms.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.github.pagehelper.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -0,0 +1,247 @@
|
||||
package com.orangeforms.common.flow.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.core.base.service.BaseService;
|
||||
import com.orangeforms.common.core.object.TokenData;
|
||||
import com.orangeforms.common.flow.constant.FlowConstant;
|
||||
import com.orangeforms.common.flow.model.constant.FlowMessageType;
|
||||
import com.orangeforms.common.flow.dao.FlowMessageCandidateIdentityMapper;
|
||||
import com.orangeforms.common.flow.dao.FlowMessageMapper;
|
||||
import com.orangeforms.common.flow.model.FlowMessage;
|
||||
import com.orangeforms.common.flow.model.FlowMessageCandidateIdentity;
|
||||
import com.orangeforms.common.flow.model.FlowTaskExt;
|
||||
import com.orangeforms.common.flow.model.FlowWorkOrder;
|
||||
import com.orangeforms.common.flow.object.FlowTaskPostCandidateGroup;
|
||||
import com.orangeforms.common.flow.service.FlowApiService;
|
||||
import com.orangeforms.common.flow.service.FlowMessageService;
|
||||
import com.orangeforms.common.flow.service.FlowTaskExtService;
|
||||
import com.orangeforms.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 工作流消息数据操作服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("flowMessageService")
|
||||
public class FlowMessageServiceImpl extends BaseService<FlowMessage, Long> implements FlowMessageService {
|
||||
|
||||
@Autowired
|
||||
private FlowMessageMapper flowMessageMapper;
|
||||
@Autowired
|
||||
private FlowMessageCandidateIdentityMapper flowMessageCandidateIdentityMapper;
|
||||
@Autowired
|
||||
private FlowTaskExtService flowTaskExtService;
|
||||
@Autowired
|
||||
private FlowApiService flowApiService;
|
||||
@Autowired
|
||||
private IdGeneratorWrapper idGenerator;
|
||||
|
||||
/**
|
||||
* 返回当前Service的主表Mapper对象。
|
||||
*
|
||||
* @return 主表Mapper对象。
|
||||
*/
|
||||
@Override
|
||||
protected BaseDaoMapper<FlowMessage> mapper() {
|
||||
return flowMessageMapper;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public FlowMessage saveNew(FlowMessage flowMessage) {
|
||||
flowMessage.setMessageId(idGenerator.nextLongId());
|
||||
TokenData tokenData = TokenData.takeFromRequest();
|
||||
flowMessage.setCreateUserId(tokenData.getUserId());
|
||||
flowMessage.setCreateUsername(tokenData.getShowName());
|
||||
flowMessage.setCreateTime(new Date());
|
||||
flowMessage.setUpdateUserId(tokenData.getUserId());
|
||||
flowMessage.setUpdateTime(flowMessage.getCreateTime());
|
||||
flowMessageMapper.insert(flowMessage);
|
||||
return flowMessage;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void saveNewRemindMessage(FlowWorkOrder flowWorkOrder) {
|
||||
List<Task> taskList =
|
||||
flowApiService.getProcessInstanceActiveTaskList(flowWorkOrder.getProcessInstanceId());
|
||||
for (Task task : taskList) {
|
||||
FlowMessage filter = new FlowMessage();
|
||||
filter.setTaskId(task.getId());
|
||||
List<FlowMessage> messageList = flowMessageMapper.selectList(new QueryWrapper<>(filter));
|
||||
// 同一个任务只能催办一次,多次催办则累加催办次数。
|
||||
if (CollUtil.isNotEmpty(messageList)) {
|
||||
for (FlowMessage flowMessage : messageList) {
|
||||
flowMessage.setRemindCount(flowMessage.getRemindCount() + 1);
|
||||
flowMessageMapper.updateById(flowMessage);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
FlowMessage flowMessage = new FlowMessage();
|
||||
flowMessage.setMessageType(FlowMessageType.REMIND_TYPE);
|
||||
flowMessage.setRemindCount(1);
|
||||
flowMessage.setWorkOrderId(flowWorkOrder.getWorkOrderId());
|
||||
flowMessage.setProcessDefinitionId(flowWorkOrder.getProcessDefinitionId());
|
||||
flowMessage.setProcessDefinitionKey(flowWorkOrder.getProcessDefinitionKey());
|
||||
flowMessage.setProcessDefinitionName(flowWorkOrder.getProcessDefinitionName());
|
||||
flowMessage.setProcessInstanceId(flowWorkOrder.getProcessInstanceId());
|
||||
flowMessage.setProcessInstanceInitiator(flowWorkOrder.getSubmitUsername());
|
||||
flowMessage.setTaskId(task.getId());
|
||||
flowMessage.setTaskDefinitionKey(task.getTaskDefinitionKey());
|
||||
flowMessage.setTaskName(task.getName());
|
||||
flowMessage.setTaskStartTime(task.getCreateTime());
|
||||
flowMessage.setTaskAssignee(task.getAssignee());
|
||||
flowMessage.setTaskFinished(false);
|
||||
this.saveNew(flowMessage);
|
||||
FlowTaskExt flowTaskExt = flowTaskExtService.getByProcessDefinitionIdAndTaskId(
|
||||
flowWorkOrder.getProcessDefinitionId(), task.getTaskDefinitionKey());
|
||||
if (flowTaskExt != null) {
|
||||
this.saveMessageCandidateIdentityWithMessage(
|
||||
flowWorkOrder.getProcessInstanceId(), flowTaskExt, flowMessage.getMessageId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateFinishedStatusByTaskId(String taskId) {
|
||||
FlowMessage flowMessage = new FlowMessage();
|
||||
flowMessage.setTaskFinished(true);
|
||||
LambdaQueryWrapper<FlowMessage> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(FlowMessage::getTaskId, taskId);
|
||||
flowMessageMapper.update(flowMessage, queryWrapper);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateFinishedStatusByProcessInstanceId(String processInstanceId) {
|
||||
FlowMessage flowMessage = new FlowMessage();
|
||||
flowMessage.setTaskFinished(true);
|
||||
LambdaQueryWrapper<FlowMessage> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(FlowMessage::getProcessInstanceId, processInstanceId);
|
||||
flowMessageMapper.update(flowMessage, queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowMessage> getRemindingMessageListByUser() {
|
||||
TokenData tokenData = TokenData.takeFromRequest();
|
||||
Set<String> groupIdSet = new HashSet<>(1);
|
||||
groupIdSet.add(tokenData.getLoginName());
|
||||
this.parseAndAddIdArray(groupIdSet, tokenData.getRoleIds());
|
||||
this.parseAndAddIdArray(groupIdSet, tokenData.getDeptPostIds());
|
||||
this.parseAndAddIdArray(groupIdSet, tokenData.getPostIds());
|
||||
if (tokenData.getDeptId() != null) {
|
||||
groupIdSet.add(tokenData.getDeptId().toString());
|
||||
}
|
||||
return flowMessageMapper.getRemindingMessageListByUser(tokenData.getLoginName(), groupIdSet);
|
||||
}
|
||||
|
||||
private void parseAndAddIdArray(Set<String> groupIdSet, String idArray) {
|
||||
if (StrUtil.isNotBlank(idArray)) {
|
||||
if (groupIdSet == null) {
|
||||
groupIdSet = new HashSet<>();
|
||||
}
|
||||
groupIdSet.addAll(StrUtil.split(idArray, ','));
|
||||
}
|
||||
}
|
||||
|
||||
private void saveMessageCandidateIdentityWithMessage(
|
||||
String processInstanceId, FlowTaskExt flowTaskExt, Long messageId) {
|
||||
this.saveMessageCandidateIdentityList(
|
||||
messageId, "username", flowTaskExt.getCandidateUsernames());
|
||||
this.saveMessageCandidateIdentityList(
|
||||
messageId, "role", flowTaskExt.getRoleIds());
|
||||
this.saveMessageCandidateIdentityList(
|
||||
messageId, "dept", flowTaskExt.getDeptIds());
|
||||
if (StrUtil.equals(flowTaskExt.getGroupType(), FlowConstant.GROUP_TYPE_UP_DEPT_POST_LEADER)) {
|
||||
Object v = flowApiService.getProcessInstanceVariable(
|
||||
processInstanceId, FlowConstant.GROUP_TYPE_UP_DEPT_POST_LEADER_VAR);
|
||||
if (v != null) {
|
||||
this.saveMessageCandidateIdentity(
|
||||
messageId, FlowConstant.GROUP_TYPE_UP_DEPT_POST_LEADER_VAR, v.toString());
|
||||
}
|
||||
} else if (StrUtil.equals(flowTaskExt.getGroupType(), FlowConstant.GROUP_TYPE_DEPT_POST_LEADER)) {
|
||||
Object v = flowApiService.getProcessInstanceVariable(
|
||||
processInstanceId, FlowConstant.GROUP_TYPE_DEPT_POST_LEADER_VAR);
|
||||
if (v != null) {
|
||||
this.saveMessageCandidateIdentity(
|
||||
messageId, FlowConstant.GROUP_TYPE_DEPT_POST_LEADER_VAR, v.toString());
|
||||
}
|
||||
} else if (StrUtil.equals(flowTaskExt.getGroupType(), FlowConstant.GROUP_TYPE_POST)) {
|
||||
Assert.notBlank(flowTaskExt.getDeptPostListJson());
|
||||
List<FlowTaskPostCandidateGroup> groupDataList =
|
||||
JSONArray.parseArray(flowTaskExt.getDeptPostListJson(), FlowTaskPostCandidateGroup.class);
|
||||
for (FlowTaskPostCandidateGroup groupData : groupDataList) {
|
||||
FlowMessageCandidateIdentity candidateIdentity = new FlowMessageCandidateIdentity();
|
||||
candidateIdentity.setId(idGenerator.nextLongId());
|
||||
candidateIdentity.setMessageId(messageId);
|
||||
candidateIdentity.setCandidateType(groupData.getType());
|
||||
switch (groupData.getType()) {
|
||||
case FlowConstant.GROUP_TYPE_ALL_DEPT_POST_VAR:
|
||||
candidateIdentity.setCandidateId(groupData.getPostId());
|
||||
flowMessageCandidateIdentityMapper.insert(candidateIdentity);
|
||||
break;
|
||||
case FlowConstant.GROUP_TYPE_DEPT_POST_VAR:
|
||||
candidateIdentity.setCandidateId(groupData.getDeptPostId());
|
||||
flowMessageCandidateIdentityMapper.insert(candidateIdentity);
|
||||
break;
|
||||
case FlowConstant.GROUP_TYPE_SELF_DEPT_POST_VAR:
|
||||
Object v = flowApiService.getProcessInstanceVariable(
|
||||
processInstanceId, FlowConstant.SELF_DEPT_POST_PREFIX + groupData.getPostId());
|
||||
if (v != null) {
|
||||
candidateIdentity.setCandidateId(v.toString());
|
||||
flowMessageCandidateIdentityMapper.insert(candidateIdentity);
|
||||
}
|
||||
break;
|
||||
case FlowConstant.GROUP_TYPE_UP_DEPT_POST_VAR:
|
||||
Object v2 = flowApiService.getProcessInstanceVariable(
|
||||
processInstanceId, FlowConstant.UP_DEPT_POST_PREFIX + groupData.getPostId());
|
||||
if (v2 != null) {
|
||||
candidateIdentity.setCandidateId(v2.toString());
|
||||
flowMessageCandidateIdentityMapper.insert(candidateIdentity);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void saveMessageCandidateIdentity(Long messageId, String candidateType, String candidateId) {
|
||||
FlowMessageCandidateIdentity candidateIdentity = new FlowMessageCandidateIdentity();
|
||||
candidateIdentity.setId(idGenerator.nextLongId());
|
||||
candidateIdentity.setMessageId(messageId);
|
||||
candidateIdentity.setCandidateType(FlowConstant.GROUP_TYPE_UP_DEPT_POST_LEADER_VAR);
|
||||
candidateIdentity.setCandidateId(candidateId);
|
||||
flowMessageCandidateIdentityMapper.insert(candidateIdentity);
|
||||
}
|
||||
|
||||
private void saveMessageCandidateIdentityList(Long messageId, String candidateType, String identityIds) {
|
||||
if (StrUtil.isNotBlank(identityIds)) {
|
||||
for (String identityId : StrUtil.split(identityIds, ',')) {
|
||||
FlowMessageCandidateIdentity candidateIdentity = new FlowMessageCandidateIdentity();
|
||||
candidateIdentity.setId(idGenerator.nextLongId());
|
||||
candidateIdentity.setMessageId(messageId);
|
||||
candidateIdentity.setCandidateType(candidateType);
|
||||
candidateIdentity.setCandidateId(identityId);
|
||||
flowMessageCandidateIdentityMapper.insert(candidateIdentity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,16 @@
|
||||
package com.flow.demo.common.flow.service.impl;
|
||||
package com.orangeforms.common.flow.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.flow.demo.common.flow.service.*;
|
||||
import com.flow.demo.common.flow.dao.*;
|
||||
import com.flow.demo.common.flow.model.*;
|
||||
import com.flow.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.flow.demo.common.core.object.TokenData;
|
||||
import com.flow.demo.common.core.base.service.BaseService;
|
||||
import com.flow.demo.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.orangeforms.common.flow.service.*;
|
||||
import com.orangeforms.common.flow.dao.*;
|
||||
import com.orangeforms.common.flow.model.*;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.core.object.TokenData;
|
||||
import com.orangeforms.common.core.base.service.BaseService;
|
||||
import com.orangeforms.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -71,4 +74,21 @@ public class FlowTaskCommentServiceImpl extends BaseService<FlowTaskComment, Lon
|
||||
queryWrapper.orderByAsc(FlowTaskComment::getId);
|
||||
return flowTaskCommentMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskComment> getFlowTaskCommentListByTaskIds(Set<String> taskIdSet) {
|
||||
LambdaQueryWrapper<FlowTaskComment> queryWrapper =
|
||||
new LambdaQueryWrapper<FlowTaskComment>().in(FlowTaskComment::getTaskId, taskIdSet);
|
||||
queryWrapper.orderByDesc(FlowTaskComment::getId);
|
||||
return flowTaskCommentMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowTaskComment getLatestFlowTaskComment(String processInstanceId) {
|
||||
LambdaQueryWrapper<FlowTaskComment> queryWrapper =
|
||||
new LambdaQueryWrapper<FlowTaskComment>().eq(FlowTaskComment::getProcessInstanceId, processInstanceId);
|
||||
queryWrapper.orderByDesc(FlowTaskComment::getId);
|
||||
IPage<FlowTaskComment> pageData = flowTaskCommentMapper.selectPage(new Page<>(1, 1), queryWrapper);
|
||||
return CollUtil.isEmpty(pageData.getRecords()) ? null : pageData.getRecords().get(0);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.flow.demo.common.flow.service.impl;
|
||||
package com.orangeforms.common.flow.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.flow.demo.common.flow.service.*;
|
||||
import com.flow.demo.common.flow.dao.*;
|
||||
import com.flow.demo.common.flow.model.*;
|
||||
import com.flow.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.flow.demo.common.core.base.service.BaseService;
|
||||
import com.orangeforms.common.flow.service.*;
|
||||
import com.orangeforms.common.flow.dao.*;
|
||||
import com.orangeforms.common.flow.model.*;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.core.base.service.BaseService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -1,17 +1,17 @@
|
||||
package com.flow.demo.common.flow.service.impl;
|
||||
package com.orangeforms.common.flow.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.flow.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.flow.demo.common.core.constant.GlobalDeletedFlag;
|
||||
import com.flow.demo.common.core.object.MyRelationParam;
|
||||
import com.flow.demo.common.core.object.TokenData;
|
||||
import com.flow.demo.common.core.base.service.BaseService;
|
||||
import com.flow.demo.common.flow.constant.FlowTaskStatus;
|
||||
import com.flow.demo.common.flow.dao.FlowWorkOrderMapper;
|
||||
import com.flow.demo.common.flow.model.FlowWorkOrder;
|
||||
import com.flow.demo.common.flow.service.FlowWorkOrderService;
|
||||
import com.flow.demo.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.core.constant.GlobalDeletedFlag;
|
||||
import com.orangeforms.common.core.object.MyRelationParam;
|
||||
import com.orangeforms.common.core.object.TokenData;
|
||||
import com.orangeforms.common.core.base.service.BaseService;
|
||||
import com.orangeforms.common.flow.constant.FlowTaskStatus;
|
||||
import com.orangeforms.common.flow.dao.FlowWorkOrderMapper;
|
||||
import com.orangeforms.common.flow.model.FlowWorkOrder;
|
||||
import com.orangeforms.common.flow.service.FlowWorkOrderService;
|
||||
import com.orangeforms.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -51,11 +51,12 @@ public class FlowWorkOrderServiceImpl extends BaseService<FlowWorkOrder, Long> i
|
||||
* @param instance 流程实例对象。
|
||||
* @param dataId 流程实例的BusinessKey。
|
||||
* @param onlineTableId 在线数据表的主键Id。
|
||||
* @param tableName 面向静态表单所使用的表名。
|
||||
* @return 新增的工作流工单对象。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public FlowWorkOrder saveNew(ProcessInstance instance, Object dataId, Long onlineTableId) {
|
||||
public FlowWorkOrder saveNew(ProcessInstance instance, Object dataId, Long onlineTableId, String tableName) {
|
||||
TokenData tokenData = TokenData.takeFromRequest();
|
||||
Date now = new Date();
|
||||
FlowWorkOrder flowWorkOrder = new FlowWorkOrder();
|
||||
@@ -66,6 +67,7 @@ public class FlowWorkOrderServiceImpl extends BaseService<FlowWorkOrder, Long> i
|
||||
flowWorkOrder.setProcessInstanceId(instance.getId());
|
||||
flowWorkOrder.setBusinessKey(dataId.toString());
|
||||
flowWorkOrder.setOnlineTableId(onlineTableId);
|
||||
flowWorkOrder.setTableName(tableName);
|
||||
flowWorkOrder.setFlowStatus(FlowTaskStatus.SUBMITTED);
|
||||
flowWorkOrder.setSubmitUsername(tokenData.getLoginName());
|
||||
flowWorkOrder.setDeptId(tokenData.getDeptId());
|
||||
@@ -118,9 +120,10 @@ public class FlowWorkOrderServiceImpl extends BaseService<FlowWorkOrder, Long> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean existByBusinessKey(Object businessKey, boolean unfinished) {
|
||||
public boolean existByBusinessKey(String tableName, Object businessKey, boolean unfinished) {
|
||||
LambdaQueryWrapper<FlowWorkOrder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(FlowWorkOrder::getBusinessKey, businessKey.toString());
|
||||
queryWrapper.eq(FlowWorkOrder::getTableName, tableName);
|
||||
if (unfinished) {
|
||||
queryWrapper.notIn(FlowWorkOrder::getFlowStatus,
|
||||
FlowTaskStatus.FINISHED, FlowTaskStatus.CANCELLED, FlowTaskStatus.STOPPED);
|
||||
@@ -128,20 +131,6 @@ public class FlowWorkOrderServiceImpl extends BaseService<FlowWorkOrder, Long> i
|
||||
return flowWorkOrderMapper.selectCount(queryWrapper) > 0;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateFlowStatusByBusinessKey(String businessKey, int flowStatus) {
|
||||
FlowWorkOrder flowWorkOrder = new FlowWorkOrder();
|
||||
flowWorkOrder.setFlowStatus(flowStatus);
|
||||
if (FlowTaskStatus.FINISHED != flowStatus) {
|
||||
flowWorkOrder.setUpdateTime(new Date());
|
||||
flowWorkOrder.setUpdateUserId(TokenData.takeFromRequest().getUserId());
|
||||
}
|
||||
LambdaQueryWrapper<FlowWorkOrder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(FlowWorkOrder::getBusinessKey, businessKey);
|
||||
flowWorkOrderMapper.update(flowWorkOrder, queryWrapper);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateFlowStatusByProcessInstanceId(String processInstanceId, int flowStatus) {
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.orangeforms.common.flow.util;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.orangeforms.common.flow.base.service.BaseFlowService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 工作流实例执行结束之后,需要需要做业务表的数据同步,可实现该接口。
|
||||
* 该插件通常用于一张表单多次提交的场景。为了避免修改后的审批中数据,由于尚未通过审批,而此时依赖该业务作为关联表时,
|
||||
* 关联到的数据往往是尚未通过审批的脏数据,因此需要做审批表和发布表的数据隔离。仅当审批流程完全结束且通过审批后,在
|
||||
* 将审批表及其一对一、一对多、多对多关联表中的数据,同步到发布表及其关联表中。至于具体需要同步那些表数据,需按需求而定。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
@Slf4j
|
||||
public class BaseDataSyncExtHelper {
|
||||
|
||||
private Map<String, BaseFlowService> serviceMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 子类要基于自身所处理的流程定义标识,把子类的this对象,注册到父类的map中。
|
||||
*
|
||||
* @param processDefinitionKey 流程定义标识。
|
||||
* @param service 流程服务实现基类。
|
||||
*/
|
||||
public synchronized void doRegister(String processDefinitionKey, BaseFlowService service) {
|
||||
Assert.isTrue(StrUtil.isNotBlank(processDefinitionKey));
|
||||
Assert.notNull(service);
|
||||
serviceMap.put(processDefinitionKey, service);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 流程结束监听器(FlowFinishedListener) 会在流程结束时调用该方法。
|
||||
*
|
||||
* @param processDefinitionKey 流程定义标识。
|
||||
* @param processInstanceId 流程实例Id。
|
||||
* @param businessKey 业务主表的主键Id。
|
||||
*/
|
||||
public void triggerSync(String processDefinitionKey, String processInstanceId, String businessKey) {
|
||||
BaseFlowService service = serviceMap.get(processDefinitionKey);
|
||||
if (service != null) {
|
||||
try {
|
||||
service.doSyncBusinessData(processInstanceId, businessKey);
|
||||
} catch (Exception e) {
|
||||
String errorMessage = String.format(
|
||||
"Failed to call doSyncBusinessData with processDefinitionKey {%s}, businessKey {%s}",
|
||||
processDefinitionKey, businessKey);
|
||||
log.error(errorMessage, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
package com.orangeforms.common.flow.util;
|
||||
|
||||
import com.orangeforms.common.flow.listener.DeptPostLeaderListener;
|
||||
import com.orangeforms.common.flow.listener.UpDeptPostLeaderListener;
|
||||
import org.activiti.engine.delegate.TaskListener;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 工作流与用户身份相关的自定义扩展接口,需要业务模块自行实现该接口。也可以根据实际需求扩展该接口的方法。
|
||||
* 目前支持的主键类型为字符型和长整型,所以这里提供了两套实现接口。可根据实际情况实现其中一套即可。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
public interface BaseFlowIdentityExtHelper {
|
||||
|
||||
/**
|
||||
* 根据(字符型)部门Id,获取当前用户部门领导所有的部门岗位Id。
|
||||
*
|
||||
* @param deptId 用户所在部门Id。
|
||||
* @return 当前用户部门领导所有的部门岗位Id。
|
||||
*/
|
||||
default String getLeaderDeptPostId(String deptId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据(字符型)部门Id,获取当前用户上级部门领导所有的部门岗位Id。
|
||||
*
|
||||
* @param deptId 用户所在部门Id。
|
||||
* @return 当前用户上级部门领导所有的部门岗位Id。
|
||||
*/
|
||||
default String getUpLeaderDeptPostId(String deptId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取(字符型)指定部门上级部门的指定岗位集合的DeptPostId集合。
|
||||
*
|
||||
* @param deptId 指定的部门Id。
|
||||
* @param postIdSet 指定的岗位Id集合。
|
||||
* @return 与该部门Id上级部门关联的岗位Id集合,key对应参数中的postId,value是与key对应的deptPostId。
|
||||
*/
|
||||
default Map<String, String> getUpDeptPostIdMap(String deptId, Set<String> postIdSet) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取(字符型)指定部门的指定岗位集合的DeptPostId集合。
|
||||
*
|
||||
* @param deptId 指定的部门Id。
|
||||
* @param postIdSet 指定的岗位Id集合。
|
||||
* @return 与部门关联的岗位Id集合,key对应参数中的postId,value是与key对应的deptPostId。
|
||||
*/
|
||||
default Map<String, String> getDeptPostIdMap(String deptId, Set<String> postIdSet) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据(长整型)部门Id,获取当前用户部门领导所有的部门岗位Id。
|
||||
*
|
||||
* @param deptId 用户所在部门Id。
|
||||
* @return 当前用户部门领导所有的部门岗位Id。
|
||||
*/
|
||||
default Long getLeaderDeptPostId(Long deptId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据(长整型)部门Id,获取当前用户上级部门领导所有的部门岗位Id。
|
||||
*
|
||||
* @param deptId 用户所在部门Id。
|
||||
* @return 当前用户上级部门领导所有的部门岗位Id。
|
||||
*/
|
||||
default Long getUpLeaderDeptPostId(Long deptId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取(长整型)指定部门的指定岗位集合的DeptPostId集合。
|
||||
*
|
||||
* @param deptId 指定的部门Id。
|
||||
* @param postIdSet 指定的岗位Id集合。
|
||||
* @return 与部门关联的岗位Id集合,key对应参数中的postId,value是与key对应的deptPostId。
|
||||
*/
|
||||
default Map<String, String> getDeptPostIdMap(Long deptId, Set<String> postIdSet) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取(长整型)指定部门上级部门的指定岗位集合的DeptPostId集合。
|
||||
*
|
||||
* @param deptId 指定的部门Id。
|
||||
* @param postIdSet 指定的岗位Id集合。
|
||||
* @return 与该部门Id上级部门关联的岗位Id集合,key对应参数中的postId,value是与key对应的deptPostId。
|
||||
*/
|
||||
default Map<String, String> getUpDeptPostIdMap(Long deptId, Set<String> postIdSet) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色Id集合,查询所属的用户名列表。
|
||||
*
|
||||
* @param roleIdSet 角色Id集合。
|
||||
* @return 所属的用户列表。
|
||||
*/
|
||||
default Set<String> getUsernameListByRoleIds(Set<String> roleIdSet) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门Id集合,查询所属的用户名列表。
|
||||
*
|
||||
* @param deptIdSet 部门Id集合。
|
||||
* @return 所属的用户列表。
|
||||
*/
|
||||
default Set<String> getUsernameListByDeptIds(Set<String> deptIdSet) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据岗位Id集合,查询所属的用户名列表。
|
||||
*
|
||||
* @param postIdSet 岗位Id集合。
|
||||
* @return 所属的用户列表。
|
||||
*/
|
||||
default Set<String> getUsernameListByPostIds(Set<String> postIdSet) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门岗位Id集合,查询所属的用户名列表。
|
||||
*
|
||||
* @param deptPostIdSet 部门岗位Id集合。
|
||||
* @return 所属的用户列表。
|
||||
*/
|
||||
default Set<String> getUsernameListByDeptPostIds(Set<String> deptPostIdSet) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取任务执行人是当前部门领导岗位的任务监听器。
|
||||
* 通常会在没有找到领导部门岗位Id的时候,为当前任务指定其他的指派人、候选人或候选组。
|
||||
*
|
||||
* @return 任务监听器。
|
||||
*/
|
||||
default Class<? extends TaskListener> getDeptPostLeaderListener() {
|
||||
return DeptPostLeaderListener.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取任务执行人是上级部门领导岗位的任务监听器。
|
||||
* 通常会在没有找到领导部门岗位Id的时候,为当前任务指定其他的指派人、候选人或候选组。
|
||||
*
|
||||
* @return 任务监听器。
|
||||
*/
|
||||
default Class<? extends TaskListener> getUpDeptPostLeaderListener() {
|
||||
return UpDeptPostLeaderListener.class;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.orangeforms.common.flow.util;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 工作流自定义扩展工厂类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
@Component
|
||||
public class FlowCustomExtFactory {
|
||||
|
||||
private BaseFlowIdentityExtHelper flowIdentityExtHelper;
|
||||
|
||||
private BaseDataSyncExtHelper dataSyncExtHelper = new BaseDataSyncExtHelper();
|
||||
|
||||
/**
|
||||
* 获取业务模块自行实现的用户身份相关的扩展帮助实现类。
|
||||
*
|
||||
* @return 业务模块自行实现的用户身份相关的扩展帮助实现类。
|
||||
*/
|
||||
public BaseFlowIdentityExtHelper getFlowIdentityExtHelper() {
|
||||
return flowIdentityExtHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册业务模块自行实现的用户身份扩展帮助实现类。
|
||||
*
|
||||
* @param helper 业务模块自行实现的用户身份扩展帮助实现类。
|
||||
*/
|
||||
public void registerFlowIdentityExtHelper(BaseFlowIdentityExtHelper helper) {
|
||||
this.flowIdentityExtHelper = helper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程结束后数据同步的帮助实现类。
|
||||
*
|
||||
* @return 流程结束后数据同步的帮助实现类。
|
||||
*/
|
||||
public BaseDataSyncExtHelper getDataSyncExtHelper() {
|
||||
return dataSyncExtHelper;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.util;
|
||||
package com.orangeforms.common.flow.util;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
@@ -6,24 +6,24 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.flow.demo.common.core.constant.ErrorCodeEnum;
|
||||
import com.flow.demo.common.core.object.CallResult;
|
||||
import com.flow.demo.common.core.object.ResponseResult;
|
||||
import com.flow.demo.common.core.object.TokenData;
|
||||
import com.flow.demo.common.core.util.MyModelUtil;
|
||||
import com.flow.demo.common.flow.constant.FlowApprovalType;
|
||||
import com.flow.demo.common.flow.constant.FlowConstant;
|
||||
import com.flow.demo.common.flow.constant.FlowTaskStatus;
|
||||
import com.flow.demo.common.flow.dto.FlowTaskCommentDto;
|
||||
import com.flow.demo.common.flow.dto.FlowWorkOrderDto;
|
||||
import com.flow.demo.common.flow.model.FlowEntry;
|
||||
import com.flow.demo.common.flow.model.FlowEntryPublish;
|
||||
import com.flow.demo.common.flow.model.FlowWorkOrder;
|
||||
import com.flow.demo.common.flow.model.constant.FlowEntryStatus;
|
||||
import com.flow.demo.common.flow.service.FlowApiService;
|
||||
import com.flow.demo.common.flow.service.FlowEntryService;
|
||||
import com.flow.demo.common.flow.vo.FlowWorkOrderVo;
|
||||
import com.flow.demo.common.flow.vo.TaskInfoVo;
|
||||
import com.orangeforms.common.core.constant.ErrorCodeEnum;
|
||||
import com.orangeforms.common.core.object.CallResult;
|
||||
import com.orangeforms.common.core.object.ResponseResult;
|
||||
import com.orangeforms.common.core.object.TokenData;
|
||||
import com.orangeforms.common.core.util.MyModelUtil;
|
||||
import com.orangeforms.common.flow.constant.FlowApprovalType;
|
||||
import com.orangeforms.common.flow.constant.FlowConstant;
|
||||
import com.orangeforms.common.flow.constant.FlowTaskStatus;
|
||||
import com.orangeforms.common.flow.dto.FlowTaskCommentDto;
|
||||
import com.orangeforms.common.flow.dto.FlowWorkOrderDto;
|
||||
import com.orangeforms.common.flow.model.FlowEntry;
|
||||
import com.orangeforms.common.flow.model.FlowEntryPublish;
|
||||
import com.orangeforms.common.flow.model.FlowWorkOrder;
|
||||
import com.orangeforms.common.flow.model.constant.FlowEntryStatus;
|
||||
import com.orangeforms.common.flow.service.FlowApiService;
|
||||
import com.orangeforms.common.flow.service.FlowEntryService;
|
||||
import com.orangeforms.common.flow.vo.FlowWorkOrderVo;
|
||||
import com.orangeforms.common.flow.vo.TaskInfoVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.engine.history.HistoricProcessInstance;
|
||||
import org.activiti.engine.history.HistoricTaskInstance;
|
||||
@@ -127,7 +127,7 @@ public class FlowOperationHelper {
|
||||
return ResponseResult.success(task);
|
||||
}
|
||||
String errorMessage;
|
||||
if (StrUtil.equals(flowTaskComment.getApprovalType(), FlowApprovalType.TRANSFER)) {
|
||||
if (flowTaskComment != null && StrUtil.equals(flowTaskComment.getApprovalType(), FlowApprovalType.TRANSFER)) {
|
||||
if (StrUtil.isBlank(flowTaskComment.getDelegateAssginee())) {
|
||||
errorMessage = "数据验证失败,加签或转办任务指派人不能为空!!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.vo;
|
||||
package com.orangeforms.common.flow.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.vo;
|
||||
package com.orangeforms.common.flow.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.vo;
|
||||
package com.orangeforms.common.flow.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.vo;
|
||||
package com.orangeforms.common.flow.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.orangeforms.common.flow.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 工作流通知消息Vo对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
*/
|
||||
@Data
|
||||
public class FlowMessageVo {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
private Long messageId;
|
||||
|
||||
/**
|
||||
* 消息类型。
|
||||
*/
|
||||
private Integer messageType;
|
||||
|
||||
/**
|
||||
* 消息内容。
|
||||
*/
|
||||
private String messageContent;
|
||||
|
||||
/**
|
||||
* 催办次数。
|
||||
*/
|
||||
private Integer remindCount;
|
||||
|
||||
/**
|
||||
* 工单Id。
|
||||
*/
|
||||
private Long workOrderId;
|
||||
|
||||
/**
|
||||
* 流程定义Id。
|
||||
*/
|
||||
private String processDefinitionId;
|
||||
|
||||
/**
|
||||
* 流程定义标识。
|
||||
*/
|
||||
private String processDefinitionKey;
|
||||
|
||||
/**
|
||||
* 流程名称。
|
||||
*/
|
||||
private String processDefinitionName;
|
||||
|
||||
/**
|
||||
* 流程实例Id。
|
||||
*/
|
||||
private String processInstanceId;
|
||||
|
||||
/**
|
||||
* 流程实例发起者。
|
||||
*/
|
||||
private String processInstanceInitiator;
|
||||
|
||||
/**
|
||||
* 流程任务Id。
|
||||
*/
|
||||
private String taskId;
|
||||
|
||||
/**
|
||||
* 流程任务定义标识。
|
||||
*/
|
||||
private String taskDefinitionKey;
|
||||
|
||||
/**
|
||||
* 流程任务名称。
|
||||
*/
|
||||
private String taskName;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
private Date taskStartTime;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建者显示名。
|
||||
*/
|
||||
private String createUsername;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.vo;
|
||||
package com.orangeforms.common.flow.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.vo;
|
||||
package com.orangeforms.common.flow.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -72,4 +72,9 @@ public class FlowTaskVo {
|
||||
* 流程实例创建时间。
|
||||
*/
|
||||
private Date processInstanceStartTime;
|
||||
|
||||
/**
|
||||
* 流程实例主表业务数据主键。
|
||||
*/
|
||||
private String businessKey;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.vo;
|
||||
package com.orangeforms.common.flow.vo;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import lombok.Data;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.flow.demo.common.flow.vo;
|
||||
package com.orangeforms.common.flow.vo;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
@@ -1,2 +1,2 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
com.flow.demo.common.flow.config.FlowAutoConfig
|
||||
com.orangeforms.common.flow.config.FlowAutoConfig
|
||||
Reference in New Issue
Block a user