update 流程新增节点
This commit is contained in:
@@ -18,23 +18,27 @@ create table laws_process_node_origin
|
|||||||
sys_code varchar(64) comment '所属部门'
|
sys_code varchar(64) comment '所属部门'
|
||||||
) comment = '流程节点_来源';
|
) comment = '流程节点_来源';
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS laws_process_node;
|
||||||
create table laws_process_node
|
create table laws_process_node
|
||||||
(
|
(
|
||||||
id varchar(36) not null primary key comment '主键id',
|
id varchar(36) not null primary key comment '主键id',
|
||||||
create_by varchar(36) comment '创建人',
|
process_definition_id varchar(64) comment '流程定义id',
|
||||||
create_time datetime(0) comment '创建时间',
|
node_name varchar(50) comment '节点名称',
|
||||||
update_by varchar(36) comment '更新人',
|
is_approval_node tinyint(4) comment '是否审批节点',
|
||||||
update_time datetime(0) comment '更新时间',
|
is_can_deleted tinyint(4) comment '是否可删除',
|
||||||
sys_code varchar(64) comment '所属部门',
|
sort tinyint(4) comment '排序',
|
||||||
replaced varchar(50) comment '代替标准',
|
create_by varchar(36) comment '创建人',
|
||||||
replaced_by varchar(50) comment '被代替标准',
|
create_time datetime comment '创建时间',
|
||||||
type int(1) comment '类型(1-代替、2-引用)'
|
update_by varchar(36) comment '更新人',
|
||||||
|
update_time datetime comment '更新时间',
|
||||||
|
sys_code varchar(64) comment '所属部门'
|
||||||
) comment = '流程节点';
|
) comment = '流程节点';
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS laws_process_node_link;
|
||||||
create table laws_process_node_link
|
create table laws_process_node_link
|
||||||
(
|
(
|
||||||
id varchar(36) not null primary key comment '主键id',
|
id varchar(36) not null primary key comment '主键id',
|
||||||
process_node_id varchar(36) comment '流程节点id',
|
process_node_id varchar(36) comment '流程节点id',
|
||||||
type int(1) comment '类型(1-用户、2-部门)',
|
type int(1) comment '类型(1-用户、2-部门)',
|
||||||
user_depart_id varchar(36) comment '用户id,部门id)'
|
user_depart_id varchar(36) comment '用户id,部门id)'
|
||||||
) comment = '流程节点';
|
) comment = '流程节点关联用户部门表';
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
第二行替换为:<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
|
||||||
|
第三行修改为:isExecutable="true"
|
||||||
|
bpmn: 替换为空
|
||||||
|
camunda: 替换为 activiti:
|
||||||
|
dc:Bounds 替换为 omgdc:Bounds
|
||||||
|
di:waypoint 替换为 omgdi:waypoint
|
||||||
@@ -1,10 +1,17 @@
|
|||||||
package com.jero.modules.activiti.controller;
|
package com.jero.modules.activiti.controller;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.jero.common.api.vo.Result;
|
import com.jero.common.api.vo.Result;
|
||||||
import com.jero.common.constant.enums.LanguageEnum;
|
import com.jero.common.constant.enums.LanguageEnum;
|
||||||
import com.jero.common.util.MessageUtils;
|
import com.jero.common.util.MessageUtils;
|
||||||
|
import com.jero.modules.activiti.entity.LawsProcessNode;
|
||||||
|
import com.jero.modules.activiti.entity.LawsProcessNodeOrigin;
|
||||||
|
import com.jero.modules.activiti.service.LawsProcessNodeOriginService;
|
||||||
|
import com.jero.modules.activiti.service.LawsProcessNodeService;
|
||||||
import com.jero.modules.activiti.service.ProcessService;
|
import com.jero.modules.activiti.service.ProcessService;
|
||||||
|
import com.jero.modules.activiti.vo.AddTaskVO;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import io.swagger.annotations.ApiParam;
|
import io.swagger.annotations.ApiParam;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -19,6 +26,7 @@ import org.activiti.engine.task.Task;
|
|||||||
import org.activiti.engine.task.TaskQuery;
|
import org.activiti.engine.task.TaskQuery;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -37,6 +45,7 @@ import java.util.*;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
|
@Api(tags = "流程控制")
|
||||||
@RequestMapping("/modeler")
|
@RequestMapping("/modeler")
|
||||||
public class AController {
|
public class AController {
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -45,8 +54,11 @@ public class AController {
|
|||||||
private RepositoryService repositoryService;
|
private RepositoryService repositoryService;
|
||||||
@Resource
|
@Resource
|
||||||
private TaskService taskService;
|
private TaskService taskService;
|
||||||
|
@Resource
|
||||||
|
private LawsProcessNodeOriginService processNodeOriginService;
|
||||||
|
@Resource
|
||||||
|
private LawsProcessNodeService processNodeService;
|
||||||
|
@ApiOperation(value="部署流程图")
|
||||||
@GetMapping("/deploy")
|
@GetMapping("/deploy")
|
||||||
public Result<Map<String, String>> deploy(@RequestParam(value = "name", required = false) String name,
|
public Result<Map<String, String>> deploy(@RequestParam(value = "name", required = false) String name,
|
||||||
@RequestParam(value = "classpathResource") String classpathResource,
|
@RequestParam(value = "classpathResource") String classpathResource,
|
||||||
@@ -79,6 +91,15 @@ public class AController {
|
|||||||
map.put("流程部署id:", deployment.getId());
|
map.put("流程部署id:", deployment.getId());
|
||||||
map.put("流程部署名称:", deployment.getName());
|
map.put("流程部署名称:", deployment.getName());
|
||||||
map.put("流程部署key:", deployment.getKey());
|
map.put("流程部署key:", deployment.getKey());
|
||||||
|
|
||||||
|
//创建一个流程定义查询
|
||||||
|
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
|
||||||
|
processDefinitionQuery.deploymentId(deployment.getId());
|
||||||
|
ProcessDefinition processDefinition = processDefinitionQuery.singleResult();
|
||||||
|
String processDefinitionId = processDefinition.getId();
|
||||||
|
processNodeOriginService.saveNodeList(processDefinitionId);
|
||||||
|
map.put("流程定义Id:", processDefinitionId);
|
||||||
|
|
||||||
return Result.OK(map);
|
return Result.OK(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,7 +146,7 @@ public class AController {
|
|||||||
return Result.OK(allList);
|
return Result.OK(allList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value="启动流程")
|
||||||
@PostMapping("/start")
|
@PostMapping("/start")
|
||||||
public Result<Map<String, String>> start(@RequestBody Map<String,Object> map) {
|
public Result<Map<String, String>> start(@RequestBody Map<String,Object> map) {
|
||||||
String key = map.get("key").toString();
|
String key = map.get("key").toString();
|
||||||
@@ -133,32 +154,54 @@ public class AController {
|
|||||||
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
|
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
|
||||||
// 2、获取RunTimeService
|
// 2、获取RunTimeService
|
||||||
RuntimeService runtimeService = processEngine.getRuntimeService();
|
RuntimeService runtimeService = processEngine.getRuntimeService();
|
||||||
Map<String, Object> vars = new HashMap<>();
|
|
||||||
vars.put("mainDrafter", "admin");
|
|
||||||
|
|
||||||
// 3、根据流程定义Id启动流程
|
// 3、根据流程定义Id启动流程
|
||||||
ProcessInstance processInstance = runtimeService
|
ProcessInstance processInstance = runtimeService
|
||||||
.startProcessInstanceByKey(key, map);
|
.startProcessInstanceByKey(key, map);
|
||||||
|
String processDefinitionId = processInstance.getProcessDefinitionId();
|
||||||
// 输出内容
|
// 输出内容
|
||||||
Map<String, String> map1 = new HashMap<>();
|
Map<String, String> map1 = new HashMap<>();
|
||||||
map1.put("流程Id:", processInstance.getDeploymentId());
|
map1.put("流程Id:", processInstance.getDeploymentId());
|
||||||
map1.put("流程定义id:", processInstance.getProcessDefinitionId());
|
map1.put("流程定义id:", processDefinitionId);
|
||||||
map1.put("流程实例id:", processInstance.getId());
|
map1.put("流程实例id:", processInstance.getId());
|
||||||
map1.put("当前活动Id:", processInstance.getActivityId());
|
map1.put("当前活动Id:", processInstance.getActivityId());
|
||||||
|
|
||||||
|
//从流程节点源表中保存一份流程节点信息到流程节点表
|
||||||
|
LambdaQueryWrapper<LawsProcessNodeOrigin> processNodeOriginLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
processNodeOriginLambdaQueryWrapper.eq(LawsProcessNodeOrigin::getNodeType,"userTask")
|
||||||
|
.orderByAsc(LawsProcessNodeOrigin::getSort);
|
||||||
|
|
||||||
|
List<LawsProcessNodeOrigin> lawsProcessNodeOrigins = processNodeOriginService.list(processNodeOriginLambdaQueryWrapper);
|
||||||
|
List<LawsProcessNode> lawsProcessNodes = new ArrayList<>();
|
||||||
|
for (LawsProcessNodeOrigin lawsProcessNodeOrigin : lawsProcessNodeOrigins) {
|
||||||
|
LawsProcessNode lawsProcessNode = new LawsProcessNode();
|
||||||
|
BeanUtils.copyProperties(lawsProcessNodeOrigin,lawsProcessNode);
|
||||||
|
lawsProcessNode.setId(null);
|
||||||
|
lawsProcessNodes.add(lawsProcessNode);
|
||||||
|
}
|
||||||
|
processNodeService.saveBatch(lawsProcessNodes);
|
||||||
|
for (LawsProcessNode lawsProcessNode : lawsProcessNodes) {
|
||||||
|
if (lawsProcessNode.getNodeName().equals("填写基本信息,在线编辑,分发其他起草人")) {
|
||||||
|
//todo 关联关系
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String mainDrafter = map.get("mainDrafter").toString();
|
||||||
|
|
||||||
return Result.OK(map1);
|
return Result.OK(map1);
|
||||||
}
|
}
|
||||||
|
@ApiOperation(value="查询待办列表")
|
||||||
@GetMapping("/getTaskList")
|
@GetMapping("/getTaskList")
|
||||||
public Result<List<Map<String, String>>> testFindPersonalTaskList(@RequestParam(value = "assignee") String assignee,
|
public Result<List<Map<String, String>>> testFindPersonalTaskList(@RequestParam(value = "assignee") String assignee,
|
||||||
@RequestParam(value = "processKey") String processKey) {
|
@RequestParam(value = "processKey") String processKey,
|
||||||
|
@RequestParam(value = "group") String group) {
|
||||||
// 根据流程key 和 任务负责人 查询任务
|
// 根据流程key 和 任务负责人 查询任务
|
||||||
TaskQuery taskQuery = taskService.createTaskQuery();
|
TaskQuery taskQuery = taskService.createTaskQuery();
|
||||||
if (StringUtils.isNotBlank(assignee)) {
|
if (StringUtils.isNotBlank(assignee)) {
|
||||||
taskQuery.taskAssignee(assignee);//只查询该任务负责人的任务
|
taskQuery.taskAssignee(assignee);//只查询该任务负责人的任务
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNotBlank(group)) {
|
||||||
|
taskQuery.taskCandidateGroup(group);//只查询该组的任务
|
||||||
|
}
|
||||||
if (StringUtils.isNotBlank(processKey)) {
|
if (StringUtils.isNotBlank(processKey)) {
|
||||||
taskQuery.processDefinitionKey(processKey); //流程Key
|
taskQuery.processDefinitionKey(processKey); //流程Key
|
||||||
}
|
}
|
||||||
@@ -170,11 +213,21 @@ public class AController {
|
|||||||
map.put("任务id:", task.getId());
|
map.put("任务id:", task.getId());
|
||||||
map.put("任务负责人:", task.getAssignee());
|
map.put("任务负责人:", task.getAssignee());
|
||||||
map.put("任务名称:", task.getName());
|
map.put("任务名称:", task.getName());
|
||||||
|
//map.put("任务名称:", task.get);
|
||||||
resut.add(map);
|
resut.add(map);
|
||||||
}
|
}
|
||||||
return Result.OK(resut);
|
return Result.OK(resut);
|
||||||
}
|
}
|
||||||
|
@ApiOperation(value="签收任务")
|
||||||
|
@PostMapping("/claim")
|
||||||
|
public Result<Object> claim(@RequestBody Map<String,Object> map) {
|
||||||
|
String taskId = map.get("taskId").toString();
|
||||||
|
String userId = map.get("userId").toString();
|
||||||
|
taskService.claim(taskId, userId);
|
||||||
|
return Result.OK();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value="完成任务")
|
||||||
@PostMapping("/complete")
|
@PostMapping("/complete")
|
||||||
public Result<Object> complete(@RequestBody Map<String,Object> map) {
|
public Result<Object> complete(@RequestBody Map<String,Object> map) {
|
||||||
String taskId = map.get("taskId").toString();
|
String taskId = map.get("taskId").toString();
|
||||||
@@ -197,6 +250,7 @@ public class AController {
|
|||||||
* @param loginName
|
* @param loginName
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value="加签/委托")
|
||||||
@GetMapping("/delegateTask")
|
@GetMapping("/delegateTask")
|
||||||
public Result<Object> delegateTask(@RequestParam(value = "taskId") String taskId,
|
public Result<Object> delegateTask(@RequestParam(value = "taskId") String taskId,
|
||||||
@RequestParam(value = "loginName") String loginName) {
|
@RequestParam(value = "loginName") String loginName) {
|
||||||
@@ -204,21 +258,23 @@ public class AController {
|
|||||||
return Result.OK();
|
return Result.OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value="解决委托")
|
||||||
@GetMapping("/resolveTask")
|
@GetMapping("/resolveTask")
|
||||||
public Result<Object> resolveTask(@RequestParam(value = "taskId") String taskId) {
|
public Result<Object> resolveTask(@RequestParam(value = "taskId") String taskId) {
|
||||||
taskService.resolveTask(taskId);
|
taskService.resolveTask(taskId);
|
||||||
return Result.OK();
|
return Result.OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/addTask")
|
@PostMapping("/addTask")
|
||||||
// @ApiOperation("新增节点")
|
@ApiOperation("新增节点")
|
||||||
public Object addTask(String taskId, String assignee) {
|
public Object addTask(@RequestBody AddTaskVO addTaskVO, HttpServletResponse response) {
|
||||||
return processService.addTask(taskId, assignee);
|
return processNodeOriginService.addTask(addTaskVO,response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getNodeList")
|
@ApiOperation("保存节点列表")
|
||||||
public Object getNodeList(String processDefinitionId) {
|
@GetMapping("/saveNodeList")
|
||||||
processService.getNodeList(processDefinitionId);
|
public Object saveNodeList(String processDefinitionId) {
|
||||||
|
processNodeOriginService.saveNodeList(processDefinitionId);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,97 @@
|
|||||||
|
package com.jero.modules.activiti.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.util.Date;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*流程节点
|
||||||
|
*@author liJiaRao
|
||||||
|
*@date 2023-09-26 15:12
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "流程节点")
|
||||||
|
@Data
|
||||||
|
@TableName(value = "laws_process_node")
|
||||||
|
public class LawsProcessNode {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||||
|
@ApiModelProperty(value = "主键id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程定义id
|
||||||
|
*/
|
||||||
|
@TableField(value = "process_definition_id")
|
||||||
|
@ApiModelProperty(value = "流程定义id")
|
||||||
|
private String processDefinitionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 节点名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "node_name")
|
||||||
|
@ApiModelProperty(value = "节点名称")
|
||||||
|
private String nodeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否审批节点
|
||||||
|
*/
|
||||||
|
@TableField(value = "is_approval_node")
|
||||||
|
@ApiModelProperty(value = "是否审批节点")
|
||||||
|
private Integer isApprovalNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否可删除
|
||||||
|
*/
|
||||||
|
@TableField(value = "is_can_deleted")
|
||||||
|
@ApiModelProperty(value = "是否可删除")
|
||||||
|
private Integer isCanDeleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
@TableField(value = "sort")
|
||||||
|
@ApiModelProperty(value = "排序")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@TableField(value = "create_by")
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "create_time")
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
@TableField(value = "update_by")
|
||||||
|
@ApiModelProperty(value = "更新人")
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "update_time")
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属部门
|
||||||
|
*/
|
||||||
|
@TableField(value = "sys_code")
|
||||||
|
@ApiModelProperty(value = "所属部门")
|
||||||
|
private String sysCode;
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.jero.modules.activiti.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*流程节点关联用户部门表
|
||||||
|
*@author liJiaRao
|
||||||
|
*@date 2023-09-26 15:12
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "流程节点关联用户部门表")
|
||||||
|
@Data
|
||||||
|
@TableName(value = "laws_process_node_link")
|
||||||
|
public class LawsProcessNodeLink {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||||
|
@ApiModelProperty(value = "主键id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程节点id
|
||||||
|
*/
|
||||||
|
@TableField(value = "process_node_id")
|
||||||
|
@ApiModelProperty(value = "流程节点id")
|
||||||
|
private String processNodeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型(1-用户、2-部门)
|
||||||
|
*/
|
||||||
|
@TableField(value = "`type`")
|
||||||
|
@ApiModelProperty(value = "类型(1-用户、2-部门)")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id,部门id)
|
||||||
|
*/
|
||||||
|
@TableField(value = "user_depart_id")
|
||||||
|
@ApiModelProperty(value = "用户id,部门id)")
|
||||||
|
private String userDepartId;
|
||||||
|
}
|
||||||
+1
-1
@@ -12,7 +12,7 @@ import lombok.Data;
|
|||||||
/**
|
/**
|
||||||
*流程节点_来源
|
*流程节点_来源
|
||||||
*@author liJiaRao
|
*@author liJiaRao
|
||||||
*@date 2023-09-25 15:17
|
*@date 2023-09-26 15:12
|
||||||
*/
|
*/
|
||||||
@ApiModel(description = "流程节点_来源")
|
@ApiModel(description = "流程节点_来源")
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
package com.jero.modules.activiti.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.jero.modules.activiti.entity.LawsProcessNodeLink;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author liJiaRao
|
||||||
|
* @date 2023-09-26 15:12
|
||||||
|
*/
|
||||||
|
public interface LawsProcessNodeLinkMapper extends BaseMapper<LawsProcessNodeLink> {
|
||||||
|
}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
package com.jero.modules.activiti.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.jero.modules.activiti.entity.LawsProcessNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author liJiaRao
|
||||||
|
* @date 2023-09-26 15:12
|
||||||
|
*/
|
||||||
|
public interface LawsProcessNodeMapper extends BaseMapper<LawsProcessNode> {
|
||||||
|
}
|
||||||
+5
-6
@@ -1,16 +1,15 @@
|
|||||||
package com.jero.modules.activiti.mapper;
|
package com.jero.modules.activiti.mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.jero.modules.activiti.entity.LawsProcessNodeOrigin;
|
import com.jero.modules.activiti.entity.LawsProcessNodeOrigin;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author liJiaRao
|
* @author liJiaRao
|
||||||
* @date 2023-09-25 15:02
|
* @date 2023-09-26 15:12
|
||||||
*/
|
*/
|
||||||
public interface LawsProcessNodeOriginMapper extends BaseMapper<LawsProcessNodeOrigin> {
|
public interface LawsProcessNodeOriginMapper extends BaseMapper<LawsProcessNodeOrigin> {
|
||||||
int insertList(@Param("list")List<LawsProcessNodeOrigin> list);
|
int insertList(@Param("list") List<LawsProcessNodeOrigin> list);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
<?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.jero.modules.activiti.mapper.LawsProcessNodeLinkMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.jero.modules.activiti.entity.LawsProcessNodeLink">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
<!--@Table laws_process_node_link-->
|
||||||
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||||
|
<result column="process_node_id" jdbcType="VARCHAR" property="processNodeId" />
|
||||||
|
<result column="type" jdbcType="INTEGER" property="type" />
|
||||||
|
<result column="user_depart_id" jdbcType="VARCHAR" property="userDepartId" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
id, process_node_id, `type`, user_depart_id
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
<?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.jero.modules.activiti.mapper.LawsProcessNodeMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.jero.modules.activiti.entity.LawsProcessNode">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
<!--@Table laws_process_node-->
|
||||||
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||||
|
<result column="process_definition_id" jdbcType="VARCHAR" property="processDefinitionId" />
|
||||||
|
<result column="node_name" jdbcType="VARCHAR" property="nodeName" />
|
||||||
|
<result column="is_approval_node" jdbcType="TINYINT" property="isApprovalNode" />
|
||||||
|
<result column="is_can_deleted" jdbcType="TINYINT" property="isCanDeleted" />
|
||||||
|
<result column="sort" jdbcType="TINYINT" property="sort" />
|
||||||
|
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
|
<result column="sys_code" jdbcType="VARCHAR" property="sysCode" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
id, process_definition_id, node_name, is_approval_node, is_can_deleted, sort, create_by,
|
||||||
|
create_time, update_by, update_time, sys_code
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
||||||
+23
-32
@@ -1,40 +1,31 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.jero.modules.activiti.mapper.LawsProcessNodeOriginMapper">
|
<mapper namespace="com.jero.modules.activiti.mapper.LawsProcessNodeOriginMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.jero.modules.activiti.entity.LawsProcessNodeOrigin">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
<!--@Table laws_process_node_origin-->
|
||||||
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||||
|
<result column="process_definition_id" jdbcType="VARCHAR" property="processDefinitionId" />
|
||||||
|
<result column="node_name" jdbcType="VARCHAR" property="nodeName" />
|
||||||
|
<result column="node_type" jdbcType="VARCHAR" property="nodeType" />
|
||||||
|
<result column="xml_node_id" jdbcType="VARCHAR" property="xmlNodeId" />
|
||||||
|
<result column="xml_source_ref" jdbcType="VARCHAR" property="xmlSourceRef" />
|
||||||
|
<result column="xml_target_ref" jdbcType="VARCHAR" property="xmlTargetRef" />
|
||||||
|
<result column="is_approval_node" jdbcType="TINYINT" property="isApprovalNode" />
|
||||||
|
<result column="is_can_deleted" jdbcType="TINYINT" property="isCanDeleted" />
|
||||||
|
<result column="sort" jdbcType="TINYINT" property="sort" />
|
||||||
|
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
|
<result column="sys_code" jdbcType="VARCHAR" property="sysCode" />
|
||||||
|
</resultMap>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id,
|
<!--@mbg.generated-->
|
||||||
process_definition_id,
|
id, process_definition_id, node_name, node_type, xml_node_id, xml_source_ref, xml_target_ref,
|
||||||
node_name,
|
is_approval_node, is_can_deleted, sort, create_by, create_time, update_by, update_time,
|
||||||
node_type,
|
|
||||||
xml_node_id,
|
|
||||||
xml_source_ref,
|
|
||||||
xml_target_ref,
|
|
||||||
is_approval_node,
|
|
||||||
is_can_deleted,
|
|
||||||
sort,
|
|
||||||
create_by,
|
|
||||||
create_time,
|
|
||||||
update_by,
|
|
||||||
update_time,
|
|
||||||
sys_code
|
sys_code
|
||||||
</sql>
|
</sql>
|
||||||
<resultMap id="BaseResultMap" type="com.jero.modules.activiti.entity.LawsProcessNodeOrigin">
|
|
||||||
<result column="id" property="id"/>
|
|
||||||
<result column="process_definition_id" property="processDefinitionId"/>
|
|
||||||
<result column="node_name" property="nodeName"/>
|
|
||||||
<result column="node_type" property="nodeType"/>
|
|
||||||
<result column="xml_node_id" property="xmlNodeId"/>
|
|
||||||
<result column="xml_source_ref" property="xmlSourceRef"/>
|
|
||||||
<result column="xml_target_ref" property="xmlTargetRef"/>
|
|
||||||
<result column="is_approval_node" property="isApprovalNode"/>
|
|
||||||
<result column="is_can_deleted" property="isCanDeleted"/>
|
|
||||||
<result column="sort" property="sort"/>
|
|
||||||
<result column="create_by" property="createBy"/>
|
|
||||||
<result column="create_time" property="createTime"/>
|
|
||||||
<result column="update_by" property="updateBy"/>
|
|
||||||
<result column="update_time" property="updateTime"/>
|
|
||||||
<result column="sys_code" property="sysCode"/>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<!--auto generated by MybatisCodeHelper on 2023-09-25-->
|
<!--auto generated by MybatisCodeHelper on 2023-09-25-->
|
||||||
<insert id="insertList">
|
<insert id="insertList">
|
||||||
@@ -55,7 +46,7 @@
|
|||||||
update_time,
|
update_time,
|
||||||
sys_code
|
sys_code
|
||||||
)VALUES
|
)VALUES
|
||||||
<foreach collection="list" item="element" index="index" separator=",">
|
<foreach collection="list" index="index" item="element" separator=",">
|
||||||
(
|
(
|
||||||
#{element.id},
|
#{element.id},
|
||||||
#{element.processDefinitionId},
|
#{element.processDefinitionId},
|
||||||
|
|||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
package com.jero.modules.activiti.service;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.jero.modules.activiti.mapper.LawsProcessNodeLinkMapper;
|
||||||
|
import com.jero.modules.activiti.entity.LawsProcessNodeLink;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*@author liJiaRao
|
||||||
|
*@date 2023-09-26 15:12
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class LawsProcessNodeLinkService extends ServiceImpl<LawsProcessNodeLinkMapper, LawsProcessNodeLink> {
|
||||||
|
|
||||||
|
}
|
||||||
+267
@@ -0,0 +1,267 @@
|
|||||||
|
package com.jero.modules.activiti.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.lang.UUID;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.jero.common.constant.enums.YesOrNoEnum;
|
||||||
|
import com.jero.common.exception.JeroBootException;
|
||||||
|
import com.jero.modules.activiti.entity.ActGeBytearray;
|
||||||
|
import com.jero.modules.activiti.mapper.ActGeBytearrayMapper;
|
||||||
|
import com.jero.modules.activiti.vo.AddTaskVO;
|
||||||
|
import org.activiti.bpmn.BpmnAutoLayout;
|
||||||
|
import org.activiti.bpmn.converter.BpmnXMLConverter;
|
||||||
|
import org.activiti.bpmn.model.*;
|
||||||
|
import org.activiti.bpmn.model.Process;
|
||||||
|
import org.activiti.engine.*;
|
||||||
|
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||||
|
import org.activiti.engine.impl.persistence.deploy.DeploymentManager;
|
||||||
|
import org.activiti.validation.ProcessValidator;
|
||||||
|
import org.activiti.validation.ProcessValidatorFactory;
|
||||||
|
import org.activiti.validation.ValidationError;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.xml.stream.XMLInputFactory;
|
||||||
|
import javax.xml.stream.XMLStreamException;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.jero.modules.activiti.mapper.LawsProcessNodeOriginMapper;
|
||||||
|
import com.jero.modules.activiti.entity.LawsProcessNodeOrigin;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*@author liJiaRao
|
||||||
|
*@date 2023-09-26 15:12
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class LawsProcessNodeOriginService extends ServiceImpl<LawsProcessNodeOriginMapper, LawsProcessNodeOrigin> {
|
||||||
|
@Resource
|
||||||
|
private RepositoryService repositoryService;
|
||||||
|
@Resource
|
||||||
|
private ProcessEngine processEngine;
|
||||||
|
@Resource
|
||||||
|
private ActGeBytearrayMapper actGeBytearrayMapper;
|
||||||
|
@Resource
|
||||||
|
private LawsProcessNodeOriginMapper processNodeOriginMapper;
|
||||||
|
|
||||||
|
public void saveNodeList(String processDefinitionId) {
|
||||||
|
final BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
|
||||||
|
Process process = bpmnModel.getMainProcess();
|
||||||
|
Collection<FlowElement> flowElements = process.getFlowElements();
|
||||||
|
List<LawsProcessNodeOrigin> processNodeOriginList = new ArrayList<>();
|
||||||
|
int sort = 1;
|
||||||
|
List<String> gatewayIdList = new ArrayList<>();
|
||||||
|
processNodeOriginList = handlerLawsProcessNodeOrigin(flowElements,sort,gatewayIdList,processDefinitionId);
|
||||||
|
List<String> approvalNodeIdList = processNodeOriginList.stream()
|
||||||
|
.filter(item -> gatewayIdList.contains(item.getXmlTargetRef()))
|
||||||
|
.map(LawsProcessNodeOrigin::getXmlSourceRef)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
for (LawsProcessNodeOrigin processNodeOrigin : processNodeOriginList) {
|
||||||
|
String xmlNodeId = processNodeOrigin.getXmlNodeId();
|
||||||
|
if (approvalNodeIdList.contains(xmlNodeId) ){
|
||||||
|
processNodeOrigin.setIsApprovalNode(YesOrNoEnum.YES.getInteger());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
processNodeOriginMapper.insertList(processNodeOriginList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object addTask(AddTaskVO addTaskVO, HttpServletResponse response) {
|
||||||
|
try {
|
||||||
|
String processDefinitionId = addTaskVO.getProcessDefinitionId();
|
||||||
|
String xmlNodeId = addTaskVO.getXmlNodeId();
|
||||||
|
String nodeName = addTaskVO.getNodeName();
|
||||||
|
//查找当前节点
|
||||||
|
LambdaQueryWrapper<LawsProcessNodeOrigin> processNodeOriginLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
processNodeOriginLambdaQueryWrapper.eq(LawsProcessNodeOrigin::getXmlNodeId, xmlNodeId)
|
||||||
|
.eq(LawsProcessNodeOrigin::getProcessDefinitionId, processDefinitionId);
|
||||||
|
|
||||||
|
LawsProcessNodeOrigin processNodeOrigin = processNodeOriginMapper.selectOne(processNodeOriginLambdaQueryWrapper);
|
||||||
|
if (processNodeOrigin == null || !YesOrNoEnum.YES.getInteger().equals(processNodeOrigin.getIsApprovalNode())) {
|
||||||
|
throw new JeroBootException("只能在审批节点后新增");
|
||||||
|
}
|
||||||
|
processNodeOriginLambdaQueryWrapper.clear();
|
||||||
|
//查找节点的流出线
|
||||||
|
processNodeOriginLambdaQueryWrapper.eq(LawsProcessNodeOrigin::getXmlSourceRef, xmlNodeId)
|
||||||
|
.eq(LawsProcessNodeOrigin::getProcessDefinitionId, processDefinitionId);
|
||||||
|
LawsProcessNodeOrigin flowOrigin1 = processNodeOriginMapper.selectOne(processNodeOriginLambdaQueryWrapper);
|
||||||
|
|
||||||
|
processNodeOriginLambdaQueryWrapper.clear();
|
||||||
|
//查找流出线指向的网关
|
||||||
|
processNodeOriginLambdaQueryWrapper.eq(LawsProcessNodeOrigin::getXmlNodeId, flowOrigin1.getXmlTargetRef())
|
||||||
|
.eq(LawsProcessNodeOrigin::getProcessDefinitionId, processDefinitionId);
|
||||||
|
LawsProcessNodeOrigin gatewayOrigin = processNodeOriginMapper.selectOne(processNodeOriginLambdaQueryWrapper);
|
||||||
|
|
||||||
|
processNodeOriginLambdaQueryWrapper.clear();
|
||||||
|
//查找网关指向的线
|
||||||
|
processNodeOriginLambdaQueryWrapper.eq(LawsProcessNodeOrigin::getXmlSourceRef, gatewayOrigin.getXmlNodeId())
|
||||||
|
.eq(LawsProcessNodeOrigin::getNodeName, "通过")
|
||||||
|
.eq(LawsProcessNodeOrigin::getProcessDefinitionId, processDefinitionId);
|
||||||
|
|
||||||
|
LawsProcessNodeOrigin flowOrigin2 = processNodeOriginMapper.selectOne(processNodeOriginLambdaQueryWrapper);
|
||||||
|
|
||||||
|
BpmnModel bpmnModelOrigin = repositoryService.getBpmnModel(processDefinitionId);
|
||||||
|
BpmnXMLConverter converter = new BpmnXMLConverter();
|
||||||
|
byte[] bytesOrigin = converter.convertToXML(bpmnModelOrigin);
|
||||||
|
ByteArrayInputStream inputStream = new ByteArrayInputStream(bytesOrigin);
|
||||||
|
|
||||||
|
XMLInputFactory factory = XMLInputFactory.newInstance();
|
||||||
|
BpmnModel bpmnModel = converter.convertToBpmnModel(factory.createXMLStreamReader(inputStream));
|
||||||
|
Process process = bpmnModel.getMainProcess();
|
||||||
|
SequenceFlow flowElement = (SequenceFlow) process.getFlowElement(flowOrigin2.getXmlNodeId());
|
||||||
|
process.removeFlowElement(flowOrigin2.getXmlNodeId());
|
||||||
|
|
||||||
|
UserTask userTask = createUserTask(nodeName, null);
|
||||||
|
String userTaskId = userTask.getId();
|
||||||
|
flowElement.setTargetRef(userTaskId);
|
||||||
|
process.addFlowElement(flowElement);
|
||||||
|
process.addFlowElement(userTask);
|
||||||
|
process.addFlowElement(createGateway(process, userTaskId, flowOrigin2.getXmlTargetRef(), processNodeOrigin.getXmlNodeId()));
|
||||||
|
|
||||||
|
//重新绘画图形
|
||||||
|
BpmnAutoLayout bpmnAutoLayout = new BpmnAutoLayout(bpmnModel);
|
||||||
|
bpmnAutoLayout.execute();
|
||||||
|
|
||||||
|
//把bpmnModel对象转换成字符
|
||||||
|
byte[] bytes = converter.convertToXML(bpmnModel);
|
||||||
|
ByteArrayInputStream in = new ByteArrayInputStream(bytes);
|
||||||
|
String filename = bpmnModel.getMainProcess().getId() + ".bpmn";
|
||||||
|
response.setContentType("application/force-download");// 设置强制下载不打开
|
||||||
|
response.setHeader("Content-Disposition", "attachment; filename=" + filename);
|
||||||
|
IOUtils.copy(in, response.getOutputStream());
|
||||||
|
response.flushBuffer();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (XMLStreamException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
////清除缓存
|
||||||
|
//ProcessEngineConfigurationImpl configuration = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration();
|
||||||
|
//DeploymentManager deploymentManager = configuration.getDeploymentManager();
|
||||||
|
//deploymentManager.getProcessDefinitionCache().remove(processDefinitionId);
|
||||||
|
//
|
||||||
|
//List<ActGeBytearray> actGeBytearrayList = actGeBytearrayMapper.getActGeBytearrayList(processDefinitionId);
|
||||||
|
//actGeBytearrayList = actGeBytearrayList.stream().filter(item -> item.getName().endsWith(".bpmn")).peek(item -> {
|
||||||
|
// item.setBytes(bytes);
|
||||||
|
//}).collect(Collectors.toList());
|
||||||
|
//if (ObjectUtils.isNotEmpty(actGeBytearrayList)) {
|
||||||
|
// actGeBytearrayMapper.updateById(actGeBytearrayList.get(0));
|
||||||
|
//}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
protected static UserTask createUserTask(String name, String assignee) {
|
||||||
|
String id = "Activity_" + UUID.randomUUID();
|
||||||
|
UserTask userTask = new UserTask();
|
||||||
|
userTask.setName(name);
|
||||||
|
userTask.setId(id);
|
||||||
|
userTask.setAssignee(assignee!=null?assignee:"${"+id+"}");
|
||||||
|
return userTask;
|
||||||
|
}
|
||||||
|
protected static SequenceFlow createSequenceFlow(String from, String to) {
|
||||||
|
SequenceFlow flow = new SequenceFlow();
|
||||||
|
flow.setSourceRef(from);
|
||||||
|
flow.setTargetRef(to);
|
||||||
|
flow.setId("Flow_"+ UUID.randomUUID());
|
||||||
|
return flow;
|
||||||
|
}
|
||||||
|
protected static SequenceFlow createSequenceFlow(String from, String to,String name,String conditionExpression) {
|
||||||
|
SequenceFlow flow = new SequenceFlow();
|
||||||
|
flow.setSourceRef(from);
|
||||||
|
flow.setTargetRef(to);
|
||||||
|
flow.setName(name);
|
||||||
|
flow.setConditionExpression(conditionExpression);
|
||||||
|
flow.setId("Flow_"+ UUID.randomUUID());
|
||||||
|
return flow;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static ExclusiveGateway createGateway(Process process, String originId, String targetIdYes, String targetIdNo) {
|
||||||
|
ExclusiveGateway gateway = new ExclusiveGateway();
|
||||||
|
String id = "Gateway_" + UUID.randomUUID();
|
||||||
|
gateway.setId(id);
|
||||||
|
List<SequenceFlow> incomingFlows = new ArrayList<>();
|
||||||
|
SequenceFlow sequenceFlow = createSequenceFlow(originId, id);
|
||||||
|
process.addFlowElement(sequenceFlow);
|
||||||
|
incomingFlows.add(sequenceFlow);
|
||||||
|
gateway.setIncomingFlows(incomingFlows);
|
||||||
|
List<SequenceFlow> outgoingFlows = new ArrayList<>();
|
||||||
|
SequenceFlow sequenceFlow1 = createSequenceFlow(id, targetIdYes, "通过", "${pass}");
|
||||||
|
SequenceFlow sequenceFlow2 = createSequenceFlow(id, targetIdNo, "驳回", "${!pass}");
|
||||||
|
process.addFlowElement(sequenceFlow1);
|
||||||
|
process.addFlowElement(sequenceFlow2);
|
||||||
|
outgoingFlows.add(sequenceFlow1);
|
||||||
|
outgoingFlows.add(sequenceFlow2);
|
||||||
|
gateway.setOutgoingFlows(outgoingFlows);
|
||||||
|
return gateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<LawsProcessNodeOrigin> handlerLawsProcessNodeOrigin(
|
||||||
|
Collection<FlowElement> flowElements,
|
||||||
|
int sort,
|
||||||
|
List<String> gatewayIdList,
|
||||||
|
String processDefinitionId) {
|
||||||
|
List<LawsProcessNodeOrigin> processNodeOriginList = new ArrayList<>();
|
||||||
|
for (FlowElement flowElement : flowElements) {
|
||||||
|
LawsProcessNodeOrigin processNodeOrigin = new LawsProcessNodeOrigin();
|
||||||
|
|
||||||
|
String nodeName = processNodeOrigin.getNodeName();
|
||||||
|
String nodeType = processNodeOrigin.getNodeType();
|
||||||
|
String xmlNodeId = processNodeOrigin.getXmlNodeId();
|
||||||
|
String xmlSourceRef = processNodeOrigin.getXmlSourceRef();
|
||||||
|
String xmlTargetRef = processNodeOrigin.getXmlTargetRef();
|
||||||
|
if (flowElement instanceof UserTask) {
|
||||||
|
UserTask userTask = (UserTask) flowElement;
|
||||||
|
nodeType = "userTask";
|
||||||
|
nodeName = userTask.getName();
|
||||||
|
xmlNodeId = userTask.getId();
|
||||||
|
} else if (flowElement instanceof SequenceFlow) {
|
||||||
|
SequenceFlow sequenceFlow = (SequenceFlow) flowElement;
|
||||||
|
nodeType = "sequenceFlow";
|
||||||
|
nodeName = sequenceFlow.getName();
|
||||||
|
xmlNodeId = sequenceFlow.getId();
|
||||||
|
xmlSourceRef = sequenceFlow.getSourceRef();
|
||||||
|
xmlTargetRef = sequenceFlow.getTargetRef();
|
||||||
|
} else if (flowElement instanceof ExclusiveGateway) {
|
||||||
|
ExclusiveGateway gateway = (ExclusiveGateway) flowElement;
|
||||||
|
nodeType = "gateway";
|
||||||
|
nodeName = gateway.getName();
|
||||||
|
xmlNodeId = gateway.getId();
|
||||||
|
gatewayIdList.add(xmlNodeId);
|
||||||
|
} else if (flowElement instanceof SubProcess) {
|
||||||
|
SubProcess subProcess = (SubProcess) flowElement;
|
||||||
|
Collection<FlowElement> flowElements1 = subProcess.getFlowElements();
|
||||||
|
List<LawsProcessNodeOrigin> processNodeOrigins = handlerLawsProcessNodeOrigin(flowElements1, sort, gatewayIdList, processDefinitionId);
|
||||||
|
processNodeOriginList.addAll(processNodeOrigins);
|
||||||
|
nodeType = "subProcess";
|
||||||
|
nodeName = subProcess.getName();
|
||||||
|
xmlNodeId = subProcess.getId();
|
||||||
|
} else if (flowElement instanceof EndEvent) {
|
||||||
|
EndEvent endEvent = (EndEvent) flowElement;
|
||||||
|
nodeType = "endEvent";
|
||||||
|
nodeName = endEvent.getName();
|
||||||
|
xmlNodeId = endEvent.getId();
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
processNodeOrigin.setProcessDefinitionId(processDefinitionId);
|
||||||
|
processNodeOrigin.setNodeName(nodeName);
|
||||||
|
processNodeOrigin.setNodeType(nodeType);
|
||||||
|
processNodeOrigin.setXmlNodeId(xmlNodeId);
|
||||||
|
processNodeOrigin.setXmlSourceRef(xmlSourceRef);
|
||||||
|
processNodeOrigin.setXmlTargetRef(xmlTargetRef);
|
||||||
|
processNodeOrigin.setSort(sort++);
|
||||||
|
processNodeOrigin.setIsApprovalNode(YesOrNoEnum.NO.getInteger());
|
||||||
|
processNodeOrigin.setIsCanDeleted(YesOrNoEnum.NO.getInteger());
|
||||||
|
processNodeOriginList.add(processNodeOrigin);
|
||||||
|
}
|
||||||
|
return processNodeOriginList;
|
||||||
|
}
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
package com.jero.modules.activiti.service;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.jero.modules.activiti.mapper.LawsProcessNodeMapper;
|
||||||
|
import com.jero.modules.activiti.entity.LawsProcessNode;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*@author liJiaRao
|
||||||
|
*@date 2023-09-26 15:12
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class LawsProcessNodeService extends ServiceImpl<LawsProcessNodeMapper, LawsProcessNode> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.jero.modules.activiti.service;
|
package com.jero.modules.activiti.service;
|
||||||
|
|
||||||
|
import com.jero.modules.activiti.vo.AddTaskVO;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -7,9 +9,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
* @date 2023-08-03 15:37
|
* @date 2023-08-03 15:37
|
||||||
*/
|
*/
|
||||||
public interface ProcessService {
|
public interface ProcessService {
|
||||||
Object addTask(String taskId, String assignee);
|
|
||||||
|
|
||||||
void readResource(String pProcessInstanceId, HttpServletResponse response) throws Exception;
|
void readResource(String pProcessInstanceId, HttpServletResponse response) throws Exception;
|
||||||
|
|
||||||
void getNodeList(String processDefinitionId);
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-209
@@ -2,6 +2,7 @@ package com.jero.modules.activiti.service.impl;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import cn.hutool.core.lang.UUID;
|
import cn.hutool.core.lang.UUID;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
@@ -14,6 +15,7 @@ import com.jero.modules.activiti.mapper.ActGeBytearrayMapper;
|
|||||||
import com.jero.modules.activiti.mapper.LawsProcessNodeOriginMapper;
|
import com.jero.modules.activiti.mapper.LawsProcessNodeOriginMapper;
|
||||||
import com.jero.modules.activiti.service.ProcessService;
|
import com.jero.modules.activiti.service.ProcessService;
|
||||||
import com.jero.modules.activiti.service.impl.image.ICustomProcessDiagramGenerator;
|
import com.jero.modules.activiti.service.impl.image.ICustomProcessDiagramGenerator;
|
||||||
|
import com.jero.modules.activiti.vo.AddTaskVO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.activiti.bpmn.BpmnAutoLayout;
|
import org.activiti.bpmn.BpmnAutoLayout;
|
||||||
import org.activiti.bpmn.converter.BpmnXMLConverter;
|
import org.activiti.bpmn.converter.BpmnXMLConverter;
|
||||||
@@ -71,79 +73,6 @@ public class ProcessServiceImpl implements ProcessService {
|
|||||||
private ActGeBytearrayMapper actGeBytearrayMapper;
|
private ActGeBytearrayMapper actGeBytearrayMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private LawsProcessNodeOriginMapper processNodeOriginMapper;
|
private LawsProcessNodeOriginMapper processNodeOriginMapper;
|
||||||
@Override
|
|
||||||
public Object addTask(String processDefinitionId, String assignee) {
|
|
||||||
final BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
|
|
||||||
Process process = bpmnModel.getMainProcess();
|
|
||||||
Collection<FlowElement> flowElements = process.getFlowElements();
|
|
||||||
for (FlowElement flowElement : flowElements) {
|
|
||||||
if (flowElement instanceof UserTask) {
|
|
||||||
UserTask userTask = (UserTask)flowElement;
|
|
||||||
System.out.println(userTask.getId() + ":" + userTask.getName());
|
|
||||||
}
|
|
||||||
if (flowElement instanceof SequenceFlow) {
|
|
||||||
SequenceFlow sequenceFlow = (SequenceFlow)flowElement;
|
|
||||||
System.out.println(sequenceFlow.getId() + ":" + sequenceFlow.getName());
|
|
||||||
}
|
|
||||||
if (flowElement instanceof ExclusiveGateway) {
|
|
||||||
ExclusiveGateway gateway = (ExclusiveGateway)flowElement;
|
|
||||||
System.out.println(gateway.getId() + ":" + gateway.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//process.removeFlowElement("add");//移除最终节点连线
|
|
||||||
//process.removeFlowElement("sequenceFlow-5d7e3faa-6c00-4010-8485-fe79c286448b");//移除最终节点连线
|
|
||||||
//process.removeFlowElement("sequenceFlow-aba52ded-835d-4863-b303-1b9771ae93cf");//移除最终节点连线
|
|
||||||
//process.addFlowElement(createSequenceFlow("Activity_0m576ex", "Event_17e1txx"));//新增节点 于原节点连线
|
|
||||||
//process.removeFlowElement("Flow_0stcykp");//移除最终节点连线
|
|
||||||
//process.addFlowElement(createUserTask("First task", "fred"));//新增节点
|
|
||||||
//process.addFlowElement(createSequenceFlow("Activity_0m576ex", "add"));//新增节点 于原节点连线
|
|
||||||
//process.addFlowElement(createSequenceFlow("add", "Event_17e1txx"));//新增节点 于原节点连线
|
|
||||||
//重新绘画图形
|
|
||||||
BpmnAutoLayout bpmnAutoLayout = new BpmnAutoLayout(bpmnModel);
|
|
||||||
bpmnAutoLayout.execute();
|
|
||||||
BpmnXMLConverter converter = new BpmnXMLConverter();
|
|
||||||
//把bpmnModel对象转换成字符
|
|
||||||
byte[] bytes = converter.convertToXML(bpmnModel);
|
|
||||||
//清除缓存
|
|
||||||
ProcessEngineConfigurationImpl configuration = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration();
|
|
||||||
DeploymentManager deploymentManager = configuration.getDeploymentManager();
|
|
||||||
deploymentManager.getProcessDefinitionCache().remove(processDefinitionId);
|
|
||||||
|
|
||||||
// List<ActGeBytearray> actGeBytearrayList = actGeBytearrayMapper.getActGeBytearrayList(userTask.getProcessDefinitionId());
|
|
||||||
// actGeBytearrayList = actGeBytearrayList.stream().filter(item -> item.getName().endsWith(".bpmn")).peek(item -> {
|
|
||||||
// item.setBytes(bytes);
|
|
||||||
// }).collect(Collectors.toList());
|
|
||||||
// if (ObjectUtils.isNotEmpty(actGeBytearrayList)) {
|
|
||||||
// actGeBytearrayMapper.updateById(actGeBytearrayList.get(0));
|
|
||||||
// }
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
protected static UserTask createUserTask(String name, String assignee) {
|
|
||||||
UserTask userTask = new UserTask();
|
|
||||||
userTask.setName(name);
|
|
||||||
userTask.setId("Activity_"+UUID.randomUUID());
|
|
||||||
userTask.setAssignee(assignee);
|
|
||||||
return userTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static SequenceFlow createSequenceFlow(String from, String to) {
|
|
||||||
SequenceFlow flow = new SequenceFlow();
|
|
||||||
flow.setSourceRef(from);
|
|
||||||
flow.setTargetRef(to);
|
|
||||||
flow.setId("Flow_"+ UUID.randomUUID());
|
|
||||||
return flow;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static ExclusiveGateway createGateway(List<SequenceFlow> incomingFlows, List<SequenceFlow> outgoingFlows) {
|
|
||||||
ExclusiveGateway gateway = new ExclusiveGateway();
|
|
||||||
gateway.setId("Gateway_"+ UUID.randomUUID());
|
|
||||||
gateway.setIncomingFlows(incomingFlows);
|
|
||||||
gateway.setOutgoingFlows(outgoingFlows);
|
|
||||||
return gateway;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> getHighLightedFlows(BpmnModel bpmnModel, ProcessDefinitionEntity processDefinitionEntity, List<HistoricActivityInstance> historicActivityInstances) {
|
private List<String> getHighLightedFlows(BpmnModel bpmnModel, ProcessDefinitionEntity processDefinitionEntity, List<HistoricActivityInstance> historicActivityInstances) {
|
||||||
// 高亮流程已发生流转的线id集合
|
// 高亮流程已发生流转的线id集合
|
||||||
@@ -254,142 +183,6 @@ public class ProcessServiceImpl implements ProcessService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getNodeList(String processDefinitionId) {
|
|
||||||
final BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
|
|
||||||
Process process = bpmnModel.getMainProcess();
|
|
||||||
Collection<FlowElement> flowElements = process.getFlowElements();
|
|
||||||
List<LawsProcessNodeOrigin> processNodeOriginList = new ArrayList<>();
|
|
||||||
int sort = 1;
|
|
||||||
List<String> gatewayIdList = new ArrayList<>();
|
|
||||||
processNodeOriginList = handlerLawsProcessNodeOrigin(flowElements,sort,gatewayIdList,processDefinitionId);
|
|
||||||
//for (FlowElement flowElement : flowElements) {
|
|
||||||
// LawsProcessNodeOrigin processNodeOrigin = new LawsProcessNodeOrigin();
|
|
||||||
//
|
|
||||||
// String nodeName = processNodeOrigin.getNodeName();
|
|
||||||
// String nodeType = processNodeOrigin.getNodeType();
|
|
||||||
// String xmlNodeId = processNodeOrigin.getXmlNodeId();
|
|
||||||
// String xmlSourceRef = processNodeOrigin.getXmlSourceRef();
|
|
||||||
// String xmlTargetRef = processNodeOrigin.getXmlTargetRef();
|
|
||||||
// if (flowElement instanceof UserTask) {
|
|
||||||
// UserTask userTask = (UserTask)flowElement;
|
|
||||||
// nodeType = "userTask";
|
|
||||||
// nodeName = userTask.getName();
|
|
||||||
// xmlNodeId = userTask.getId();
|
|
||||||
// }else
|
|
||||||
// if (flowElement instanceof SequenceFlow) {
|
|
||||||
// SequenceFlow sequenceFlow = (SequenceFlow)flowElement;
|
|
||||||
// nodeType = "sequenceFlow";
|
|
||||||
// nodeName = sequenceFlow.getName();
|
|
||||||
// xmlNodeId = sequenceFlow.getId();
|
|
||||||
// xmlSourceRef = sequenceFlow.getSourceRef();
|
|
||||||
// xmlTargetRef = sequenceFlow.getTargetRef();
|
|
||||||
// }else
|
|
||||||
// if (flowElement instanceof ExclusiveGateway) {
|
|
||||||
// ExclusiveGateway gateway = (ExclusiveGateway)flowElement;
|
|
||||||
// nodeType = "gateway";
|
|
||||||
// nodeName = gateway.getName();
|
|
||||||
// xmlNodeId = gateway.getId();
|
|
||||||
// gatewayIdList.add(xmlNodeId);
|
|
||||||
// }else
|
|
||||||
// if (flowElement instanceof SubProcess) {
|
|
||||||
// SubProcess subProcess = (SubProcess)flowElement;
|
|
||||||
// Collection<FlowElement> flowElements1 = subProcess.getFlowElements();
|
|
||||||
//
|
|
||||||
// nodeType = "subProcess";
|
|
||||||
// nodeName = subProcess.getName();
|
|
||||||
// xmlNodeId = subProcess.getId();
|
|
||||||
// gatewayIdList.add(xmlNodeId);
|
|
||||||
// }else {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// processNodeOrigin.setProcessDefinitionId(processDefinitionId);
|
|
||||||
// processNodeOrigin.setNodeName(nodeName);
|
|
||||||
// processNodeOrigin.setNodeType(nodeType);
|
|
||||||
// processNodeOrigin.setXmlNodeId(xmlNodeId);
|
|
||||||
// processNodeOrigin.setXmlSourceRef(xmlSourceRef);
|
|
||||||
// processNodeOrigin.setXmlTargetRef(xmlTargetRef);
|
|
||||||
// processNodeOrigin.setSort(sort++);
|
|
||||||
// processNodeOrigin.setIsApprovalNode(YesOrNoEnum.NO.getInteger());
|
|
||||||
// processNodeOrigin.setIsCanDeleted(YesOrNoEnum.NO.getInteger());
|
|
||||||
// processNodeOriginList.add(processNodeOrigin);
|
|
||||||
//}
|
|
||||||
List<String> approvalNodeIdList = processNodeOriginList.stream()
|
|
||||||
.filter(item -> gatewayIdList.contains(item.getXmlTargetRef()))
|
|
||||||
.map(LawsProcessNodeOrigin::getXmlSourceRef)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
for (LawsProcessNodeOrigin processNodeOrigin : processNodeOriginList) {
|
|
||||||
String xmlNodeId = processNodeOrigin.getXmlNodeId();
|
|
||||||
if (approvalNodeIdList.contains(xmlNodeId) ){
|
|
||||||
processNodeOrigin.setIsApprovalNode(YesOrNoEnum.YES.getInteger());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
processNodeOriginMapper.insertList(processNodeOriginList);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<LawsProcessNodeOrigin> handlerLawsProcessNodeOrigin(
|
|
||||||
Collection<FlowElement> flowElements,
|
|
||||||
int sort,
|
|
||||||
List<String> gatewayIdList,
|
|
||||||
String processDefinitionId) {
|
|
||||||
List<LawsProcessNodeOrigin> processNodeOriginList = new ArrayList<>();
|
|
||||||
for (FlowElement flowElement : flowElements) {
|
|
||||||
LawsProcessNodeOrigin processNodeOrigin = new LawsProcessNodeOrigin();
|
|
||||||
|
|
||||||
String nodeName = processNodeOrigin.getNodeName();
|
|
||||||
String nodeType = processNodeOrigin.getNodeType();
|
|
||||||
String xmlNodeId = processNodeOrigin.getXmlNodeId();
|
|
||||||
String xmlSourceRef = processNodeOrigin.getXmlSourceRef();
|
|
||||||
String xmlTargetRef = processNodeOrigin.getXmlTargetRef();
|
|
||||||
if (flowElement instanceof UserTask) {
|
|
||||||
UserTask userTask = (UserTask) flowElement;
|
|
||||||
nodeType = "userTask";
|
|
||||||
nodeName = userTask.getName();
|
|
||||||
xmlNodeId = userTask.getId();
|
|
||||||
} else if (flowElement instanceof SequenceFlow) {
|
|
||||||
SequenceFlow sequenceFlow = (SequenceFlow) flowElement;
|
|
||||||
nodeType = "sequenceFlow";
|
|
||||||
nodeName = sequenceFlow.getName();
|
|
||||||
xmlNodeId = sequenceFlow.getId();
|
|
||||||
xmlSourceRef = sequenceFlow.getSourceRef();
|
|
||||||
xmlTargetRef = sequenceFlow.getTargetRef();
|
|
||||||
} else if (flowElement instanceof ExclusiveGateway) {
|
|
||||||
ExclusiveGateway gateway = (ExclusiveGateway) flowElement;
|
|
||||||
nodeType = "gateway";
|
|
||||||
nodeName = gateway.getName();
|
|
||||||
xmlNodeId = gateway.getId();
|
|
||||||
gatewayIdList.add(xmlNodeId);
|
|
||||||
} else if (flowElement instanceof SubProcess) {
|
|
||||||
SubProcess subProcess = (SubProcess) flowElement;
|
|
||||||
Collection<FlowElement> flowElements1 = subProcess.getFlowElements();
|
|
||||||
List<LawsProcessNodeOrigin> processNodeOrigins = handlerLawsProcessNodeOrigin(flowElements1, sort, gatewayIdList, processDefinitionId);
|
|
||||||
processNodeOriginList.addAll(processNodeOrigins);
|
|
||||||
nodeType = "subProcess";
|
|
||||||
nodeName = subProcess.getName();
|
|
||||||
xmlNodeId = subProcess.getId();
|
|
||||||
} else if (flowElement instanceof EndEvent) {
|
|
||||||
EndEvent endEvent = (EndEvent) flowElement;
|
|
||||||
nodeType = "endEvent";
|
|
||||||
nodeName = endEvent.getName();
|
|
||||||
xmlNodeId = endEvent.getId();
|
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
processNodeOrigin.setProcessDefinitionId(processDefinitionId);
|
|
||||||
processNodeOrigin.setNodeName(nodeName);
|
|
||||||
processNodeOrigin.setNodeType(nodeType);
|
|
||||||
processNodeOrigin.setXmlNodeId(xmlNodeId);
|
|
||||||
processNodeOrigin.setXmlSourceRef(xmlSourceRef);
|
|
||||||
processNodeOrigin.setXmlTargetRef(xmlTargetRef);
|
|
||||||
processNodeOrigin.setSort(sort++);
|
|
||||||
processNodeOrigin.setIsApprovalNode(YesOrNoEnum.NO.getInteger());
|
|
||||||
processNodeOrigin.setIsCanDeleted(YesOrNoEnum.NO.getInteger());
|
|
||||||
processNodeOriginList.add(processNodeOrigin);
|
|
||||||
}
|
|
||||||
return processNodeOriginList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取流程图像,已执行节点和流程线高亮显示
|
* 获取流程图像,已执行节点和流程线高亮显示
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.jero.modules.activiti.vo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author liJiaRao
|
||||||
|
* @date 2023-09-26 15:30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AddTaskVO {
|
||||||
|
/**
|
||||||
|
* 流程定义id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "流程定义id")
|
||||||
|
private String processDefinitionId;
|
||||||
|
/**
|
||||||
|
* xml节点Id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "xml节点Id")
|
||||||
|
private String xmlNodeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 节点名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "node_name")
|
||||||
|
@ApiModelProperty(value = "节点名称")
|
||||||
|
private String nodeName;
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.jero.modules.activiti.vo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*流程节点关联用户部门表
|
||||||
|
*@author liJiaRao
|
||||||
|
*@date 2023-09-26 15:12
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class LawsProcessNodeLinkVO {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "主键id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程节点id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "流程节点id")
|
||||||
|
private String processNodeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型(1-用户、2-部门)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "类型(1-用户、2-部门)")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id,部门id)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "用户id,部门id)")
|
||||||
|
private String userDepartId;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user