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,23 +45,41 @@ public class FlowController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/tasks/todo")
|
@GetMapping("/tasks/todo")
|
||||||
@Operation(summary = "待办列表", description = "按 assignee(用户)或 candidateGroup(候选组)查活动待办;不传则查全部活动待办")
|
@Operation(summary = "待办列表", description = "按 assignee(用户)或 candidateGroup(候选组,可多值)查活动待办;不传则查全部活动待办。"
|
||||||
|
+ "assignee 与候选维度同传时为 OR 语义(我的待办=指派给我的 ∪ 我候选的)——网关按 JWT userId+roles 全量传参依赖此语义")
|
||||||
public List<TaskDto> todo(
|
public List<TaskDto> todo(
|
||||||
@RequestParam(required = false) String assignee,
|
@RequestParam(required = false) String assignee,
|
||||||
@RequestParam(required = false) String candidateGroup,
|
@RequestParam(required = false) List<String> candidateGroup,
|
||||||
@RequestParam(required = false) String candidateUser,
|
@RequestParam(required = false) String candidateUser,
|
||||||
@RequestParam(defaultValue = "0") int firstResult,
|
@RequestParam(defaultValue = "0") int firstResult,
|
||||||
@RequestParam(defaultValue = "50") int maxResults) {
|
@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();
|
var q = taskService.createTaskQuery().active();
|
||||||
if (assignee != null && !assignee.isBlank()) {
|
if (hasAssignee && hasCandidate) {
|
||||||
q = q.taskAssignee(assignee);
|
// F1-7 修复:原实现 assignee 与 candidateGroup 叠加为 AND,带角色的用户待办恒空。
|
||||||
|
// Flowable or() 块内组合为 OR:指派给我的 ∪ 我(组)候选的。
|
||||||
|
var or = q.or().taskAssignee(assignee);
|
||||||
|
if (!groups.isEmpty()) {
|
||||||
|
or = or.taskCandidateGroupIn(groups);
|
||||||
}
|
}
|
||||||
if (candidateGroup != null && !candidateGroup.isBlank()) {
|
if (candidateUser != null && !candidateUser.isBlank()) {
|
||||||
q = q.taskCandidateGroup(candidateGroup);
|
or = or.taskCandidateUser(candidateUser);
|
||||||
|
}
|
||||||
|
q = or.endOr();
|
||||||
|
} else if (hasAssignee) {
|
||||||
|
q = q.taskAssignee(assignee);
|
||||||
|
} else if (hasCandidate) {
|
||||||
|
if (!groups.isEmpty()) {
|
||||||
|
q = q.taskCandidateGroupIn(groups);
|
||||||
}
|
}
|
||||||
if (candidateUser != null && !candidateUser.isBlank()) {
|
if (candidateUser != null && !candidateUser.isBlank()) {
|
||||||
q = q.taskCandidateUser(candidateUser);
|
q = q.taskCandidateUser(candidateUser);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
List<TaskDto> dtos = q.orderByTaskCreateTime().desc()
|
List<TaskDto> dtos = q.orderByTaskCreateTime().desc()
|
||||||
.listPage(firstResult, maxResults)
|
.listPage(firstResult, maxResults)
|
||||||
.stream().map(TaskDto::of).collect(Collectors.toList());
|
.stream().map(TaskDto::of).collect(Collectors.toList());
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
server:
|
server:
|
||||||
port: 8089
|
port: 8089
|
||||||
|
# F1-7 缓解:网关按 JWT roles 全量传 candidateGroup,多角色用户 URL 超 Tomcat 默认 8KB 上限。
|
||||||
|
# 根治=F2-6 JWT/传参瘦身(roles 服务端解析),根治后回收此配置。
|
||||||
|
max-http-request-header-size: 64KB
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
|
|||||||
@@ -10,6 +10,11 @@
|
|||||||
# local 本地自举最小集(eip4m0),CI/对拍/单元测试,数据极简
|
# local 本地自举最小集(eip4m0),CI/对拍/单元测试,数据极简
|
||||||
# 默认 指向客户库副本 5435,验收验证/性能基线用,需网络
|
# 默认 指向客户库副本 5435,验收验证/性能基线用,需网络
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
server:
|
||||||
|
# F1-7 缓解:JWT 把全部角色塞进 claims,多角色用户(实测 ceshi 16,924 字符)超 Tomcat 默认
|
||||||
|
# 8KB 请求头上限直接 400。根治=F2-6 JWT 瘦身(roles 不入令牌),根治后回收此配置。
|
||||||
|
max-http-request-header-size: 64KB
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:postgresql://localhost:5433/eip4dev?currentSchema=eip3
|
url: jdbc:postgresql://localhost:5433/eip4dev?currentSchema=eip3
|
||||||
|
|||||||
Reference in New Issue
Block a user