Browse Source

refactor(lingxing): 领星 shopify 接口按 Target 平台对接;店铺过滤改为可选

平台改名:
- platform/shopify/ → platform/target/
- ShopifySubPlatform / ShopifyProductSource / ShopifyListingDto / ShopifyLocationDto
  → Target* 系列
- Platform.SHOPIFY 保留(供直连场景),领星侧改用 Platform.TARGET
- 领星接口路径不变(/basicOpen/multiplatform/shopify/variantList)

店铺过滤:
- 各商品 Source 不再无条件拼 store_ids / storeIds / sid / vc_store_ids
- 账户 externalStoreId 为空时不传,由平台侧校验是否必填;
  SDK 不做上层校验,只负责透传

Co-Authored-By: Claude <noreply@anthropic.com>
feature/supplier-lingxing
chenchuchuan 2 weeks ago
parent
commit
a4ba27e715
  1. 2
      core/src/main/java/common/ecommerce/model/Platform.java
  2. 5
      lingxing/src/main/java/common/ecommerce/lingxing/LingxingApi.java
  3. 2
      lingxing/src/main/java/common/ecommerce/lingxing/adapter/LingxingAdapter.java
  4. 2
      lingxing/src/main/java/common/ecommerce/lingxing/adapter/LingxingAdapterFactory.java
  5. 2
      lingxing/src/main/java/common/ecommerce/lingxing/dto/LingxingPlatformInfoDto.java
  6. 1
      lingxing/src/main/java/common/ecommerce/lingxing/platform/LingxingOutboundSource.java
  7. 4
      lingxing/src/main/java/common/ecommerce/lingxing/platform/LingxingSubPlatformDefaults.java
  8. 6
      lingxing/src/main/java/common/ecommerce/lingxing/platform/aliexpress/product/AliexpressProductSource.java
  9. 6
      lingxing/src/main/java/common/ecommerce/lingxing/platform/amazon/sc/product/AmazonScProductSource.java
  10. 6
      lingxing/src/main/java/common/ecommerce/lingxing/platform/amazon/vc/product/AmazonVcProductSource.java
  11. 6
      lingxing/src/main/java/common/ecommerce/lingxing/platform/ebay/product/EbayProductSource.java
  12. 6
      lingxing/src/main/java/common/ecommerce/lingxing/platform/shein/product/SheinProductSource.java
  13. 14
      lingxing/src/main/java/common/ecommerce/lingxing/platform/target/TargetSubPlatform.java
  14. 10
      lingxing/src/main/java/common/ecommerce/lingxing/platform/target/dto/TargetListingDto.java
  15. 6
      lingxing/src/main/java/common/ecommerce/lingxing/platform/target/dto/TargetLocationDto.java
  16. 31
      lingxing/src/main/java/common/ecommerce/lingxing/platform/target/product/TargetProductSource.java
  17. 6
      lingxing/src/main/java/common/ecommerce/lingxing/platform/temu/product/TemuProductSource.java
  18. 6
      lingxing/src/main/java/common/ecommerce/lingxing/platform/tiktok/product/TiktokProductSource.java
  19. 6
      lingxing/src/main/java/common/ecommerce/lingxing/platform/walmart/product/WalmartProductSource.java

2
core/src/main/java/common/ecommerce/model/Platform.java

