diff --git a/common/common-flow/src/main/java/apelet/common/flow/constant/FlowConstant.java b/common/common-flow/src/main/java/apelet/common/flow/constant/FlowConstant.java
index faaf71c..6c4dc8f 100644
--- a/common/common-flow/src/main/java/apelet/common/flow/constant/FlowConstant.java
+++ b/common/common-flow/src/main/java/apelet/common/flow/constant/FlowConstant.java
@@ -39,6 +39,13 @@ public class FlowConstant {
public static final String SUBMIT_USER_VAR = "submitUser";
/**
+ * 标题模板里未解析占位符的起始标记。
+ *
resolveTitle 对"占位符取不到值"是静默处理的 —— 不删不报错,把 ${xxx} 原样留在标题里
+ * (最常见的原因是该实例的业务数据已经不存在了)。写入标题时据此打 title_incomplete 标记。
+ */
+ public static final String TITLE_PLACEHOLDER_PREFIX = "${";
+
+ /**
* 多任务拒绝数量变量。
*/
public static final String MULTI_REFUSE_COUNT_VAR = "multiRefuseCount";
diff --git a/common/common-flow/src/main/java/apelet/common/flow/controller/FlowOperationController.java b/common/common-flow/src/main/java/apelet/common/flow/controller/FlowOperationController.java
index 4b39b89..d6ac6aa 100644
--- a/common/common-flow/src/main/java/apelet/common/flow/controller/FlowOperationController.java
+++ b/common/common-flow/src/main/java/apelet/common/flow/controller/FlowOperationController.java
@@ -853,18 +853,6 @@ public class FlowOperationController {
// 节点标题按实例批量预载(一次 IN 查询覆盖整页),避免逐行查询造成 N+1。
Map taskInstanceExtMap =
flowTaskInstanceExtService.getMapByProcessInstanceIds(instanceIdSet);
- Set processDefinitionIdSet = taskInstanceList.stream()
- .map(HistoricTaskInstance::getProcessDefinitionId).collect(Collectors.toSet());
- List flowEntryPublishList =
- flowEntryService.getFlowEntryPublishList(processDefinitionIdSet);
- Map flowEntryPublishMap =
- flowEntryPublishList.stream().collect(Collectors.toMap(FlowEntryPublish::getProcessDefinitionId, c -> c));
- Set entryIdSet = flowEntryPublishList.stream()
- .map(FlowEntryPublish::getEntryId).filter(Objects::nonNull).collect(Collectors.toSet());
- Map flowEntryMap = flowEntryService.listByIds(entryIdSet).stream()
- .collect(Collectors.toMap(FlowEntry::getEntryId, e -> e));
- Map flowTaskExtMap = flowTaskExtService.getByProcessDefinitionId(processDefinitionIdSet).stream()
- .collect(Collectors.toMap(t -> t.getProcessDefinitionId() + ":" + t.getTaskId(), t -> t, (k1, k2) -> k1));
resultList.forEach(result -> {
String instanceId = result.get(INSTANCE_ID).toString();
HistoricProcessInstance instance = instanceMap.get(instanceId);
@@ -878,19 +866,11 @@ public class FlowOperationController {
FlowWorkOrder flowWorkOrder = workOrderMap.get(instanceId);
if (flowWorkOrder != null) {
result.put("workOrderCode", flowWorkOrder.getWorkOrderCode());
- String processDefinitionId = result.get("processDefinitionId").toString();
- FlowEntryPublish flowEntryPublish = flowEntryPublishMap.get(processDefinitionId);
- FlowTaskExt flowTaskExt = flowTaskExtMap.get(
- processDefinitionId + ":" + result.get("taskDefinitionKey"));
- if (flowEntryPublish != null && flowTaskExt != null) {
- FlowEntry flowEntry = flowEntryMap.get(flowEntryPublish.getEntryId());
- if (flowEntry != null) {
- Object taskDefinitionKey = result.get("taskDefinitionKey");
- String taskKey = taskDefinitionKey == null ? null : taskDefinitionKey.toString();
- result.put("title", flowApiService.resolveTitleCached(flowWorkOrder, taskKey,
- taskKey == null ? null : taskInstanceExtMap.get(instanceId + ":" + taskKey)));
- }
- }
+ // 标题只认 zz_flow_task_instance_ext 的落库值:没有标题行就是空
+ Object taskDefinitionKey = result.get("taskDefinitionKey");
+ String taskKey = taskDefinitionKey == null ? null : taskDefinitionKey.toString();
+ result.put("title", flowApiService.resolveTitleCached(flowWorkOrder, taskKey,
+ taskKey == null ? null : taskInstanceExtMap.get(instanceId + ":" + taskKey)));
}
});
Set taskIdSet =
@@ -949,22 +929,11 @@ public class FlowOperationController {
Map taskInstanceExtMap = flowTaskInstanceExtService.getMapByProcessInstanceIds(instanceIdSet);
Set processDefinitionIdSet = pageData.getDataList().stream()
.map(HistoricProcessInstance::getProcessDefinitionId).collect(Collectors.toSet());
- Map flowEntryPublishMap = new HashMap<>();
- Map flowEntryMap = new HashMap<>();
- Map flowTaskExtMap = new HashMap<>();
- // 流程实例列表使用起始节点的标题模板。
+ // 流程实例列表使用起始节点的标题,首节点 taskKey 存在发布版本的 initTaskInfo 里。
Map initTaskKeyMap = new HashMap<>();
if (CollUtil.isNotEmpty(processDefinitionIdSet)) {
List flowEntryPublishList =
flowEntryService.getFlowEntryPublishList(processDefinitionIdSet);
- flowEntryPublishMap.putAll(flowEntryPublishList.stream()
- .collect(Collectors.toMap(FlowEntryPublish::getProcessDefinitionId, c -> c)));
- Set entryIdSet = flowEntryPublishList.stream()
- .map(FlowEntryPublish::getEntryId).filter(Objects::nonNull).collect(Collectors.toSet());
- if (CollUtil.isNotEmpty(entryIdSet)) {
- flowEntryMap.putAll(flowEntryService.listByIds(entryIdSet).stream()
- .collect(Collectors.toMap(FlowEntry::getEntryId, e -> e)));
- }
for (FlowEntryPublish flowEntryPublish : flowEntryPublishList) {
TaskInfoVo initTaskInfo = StrUtil.isBlank(flowEntryPublish.getInitTaskInfo())
? null : JSON.parseObject(flowEntryPublish.getInitTaskInfo(), TaskInfoVo.class);
@@ -972,8 +941,6 @@ public class FlowOperationController {
initTaskKeyMap.put(flowEntryPublish.getProcessDefinitionId(), initTaskInfo.getTaskKey());
}
}
- flowTaskExtMap.putAll(flowTaskExtService.getByProcessDefinitionId(processDefinitionIdSet).stream()
- .collect(Collectors.toMap(t -> t.getProcessDefinitionId() + ":" + t.getTaskId(), t -> t, (k1, k2) -> k1)));
}
List