mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-23 23:19:19 +08:00
feat: 商品详情拉取由 information.get 迁移到 detail.get
This commit is contained in:
+1
-1
@@ -186,7 +186,7 @@ public class PddGoodsEnsureServiceImpl implements PddGoodsEnsureService {
|
||||
throw new BusinessException("非法 goods_id=" + gid);
|
||||
}
|
||||
PddAuthPO auth = authTokenService.ensureUsableById(pddShop.getPddAuthId());
|
||||
PddGoodsPopApiClient.GoodsDetail detail = goodsPopApiClient.fetchGoodsInformation(
|
||||
PddGoodsPopApiClient.GoodsDetail detail = goodsPopApiClient.fetchGoodsDetail(
|
||||
pddShop.getMallId(), auth.getAccessToken(), goodsIdLong);
|
||||
if (detail == null || detail.goodsId() == null) {
|
||||
throw new BusinessException("拉取拼多多商品详情为空 goods_id=" + gid);
|
||||
|
||||
+1
-1
@@ -333,7 +333,7 @@ public class PddGoodsPublishServiceImpl implements PddGoodsPublishService {
|
||||
PddGoodsPublishPopApiClient.GoodsAddResult addResult =
|
||||
publishPopApiClient.addGoods(ctx.mallId(), ctx.accessToken(), command);
|
||||
|
||||
PddGoodsPopApiClient.GoodsDetail detailInfo = goodsPopApiClient.fetchGoodsInformation(
|
||||
PddGoodsPopApiClient.GoodsDetail detailInfo = goodsPopApiClient.fetchGoodsDetail(
|
||||
ctx.mallId(), ctx.accessToken(), addResult.goodsId());
|
||||
if (detailInfo == null || detailInfo.goodsId() == null) {
|
||||
throw new BusinessException("发布成功但拉取商品详情为空 goodsId=" + addResult.goodsId());
|
||||
|
||||
+9
-5
@@ -256,7 +256,9 @@ public class PddGoodsServiceImpl extends ServiceImpl<PddGoodsMapper, PddGoodsPO>
|
||||
goods.setMallId(mallId);
|
||||
goods.setGoodsId(goodsId);
|
||||
goods.setGoodsName(StringUtils.hasText(detail.goodsName()) ? detail.goodsName().trim() : goodsId);
|
||||
if (goods.getGoodsQuantity() == null) {
|
||||
if (detail.goodsQuantity() != null) {
|
||||
goods.setGoodsQuantity(detail.goodsQuantity());
|
||||
} else if (goods.getGoodsQuantity() == null) {
|
||||
goods.setGoodsQuantity(0);
|
||||
}
|
||||
if (goods.getGoodsReserveQuantity() == null) {
|
||||
@@ -271,7 +273,9 @@ public class PddGoodsServiceImpl extends ServiceImpl<PddGoodsMapper, PddGoodsPO>
|
||||
}
|
||||
int skuSize = detail.skuList() != null ? detail.skuList().size() : 0;
|
||||
goods.setIsMoreSku(skuSize > 1 ? 1 : 0);
|
||||
if (goods.getIsOnsale() == null) {
|
||||
if (detail.isOnsale() != null) {
|
||||
goods.setIsOnsale(detail.isOnsale());
|
||||
} else if (goods.getIsOnsale() == null) {
|
||||
goods.setIsOnsale(0);
|
||||
}
|
||||
// 详情 upsert 视为平台商品仍存在,清除删除标记
|
||||
@@ -299,9 +303,9 @@ public class PddGoodsServiceImpl extends ServiceImpl<PddGoodsMapper, PddGoodsPO>
|
||||
po.setGoodsId(goodsId);
|
||||
po.setSkuId(String.valueOf(sku.skuId()));
|
||||
po.setSpec(blankToNull(sku.spec()));
|
||||
po.setSkuQuantity(0);
|
||||
po.setReserveQuantity(0);
|
||||
po.setIsSkuOnsale(0);
|
||||
po.setSkuQuantity(sku.skuQuantity() != null ? sku.skuQuantity() : 0);
|
||||
po.setReserveQuantity(sku.reserveQuantity() != null ? sku.reserveQuantity() : 0);
|
||||
po.setIsSkuOnsale(sku.isSkuOnsale() != null ? sku.isSkuOnsale() : 0);
|
||||
po.setOuterGoodsId(blankToNull(sku.outerGoodsId()));
|
||||
po.setOuterId(blankToNull(sku.outerId()));
|
||||
pddGoodsSkuMapper.insert(po);
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ abstract class AbstractPddGoodsUpsertMsgHandler implements PddMsgHandler {
|
||||
throw new IllegalStateException("渠道店不存在或未授权 shopId=" + inbox.getChannelShopId());
|
||||
}
|
||||
PddAuthPO auth = authTokenService.ensureUsableById(shop.getPddAuthId());
|
||||
PddGoodsPopApiClient.GoodsDetail detail = goodsPopApiClient.fetchGoodsInformation(
|
||||
PddGoodsPopApiClient.GoodsDetail detail = goodsPopApiClient.fetchGoodsDetail(
|
||||
shop.getMallId(), auth.getAccessToken(), goodsIdLong);
|
||||
if (detail == null || detail.goodsId() == null) {
|
||||
throw new IllegalStateException("拉取商品详情为空 goodsId=" + goodsId);
|
||||
|
||||
+50
-10
@@ -8,6 +8,8 @@ import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.cat.mapper.PddCatMapper;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.cat.model.po.PddCatPO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.goods.ensure.PddGoodsEnsureService;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.order.convert.messaging.PddProductAutoCreateMessage;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.order.mapper.PddOrderItemMapper;
|
||||
@@ -25,7 +27,7 @@ import top.xyquan.ecomdmbbackend.modules.ec.product.sku.service.ProductSkuServic
|
||||
/**
|
||||
* 按平台 goodsId 拉详情,自动创建内部商品 + 全部 SKU(已存在则跳过),
|
||||
* 并 upsert 渠道商品 channel_pdd_goods(不定主表 product_id,内部关联经 SKU outer_id)。
|
||||
* 类目:PDD 一级/叶子 → 内部一级/二级;按公司内叶子类目名复用,不重复创建。
|
||||
* 类目:detail.get 仅返回 cat_id,经本地 channel_pdd_cat 反查名称后落到内部一/二级类目。
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -34,6 +36,7 @@ public class PddProductAutoCreateService {
|
||||
private final PddOrderSyncContextResolver contextResolver;
|
||||
private final PddGoodsPopApiClient goodsPopApiClient;
|
||||
private final PddOrderItemMapper pddOrderItemMapper;
|
||||
private final PddCatMapper pddCatMapper;
|
||||
private final CategoryService categoryService;
|
||||
private final ProductService productService;
|
||||
private final ProductSkuService productSkuService;
|
||||
@@ -46,12 +49,14 @@ public class PddProductAutoCreateService {
|
||||
public PddProductAutoCreateService(PddOrderSyncContextResolver contextResolver,
|
||||
PddGoodsPopApiClient goodsPopApiClient,
|
||||
PddOrderItemMapper pddOrderItemMapper,
|
||||
PddCatMapper pddCatMapper,
|
||||
CategoryService categoryService,
|
||||
ProductService productService,
|
||||
ProductSkuService productSkuService) {
|
||||
this.contextResolver = contextResolver;
|
||||
this.goodsPopApiClient = goodsPopApiClient;
|
||||
this.pddOrderItemMapper = pddOrderItemMapper;
|
||||
this.pddCatMapper = pddCatMapper;
|
||||
this.categoryService = categoryService;
|
||||
this.productService = productService;
|
||||
this.productSkuService = productSkuService;
|
||||
@@ -88,7 +93,7 @@ public class PddProductAutoCreateService {
|
||||
if (companyId == null || goodsId == null) {
|
||||
return null;
|
||||
}
|
||||
PddGoodsPopApiClient.GoodsDetail detail = goodsPopApiClient.fetchGoodsInformation(
|
||||
PddGoodsPopApiClient.GoodsDetail detail = goodsPopApiClient.fetchGoodsDetail(
|
||||
mallId, accessToken, goodsId);
|
||||
return ensureInternalProduct(companyId, detail);
|
||||
}
|
||||
@@ -113,7 +118,7 @@ public class PddProductAutoCreateService {
|
||||
: productCode;
|
||||
|
||||
String imageUrl = resolveProductImageUrl(detail, companyId, detail.goodsId());
|
||||
Long categoryId = ensureCategoryId(companyId, detail.goodsCategory(), detail.lastCategory());
|
||||
Long categoryId = ensureCategoryId(companyId, detail.catId());
|
||||
ProductPO product = ensureProduct(companyId, productCode, productName, imageUrl, categoryId);
|
||||
if (product == null || product.getId() == null) {
|
||||
return null;
|
||||
@@ -161,7 +166,7 @@ public class PddProductAutoCreateService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 主图优先级:详情 image_url → 首个 sku_img → 订单明细 goods_img。
|
||||
* 主图优先级:详情 image_url → 首个 SKU thumb_url → 订单明细 goods_img。
|
||||
*/
|
||||
private String resolveProductImageUrl(PddGoodsPopApiClient.GoodsDetail detail,
|
||||
Long companyId, Long goodsId) {
|
||||
@@ -185,13 +190,48 @@ public class PddProductAutoCreateService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 按叶子类目名判断是否已有内部类目;有则直接用。
|
||||
* 无则:一级类目(goods_category) → parent_id=null;叶子(last_category) → 挂在一级下。
|
||||
* 商品绑定叶子类目 id(仅有一级时绑一级)。
|
||||
* <p>
|
||||
* PDD 类目名可能带路径如「洗护清洁剂/卫生巾/纸/香薰」,只取第一个「/」前一段。
|
||||
* 用 detail.get 的 cat_id 反查本地平台类目名,再建/复用内部类目。
|
||||
* 本地无该类目时不建、不绑内部类目(返回 null)。
|
||||
*/
|
||||
private Long ensureCategoryId(Long companyId, String goodsCategory, String lastCategory) {
|
||||
private Long ensureCategoryId(Long companyId, Long catId) {
|
||||
if (catId == null) {
|
||||
return null;
|
||||
}
|
||||
PddCatPO leafCat = pddCatMapper.selectById(catId);
|
||||
if (leafCat == null) {
|
||||
log.warn("自动建品:本地无平台类目 catId={},跳过内部类目绑定", catId);
|
||||
return null;
|
||||
}
|
||||
String leaf = normalizeCategoryName(leafCat.getCatName());
|
||||
String level1 = null;
|
||||
if (StringUtils.hasText(leafCat.getPathNames())) {
|
||||
String[] parts = leafCat.getPathNames().split("/");
|
||||
if (parts.length > 0) {
|
||||
level1 = normalizeCategoryName(parts[0]);
|
||||
}
|
||||
}
|
||||
if (level1 == null && leafCat.getParentCatId() != null && leafCat.getParentCatId() > 0) {
|
||||
PddCatPO parent = pddCatMapper.selectById(leafCat.getParentCatId());
|
||||
while (parent != null) {
|
||||
if (parent.getLevel() != null && parent.getLevel() == 1) {
|
||||
level1 = normalizeCategoryName(parent.getCatName());
|
||||
break;
|
||||
}
|
||||
if (parent.getParentCatId() == null || parent.getParentCatId() <= 0) {
|
||||
level1 = normalizeCategoryName(parent.getCatName());
|
||||
break;
|
||||
}
|
||||
parent = pddCatMapper.selectById(parent.getParentCatId());
|
||||
}
|
||||
}
|
||||
return ensureCategoryByNames(companyId, level1, leaf);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按叶子类目名判断是否已有内部类目;有则直接用。
|
||||
* 无则:一级类目 → parent_id=null;叶子 → 挂在一级下。
|
||||
*/
|
||||
private Long ensureCategoryByNames(Long companyId, String goodsCategory, String lastCategory) {
|
||||
String leaf = normalizeCategoryName(lastCategory);
|
||||
String level1 = normalizeCategoryName(goodsCategory);
|
||||
if (leaf == null && level1 == null) {
|
||||
|
||||
+3
@@ -14,7 +14,10 @@ public final class PddPopApiTypes {
|
||||
public static final String ORDER_INFORMATION_GET = "pdd.order.information.get";
|
||||
|
||||
// ---------- 商品 ----------
|
||||
/** @deprecated 官方不再维护,请用 {@link #GOODS_DETAIL_GET} */
|
||||
@Deprecated
|
||||
public static final String GOODS_INFORMATION_GET = "pdd.goods.information.get";
|
||||
public static final String GOODS_DETAIL_GET = "pdd.goods.detail.get";
|
||||
public static final String GOODS_LIST_GET = "pdd.goods.list.get";
|
||||
public static final String GOODS_ADD = "pdd.goods.add";
|
||||
public static final String GOODS_IMAGE_UPLOAD = "pdd.goods.image.upload";
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ public class PddPopProperties {
|
||||
map.put(PddPopApiTypes.ORDER_LIST_GET, orderLike);
|
||||
map.put(PddPopApiTypes.ORDER_INCREMENT_GET, ApiRule.of(6000, 60, 800, 10));
|
||||
map.put(PddPopApiTypes.ORDER_INFORMATION_GET, ApiRule.of(6000, 60, 800, 10));
|
||||
map.put(PddPopApiTypes.GOODS_INFORMATION_GET, ApiRule.of(5000, 60, 800, 10));
|
||||
map.put(PddPopApiTypes.GOODS_DETAIL_GET, ApiRule.of(5000, 60, 800, 10));
|
||||
map.put(PddPopApiTypes.GOODS_AUTHORIZATION_CATS, ApiRule.of(6000, 60, 800, 10));
|
||||
map.put(PddPopApiTypes.GOODS_CATS_GET, ApiRule.of(6000, 60, 800, 10));
|
||||
map.put(PddPopApiTypes.MALL_INFO_GET, ApiRule.of(6000, 60, 800, 10));
|
||||
|
||||
+120
-30
@@ -1,9 +1,9 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.channel.pdd.pop.goods;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.pdd.pop.sdk.http.api.pop.request.PddGoodsInformationGetRequest;
|
||||
import com.pdd.pop.sdk.http.api.pop.request.PddGoodsDetailGetRequest;
|
||||
import com.pdd.pop.sdk.http.api.pop.request.PddGoodsListGetRequest;
|
||||
import com.pdd.pop.sdk.http.api.pop.response.PddGoodsInformationGetResponse;
|
||||
import com.pdd.pop.sdk.http.api.pop.response.PddGoodsDetailGetResponse;
|
||||
import com.pdd.pop.sdk.http.api.pop.response.PddGoodsListGetResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -14,9 +14,12 @@ import top.xyquan.ecomdmbbackend.modules.channel.pdd.pop.support.PddPopInvokeSup
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 商品域 POP:{@value PddPopApiTypes#GOODS_INFORMATION_GET}、{@value PddPopApiTypes#GOODS_LIST_GET}。
|
||||
* 商品域 POP:{@value PddPopApiTypes#GOODS_DETAIL_GET}、{@value PddPopApiTypes#GOODS_LIST_GET}。
|
||||
* <p>
|
||||
* 详情已从废弃的 {@code pdd.goods.information.get} 迁移到 {@code pdd.goods.detail.get}。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@@ -30,19 +33,30 @@ public class PddGoodsPopApiClient {
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
public GoodsDetail fetchGoodsInformation(Long mallId, String accessToken, Long goodsId) throws Exception {
|
||||
/**
|
||||
* 拉取商品明细(pdd.goods.detail.get),映射为统一 {@link GoodsDetail}。
|
||||
*/
|
||||
public GoodsDetail fetchGoodsDetail(Long mallId, String accessToken, Long goodsId) throws Exception {
|
||||
if (goodsId == null) {
|
||||
return null;
|
||||
}
|
||||
return invokeSupport.invoke(PddPopApiTypes.GOODS_INFORMATION_GET, mallId, client -> {
|
||||
PddGoodsInformationGetRequest request = new PddGoodsInformationGetRequest();
|
||||
return invokeSupport.invoke(PddPopApiTypes.GOODS_DETAIL_GET, mallId, client -> {
|
||||
PddGoodsDetailGetRequest request = new PddGoodsDetailGetRequest();
|
||||
request.setGoodsId(goodsId);
|
||||
PddGoodsInformationGetResponse response = client.syncInvoke(request, accessToken);
|
||||
invokeSupport.assertNoError(response, PddPopApiTypes.GOODS_INFORMATION_GET);
|
||||
return mapInformation(response);
|
||||
PddGoodsDetailGetResponse response = client.syncInvoke(request, accessToken);
|
||||
invokeSupport.assertNoError(response, PddPopApiTypes.GOODS_DETAIL_GET);
|
||||
return mapDetail(response);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 使用 {@link #fetchGoodsDetail(Long, String, Long)}
|
||||
*/
|
||||
@Deprecated
|
||||
public GoodsDetail fetchGoodsInformation(Long mallId, String accessToken, Long goodsId) throws Exception {
|
||||
return fetchGoodsDetail(mallId, accessToken, goodsId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品列表分页。isOnsale:0 下架 / 1 上架;与 outer_id、goods_name 三选一,优先级 is_onsale 最高。
|
||||
*/
|
||||
@@ -110,35 +124,82 @@ public class PddGoodsPopApiClient {
|
||||
return new GoodsListPage(total, Collections.unmodifiableList(items));
|
||||
}
|
||||
|
||||
private GoodsDetail mapInformation(PddGoodsInformationGetResponse response) {
|
||||
if (response == null || response.getGoodsInfoGetResponse() == null
|
||||
|| response.getGoodsInfoGetResponse().getGoodsInfo() == null) {
|
||||
private GoodsDetail mapDetail(PddGoodsDetailGetResponse response) {
|
||||
if (response == null || response.getGoodsDetailGetResponse() == null) {
|
||||
return null;
|
||||
}
|
||||
var info = response.getGoodsInfoGetResponse().getGoodsInfo();
|
||||
var body = response.getGoodsDetailGetResponse();
|
||||
if (body.getGoodsId() == null) {
|
||||
return null;
|
||||
}
|
||||
String outerGoodsId = blankToNull(body.getOuterGoodsId());
|
||||
List<SkuDetail> skus = new ArrayList<>();
|
||||
if (info.getSkuList() != null) {
|
||||
for (var item : info.getSkuList()) {
|
||||
if (item == null) {
|
||||
long quantitySum = 0L;
|
||||
if (body.getSkuList() != null) {
|
||||
for (var item : body.getSkuList()) {
|
||||
if (item == null || item.getSkuId() == null) {
|
||||
continue;
|
||||
}
|
||||
Integer qty = toInt(item.getQuantity());
|
||||
if (qty != null) {
|
||||
quantitySum += qty;
|
||||
}
|
||||
skus.add(new SkuDetail(
|
||||
item.getSkuId(),
|
||||
item.getSpec(),
|
||||
item.getOuterId(),
|
||||
item.getOuterGoodsId(),
|
||||
item.getSkuImg()));
|
||||
formatSpec(item.getSpec()),
|
||||
blankToNull(item.getOutSkuSn()),
|
||||
outerGoodsId,
|
||||
blankToNull(item.getThumbUrl()),
|
||||
qty,
|
||||
toInt(item.getReserveQuantity()),
|
||||
item.getIsOnsale()));
|
||||
}
|
||||
}
|
||||
// status: 1上架 2下架 3售罄 4已删除 → isOnsale 仅 1 视为上架
|
||||
Integer isOnsale = body.getStatus() != null && body.getStatus() == 1 ? 1 : 0;
|
||||
Integer goodsQuantity = skus.isEmpty() ? null : (int) Math.min(quantitySum, Integer.MAX_VALUE);
|
||||
return new GoodsDetail(
|
||||
info.getGoodsId(),
|
||||
info.getGoodsName(),
|
||||
info.getImageUrl(),
|
||||
info.getGoodsCategory(),
|
||||
info.getLastCategory(),
|
||||
body.getGoodsId(),
|
||||
blankToNull(body.getGoodsName()),
|
||||
blankToNull(body.getImageUrl()),
|
||||
body.getCatId(),
|
||||
outerGoodsId,
|
||||
body.getStatus(),
|
||||
isOnsale,
|
||||
goodsQuantity,
|
||||
Collections.unmodifiableList(skus));
|
||||
}
|
||||
|
||||
/** 规格对象数组 → 可读文案(多维用空格拼接规格值名) */
|
||||
private static String formatSpec(
|
||||
List<PddGoodsDetailGetResponse.GoodsDetailGetResponseSkuListItemSpecItem> specs) {
|
||||
if (specs == null || specs.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
String joined = specs.stream()
|
||||
.filter(s -> s != null && StringUtils.hasText(s.getSpecName()))
|
||||
.map(s -> s.getSpecName().trim())
|
||||
.collect(Collectors.joining(" "));
|
||||
return StringUtils.hasText(joined) ? joined : null;
|
||||
}
|
||||
|
||||
private static Integer toInt(Long value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
if (value > Integer.MAX_VALUE) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
if (value < Integer.MIN_VALUE) {
|
||||
return Integer.MIN_VALUE;
|
||||
}
|
||||
return value.intValue();
|
||||
}
|
||||
|
||||
private static String blankToNull(String value) {
|
||||
return StringUtils.hasText(value) ? value.trim() : null;
|
||||
}
|
||||
|
||||
private String toJsonQuietly(Object value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
@@ -179,14 +240,30 @@ public class PddGoodsPopApiClient {
|
||||
String specDetailsJson) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一商品详情(由 detail.get 映射)。
|
||||
*
|
||||
* @param catId 叶子类目 ID(detail.get 不再返回类目名)
|
||||
* @param outerGoodsId 商品维度商家编码
|
||||
* @param status 平台状态 1上架/2下架/3售罄/4已删除
|
||||
* @param isOnsale 由 status 推导:仅 status==1 为上架
|
||||
* @param goodsQuantity SKU 库存合计
|
||||
*/
|
||||
public record GoodsDetail(
|
||||
Long goodsId,
|
||||
String goodsName,
|
||||
String imageUrl,
|
||||
String goodsCategory,
|
||||
String lastCategory,
|
||||
Long catId,
|
||||
String outerGoodsId,
|
||||
Integer status,
|
||||
Integer isOnsale,
|
||||
Integer goodsQuantity,
|
||||
List<SkuDetail> skuList) {
|
||||
|
||||
public String resolveProductCode() {
|
||||
if (StringUtils.hasText(outerGoodsId)) {
|
||||
return outerGoodsId.trim();
|
||||
}
|
||||
if (skuList != null) {
|
||||
for (SkuDetail sku : skuList) {
|
||||
if (sku != null && StringUtils.hasText(sku.outerGoodsId())) {
|
||||
@@ -198,7 +275,7 @@ public class PddGoodsPopApiClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* 主图:优先 goods.image_url;接口常返回空串,则回退首个非空 sku_img。
|
||||
* 主图:优先 goods.image_url;空则回退首个非空 SKU thumb_url。
|
||||
*/
|
||||
public String resolveImageUrl() {
|
||||
if (StringUtils.hasText(imageUrl)) {
|
||||
@@ -215,9 +292,22 @@ public class PddGoodsPopApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
public record SkuDetail(Long skuId, String spec, String outerId, String outerGoodsId, String skuImg) {
|
||||
/**
|
||||
* @param outerId 对应平台 out_sku_sn
|
||||
* @param outerGoodsId 商品维度编码(落库冗余到 SKU 行)
|
||||
* @param skuImg 对应平台 thumb_url
|
||||
*/
|
||||
public record SkuDetail(
|
||||
Long skuId,
|
||||
String spec,
|
||||
String outerId,
|
||||
String outerGoodsId,
|
||||
String skuImg,
|
||||
Integer skuQuantity,
|
||||
Integer reserveQuantity,
|
||||
Integer isSkuOnsale) {
|
||||
/**
|
||||
* 内部 sku_code:优先商家编码 outer_id;无则回退 {@code PDD:{skuId}}。
|
||||
* 内部 sku_code:优先商家编码 out_sku_sn;无则回退 {@code PDD:{skuId}}。
|
||||
*/
|
||||
public String resolveSkuCode() {
|
||||
if (StringUtils.hasText(outerId)) {
|
||||
|
||||
@@ -31,7 +31,7 @@ pdd:
|
||||
shop-window-seconds: 60
|
||||
app-burst-limit: 800
|
||||
app-burst-window-seconds: 10
|
||||
pdd.goods.information.get:
|
||||
pdd.goods.detail.get:
|
||||
shop-limit: 5000
|
||||
shop-window-seconds: 60
|
||||
app-burst-limit: 800
|
||||
|
||||
Reference in New Issue
Block a user