mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-10 21:19:00 +08:00
🔥 删除json流程转bpmn 图片
This commit is contained in:
1 parent
932c4ec1f4
commit
1c68bc0661
5 files changed
-105
No files matched your search
-71
@@ -107,77 +107,6 @@ public class EngineFlowController {
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/showImg")
|
||||
public R showImg(String procInsId) {
|
||||
|
||||
String procDefId;
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
|
||||
.processInstanceId(procInsId)
|
||||
.singleResult();
|
||||
if (processInstance == null) {
|
||||
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(procInsId)
|
||||
.singleResult();
|
||||
procDefId = historicProcessInstance.getProcessDefinitionId();
|
||||
|
||||
}
|
||||
else {
|
||||
procDefId = processInstance.getProcessDefinitionId();
|
||||
}
|
||||
|
||||
// 使用流程实例ID,查询正在执行的执行对象表,返回流程实例对象
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(procDefId);
|
||||
|
||||
// 创建默认的流程图生成器
|
||||
DefaultProcessDiagramGenerator defaultProcessDiagramGenerator = new DefaultProcessDiagramGenerator();
|
||||
// 生成图片的类型
|
||||
String imageType = "png";
|
||||
// 高亮节点集合
|
||||
List<String> highLightedActivities = new ArrayList<>();
|
||||
// 高亮连线集合
|
||||
List<String> highLightedFlows = new ArrayList<>();
|
||||
// 查询所有历史节点信息
|
||||
List<HistoricActivityInstance> hisActInsList = historyService.createHistoricActivityInstanceQuery()
|
||||
.processInstanceId(procInsId)
|
||||
.list();
|
||||
|
||||
// 遍历
|
||||
hisActInsList.forEach(historicActivityInstance -> {
|
||||
if ("sequenceFlow".equals(historicActivityInstance.getActivityType())) {
|
||||
// 添加高亮连线
|
||||
highLightedFlows.add(historicActivityInstance.getActivityId());
|
||||
}
|
||||
else {
|
||||
// 添加高亮节点
|
||||
highLightedActivities.add(historicActivityInstance.getActivityId());
|
||||
}
|
||||
});
|
||||
// 节点字体
|
||||
String activityFontName = "宋体";
|
||||
// 连线标签字体
|
||||
String labelFontName = "微软雅黑";
|
||||
// 连线标签字体
|
||||
String annotationFontName = "宋体";
|
||||
// 类加载器
|
||||
ClassLoader customClassLoader = null;
|
||||
// 比例因子,默认即可
|
||||
double scaleFactor = 1.0d;
|
||||
// 不设置连线标签不会画
|
||||
boolean drawSequenceFlowNameWithNoLabelDI = true;
|
||||
|
||||
BpmnAutoLayout bpmnAutoLayout = new BpmnAutoLayout(bpmnModel);
|
||||
bpmnAutoLayout.setTaskHeight(120);
|
||||
bpmnAutoLayout.setTaskWidth(120);
|
||||
bpmnAutoLayout.execute();
|
||||
// 生成图片
|
||||
InputStream inputStream = defaultProcessDiagramGenerator.generateDiagram(bpmnModel, imageType,
|
||||
highLightedActivities, highLightedFlows, activityFontName, labelFontName, annotationFontName, null,
|
||||
scaleFactor, drawSequenceFlowNameWithNoLabelDI); // 获取输入流
|
||||
|
||||
String content = Base64.encode(inputStream);
|
||||
return R.ok(content);
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批任务
|
||||
* @param taskId 任务ID
|
||||
|
||||
-7
@@ -115,13 +115,6 @@ public interface RemoteFlowEngineService {
|
||||
@PostMapping("/task/delegateTask")
|
||||
R<String> delegateTask(@RequestBody TaskParamDto taskParamDto);
|
||||
|
||||
/**
|
||||
* 显示流程图
|
||||
* @param procInsId 流程实例ID
|
||||
* @return 流程图地址
|
||||
*/
|
||||
@GetMapping("/flow/showImg")
|
||||
R<String> showImg(@RequestParam("procInsId") String procInsId);
|
||||
|
||||
/**
|
||||
* 查询任务
|
||||
|
||||
-12
@@ -74,18 +74,6 @@ public class ProcessInstanceController {
|
||||
return processInstanceService.queryMineCC(taskQueryParamDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示流程图
|
||||
* @param procInsId
|
||||
* @return
|
||||
*/
|
||||
|
||||
@SneakyThrows
|
||||
@GetMapping("showImg")
|
||||
public R showImg(String procInsId) {
|
||||
return processInstanceService.showImg(procInsId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化流程显示
|
||||
* @param nodeFormatParamVo
|
||||
|
||||
-6
@@ -52,12 +52,6 @@ public interface IProcessInstanceService {
|
||||
*/
|
||||
R queryMineCC(TaskQueryParamDto taskQueryParamDto);
|
||||
|
||||
/**
|
||||
* 显示流程实例图片
|
||||
* @param procInsId
|
||||
* @return
|
||||
*/
|
||||
R showImg(String procInsId);
|
||||
|
||||
/**
|
||||
* 格式化流程显示
|
||||
|
||||
-9
@@ -289,15 +289,6 @@ public class ProcessInstanceServiceImpl implements IProcessInstanceService {
|
||||
return R.ok(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示流程实例图片
|
||||
* @param procInsId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public R showImg(String procInsId) {
|
||||
return flowEngineService.showImg(procInsId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化流程显示
|
||||
|
||||
Reference in new issue
Block a user