@ -24,7 +24,7 @@ public enum Platform {
EBAY, EBAY,
/** SHEIN(首期经领星接入) */ /** SHEIN(首期经领星接入) */
SHEIN, SHEIN,
/** Shopify(首期经领星接入) */ /** Shopify。当前领星侧该接口按 Target 对接,保留此值以备直连使用。 */
SHOPIFY, SHOPIFY,
/** AliExpress(首期经领星接入) */ /** AliExpress(首期经领星接入) */
ALIEXPRESS, ALIEXPRESS,

5
lingxing/src/main/java/common/ecommerce/lingxing/LingxingApi.java

@ -50,7 +50,10 @@ public enum LingxingApi {
/** Temu 在线商品。POST,offset/length(上限 1000)或游标分页,返回 data.list。 */ /** Temu 在线商品。POST,offset/length(上限 1000)或游标分页,返回 data.list。 */
LISTING_TEMU("/basicOpen/multiplatform/temu/list", 1), LISTING_TEMU("/basicOpen/multiplatform/temu/list", 1),
/** Shopify 在线商品(变体维度)。POST,offset/length(上限 1000),返回 data.list。 */ /**
* Target 在线商品(领星侧路径仍叫 shopify,返回变体维度)。
* POST,offset/length(上限 1000),返回 data.list。
*/
LISTING_SHOPIFY("/basicOpen/multiplatform/shopify/variantList", 1), LISTING_SHOPIFY("/basicOpen/multiplatform/shopify/variantList", 1),
/** eBay 在线商品。POST,offset/length(上限 200),返回 data 数组。 */ /** eBay 在线商品。POST,offset/length(上限 200),返回 data 数组。 */

2
lingxing/src/main/java/common/ecommerce/lingxing/adapter/LingxingAdapter.java

@ -125,7 +125,7 @@ public final class LingxingAdapter implements SalesOrderCapable, ProductCapable,
@Override @Override
public Set<Platform> platforms() { public Set<Platform> platforms() {
return EnumSet.of(Platform.AMAZON_SC, Platform.AMAZON_VC, Platform.WALMART_SC, Platform.TIKTOK, return EnumSet.of(Platform.AMAZON_SC, Platform.AMAZON_VC, Platform.WALMART_SC, Platform.TIKTOK,
Platform.TEMU, Platform.EBAY, Platform.SHEIN, Platform.SHOPIFY, Platform.TEMU, Platform.EBAY, Platform.SHEIN, Platform.TARGET,
Platform.ALIEXPRESS, Platform.MIRAKL, Platform.ALIEXPRESS, Platform.MIRAKL,
Platform.CUSTOM); Platform.CUSTOM);
} }

2
lingxing/src/main/java/common/ecommerce/lingxing/adapter/LingxingAdapterFactory.java

@ -40,7 +40,7 @@ public final class LingxingAdapterFactory implements AdapterFactory {
@Override @Override
public EnumSet<Platform> platforms() { public EnumSet<Platform> platforms() {
return EnumSet.of(Platform.AMAZON_SC, Platform.AMAZON_VC, Platform.WALMART_SC, Platform.TIKTOK, return EnumSet.of(Platform.AMAZON_SC, Platform.AMAZON_VC, Platform.WALMART_SC, Platform.TIKTOK,
Platform.TEMU, Platform.EBAY, Platform.SHEIN, Platform.SHOPIFY, Platform.TEMU, Platform.EBAY, Platform.SHEIN, Platform.TARGET,
Platform.ALIEXPRESS, Platform.MIRAKL, Platform.ALIEXPRESS, Platform.MIRAKL,
Platform.CUSTOM); Platform.CUSTOM);
} }

2
lingxing/src/main/java/common/ecommerce/lingxing/dto/LingxingPlatformInfoDto.java

@ -20,7 +20,7 @@ public class LingxingPlatformInfoDto {
@JsonProperty("platform_code") @JsonProperty("platform_code")
private String platformCode; private String platformCode;
/** 平台订单唯一标识;Shopify 下与 platform_order_name 不同。 */ /** 平台订单唯一标识;Target(领星路径 shopify)下与 platform_order_name 不同。 */
@JsonProperty("platform_order_no") @JsonProperty("platform_order_no")
private String platformOrderNo; private String platformOrderNo;

1
lingxing/src/main/java/common/ecommerce/lingxing/platform/LingxingOutboundSource.java

@ -1,6 +1,5 @@
package common.ecommerce.lingxing.platform; package common.ecommerce.lingxing.platform;
import common.ecommerce.lingxing.platform.LingxingCall;
import common.ecommerce.model.fulfillment.OutboundPackage; import common.ecommerce.model.fulfillment.OutboundPackage;
import common.ecommerce.model.fulfillment.OutboundResult; import common.ecommerce.model.fulfillment.OutboundResult;

4
lingxing/src/main/java/common/ecommerce/lingxing/platform/LingxingSubPlatformDefaults.java

@ -7,7 +7,7 @@ import common.ecommerce.lingxing.platform.amazon.sc.AmazonScSubPlatform;
import common.ecommerce.lingxing.platform.amazon.vc.AmazonVcSubPlatform; import common.ecommerce.lingxing.platform.amazon.vc.AmazonVcSubPlatform;
import common.ecommerce.lingxing.platform.ebay.EbaySubPlatform; import common.ecommerce.lingxing.platform.ebay.EbaySubPlatform;
import common.ecommerce.lingxing.platform.shein.SheinSubPlatform; import common.ecommerce.lingxing.platform.shein.SheinSubPlatform;
import common.ecommerce.lingxing.platform.shopify.ShopifySubPlatform; import common.ecommerce.lingxing.platform.target.TargetSubPlatform;
import common.ecommerce.lingxing.platform.temu.TemuSubPlatform; import common.ecommerce.lingxing.platform.temu.TemuSubPlatform;
import common.ecommerce.lingxing.platform.tiktok.TiktokSubPlatform; import common.ecommerce.lingxing.platform.tiktok.TiktokSubPlatform;
import common.ecommerce.lingxing.platform.walmart.WalmartSubPlatform; import common.ecommerce.lingxing.platform.walmart.WalmartSubPlatform;
@ -31,7 +31,7 @@ public final class LingxingSubPlatformDefaults {
.register(new WalmartSubPlatform(transport, json)) .register(new WalmartSubPlatform(transport, json))
.register(new TemuSubPlatform(transport, json)) .register(new TemuSubPlatform(transport, json))
.register(new SheinSubPlatform(transport, json)) .register(new SheinSubPlatform(transport, json))
.register(new ShopifySubPlatform(transport, json)) .register(new TargetSubPlatform(transport, json))
.register(new EbaySubPlatform(transport, json)) .register(new EbaySubPlatform(transport, json))
.register(new AliexpressSubPlatform(transport, json)) .register(new AliexpressSubPlatform(transport, json))
.register(new TiktokSubPlatform(transport, json)) .register(new TiktokSubPlatform(transport, json))

6
lingxing/src/main/java/common/ecommerce/lingxing/platform/aliexpress/product/AliexpressProductSource.java

@ -55,7 +55,11 @@ public final class AliexpressProductSource implements LingxingProductSource {
body.put("isParent", IS_CHILD); body.put("isParent", IS_CHILD);
body.put("offset", offset); body.put("offset", offset);
body.put("length", length); body.put("length", length);
body.put("storeIds", Collections.singletonList(parseStoreId(call.ctx().account().externalStoreId()))); // storeIds 非必填:账户配了才传,由平台侧校验是否必填
String storeId = call.ctx().account().externalStoreId();
if (storeId != null && !storeId.trim().isEmpty()) {
body.put("storeIds", Collections.singletonList(parseStoreId(storeId)));
}
applyTimeWindow(body, query); applyTimeWindow(body, query);
HttpRequest req = call.signed(LingxingApi.LISTING_ALIEXPRESS, body, "products.pull"); HttpRequest req = call.signed(LingxingApi.LISTING_ALIEXPRESS, body, "products.pull");

6
lingxing/src/main/java/common/ecommerce/lingxing/platform/amazon/sc/product/AmazonScProductSource.java

@ -48,7 +48,11 @@ public final class AmazonScProductSource implements LingxingProductSource {
int offset = query.cursor() == null ? 0 : Integer.parseInt(query.cursor()); int offset = query.cursor() == null ? 0 : Integer.parseInt(query.cursor());
Map<String, Object> body = new LinkedHashMap<String, Object>(); Map<String, Object> body = new LinkedHashMap<String, Object>();
body.put("sid", call.ctx().account().externalStoreId()); // sid 非必填:账户配了才传,由平台侧校验是否必填
String storeId = call.ctx().account().externalStoreId();
if (storeId != null && !storeId.trim().isEmpty()) {
body.put("sid", storeId);
}
body.put("offset", offset); body.put("offset", offset);
body.put("length", length); body.put("length", length);
Instant from = query.updatedAfter(); Instant from = query.updatedAfter();

6
lingxing/src/main/java/common/ecommerce/lingxing/platform/amazon/vc/product/AmazonVcProductSource.java

@ -49,7 +49,11 @@ public final class AmazonVcProductSource implements LingxingProductSource {
Map<String, Object> body = new LinkedHashMap<String, Object>(); Map<String, Object> body = new LinkedHashMap<String, Object>();
body.put("offset", offset); body.put("offset", offset);
body.put("length", length); body.put("length", length);
body.put("vc_store_ids", Collections.singletonList(call.ctx().account().externalStoreId())); // vc_store_ids 非必填:账户配了才传,由平台侧校验是否必填
String storeId = call.ctx().account().externalStoreId();
if (storeId != null && !storeId.trim().isEmpty()) {
body.put("vc_store_ids", Collections.singletonList(storeId));
}
HttpRequest req = call.signed(LingxingApi.LISTING_AMAZON_VC, body, "products.pull"); HttpRequest req = call.signed(LingxingApi.LISTING_AMAZON_VC, body, "products.pull");
HttpResponse resp = call.execute(req); HttpResponse resp = call.execute(req);
LingxingEnvelope envelope = call.envelope(resp, "products.pull"); LingxingEnvelope envelope = call.envelope(resp, "products.pull");

6
lingxing/src/main/java/common/ecommerce/lingxing/platform/ebay/product/EbayProductSource.java

@ -55,7 +55,11 @@ public final class EbayProductSource implements LingxingProductSource {
Map<String, Object> body = new LinkedHashMap<String, Object>(); Map<String, Object> body = new LinkedHashMap<String, Object>();
body.put("offset", offset); body.put("offset", offset);
body.put("length", length); body.put("length", length);
body.put("store_ids", Collections.singletonList(call.ctx().account().externalStoreId())); // store_ids 非必填:账户配了才传,由平台侧校验是否必填
String storeId = call.ctx().account().externalStoreId();
if (storeId != null && !storeId.trim().isEmpty()) {
body.put("store_ids", Collections.singletonList(storeId));
}
applyTimeWindow(body, query); applyTimeWindow(body, query);
HttpRequest req = call.signed(LingxingApi.LISTING_EBAY, body, "products.pull"); HttpRequest req = call.signed(LingxingApi.LISTING_EBAY, body, "products.pull");

6
lingxing/src/main/java/common/ecommerce/lingxing/platform/shein/product/SheinProductSource.java

@ -40,7 +40,11 @@ public final class SheinProductSource implements LingxingProductSource {
Map<String, Object> body = new LinkedHashMap<String, Object>(); Map<String, Object> body = new LinkedHashMap<String, Object>();
body.put("offset", offset); body.put("offset", offset);
body.put("length", length); body.put("length", length);
body.put("storeIds", Collections.singletonList(call.ctx().account().externalStoreId())); // storeIds 非必填:账户配了才传,由平台侧校验是否必填
String storeId = call.ctx().account().externalStoreId();
if (storeId != null && !storeId.trim().isEmpty()) {
body.put("storeIds", Collections.singletonList(storeId));
}
HttpRequest req = call.signed(LingxingApi.LISTING_SHEIN, body, "products.pull"); HttpRequest req = call.signed(LingxingApi.LISTING_SHEIN, body, "products.pull");
HttpResponse resp = call.execute(req); HttpResponse resp = call.execute(req);
LingxingEnvelope envelope = call.envelope(resp, "products.pull"); LingxingEnvelope envelope = call.envelope(resp, "products.pull");

14
lingxing/src/main/java/common/ecommerce/lingxing/platform/shopify/ShopifySubPlatform.java → lingxing/src/main/java/common/ecommerce/lingxing/platform/target/TargetSubPlatform.java

@ -1,4 +1,4 @@
package common.ecommerce.lingxing.platform.shopify; package common.ecommerce.lingxing.platform.target;
import common.ecommerce.http.HttpTransport; import common.ecommerce.http.HttpTransport;
import common.ecommerce.http.JacksonJsonCodec; import common.ecommerce.http.JacksonJsonCodec;
@ -6,26 +6,26 @@ import common.ecommerce.lingxing.platform.LingxingSubPlatform;
import common.ecommerce.lingxing.platform.LingxingProductSource; import common.ecommerce.lingxing.platform.LingxingProductSource;
import common.ecommerce.lingxing.platform.multiplatform.outbound.MultiPlatformOutboundSource; import common.ecommerce.lingxing.platform.multiplatform.outbound.MultiPlatformOutboundSource;
import common.ecommerce.lingxing.platform.LingxingOutboundSource; import common.ecommerce.lingxing.platform.LingxingOutboundSource;
import common.ecommerce.lingxing.platform.shopify.product.ShopifyProductSource; import common.ecommerce.lingxing.platform.target.product.TargetProductSource;
import common.ecommerce.model.Platform; import common.ecommerce.model.Platform;
/** /**
* 领星 · Shopify 子平台:只做能力组合。 * 领星 · Target 子平台:只做能力组合。
*/ */
public final class ShopifySubPlatform implements LingxingSubPlatform { public final class TargetSubPlatform implements LingxingSubPlatform {
/** 快速出库是多平台通用接口,各子平台共用。 */ /** 快速出库是多平台通用接口,各子平台共用。 */
private static final MultiPlatformOutboundSource OUTBOUND = new MultiPlatformOutboundSource(); private static final MultiPlatformOutboundSource OUTBOUND = new MultiPlatformOutboundSource();
private final LingxingProductSource products; private final LingxingProductSource products;
public ShopifySubPlatform(HttpTransport transport, JacksonJsonCodec json) { public TargetSubPlatform(HttpTransport transport, JacksonJsonCodec json) {
this.products = new ShopifyProductSource(); this.products = new TargetProductSource();
} }
@Override @Override
public Platform platform() { public Platform platform() {
return Platform.SHOPIFY; return Platform.TARGET;
} }
@Override @Override

10
lingxing/src/main/java/common/ecommerce/lingxing/platform/shopify/dto/ShopifyListingDto.java → lingxing/src/main/java/common/ecommerce/lingxing/platform/target/dto/TargetListingDto.java

@ -1,4 +1,4 @@
package common.ecommerce.lingxing.platform.shopify.dto; package common.ecommerce.lingxing.platform.target.dto;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
@ -9,16 +9,16 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* 领星 · Shopify 在线商品({@code /basicOpen/multiplatform/shopify/variantList} 的 {@code data.list[]})。 * 领星 · Target 在线商品({@code /basicOpen/multiplatform/shopify/variantList} 的 {@code data.list[]})。
* *
* <p>文档字段是 snake_case;这里用 camelCase 的 Java 字段 + {@code @JsonProperty} 映射。</p> * <p>文档字段是 snake_case;这里用 camelCase 的 Java 字段 + {@code @JsonProperty} 映射。</p>
* *
* <p>Shopify 按<b>变体(variant)</b>返回,{@code msku} 是平台侧 SKU。</p> * <p>Target(领星路径 shopify)按<b>变体(variant)</b>返回,{@code msku} 是平台侧 SKU。</p>
*/ */
@Getter @Getter
@Setter @Setter
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
public class ShopifyListingDto { public class TargetListingDto {
/** 商品 ID。 */ /** 商品 ID。 */
@JsonProperty("item_id") @JsonProperty("item_id")
@ -162,5 +162,5 @@ public class ShopifyListingDto {
/** 各仓位信息。 */ /** 各仓位信息。 */
@JsonProperty("location_infos") @JsonProperty("location_infos")
private List<ShopifyLocationDto> locationInfos = new ArrayList<ShopifyLocationDto>(); private List<TargetLocationDto> locationInfos = new ArrayList<TargetLocationDto>();
} }

6
lingxing/src/main/java/common/ecommerce/lingxing/platform/shopify/dto/ShopifyLocationDto.java → lingxing/src/main/java/common/ecommerce/lingxing/platform/target/dto/TargetLocationDto.java

@ -1,15 +1,15 @@
package common.ecommerce.lingxing.platform.shopify.dto; package common.ecommerce.lingxing.platform.target.dto;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
/** Shopify 商品仓位信息({@code location_infos[]})。 */ /** Target 商品仓位信息({@code location_infos[]})。 */
@Getter @Getter
@Setter @Setter
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
public class ShopifyLocationDto { public class TargetLocationDto {
/** 仓位 id。 */ /** 仓位 id。 */
@JsonProperty("location_id") @JsonProperty("location_id")

31
lingxing/src/main/java/common/ecommerce/lingxing/platform/shopify/product/ShopifyProductSource.java → lingxing/src/main/java/common/ecommerce/lingxing/platform/target/product/TargetProductSource.java

@ -1,4 +1,4 @@
package common.ecommerce.lingxing.platform.shopify.product; package common.ecommerce.lingxing.platform.target.product;
import common.ecommerce.http.HttpRequest; import common.ecommerce.http.HttpRequest;
import common.ecommerce.http.HttpResponse; import common.ecommerce.http.HttpResponse;
@ -6,7 +6,7 @@ import common.ecommerce.lingxing.LingxingApi;
import common.ecommerce.lingxing.http.LingxingEnvelope; import common.ecommerce.lingxing.http.LingxingEnvelope;
import common.ecommerce.lingxing.platform.LingxingCall; import common.ecommerce.lingxing.platform.LingxingCall;
import common.ecommerce.lingxing.platform.LingxingProductSource; import common.ecommerce.lingxing.platform.LingxingProductSource;
import common.ecommerce.lingxing.platform.shopify.dto.ShopifyListingDto; import common.ecommerce.lingxing.platform.target.dto.TargetListingDto;
import common.ecommerce.model.ChannelProvider; import common.ecommerce.model.ChannelProvider;
import common.ecommerce.model.product.ProductListing; import common.ecommerce.model.product.ProductListing;
import common.ecommerce.model.product.ProductQuery; import common.ecommerce.model.product.ProductQuery;
@ -27,12 +27,15 @@ import java.util.Locale;
import java.util.Map; import java.util.Map;
/** /**
* 领星 · Shopify 在线商品(变体维度)。 * 领星 · Target 在线商品(变体维度)。
* *
* <p>接口 {@code /basicOpen/multiplatform/shopify/variantList}:POST,{@code offset}/{@code length} * <p>接口 {@code /basicOpen/multiplatform/shopify/variantList}:POST,{@code offset}/{@code length}
* (上限 1000),返回 {@code data.list};令牌桶容量 1。</p> * (上限 1000),返回 {@code data.list};令牌桶容量 1。</p>
*
* <p>{@code store_ids} 是<b>非必填</b>项:文档未标必填,不传时返回该 app 下所有店铺的商品。
* 这里按账户的 {@code externalStoreId} 过滤,避免把其它店铺的商品混进同一个 omsStoreId。</p>
*/ */
public final class ShopifyProductSource implements LingxingProductSource { public final class TargetProductSource implements LingxingProductSource {
private static final int MAX_PAGE_SIZE = 1000; private static final int MAX_PAGE_SIZE = 1000;
@ -46,16 +49,20 @@ public final class ShopifyProductSource implements LingxingProductSource {
Map<String, Object> body = new LinkedHashMap<String, Object>(); Map<String, Object> body = new LinkedHashMap<String, Object>();
body.put("offset", offset); body.put("offset", offset);
body.put("length", length); body.put("length", length);
body.put("store_ids", Collections.singletonList(call.ctx().account().externalStoreId())); // store_ids 非必填:账户配了才传,由平台侧校验是否必填
String storeId = call.ctx().account().externalStoreId();
if (storeId != null && !storeId.trim().isEmpty()) {
body.put("store_ids", Collections.singletonList(storeId));
}
applyTimeWindow(body, query); applyTimeWindow(body, query);
HttpRequest req = call.signed(LingxingApi.LISTING_SHOPIFY, body, "products.pull"); HttpRequest req = call.signed(LingxingApi.LISTING_SHOPIFY, body, "products.pull");
HttpResponse resp = call.execute(req); HttpResponse resp = call.execute(req);
LingxingEnvelope envelope = call.envelope(resp, "products.pull"); LingxingEnvelope envelope = call.envelope(resp, "products.pull");
List<ShopifyListingDto> dtos = call.json().listAt(envelope.body(), "data.list", ShopifyListingDto.class); List<TargetListingDto> dtos = call.json().listAt(envelope.body(), "data.list", TargetListingDto.class);
List<ProductListing> out = new ArrayList<ProductListing>(dtos.size()); List<ProductListing> out = new ArrayList<ProductListing>(dtos.size());
for (ShopifyListingDto dto : dtos) { for (TargetListingDto dto : dtos) {
out.add(toProductListing(dto, call)); out.add(toProductListing(dto, call));
} }
@ -98,7 +105,7 @@ public final class ShopifyProductSource implements LingxingProductSource {
} }
/** /**
* 领星 Shopify 商品 → 统一模型。 * 领星 Target 商品 → 统一模型。
* *
* <p>统一字段来源:</p> * <p>统一字段来源:</p>
* <ul> * <ul>
@ -115,7 +122,7 @@ public final class ShopifyProductSource implements LingxingProductSource {
* <li>attributes ← 其余全部原始字段</li> * <li>attributes ← 其余全部原始字段</li>
* </ul> * </ul>
*/ */
private ProductListing toProductListing(ShopifyListingDto dto, LingxingCall call) { private ProductListing toProductListing(TargetListingDto dto, LingxingCall call) {
ZoneId zone = ZoneId.of(call.ctx().account().marketplaceZone()); ZoneId zone = ZoneId.of(call.ctx().account().marketplaceZone());
String currency = currencyOf(dto.getCurrencyIcon()); String currency = currencyOf(dto.getCurrencyIcon());
String image = firstNonBlank(dto.getPictureUrl(), dto.getParentPictureUrl()); String image = firstNonBlank(dto.getPictureUrl(), dto.getParentPictureUrl());
@ -139,8 +146,8 @@ public final class ShopifyProductSource implements LingxingProductSource {
.build(); .build();
} }
/** Shopify:1 active / 2 draft / 3 archived / 4 deleted。 */ /** Target:1 active / 2 draft / 3 archived / 4 deleted。 */
private static ProductStatus statusOf(ShopifyListingDto dto) { private static ProductStatus statusOf(TargetListingDto dto) {
if (dto.getStatus() == null) { if (dto.getStatus() == null) {
String name = dto.getStatusName(); String name = dto.getStatusName();
if (name != null) { if (name != null) {
@ -170,7 +177,7 @@ public final class ShopifyProductSource implements LingxingProductSource {
} }
} }
private static Map<String, Object> attributesOf(ShopifyListingDto dto) { private static Map<String, Object> attributesOf(TargetListingDto dto) {
Map<String, Object> attrs = new LinkedHashMap<String, Object>(); Map<String, Object> attrs = new LinkedHashMap<String, Object>();
attrs.put("item_id", dto.getItemId()); attrs.put("item_id", dto.getItemId());
attrs.put("item_url", dto.getItemUrl()); attrs.put("item_url", dto.getItemUrl());

6
lingxing/src/main/java/common/ecommerce/lingxing/platform/temu/product/TemuProductSource.java

@ -45,7 +45,11 @@ public final class TemuProductSource implements LingxingProductSource {
body.put("offset", offset); body.put("offset", offset);
body.put("length", length); body.put("length", length);
body.put("useCursor", Boolean.FALSE); body.put("useCursor", Boolean.FALSE);
body.put("storeIds", Collections.singletonList(call.ctx().account().externalStoreId())); // storeIds 非必填:账户配了才传,由平台侧校验是否必填
String storeId = call.ctx().account().externalStoreId();
if (storeId != null && !storeId.trim().isEmpty()) {
body.put("storeIds", Collections.singletonList(storeId));
}
applyTimeWindow(body, query); applyTimeWindow(body, query);
HttpRequest req = call.signed(LingxingApi.LISTING_TEMU, body, "products.pull"); HttpRequest req = call.signed(LingxingApi.LISTING_TEMU, body, "products.pull");

6
lingxing/src/main/java/common/ecommerce/lingxing/platform/tiktok/product/TiktokProductSource.java

@ -39,7 +39,11 @@ public final class TiktokProductSource implements LingxingProductSource {
Map<String, Object> body = new LinkedHashMap<String, Object>(); Map<String, Object> body = new LinkedHashMap<String, Object>();
body.put("offset", offset); body.put("offset", offset);
body.put("length", length); body.put("length", length);
body.put("storeIds", Collections.singletonList(call.ctx().account().externalStoreId())); // storeIds 非必填:账户配了才传,由平台侧校验是否必填
String storeId = call.ctx().account().externalStoreId();
if (storeId != null && !storeId.trim().isEmpty()) {
body.put("storeIds", Collections.singletonList(storeId));
}
HttpRequest req = call.signed(LingxingApi.LISTING_TIKTOK, body, "products.pull"); HttpRequest req = call.signed(LingxingApi.LISTING_TIKTOK, body, "products.pull");
HttpResponse resp = call.execute(req); HttpResponse resp = call.execute(req);
LingxingEnvelope envelope = call.envelope(resp, "products.pull"); LingxingEnvelope envelope = call.envelope(resp, "products.pull");

6
lingxing/src/main/java/common/ecommerce/lingxing/platform/walmart/product/WalmartProductSource.java

@ -64,7 +64,11 @@ public final class WalmartProductSource implements LingxingProductSource {
Map<String, Object> body = new LinkedHashMap<String, Object>(); Map<String, Object> body = new LinkedHashMap<String, Object>();
body.put("offset", offset); body.put("offset", offset);
body.put("length", length); body.put("length", length);
body.put("store_ids", Collections.singletonList(call.ctx().account().externalStoreId())); // store_ids 非必填:账户配了才传,由平台侧校验是否必填
String storeId = call.ctx().account().externalStoreId();
if (storeId != null && !storeId.trim().isEmpty()) {
body.put("store_ids", Collections.singletonList(storeId));
}
applyTimeWindow(body, query); applyTimeWindow(body, query);
HttpRequest req = call.signed(LingxingApi.LISTING_WALMART, body, "products.pull"); HttpRequest req = call.signed(LingxingApi.LISTING_WALMART, body, "products.pull");

Loading…
Cancel
Save