init
This commit is contained in:
24
backend/common/common-core/pom.xml
Normal file
24
backend/common/common-core/pom.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.k12study</groupId>
|
||||
<artifactId>k12study-backend</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<artifactId>common-core</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.k12study.common.core.constants;
|
||||
|
||||
public final class SecurityConstants {
|
||||
public static final String TRACE_ID = "X-Trace-Id";
|
||||
public static final String HEADER_USER_ID = "X-User-Id";
|
||||
public static final String HEADER_USERNAME = "X-Username";
|
||||
public static final String HEADER_DISPLAY_NAME = "X-Display-Name";
|
||||
public static final String HEADER_TENANT_ID = "X-Tenant-Id";
|
||||
public static final String HEADER_DEPT_ID = "X-Dept-Id";
|
||||
|
||||
private SecurityConstants() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.k12study.common.core.domain;
|
||||
|
||||
public record RouteKey(
|
||||
String provinceCode,
|
||||
String areaCode,
|
||||
String tenantId,
|
||||
String tenantPath,
|
||||
String deptId,
|
||||
String deptPath
|
||||
) {
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.k12study.common.core.utils;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public final class TraceIdHolder {
|
||||
private static final ThreadLocal<String> TRACE_ID = new ThreadLocal<>();
|
||||
|
||||
private TraceIdHolder() {
|
||||
}
|
||||
|
||||
public static String getOrCreate() {
|
||||
String value = TRACE_ID.get();
|
||||
if (value == null || value.isBlank()) {
|
||||
value = UUID.randomUUID().toString().replace("-", "");
|
||||
TRACE_ID.set(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static void set(String traceId) {
|
||||
TRACE_ID.set(traceId);
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
TRACE_ID.remove();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user