处理流程高亮时的问题

This commit is contained in:
wanggeng 2021-09-26 10:43:13 +08:00
parent ec72a2c181
commit 7c624e7482
2 changed files with 28 additions and 5 deletions

View File

@ -185,13 +185,17 @@ public class ActivitiModelServiceImpl extends DefaultBaseService implements IAct
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId); BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
//获取流程实例当前的节点需要高亮显示 //获取流程实例当前的节点需要高亮显示
List<String> highLightedActivitiIds = Collections.EMPTY_LIST; List<String> highLightedActivitiIds = new ArrayList<>();
if (processInstance != null) { if (processInstance != null) {
highLightedActivitiIds = runtimeService.getActiveActivityIds(processInstance.getId()); List<String> activeActivityIds = runtimeService.getActiveActivityIds(processInstance.getId());
highLightedActivitiIds.addAll(activeActivityIds);
// 获取历史节点 // 获取历史节点
List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).list(); List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).list();
if (!historicActivityInstances.isEmpty()) { if (!historicActivityInstances.isEmpty()) {
for (HistoricActivityInstance historicActivityInstance : historicActivityInstances) { for (HistoricActivityInstance historicActivityInstance : historicActivityInstances) {
if (isActiveActivityId(historicActivityInstance.getActivityId(), activeActivityIds)) {
continue;
}
highLightedActivitiIds.add("#" + historicActivityInstance.getActivityId()); highLightedActivitiIds.add("#" + historicActivityInstance.getActivityId());
} }
} }
@ -202,6 +206,25 @@ public class ActivitiModelServiceImpl extends DefaultBaseService implements IAct
fontName, fontName, fontName, null, 1D); fontName, fontName, fontName, null, 1D);
} }
/**
* 判断历史节点是否是激活节点
*
* @param historyActivityId
* @param activeActivityIds
* @return
*/
private boolean isActiveActivityId(String historyActivityId, List<String> activeActivityIds) {
if (activeActivityIds == null || activeActivityIds.isEmpty()) {
return false;
}
for (String activeActivityId : activeActivityIds) {
if (StringUtils.equals(historyActivityId, activeActivityId)) {
return true;
}
}
return false;
}
/** /**
* 序列流列表 * 序列流列表
* *

View File

@ -52,8 +52,8 @@ public class CustomProcessDiagramCanvas {
protected static Color EVENT_COLOR = new Color(255, 255, 255); protected static Color EVENT_COLOR = new Color(255, 255, 255);
protected static Color CONNECTION_COLOR = new Color(88, 88, 88); protected static Color CONNECTION_COLOR = new Color(88, 88, 88);
protected static Color CONDITIONAL_INDICATOR_COLOR = new Color(255, 255, 255); protected static Color CONDITIONAL_INDICATOR_COLOR = new Color(255, 255, 255);
protected static Color HIGHLIGHT_COLOR = new Color(255, 87, 34); protected static Color HIGHLIGHT_COLOR = new Color(255, 0, 0);
protected static Color HIGHLIGHT_HISTORY_COLOR = new Color(0, 150, 136); protected static Color HIGHLIGHT_HISTORY_COLOR = new Color(0, 255, 0);
protected static Color LABEL_COLOR = Color.BLACK; // new Color(112, 146, 190); protected static Color LABEL_COLOR = Color.BLACK; // new Color(112, 146, 190);
protected static Color TASK_BORDER_COLOR = new Color(187, 187, 187); protected static Color TASK_BORDER_COLOR = new Color(187, 187, 187);
protected static Color EVENT_BORDER_COLOR = new Color(88, 88, 88); protected static Color EVENT_BORDER_COLOR = new Color(88, 88, 88);
@ -64,7 +64,7 @@ public class CustomProcessDiagramCanvas {
protected static Font ANNOTATION_FONT = null; protected static Font ANNOTATION_FONT = null;
// Strokes // Strokes
protected static Stroke THICK_TASK_BORDER_STROKE = new BasicStroke(2.0f); protected static Stroke THICK_TASK_BORDER_STROKE = new BasicStroke(3.0f);
protected static Stroke GATEWAY_TYPE_STROKE = new BasicStroke(3.0f); protected static Stroke GATEWAY_TYPE_STROKE = new BasicStroke(3.0f);
protected static Stroke END_EVENT_STROKE = new BasicStroke(3.0f); protected static Stroke END_EVENT_STROKE = new BasicStroke(3.0f);
protected static Stroke MULTI_INSTANCE_STROKE = new BasicStroke(1.3f); protected static Stroke MULTI_INSTANCE_STROKE = new BasicStroke(1.3f);