From 2ff213e3c42085ef11425c611c7dd425f8663ef3 Mon Sep 17 00:00:00 2001 From: chenchuchuan <13554600537@163.com> Date: Tue, 3 Nov 2026 14:34:09 +0800 Subject: [PATCH] =?UTF-8?q?fix(aliexpress):=20price=20=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E6=8C=89=E5=88=86=E6=8D=A2=E7=AE=97=E4=B8=BA=E6=A0=87=E5=87=86?= =?UTF-8?q?=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 接口 price 字段单位为分,统一模型用标准金额(元),除以 100 后输出。 取值优先级: 1. effectiveSupplyPrice(已格式化的字符串,直接可用) 2. price(分)÷ 100 3. 当前生效的 supplyPriceList 条目 文档示例 99990000 与 effectiveSupplyPrice 59.99 不一致,按「单位分」处理; 原始 price 仍保留在 attributes.price。 Co-Authored-By: Claude --- .../product/AliexpressProductSource.java | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) 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 a884d8c..2c52492 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 @@ -128,7 +128,9 @@ public final class AliexpressProductSource implements LingxingProductSource { *
  • imageUrls ← {@code skuImage},为空时用 {@code imageUrls}(父体图)
  • *
  • status ← {@code status}(文档只给了「可售」=2,其余归 UNKNOWN)
  • *
  • rawStatus ← {@code statusName} 原值(中文)
  • - *
  • price ← {@code effectiveSupplyPrice} + {@code currencyCode}
  • + *
  • price ← 优先 {@code effectiveSupplyPrice}(已格式化的字符串); + * 缺失时用 {@code price}(单位:分)除以 100 转成标准金额; + * 再缺失时取当前生效的 {@code supplyPriceList} 条目
  • *
  • listedAt ← {@code createTime}(北京时间,按 UTC 换算)
  • *
  • updatedAt ← 无
  • *
  • attributes ← 其余全部原始字段
  • @@ -138,7 +140,10 @@ public final class AliexpressProductSource implements LingxingProductSource { ZoneId zone = ZoneId.of(call.ctx().account().marketplaceZone()); String image = firstNonBlank(dto.getSkuImage(), dto.getImageUrls()); String currency = trimToNull(dto.getCurrencyCode()); - String price = firstNonBlank(dto.getEffectiveSupplyPrice(), currentSupplyPrice(dto.getSupplyPriceList())); + String price = firstNonBlank( + dto.getEffectiveSupplyPrice(), + centsToAmount(dto.getPrice()), + currentSupplyPrice(dto.getSupplyPriceList())); return ProductListing.builder() .platform(call.ctx().platform()) @@ -157,6 +162,19 @@ public final class AliexpressProductSource implements LingxingProductSource { .build(); } + /** + * 接口的 {@code price} 单位是分,统一模型用标准金额(元),此处除以 100。 + * + *

    文档示例 99990000 与 effectiveSupplyPrice 59.99 不一致,属于文档笔误; + * 以「单位分」为准做换算。

    + */ + private static String centsToAmount(Long cents) { + if (cents == null) { + return null; + } + return java.math.BigDecimal.valueOf(cents, 2).toPlainString(); + } + /** 当前生效供货价:优先 endStr 为空,否则取 beginStr 最大的一条。 */ private static String currentSupplyPrice(List prices) { if (prices == null || prices.isEmpty()) {