feat: 会话记录接入客户端 X-Device-Id(auth_sessions.device_id)

- Flutter 端每次请求已携带 X-Device-Id;auth 读取该头(截断 128)经 CreateSessionRequest 透传,user 落 auth_sessions.device_id,为多设备会话列表备数据
- 门禁:./mvnw clean test → BUILD SUCCESS,74 测试 0 失败(新增 registerForwardsDeviceIdHeaderToTheSessionRecord + 会话落库断言)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-04 14:43:44 +08:00
parent 4dc3dcdfa3
commit 8bdaf53222
7 changed files with 65 additions and 16 deletions
@@ -15,6 +15,9 @@ public class CreateSessionRequest {
@NotNull(message = "userId 不能为空")
private UUID userId;
@Size(max = 128, message = "deviceId 长度不能超过128位")
private String deviceId;
@Size(max = 512, message = "userAgent 长度不能超过512位")
private String userAgent;
@@ -24,8 +27,9 @@ public class CreateSessionRequest {
public CreateSessionRequest() {
}
public CreateSessionRequest(UUID userId, String userAgent, String ipAddress) {
public CreateSessionRequest(UUID userId, String deviceId, String userAgent, String ipAddress) {
this.userId = userId;
this.deviceId = deviceId;
this.userAgent = userAgent;
this.ipAddress = ipAddress;
}
@@ -38,6 +42,14 @@ public class CreateSessionRequest {
this.userId = userId;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getUserAgent() {
return userAgent;
}