修审批界面无法审批:候选人式审批任务在待办全不可见(dogfooding)
根因二连: 1) TodoAggregator candidateUser 传 null → 客户 BPMN 用 candidateUsers(候选人解析把当前用户 设为候选用户、assignee 空)的任务全部漏查。改传 userId(我的待办=指派∪组候选∪用户候选)。 2) 保真层从 CHAR(36) 列取的短 user id(如 ADMIN)带空格补白,flowable taskCandidateUser 精确 匹配不到 → 候选任务不可见。com.eip4 包装 TrimmingCandidateUsersHandler trim 候选 id(不改保真层)。 附:flowable-service start 命名流程未部署→回退默认审批(dev 无客户 BPMN 仍走通审批闭环)。 实证:真实通知提交审批→公司通知任务自动现身 admin 待办(UI 4 条,办理→同意可用)。TodoAggregatorTest 5 测。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -45,7 +45,10 @@ public class TodoAggregator {
|
||||
* @param candidateGroups 候选组(JWT roles 驱动的候选组待办)
|
||||
*/
|
||||
public List<TodoItem> todo(String userId, List<String> candidateGroups, int firstResult, int maxResults) {
|
||||
List<FlowTaskDto> tasks = flowableClient.todo(userId, candidateGroups, null, firstResult, maxResults);
|
||||
// candidateUser=userId:客户审批 BPMN 普遍用 candidateUsers(候选人解析把当前用户设为候选用户、
|
||||
// assignee 留空)。原传 null 漏掉这一维度 → 候选人式审批任务在待办里全不可见 → 看似"无法审批"。
|
||||
// 我的待办 = 指派给我的 ∪ 我(组)候选的 ∪ 我(用户)候选的(flowable-service todo OR 块承接)。
|
||||
List<FlowTaskDto> tasks = flowableClient.todo(userId, candidateGroups, userId, firstResult, maxResults);
|
||||
return aggregate(tasks);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.isNull;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.List;
|
||||
@@ -126,7 +125,7 @@ class PageTemplateMappingTest {
|
||||
|
||||
@Test
|
||||
void 聚合_有模板条目pageUrl正确填充() {
|
||||
when(flowableClient.todo(eq("U1"), any(), isNull(), anyInt(), anyInt()))
|
||||
when(flowableClient.todo(eq("U1"), any(), eq("U1"), anyInt(), anyInt()))
|
||||
.thenReturn(List.of(task("T1", "BK-1")));
|
||||
when(businessSummaryService.summarize("BK-1"))
|
||||
.thenReturn(new BusinessSummaryService.Summary("PM_PAYMENTAPPLY", Map.of("TITLE", "付款单")));
|
||||
@@ -144,7 +143,7 @@ class PageTemplateMappingTest {
|
||||
|
||||
@Test
|
||||
void 聚合_无模板映射_pageUrl为null且reason含表名() {
|
||||
when(flowableClient.todo(eq("U1"), any(), isNull(), anyInt(), anyInt()))
|
||||
when(flowableClient.todo(eq("U1"), any(), eq("U1"), anyInt(), anyInt()))
|
||||
.thenReturn(List.of(task("T2", "BK-2")));
|
||||
when(businessSummaryService.summarize("BK-2"))
|
||||
.thenReturn(new BusinessSummaryService.Summary("OA_UNKNOWN_TABLE", Map.of()));
|
||||
@@ -162,7 +161,7 @@ class PageTemplateMappingTest {
|
||||
|
||||
@Test
|
||||
void 聚合_businessTable为null_pageUrl为null且reason含提示() {
|
||||
when(flowableClient.todo(eq("U1"), any(), isNull(), anyInt(), anyInt()))
|
||||
when(flowableClient.todo(eq("U1"), any(), eq("U1"), anyInt(), anyInt()))
|
||||
.thenReturn(List.of(task("T3", "BK-MISSING")));
|
||||
when(businessSummaryService.summarize("BK-MISSING"))
|
||||
.thenReturn(BusinessSummaryService.Summary.EMPTY);
|
||||
@@ -179,7 +178,7 @@ class PageTemplateMappingTest {
|
||||
|
||||
@Test
|
||||
void 聚合_有模板与无模板条目共存_优雅降级() {
|
||||
when(flowableClient.todo(eq("U1"), any(), isNull(), anyInt(), anyInt()))
|
||||
when(flowableClient.todo(eq("U1"), any(), eq("U1"), anyInt(), anyInt()))
|
||||
.thenReturn(List.of(task("T4", "BK-4"), task("T5", "BK-5")));
|
||||
when(businessSummaryService.summarize("BK-4"))
|
||||
.thenReturn(new BusinessSummaryService.Summary("PM_PAYMENTAPPLY", Map.of("TITLE", "付款单")));
|
||||
|
||||
@@ -4,7 +4,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.isNull;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.List;
|
||||
@@ -51,7 +50,7 @@ class TodoAggregatorTest {
|
||||
|
||||
@Test
|
||||
void 待办拼接业务摘要_businessKey连到业务表标题字段() {
|
||||
when(flowableClient.todo(eq("U1"), any(), isNull(), anyInt(), anyInt()))
|
||||
when(flowableClient.todo(eq("U1"), any(), eq("U1"), anyInt(), anyInt()))
|
||||
.thenReturn(List.of(task("T1", "BK-1")));
|
||||
when(businessSummaryService.summarize("BK-1"))
|
||||
.thenReturn(new BusinessSummaryService.Summary("ORDER_ENTITY", Map.of("TITLE", "某交底单")));
|
||||
@@ -69,7 +68,7 @@ class TodoAggregatorTest {
|
||||
|
||||
@Test
|
||||
void 待办摘要拼不到_优雅降级为仅流程字段() {
|
||||
when(flowableClient.todo(eq("U1"), any(), isNull(), anyInt(), anyInt()))
|
||||
when(flowableClient.todo(eq("U1"), any(), eq("U1"), anyInt(), anyInt()))
|
||||
.thenReturn(List.of(task("T2", "BK-MISSING")));
|
||||
when(businessSummaryService.summarize("BK-MISSING"))
|
||||
.thenReturn(BusinessSummaryService.Summary.EMPTY);
|
||||
@@ -99,9 +98,20 @@ class TodoAggregatorTest {
|
||||
assertThat(items.get(0).businessTable).isEqualTo("ORDER_ENTITY");
|
||||
}
|
||||
|
||||
@Test
|
||||
void 待办查询_候选用户维度传当前userId_候选人式审批任务可见() {
|
||||
// 根因(dogfooding):客户审批 BPMN 用 candidateUsers(候选人解析器把当前用户设为候选用户,
|
||||
// assignee 为空),原实现 candidateUser 传 null → 候选人式任务全不可见 → 审批界面没任务=无法审批。
|
||||
org.mockito.ArgumentCaptor<String> candUser = org.mockito.ArgumentCaptor.forClass(String.class);
|
||||
when(flowableClient.todo(eq("U1"), any(), candUser.capture(), anyInt(), anyInt()))
|
||||
.thenReturn(List.of());
|
||||
aggregator.todo("U1", List.of("ROLE_A"), 0, 50);
|
||||
assertThat(candUser.getValue()).isEqualTo("U1");
|
||||
}
|
||||
|
||||
@Test
|
||||
void 空待办列表返回空聚合() {
|
||||
when(flowableClient.todo(any(), any(), isNull(), anyInt(), anyInt())).thenReturn(List.of());
|
||||
when(flowableClient.todo(any(), any(), any(), anyInt(), anyInt())).thenReturn(List.of());
|
||||
assertThat(aggregator.todo("U1", List.of(), 0, 50)).isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user