F1-7: 修待办查询 AND→OR 语义缺陷 + 请求头上限缓解
- FlowController /tasks/todo: candidateGroup 改 List 多值绑定;assignee 与候选维度 同传时 or() 组合(原 AND 叠加导致带角色用户待办恒空,P3 对账只测 assignee 单维未暴露)。 实测 ceshi(2 条指派)经网关 JWT 全角色传参精确返回 2 条带 pageUrl - 两服务 yml: max-http-request-header-size=64KB(JWT 全角色 16.9KB 超 Tomcat 8KB 上限, 多角色用户 400 无法使用系统;根治在 F2-6 JWT 瘦身,根治后回收) - FlowControllerTest 9/9 过;OrgDirectoryJdbcTest 17 错误为既有 JDK26+Mockito 问题(stash 对比一致) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -45,22 +45,40 @@ public class FlowController {
|
||||
}
|
||||
|
||||
@GetMapping("/tasks/todo")
|
||||
@Operation(summary = "待办列表", description = "按 assignee(用户)或 candidateGroup(候选组)查活动待办;不传则查全部活动待办")
|
||||
@Operation(summary = "待办列表", description = "按 assignee(用户)或 candidateGroup(候选组,可多值)查活动待办;不传则查全部活动待办。"
|
||||
+ "assignee 与候选维度同传时为 OR 语义(我的待办=指派给我的 ∪ 我候选的)——网关按 JWT userId+roles 全量传参依赖此语义")
|
||||
public List<TaskDto> todo(
|
||||
@RequestParam(required = false) String assignee,
|
||||
@RequestParam(required = false) String candidateGroup,
|
||||
@RequestParam(required = false) List<String> candidateGroup,
|
||||
@RequestParam(required = false) String candidateUser,
|
||||
@RequestParam(defaultValue = "0") int firstResult,
|
||||
@RequestParam(defaultValue = "50") int maxResults) {
|
||||
boolean hasAssignee = assignee != null && !assignee.isBlank();
|
||||
List<String> groups = candidateGroup == null ? List.of()
|
||||
: candidateGroup.stream().filter(g -> g != null && !g.isBlank()).collect(Collectors.toList());
|
||||
boolean hasCandidate = !groups.isEmpty() || (candidateUser != null && !candidateUser.isBlank());
|
||||
|
||||
var q = taskService.createTaskQuery().active();
|
||||
if (assignee != null && !assignee.isBlank()) {
|
||||
if (hasAssignee && hasCandidate) {
|
||||
// F1-7 修复:原实现 assignee 与 candidateGroup 叠加为 AND,带角色的用户待办恒空。
|
||||
// Flowable or() 块内组合为 OR:指派给我的 ∪ 我(组)候选的。
|
||||
var or = q.or().taskAssignee(assignee);
|
||||
if (!groups.isEmpty()) {
|
||||
or = or.taskCandidateGroupIn(groups);
|
||||
}
|
||||
if (candidateUser != null && !candidateUser.isBlank()) {
|
||||
or = or.taskCandidateUser(candidateUser);
|
||||
}
|
||||
q = or.endOr();
|
||||
} else if (hasAssignee) {
|
||||
q = q.taskAssignee(assignee);
|
||||
}
|
||||
if (candidateGroup != null && !candidateGroup.isBlank()) {
|
||||
q = q.taskCandidateGroup(candidateGroup);
|
||||
}
|
||||
if (candidateUser != null && !candidateUser.isBlank()) {
|
||||
q = q.taskCandidateUser(candidateUser);
|
||||
} else if (hasCandidate) {
|
||||
if (!groups.isEmpty()) {
|
||||
q = q.taskCandidateGroupIn(groups);
|
||||
}
|
||||
if (candidateUser != null && !candidateUser.isBlank()) {
|
||||
q = q.taskCandidateUser(candidateUser);
|
||||
}
|
||||
}
|
||||
List<TaskDto> dtos = q.orderByTaskCreateTime().desc()
|
||||
.listPage(firstResult, maxResults)
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
server:
|
||||
port: 8089
|
||||
# F1-7 缓解:网关按 JWT roles 全量传 candidateGroup,多角色用户 URL 超 Tomcat 默认 8KB 上限。
|
||||
# 根治=F2-6 JWT/传参瘦身(roles 服务端解析),根治后回收此配置。
|
||||
max-http-request-header-size: 64KB
|
||||
|
||||
spring:
|
||||
application:
|
||||
|
||||
Reference in New Issue
Block a user