Browse Source
模块更名与上提(Spec W0 §11): - shared → sdk-common,http 合并进来,channel-sdk-http 取消 - channel → channel-sdk-core,testkit → sdk-testkit - 父 POM 更名为 channel-sdk-parent 共享层为跨域复用做的三处调整: - IdempotencyStore / IdempotencyRecord 的 provider 改为 String, 渠道域与仓库域两套 provider 枚举落同一张幂等表 - 新增 WriteIdentity,WriteScope 实现它;幂等守卫改为面向接口 - CallSupport 从 channel 移到 sdk-common,新增 CallScope; ChannelContext 实现 CallScope,耗时与埋点维度不再绑定渠道域 ChannelProvider 里误加的 YUNQUNA 移除:仓不是渠道,走 WarehouseProvider。 Co-Authored-By: Claude <noreply@anthropic.com>feature/supplier-lingxing
142 changed files with 309 additions and 223 deletions
@ -1,48 +0,0 @@
@@ -1,48 +0,0 @@
|
||||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
|
||||
<parent> |
||||
<groupId>ecommerce</groupId> |
||||
<artifactId>common-ecommerce</artifactId> |
||||
<version>1.0.0-SNAPSHOT</version> |
||||
</parent> |
||||
|
||||
<artifactId>common-ecommerce-http</artifactId> |
||||
<description>HTTP 传输、签名、令牌管理、JSON 编解码</description> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>ecommerce</groupId> |
||||
<artifactId>common-ecommerce-shared</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.squareup.okhttp3</groupId> |
||||
<artifactId>okhttp</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.fasterxml.jackson.core</groupId> |
||||
<artifactId>jackson-databind</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.slf4j</groupId> |
||||
<artifactId>slf4j-api</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.junit.jupiter</groupId> |
||||
<artifactId>junit-jupiter</artifactId> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
<build> |
||||
<plugins> |
||||
<plugin> |
||||
<groupId>org.apache.maven.plugins</groupId> |
||||
<artifactId>maven-compiler-plugin</artifactId> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
</project> |
||||
@ -0,0 +1,29 @@
@@ -0,0 +1,29 @@
|
||||
package common.ecommerce.shared.audit; |
||||
|
||||
import java.time.Clock; |
||||
|
||||
/** |
||||
* 一次门面调用可供埋点读取的维度。渠道域的 {@code ChannelContext}、 |
||||
* 仓库域的 {@code WarehouseContext} 都实现它,因此 {@link CallSupport} 可以放在 |
||||
* 共享层,两个域各传自己的上下文。 |
||||
*/ |
||||
public interface CallScope { |
||||
|
||||
/** <b>我方</b>链路 ID。 */ |
||||
String requestId(); |
||||
|
||||
/** 接入通道名(渠道 provider / 仓库 provider)。 */ |
||||
String providerName(); |
||||
|
||||
/** 业务平台名;仓库域没有平台概念,返回 null。 */ |
||||
String platformName(); |
||||
|
||||
/** 宿主侧店铺 ID;仓库域返回 null。 */ |
||||
String omsStoreId(); |
||||
|
||||
/** 渠道侧店铺 ID;仓库域返回 null。 */ |
||||
String externalStoreId(); |
||||
|
||||
/** 取调用耗时的时钟。 */ |
||||
Clock clock(); |
||||
} |
||||
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
package common.ecommerce.shared.idempotency; |
||||
|
||||
/** |
||||
* 一次写操作的标识维度。渠道域与仓库域各自实现:两边的主键模型不同 |
||||
* (渠道域是 {@code platform + omsStoreId},仓库域是 {@code warehouseCode}), |
||||
* 但幂等状态机共用。 |
||||
* |
||||
* <p>实现方负责算出两个键: |
||||
* {@link #businessKey()} 跨 provider 共用,{@link #providerKey()} 只在本 provider 内去重。</p> |
||||
*/ |
||||
public interface WriteIdentity { |
||||
|
||||
/** 接入通道名,用于幂等记录与跨 provider 冲突判定;非 null。 */ |
||||
String providerName(); |
||||
|
||||
/** 业务平台名,无平台概念时返回 null。 */ |
||||
String platformName(); |
||||
|
||||
/** 宿主侧店铺 ID;仓库域无此概念,返回 null。 */ |
||||
String omsStoreId(); |
||||
|
||||
/** 渠道侧店铺 ID;仓库域无此概念,返回 null。 */ |
||||
String externalStoreId(); |
||||
|
||||
/** 业务动作名,如 {@code create} / {@code cancel};非 null。 */ |
||||
String action(); |
||||
|
||||
/** 业务自然键,如 {@code PO-1:pkg-1} 或 {@code OB-20261028-000123};非 null。 */ |
||||
String businessRef(); |
||||
|
||||
/** 跨 provider 的业务幂等键;非 null。 */ |
||||
String businessKey(); |
||||
|
||||
/** 单 provider 内的请求幂等键;非 null。 */ |
||||
String providerKey(); |
||||
} |
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue