diff --git a/core/src/main/java/common/ecommerce/model/product/ProductQuery.java b/core/src/main/java/common/ecommerce/model/product/ProductQuery.java
index 9230da6..f6472db 100644
--- a/core/src/main/java/common/ecommerce/model/product/ProductQuery.java
+++ b/core/src/main/java/common/ecommerce/model/product/ProductQuery.java
@@ -1,10 +1,23 @@
package common.ecommerce.model.product;
import java.time.Instant;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
import java.util.Objects;
/**
* 商品查询条件。
+ *
+ *
支持两类过滤:
+ *
+ * - 时间窗:{@link #updatedAfter()} / {@link #updatedBefore()}
+ * - 按 SKU 搜索:{@link #searchField()} + 单值或多值
+ *
+ *
+ * 搜索有两种形态:{@link #searchValue()} 是单个模糊匹配,
+ * {@link #searchValues()} 是多个精确匹配。两者互斥,同时设置时以多值为准。
+ * 平台不支持对应形态时由适配器显式报错,不做静默忽略。
*/
public final class ProductQuery {
@@ -12,12 +25,24 @@ public final class ProductQuery {
private final Instant updatedBefore;
private final int pageSize;
private final String cursor;
+ private final ProductSearchField searchField;
+ private final String searchValue;
+ private final List searchValues;
private ProductQuery(Builder b) {
this.updatedAfter = b.updatedAfter;
this.updatedBefore = b.updatedBefore;
this.pageSize = b.pageSize;
this.cursor = b.cursor;
+ this.searchField = b.searchField;
+ this.searchValue = b.searchValue;
+ this.searchValues = Collections.unmodifiableList(new ArrayList(b.searchValues));
+ if (searchField == null && (searchValue != null || !searchValues.isEmpty())) {
+ throw new IllegalArgumentException("searchField is required when searching by SKU");
+ }
+ if (searchValue != null && !searchValues.isEmpty()) {
+ throw new IllegalArgumentException("searchValue (fuzzy) and searchValues (exact) are mutually exclusive");
+ }
}
public static Builder builder() {
@@ -40,12 +65,46 @@ public final class ProductQuery {
return cursor;
}
+ /** 搜索维度;为 null 表示不按 SKU 搜索。 */
+ public ProductSearchField searchField() {
+ return searchField;
+ }
+
+ /** 单个模糊搜索值;与 {@link #searchValues()} 互斥,可能为 null。 */
+ public String searchValue() {
+ return searchValue;
+ }
+
+ /** 多个精确搜索值;未设置时为空列表。 */
+ public List searchValues() {
+ return searchValues;
+ }
+
+ /** 是否带了 SKU 搜索条件。 */
+ public boolean hasSearch() {
+ return searchField != null && (searchValue != null || !searchValues.isEmpty());
+ }
+
+ public Builder toBuilder() {
+ return builder()
+ .updatedAfter(updatedAfter)
+ .updatedBefore(updatedBefore)
+ .pageSize(pageSize)
+ .cursor(cursor)
+ .searchField(searchField)
+ .searchValue(searchValue)
+ .searchValues(searchValues);
+ }
+
public static final class Builder {
private Instant updatedAfter;
private Instant updatedBefore;
private int pageSize = 100;
private String cursor;
+ private ProductSearchField searchField;
+ private String searchValue;
+ private List searchValues = Collections.emptyList();
public Builder updatedAfter(Instant updatedAfter) {
this.updatedAfter = updatedAfter;
@@ -67,6 +126,24 @@ public final class ProductQuery {
return this;
}
+ /** 搜索维度;必须与 {@link #searchValue(String)} 或 {@link #searchValues(List)} 一起用。 */
+ public Builder searchField(ProductSearchField searchField) {
+ this.searchField = searchField;
+ return this;
+ }
+
+ /** 单个模糊搜索。 */
+ public Builder searchValue(String searchValue) {
+ this.searchValue = searchValue;
+ return this;
+ }
+
+ /** 多个精确搜索;与 {@link #searchValue(String)} 互斥。 */
+ public Builder searchValues(List searchValues) {
+ this.searchValues = searchValues == null ? Collections.emptyList() : searchValues;
+ return this;
+ }
+
public ProductQuery build() {
return new ProductQuery(this);
}
diff --git a/core/src/main/java/common/ecommerce/model/product/ProductSearchField.java b/core/src/main/java/common/ecommerce/model/product/ProductSearchField.java
new file mode 100644
index 0000000..a562162
--- /dev/null
+++ b/core/src/main/java/common/ecommerce/model/product/ProductSearchField.java
@@ -0,0 +1,23 @@
+package common.ecommerce.model.product;
+
+/**
+ * 商品搜索维度。
+ *
+ * 只定义跨平台语义一致的维度;各平台自己的数字编码由适配器映射,
+ * 调用方不感知。见各适配器里的 {@code ProductSearchMapper}。
+ *
+ *
+ * - {@link #PLATFORM_SKU}:平台侧 SKU。领星 {@code msku}、亚马逊 {@code seller_sku}、
+ * 沃尔玛 {@code sku}。也是 {@link ProductListing#platformSku()} 的来源。
+ * - {@link #LOCAL_SKU}:本地 SKU。领星配对时填的 {@code sku} / {@code local_sku};
+ * 直连平台没有这个概念。
+ *
+ */
+public enum ProductSearchField {
+
+ /** 平台侧 SKU。 */
+ PLATFORM_SKU,
+
+ /** 本地 SKU(领星特有)。 */
+ LOCAL_SKU
+}
diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/aliexpress/product/AliexpressProductSource.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/aliexpress/product/AliexpressProductSource.java
index bdb85e9..369dcb3 100644
--- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/aliexpress/product/AliexpressProductSource.java
+++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/aliexpress/product/AliexpressProductSource.java
@@ -5,6 +5,11 @@ import common.ecommerce.http.HttpResponse;
import common.ecommerce.lingxing.LingxingApi;
import common.ecommerce.lingxing.http.LingxingEnvelope;
import common.ecommerce.lingxing.platform.LingxingCall;
+import common.ecommerce.error.ChannelException;
+import common.ecommerce.error.ValidationException;
+import common.ecommerce.lingxing.platform.multiplatform.product.LingxingProductSearchBody;
+import common.ecommerce.lingxing.platform.multiplatform.product.LingxingProductSearchMapper;
+import common.ecommerce.model.product.ProductQuery;
import common.ecommerce.lingxing.platform.aliexpress.dto.AliexpressListingDto;
import common.ecommerce.lingxing.platform.LingxingProductSource;
import common.ecommerce.model.ChannelProvider;
@@ -55,13 +60,12 @@ public final class AliexpressProductSource implements LingxingProductSource {
body.put("isParent", IS_CHILD);
body.put("offset", offset);
body.put("length", length);
- // storeIds 非必填:账户配了才传,由平台侧校验是否必填
- String storeId = call.ctx().account().externalStoreId();
- if (storeId != null && !storeId.trim().isEmpty()) {
- body.put("storeIds", Collections.singletonList(parseStoreId(storeId)));
- }
+ // 该接口不需要 storeIds:一次返回当前 app 下全部阿里店铺的商品
applyTimeWindow(body, query);
+ // 按 SKU 搜索:平台不支持的维度直接报错,不静默忽略
+ applySearch(body, query);
+
HttpRequest req = call.signed(LingxingApi.LISTING_ALIEXPRESS, body, "products.pull");
HttpResponse resp = call.execute(req);
LingxingEnvelope envelope = call.envelope(resp, "products.pull");
@@ -78,15 +82,6 @@ public final class AliexpressProductSource implements LingxingProductSource {
return Page.of(out, hasMore ? String.valueOf(nextOffset) : null);
}
- /** storeIds 文档示例是数字数组;能解析成数字就传数字,否则原样传字符串。 */
- private static Object parseStoreId(String externalStoreId) {
- try {
- return Long.valueOf(externalStoreId);
- } catch (RuntimeException e) {
- return externalStoreId;
- }
- }
-
/** 时间窗:start/end 为 yyyy-MM-dd(北京时间的日期)。 */
private static void applyTimeWindow(Map body, ProductQuery query) {
Instant from = query.updatedAfter();
@@ -269,4 +264,23 @@ public final class AliexpressProductSource implements LingxingProductSource {
String trimmed = v.trim();
return trimmed.isEmpty() ? null : trimmed;
}
+
+ /** 统一 SKU 搜索 → aliexpress 的字段形态;未带搜索条件时什么也不做。 */
+ private static void applySearch(java.util.Map body,
+ ProductQuery query) {
+ if (query == null || !query.hasSearch()) {
+ return;
+ }
+ try {
+ Object fieldValue = LingxingProductSearchMapper.aliexpress(query.searchField());
+ LingxingProductSearchBody.camelCase(body, query, fieldValue);
+ } catch (UnsupportedOperationException e) {
+ ChannelException.Builder b = ChannelException.builder()
+ .message("aliexpress listing does not support search field "
+ + query.searchField())
+ .operation("products.pull")
+ .retryable(false);
+ throw new ValidationException(b);
+ }
+ }
}
diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/amazon/sc/product/AmazonScProductSource.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/amazon/sc/product/AmazonScProductSource.java
index e235b1d..8a510ca 100644
--- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/amazon/sc/product/AmazonScProductSource.java
+++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/amazon/sc/product/AmazonScProductSource.java
@@ -5,6 +5,11 @@ import common.ecommerce.http.HttpResponse;
import common.ecommerce.lingxing.LingxingApi;
import common.ecommerce.lingxing.http.LingxingEnvelope;
import common.ecommerce.lingxing.platform.LingxingCall;
+import common.ecommerce.error.ChannelException;
+import common.ecommerce.error.ValidationException;
+import common.ecommerce.lingxing.platform.multiplatform.product.LingxingProductSearchBody;
+import common.ecommerce.lingxing.platform.multiplatform.product.LingxingProductSearchMapper;
+import common.ecommerce.model.product.ProductQuery;
import common.ecommerce.lingxing.platform.amazon.sc.dto.AmazonScListingDto;
import common.ecommerce.lingxing.platform.LingxingProductSource;
import common.ecommerce.model.ChannelProvider;
@@ -66,6 +71,9 @@ public final class AmazonScProductSource implements LingxingProductSource {
LocalDateTime.ofInstant(to, ZoneOffset.UTC)));
}
+ // 按 SKU 搜索:平台不支持的维度直接报错,不静默忽略
+ applySearch(body, query);
+
HttpRequest req = call.signed(LingxingApi.LISTING_AMAZON_SC, body, "products.pull");
HttpResponse resp = call.execute(req);
LingxingEnvelope envelope = call.envelope(resp, "products.pull");
@@ -232,4 +240,23 @@ public final class AmazonScProductSource implements LingxingProductSource {
String trimmed = v.trim();
return trimmed.isEmpty() ? null : trimmed;
}
+
+ /** 统一 SKU 搜索 → amazon sc 的字段形态;未带搜索条件时什么也不做。 */
+ private static void applySearch(java.util.Map body,
+ ProductQuery query) {
+ if (query == null || !query.hasSearch()) {
+ return;
+ }
+ try {
+ Object fieldValue = LingxingProductSearchMapper.amazonSc(query.searchField());
+ LingxingProductSearchBody.amazonSc(body, query, fieldValue);
+ } catch (UnsupportedOperationException e) {
+ ChannelException.Builder b = ChannelException.builder()
+ .message("amazon sc listing does not support search field "
+ + query.searchField())
+ .operation("products.pull")
+ .retryable(false);
+ throw new ValidationException(b);
+ }
+ }
}
diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/ebay/product/EbayProductSource.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/ebay/product/EbayProductSource.java
index 03682c5..c240ad0 100644
--- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/ebay/product/EbayProductSource.java
+++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/ebay/product/EbayProductSource.java
@@ -5,6 +5,11 @@ import common.ecommerce.http.HttpResponse;
import common.ecommerce.lingxing.LingxingApi;
import common.ecommerce.lingxing.http.LingxingEnvelope;
import common.ecommerce.lingxing.platform.LingxingCall;
+import common.ecommerce.error.ChannelException;
+import common.ecommerce.error.ValidationException;
+import common.ecommerce.lingxing.platform.multiplatform.product.LingxingProductSearchBody;
+import common.ecommerce.lingxing.platform.multiplatform.product.LingxingProductSearchMapper;
+import common.ecommerce.model.product.ProductQuery;
import common.ecommerce.lingxing.platform.ebay.dto.EbayListingDto;
import common.ecommerce.lingxing.platform.LingxingProductSource;
import common.ecommerce.model.ChannelProvider;
@@ -62,6 +67,9 @@ public final class EbayProductSource implements LingxingProductSource {
}
applyTimeWindow(body, query);
+ // 按 SKU 搜索:平台不支持的维度直接报错,不静默忽略
+ applySearch(body, query);
+
HttpRequest req = call.signed(LingxingApi.LISTING_EBAY, body, "products.pull");
HttpResponse resp = call.execute(req);
LingxingEnvelope envelope = call.envelope(resp, "products.pull");
@@ -208,4 +216,23 @@ public final class EbayProductSource implements LingxingProductSource {
String trimmed = v.trim();
return trimmed.isEmpty() ? null : trimmed;
}
+
+ /** 统一 SKU 搜索 → ebay 的字段形态;未带搜索条件时什么也不做。 */
+ private static void applySearch(java.util.Map body,
+ ProductQuery query) {
+ if (query == null || !query.hasSearch()) {
+ return;
+ }
+ try {
+ Object fieldValue = LingxingProductSearchMapper.ebay(query.searchField());
+ LingxingProductSearchBody.camelCase(body, query, fieldValue);
+ } catch (UnsupportedOperationException e) {
+ ChannelException.Builder b = ChannelException.builder()
+ .message("ebay listing does not support search field "
+ + query.searchField())
+ .operation("products.pull")
+ .retryable(false);
+ throw new ValidationException(b);
+ }
+ }
}
diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/multiplatform/product/LingxingProductSearchBody.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/multiplatform/product/LingxingProductSearchBody.java
new file mode 100644
index 0000000..617b877
--- /dev/null
+++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/multiplatform/product/LingxingProductSearchBody.java
@@ -0,0 +1,80 @@
+package common.ecommerce.lingxing.platform.multiplatform.product;
+
+import common.ecommerce.model.product.ProductQuery;
+
+import java.util.List;
+
+/**
+ * 把统一的 SKU 搜索条件拼进领星请求体。
+ *
+ * 各平台字段名与形态不同:
+ *
+ * - 沃尔玛 / eBay / Temu / SHEIN / TikTok / AliExpress:{@code searchField}(数字)
+ * + {@code searchSingleValue}(单值模糊)+ {@code searchValues}(多值精确)
+ * - Shopify / Target:{@code search_field} + {@code search_single_value} + {@code search_values}
+ * - 亚马逊 SC:{@code search_field}(字符串)+ {@code search_value}(数组)+ {@code exact_search}
+ *
+ */
+public final class LingxingProductSearchBody {
+
+ private LingxingProductSearchBody() {
+ }
+
+ /**
+ * camelCase 形态:searchField / searchSingleValue / searchValues。
+ *
+ * 用于 Temu、SHEIN、TikTok、AliExpress、沃尔玛、eBay。
+ */
+ public static void camelCase(java.util.Map body, ProductQuery query, Object fieldValue) {
+ if (query == null || !query.hasSearch()) {
+ return;
+ }
+ body.put("searchField", fieldValue);
+ applyValue(body, query, "searchSingleValue", "searchValues");
+ }
+
+ /**
+ * snake_case 形态:search_field / search_single_value / search_values。
+ *
+ * 用于 Shopify、Target。
+ */
+ public static void snakeCase(java.util.Map body, ProductQuery query, Object fieldValue) {
+ if (query == null || !query.hasSearch()) {
+ return;
+ }
+ body.put("search_field", fieldValue);
+ applyValue(body, query, "search_single_value", "search_values");
+ }
+
+ /**
+ * 亚马逊 SC 形态:search_field(字符串)+ search_value(数组)+ exact_search。
+ *
+ * 单值模糊时转成单元素数组并设 {@code exact_search=0};
+ * 多值时设 {@code exact_search=1}。
+ */
+ public static void amazonSc(java.util.Map body, ProductQuery query, Object fieldValue) {
+ if (query == null || !query.hasSearch()) {
+ return;
+ }
+ body.put("search_field", fieldValue);
+ List values = query.searchValues();
+ if (values.isEmpty()) {
+ body.put("search_value", java.util.Collections.singletonList(query.searchValue()));
+ body.put("exact_search", 0);
+ } else {
+ body.put("search_value", values);
+ body.put("exact_search", 1);
+ }
+ }
+
+ /** 单值模糊与多值精确二选一,已在 ProductQuery 构造时校验。 */
+ private static void applyValue(java.util.Map body, ProductQuery query,
+ String singleKey, String multiKey) {
+ List values = query.searchValues();
+ if (values.isEmpty()) {
+ body.put(singleKey, query.searchValue());
+ } else {
+ body.put(multiKey, values);
+ }
+ }
+}
diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/multiplatform/product/LingxingProductSearchMapper.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/multiplatform/product/LingxingProductSearchMapper.java
new file mode 100644
index 0000000..7b74522
--- /dev/null
+++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/multiplatform/product/LingxingProductSearchMapper.java
@@ -0,0 +1,81 @@
+package common.ecommerce.lingxing.platform.multiplatform.product;
+
+import common.ecommerce.model.product.ProductSearchField;
+
+/**
+ * 领星侧各平台的「搜索维度 → 平台枚举值」映射。
+ *
+ * 同一个语义在不同平台下的取值完全不同:
+ *
+ * 平台 SKU 本地 SKU
+ * 沃尔玛 1 3
+ * eBay 1 3
+ * AliExpress 1 5 ← 实测:文档写 3,但 3 查不到
+ * Temu 9 8
+ * SHEIN 9 8
+ * TikTok 9 8
+ * Shopify/Target 1 待核对(样本 local_sku 为空)
+ * 亚马逊 SC "seller_sku" "sku" ← 字符串,不是数字
+ * 亚马逊 VC 不支持搜索
+ *
+ *
+ * 取值来源:领星文档(2026-10 摘录)+ AliExpress 实测(2026-11)。
+ * 未实测的平台按文档写,联调时用 {@code SearchFieldProbeTest} 逐个核对。
+ *
+ * 用「按平台命名的方法」而不是「按 platform_code 查表」:每个 Source 只服务一个平台,
+ * 直接调自己那一个方法即可;AliExpress 的 platform_code 尚未确认,也不影响调用。
+ * 返回值类型不统一(数字 / 字符串),由各 Source 直接塞进请求体。
+ */
+public final class LingxingProductSearchMapper {
+
+ private LingxingProductSearchMapper() {
+ }
+
+ /** 沃尔玛:1 = MSKU,3 = SKU。 */
+ public static Object walmart(ProductSearchField field) {
+ return field == ProductSearchField.PLATFORM_SKU ? 1 : 3;
+ }
+
+ /** eBay:1 = msku,3 = sku。 */
+ public static Object ebay(ProductSearchField field) {
+ return field == ProductSearchField.PLATFORM_SKU ? 1 : 3;
+ }
+
+ /** AliExpress:1 = msku,5 = 本地 SKU(实测;文档写 3 但查不到)。 */
+ public static Object aliexpress(ProductSearchField field) {
+ return field == ProductSearchField.PLATFORM_SKU ? 1 : 5;
+ }
+
+ /** Temu:9 = MSKU,8 = SKU。 */
+ public static Object temu(ProductSearchField field) {
+ return field == ProductSearchField.PLATFORM_SKU ? 9 : 8;
+ }
+
+ /** SHEIN:9 = MSKU,8 = SKU。 */
+ public static Object shein(ProductSearchField field) {
+ return field == ProductSearchField.PLATFORM_SKU ? 9 : 8;
+ }
+
+ /** TikTok:9 = MSKU,8 = SKU。 */
+ public static Object tiktok(ProductSearchField field) {
+ return field == ProductSearchField.PLATFORM_SKU ? 9 : 8;
+ }
+
+ /**
+ * Shopify / Target:1 = msku。
+ *
+ * 本地 SKU 的编码文档未给出,实测样本 {@code local_sku} 也为空,
+ * 暂时返回 null 表示不支持;联调时用探针确认后再补。
+ */
+ public static Object shopify(ProductSearchField field) {
+ if (field == ProductSearchField.PLATFORM_SKU) {
+ return 1;
+ }
+ throw new UnsupportedOperationException("shopify/target listing does not support local sku search yet");
+ }
+
+ /** 亚马逊 SC:字符串 "seller_sku" / "sku"。 */
+ public static Object amazonSc(ProductSearchField field) {
+ return field == ProductSearchField.PLATFORM_SKU ? "seller_sku" : "sku";
+ }
+}
diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/shein/product/SheinProductSource.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/shein/product/SheinProductSource.java
index 8fa82d3..99cda0c 100644
--- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/shein/product/SheinProductSource.java
+++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/shein/product/SheinProductSource.java
@@ -5,6 +5,11 @@ import common.ecommerce.http.HttpResponse;
import common.ecommerce.lingxing.LingxingApi;
import common.ecommerce.lingxing.http.LingxingEnvelope;
import common.ecommerce.lingxing.platform.LingxingCall;
+import common.ecommerce.error.ChannelException;
+import common.ecommerce.error.ValidationException;
+import common.ecommerce.lingxing.platform.multiplatform.product.LingxingProductSearchBody;
+import common.ecommerce.lingxing.platform.multiplatform.product.LingxingProductSearchMapper;
+import common.ecommerce.model.product.ProductQuery;
import common.ecommerce.lingxing.platform.LingxingProductSource;
import common.ecommerce.lingxing.platform.shein.dto.SheinListingDto;
import common.ecommerce.model.ChannelProvider;
@@ -45,6 +50,8 @@ public final class SheinProductSource implements LingxingProductSource {
if (storeId != null && !storeId.trim().isEmpty()) {
body.put("storeIds", Collections.singletonList(storeId));
}
+ // 按 SKU 搜索:平台不支持的维度直接报错,不静默忽略
+ applySearch(body, query);
HttpRequest req = call.signed(LingxingApi.LISTING_SHEIN, body, "products.pull");
HttpResponse resp = call.execute(req);
LingxingEnvelope envelope = call.envelope(resp, "products.pull");
@@ -232,4 +239,23 @@ public final class SheinProductSource implements LingxingProductSource {
String trimmed = v.trim();
return trimmed.isEmpty() ? null : trimmed;
}
+
+ /** 统一 SKU 搜索 → shein 的字段形态;未带搜索条件时什么也不做。 */
+ private static void applySearch(java.util.Map body,
+ ProductQuery query) {
+ if (query == null || !query.hasSearch()) {
+ return;
+ }
+ try {
+ Object fieldValue = LingxingProductSearchMapper.shein(query.searchField());
+ LingxingProductSearchBody.camelCase(body, query, fieldValue);
+ } catch (UnsupportedOperationException e) {
+ ChannelException.Builder b = ChannelException.builder()
+ .message("shein listing does not support search field "
+ + query.searchField())
+ .operation("products.pull")
+ .retryable(false);
+ throw new ValidationException(b);
+ }
+ }
}
diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/target/product/TargetProductSource.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/target/product/TargetProductSource.java
index 0fc823b..c193149 100644
--- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/target/product/TargetProductSource.java
+++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/target/product/TargetProductSource.java
@@ -5,6 +5,11 @@ import common.ecommerce.http.HttpResponse;
import common.ecommerce.lingxing.LingxingApi;
import common.ecommerce.lingxing.http.LingxingEnvelope;
import common.ecommerce.lingxing.platform.LingxingCall;
+import common.ecommerce.error.ChannelException;
+import common.ecommerce.error.ValidationException;
+import common.ecommerce.lingxing.platform.multiplatform.product.LingxingProductSearchBody;
+import common.ecommerce.lingxing.platform.multiplatform.product.LingxingProductSearchMapper;
+import common.ecommerce.model.product.ProductQuery;
import common.ecommerce.lingxing.platform.LingxingProductSource;
import common.ecommerce.lingxing.platform.target.dto.TargetListingDto;
import common.ecommerce.model.ChannelProvider;
@@ -56,6 +61,9 @@ public final class TargetProductSource implements LingxingProductSource {
// }
applyTimeWindow(body, query);
+ // 按 SKU 搜索:平台不支持的维度直接报错,不静默忽略
+ applySearch(body, query);
+
HttpRequest req = call.signed(LingxingApi.LISTING_SHOPIFY, body, "products.pull");
HttpResponse resp = call.execute(req);
LingxingEnvelope envelope = call.envelope(resp, "products.pull");
@@ -276,4 +284,23 @@ public final class TargetProductSource implements LingxingProductSource {
String trimmed = v.trim();
return trimmed.isEmpty() ? null : trimmed;
}
+
+ /** 统一 SKU 搜索 → shopify/target 的字段形态;未带搜索条件时什么也不做。 */
+ private static void applySearch(java.util.Map body,
+ ProductQuery query) {
+ if (query == null || !query.hasSearch()) {
+ return;
+ }
+ try {
+ Object fieldValue = LingxingProductSearchMapper.shopify(query.searchField());
+ LingxingProductSearchBody.snakeCase(body, query, fieldValue);
+ } catch (UnsupportedOperationException e) {
+ ChannelException.Builder b = ChannelException.builder()
+ .message("shopify/target listing does not support search field "
+ + query.searchField())
+ .operation("products.pull")
+ .retryable(false);
+ throw new ValidationException(b);
+ }
+ }
}
diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/temu/product/TemuProductSource.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/temu/product/TemuProductSource.java
index a13076a..4b784d1 100644
--- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/temu/product/TemuProductSource.java
+++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/temu/product/TemuProductSource.java
@@ -5,6 +5,11 @@ import common.ecommerce.http.HttpResponse;
import common.ecommerce.lingxing.LingxingApi;
import common.ecommerce.lingxing.http.LingxingEnvelope;
import common.ecommerce.lingxing.platform.LingxingCall;
+import common.ecommerce.error.ChannelException;
+import common.ecommerce.error.ValidationException;
+import common.ecommerce.lingxing.platform.multiplatform.product.LingxingProductSearchBody;
+import common.ecommerce.lingxing.platform.multiplatform.product.LingxingProductSearchMapper;
+import common.ecommerce.model.product.ProductQuery;
import common.ecommerce.lingxing.platform.LingxingProductSource;
import common.ecommerce.lingxing.platform.temu.dto.TemuListingDto;
import common.ecommerce.model.ChannelProvider;
@@ -52,6 +57,9 @@ public final class TemuProductSource implements LingxingProductSource {
}
applyTimeWindow(body, query);
+ // 按 SKU 搜索:平台不支持的维度直接报错,不静默忽略
+ applySearch(body, query);
+
HttpRequest req = call.signed(LingxingApi.LISTING_TEMU, body, "products.pull");
HttpResponse resp = call.execute(req);
LingxingEnvelope envelope = call.envelope(resp, "products.pull");
@@ -201,4 +209,23 @@ public final class TemuProductSource implements LingxingProductSource {
String trimmed = v.trim();
return trimmed.isEmpty() ? null : trimmed;
}
+
+ /** 统一 SKU 搜索 → temu 的字段形态;未带搜索条件时什么也不做。 */
+ private static void applySearch(java.util.Map body,
+ ProductQuery query) {
+ if (query == null || !query.hasSearch()) {
+ return;
+ }
+ try {
+ Object fieldValue = LingxingProductSearchMapper.temu(query.searchField());
+ LingxingProductSearchBody.camelCase(body, query, fieldValue);
+ } catch (UnsupportedOperationException e) {
+ ChannelException.Builder b = ChannelException.builder()
+ .message("temu listing does not support search field "
+ + query.searchField())
+ .operation("products.pull")
+ .retryable(false);
+ throw new ValidationException(b);
+ }
+ }
}
diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/tiktok/product/TiktokProductSource.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/tiktok/product/TiktokProductSource.java
index 181c86f..41b5e4f 100644
--- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/tiktok/product/TiktokProductSource.java
+++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/tiktok/product/TiktokProductSource.java
@@ -5,6 +5,11 @@ import common.ecommerce.http.HttpResponse;
import common.ecommerce.lingxing.LingxingApi;
import common.ecommerce.lingxing.http.LingxingEnvelope;
import common.ecommerce.lingxing.platform.LingxingCall;
+import common.ecommerce.error.ChannelException;
+import common.ecommerce.error.ValidationException;
+import common.ecommerce.lingxing.platform.multiplatform.product.LingxingProductSearchBody;
+import common.ecommerce.lingxing.platform.multiplatform.product.LingxingProductSearchMapper;
+import common.ecommerce.model.product.ProductQuery;
import common.ecommerce.lingxing.platform.LingxingProductSource;
import common.ecommerce.lingxing.platform.tiktok.dto.TiktokListingDto;
import common.ecommerce.model.ChannelProvider;
@@ -44,6 +49,8 @@ public final class TiktokProductSource implements LingxingProductSource {
if (storeId != null && !storeId.trim().isEmpty()) {
body.put("storeIds", Collections.singletonList(storeId));
}
+ // 按 SKU 搜索:平台不支持的维度直接报错,不静默忽略
+ applySearch(body, query);
HttpRequest req = call.signed(LingxingApi.LISTING_TIKTOK, body, "products.pull");
HttpResponse resp = call.execute(req);
LingxingEnvelope envelope = call.envelope(resp, "products.pull");
@@ -231,4 +238,23 @@ public final class TiktokProductSource implements LingxingProductSource {
String trimmed = v.trim();
return trimmed.isEmpty() ? null : trimmed;
}
+
+ /** 统一 SKU 搜索 → tiktok 的字段形态;未带搜索条件时什么也不做。 */
+ private static void applySearch(java.util.Map body,
+ ProductQuery query) {
+ if (query == null || !query.hasSearch()) {
+ return;
+ }
+ try {
+ Object fieldValue = LingxingProductSearchMapper.tiktok(query.searchField());
+ LingxingProductSearchBody.camelCase(body, query, fieldValue);
+ } catch (UnsupportedOperationException e) {
+ ChannelException.Builder b = ChannelException.builder()
+ .message("tiktok listing does not support search field "
+ + query.searchField())
+ .operation("products.pull")
+ .retryable(false);
+ throw new ValidationException(b);
+ }
+ }
}
diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/walmart/product/WalmartProductSource.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/walmart/product/WalmartProductSource.java
index 3318e8c..15f9168 100644
--- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/walmart/product/WalmartProductSource.java
+++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/walmart/product/WalmartProductSource.java
@@ -6,6 +6,11 @@ import common.ecommerce.lingxing.LingxingApi;
import common.ecommerce.lingxing.LingxingConstants;
import common.ecommerce.lingxing.http.LingxingEnvelope;
import common.ecommerce.lingxing.platform.LingxingCall;
+import common.ecommerce.error.ChannelException;
+import common.ecommerce.error.ValidationException;
+import common.ecommerce.lingxing.platform.multiplatform.product.LingxingProductSearchBody;
+import common.ecommerce.lingxing.platform.multiplatform.product.LingxingProductSearchMapper;
+import common.ecommerce.model.product.ProductQuery;
import common.ecommerce.lingxing.platform.LingxingProductSource;
import common.ecommerce.lingxing.platform.walmart.dto.WalmartListingDto;
import common.ecommerce.model.ChannelProvider;
@@ -71,6 +76,9 @@ public final class WalmartProductSource implements LingxingProductSource {
}
applyTimeWindow(body, query);
+ // 按 SKU 搜索:平台不支持的维度直接报错,不静默忽略
+ applySearch(body, query);
+
HttpRequest req = call.signed(LingxingApi.LISTING_WALMART, body, "products.pull");
HttpResponse resp = call.execute(req);
LingxingEnvelope envelope = call.envelope(resp, "products.pull");
@@ -283,4 +291,23 @@ public final class WalmartProductSource implements LingxingProductSource {
String trimmed = v.trim();
return trimmed.isEmpty() ? null : trimmed;
}
+
+ /** 统一 SKU 搜索 → walmart 的字段形态;未带搜索条件时什么也不做。 */
+ private static void applySearch(java.util.Map body,
+ ProductQuery query) {
+ if (query == null || !query.hasSearch()) {
+ return;
+ }
+ try {
+ Object fieldValue = LingxingProductSearchMapper.walmart(query.searchField());
+ LingxingProductSearchBody.camelCase(body, query, fieldValue);
+ } catch (UnsupportedOperationException e) {
+ ChannelException.Builder b = ChannelException.builder()
+ .message("walmart listing does not support search field "
+ + query.searchField())
+ .operation("products.pull")
+ .retryable(false);
+ throw new ValidationException(b);
+ }
+ }
}