feat(erp-open): 拼多多改库存接口增加结果与 POP 响应摘要日志
- ExternalGoodsController: 每次 quantity/update 记录 popBizSuccess、解析出的 pddGoodsId/pddSkuId;失败时 WARN 输出截断的 popResponseBody - ExternalGoodsPddQuantityUpdateAppServiceImpl: INFO 记录 noPopError/innerSuccess 与 DEBUG 原始响应便于排障 Made-with: Cursor
This commit is contained in:
parent
f271eb2300
commit
e8565b4392
|
|
@ -177,6 +177,14 @@ public class ExternalGoodsController extends BaseController {
|
||||||
return AjaxResult.error("参数错误:pddPopAuth 需提供 appKey、appSecret、accessToken");
|
return AjaxResult.error("参数错误:pddPopAuth 需提供 appKey、appSecret、accessToken");
|
||||||
}
|
}
|
||||||
ExternalGoodsPddQuantityUpdateResultVo vo = externalGoodsPddQuantityUpdateAppService.updateQuantity(req);
|
ExternalGoodsPddQuantityUpdateResultVo vo = externalGoodsPddQuantityUpdateAppService.updateQuantity(req);
|
||||||
|
log.info("[external/goods/pdd/quantity/update] result shopId={} outGoodsId={} outSkuId={} quantity={} "
|
||||||
|
+ "popBizSuccess={} quantityUpdateSuccess={} resolvedPddGoodsId={} resolvedPddSkuId={} message={}",
|
||||||
|
req.getShopId(), req.getOutGoodsId(), req.getOutSkuId(), req.getQuantity(),
|
||||||
|
vo.getPopBizSuccess(), vo.getQuantityUpdateSuccess(), vo.getResolvedPddGoodsId(), vo.getResolvedPddSkuId(),
|
||||||
|
truncateLog(vo.getMessage(), 600));
|
||||||
|
if (!Boolean.TRUE.equals(vo.getPopBizSuccess()) && StringUtils.hasText(vo.getPopResponseBody())) {
|
||||||
|
log.warn("[external/goods/pdd/quantity/update] popResponseBody={}", truncateLog(vo.getPopResponseBody(), 1200));
|
||||||
|
}
|
||||||
if (!Boolean.TRUE.equals(vo.getPopBizSuccess())) {
|
if (!Boolean.TRUE.equals(vo.getPopBizSuccess())) {
|
||||||
return AjaxResult.error(StringUtils.hasText(vo.getMessage()) ? vo.getMessage() : "pdd.goods.quantity.update 失败");
|
return AjaxResult.error(StringUtils.hasText(vo.getMessage()) ? vo.getMessage() : "pdd.goods.quantity.update 失败");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,14 @@ public class ExternalGoodsPddQuantityUpdateAppServiceImpl implements ExternalGoo
|
||||||
} else {
|
} else {
|
||||||
msg = "pdd.goods.quantity.update 成功";
|
msg = "pdd.goods.quantity.update 成功";
|
||||||
}
|
}
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("[PDD] pdd.goods.quantity.update rawResponse shopId={} body={}",
|
||||||
|
req.getShopId(), truncateForLog(raw, 4000));
|
||||||
|
}
|
||||||
|
log.info("[PDD] pdd.goods.quantity.update outcome shopId={} outGoodsId={} outSkuId={} pddGoodsId={} pddSkuId={} "
|
||||||
|
+ "quantity={} updateType={} forceUpdate={} noPopError={} innerSuccess={} popBizSuccess={} message={}",
|
||||||
|
req.getShopId(), outGoodsId, outSkuId, pddGoodsId, pddSkuId, req.getQuantity(), updateType, forceUpdate,
|
||||||
|
noPopError, innerOk, ok, truncateForLog(msg, 500));
|
||||||
return ExternalGoodsPddQuantityUpdateResultVo.builder()
|
return ExternalGoodsPddQuantityUpdateResultVo.builder()
|
||||||
.popBizSuccess(ok)
|
.popBizSuccess(ok)
|
||||||
.quantityUpdateSuccess(innerOk)
|
.quantityUpdateSuccess(innerOk)
|
||||||
|
|
@ -181,4 +189,11 @@ public class ExternalGoodsPddQuantityUpdateAppServiceImpl implements ExternalGoo
|
||||||
}
|
}
|
||||||
return s.trim();
|
return s.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String truncateForLog(String s, int max) {
|
||||||
|
if (s == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return s.length() <= max ? s : s.substring(0, max) + "...(truncated)";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue