创建订单原货主策略读取字段错误调整
This commit is contained in:
parent
276d76f65d
commit
70ad3153a1
@ -317,15 +317,17 @@ class DeliveryOrderService extends Service {
|
||||
*
|
||||
* 优先级:
|
||||
* 1. 先匹配平台列表里的基础平台项;
|
||||
* 2. 再匹配平台列表里的系统设置项。
|
||||
* 2. 再匹配平台列表里的系统设置项;
|
||||
* 3. 兜底:签约策略 default_platform_code(货主-仓库级)→ 货主 subject_config.default_platform_code。
|
||||
*
|
||||
* @param {string} sourcePlatformCode 外部平台编码。
|
||||
* @param {Object} storeSubjectConfig 货主签约配置。
|
||||
* @param {Object} [policyConfig={}] 货主-仓库签约策略配置。
|
||||
* @param {Object} [info={}] 上下文信息。
|
||||
* @param {Array<Object>} [operationLogs=[]] 待写入的操作日志数组。
|
||||
* @return {Promise<Object>} 平台快照。
|
||||
*/
|
||||
async resolvePlatformSnapshot(sourcePlatformCode, storeSubjectConfig, info = {}, operationLogs = []) {
|
||||
async resolvePlatformSnapshot(sourcePlatformCode, storeSubjectConfig, policyConfig = {}, info = {}, operationLogs = []) {
|
||||
const platformList = await this.ctx.service.systems.platform.getPlatformList(
|
||||
false,
|
||||
false,
|
||||
@ -348,24 +350,29 @@ class DeliveryOrderService extends Service {
|
||||
sourcePlatformCode: externalCode,
|
||||
});
|
||||
|
||||
const defaultCode = String(storeSubjectConfig && storeSubjectConfig.default_platform_code || '').trim();
|
||||
// 兜底优先级:签约策略(货主-仓库级)→ 货主 subject_config
|
||||
const policyDefaultCode = String(policyConfig && policyConfig.default_platform_code || '').trim();
|
||||
const ownerDefaultCode = String(storeSubjectConfig && storeSubjectConfig.default_platform_code || '').trim();
|
||||
const defaultCode = policyDefaultCode || ownerDefaultCode;
|
||||
const fallbackPlatform = defaultCode ? this.findPlatformOptionByCode(platformList, defaultCode) : null;
|
||||
const fallbackPlatformName = this.getPlatformSnapshotName(fallbackPlatform) || defaultCode;
|
||||
|
||||
if (defaultCode) {
|
||||
const fallbackSource = policyDefaultCode ? 'policy_config' : 'subject_config';
|
||||
this.appendOrderOperationLog(
|
||||
operationLogs,
|
||||
ORDER_OPERATION_CODES.PLATFORM_FALLBACK,
|
||||
`平台编码${externalCode}匹配不到平台,已转为默认平台:${fallbackPlatformName}`
|
||||
`平台编码${externalCode}匹配不到平台,已转为默认平台:${fallbackPlatformName}(来源:${fallbackSource})`
|
||||
);
|
||||
|
||||
if (fallbackPlatform) {
|
||||
this.ctx.logger.warn('[DeliveryOrderService.prepareOrderData] platform code fallback to store default', {
|
||||
this.ctx.logger.warn('[DeliveryOrderService.prepareOrderData] platform code fallback to default', {
|
||||
deliveryOrderCode: info.deliveryOrderCode,
|
||||
warehouseId: info.warehouseId,
|
||||
storeId: info.storeId,
|
||||
sourcePlatformCode: externalCode,
|
||||
defaultPlatformCode: defaultCode,
|
||||
fallbackSource,
|
||||
});
|
||||
|
||||
return {
|
||||
@ -1020,7 +1027,7 @@ class DeliveryOrderService extends Service {
|
||||
const storeSubjectConfig = await this.getStoreSubjectConfig(info.storeId);
|
||||
const policyConfig = await this.getStoreWarehousePolicyConfig(info.storeId, info.warehouseId);
|
||||
const enableExternalExpressCode = this.resolveEnableExternalExpressCode(storeSubjectConfig, policyConfig);
|
||||
const platformSnapshot = await this.resolvePlatformSnapshot(sourcePlatformCode, storeSubjectConfig, {
|
||||
const platformSnapshot = await this.resolvePlatformSnapshot(sourcePlatformCode, storeSubjectConfig, policyConfig, {
|
||||
deliveryOrderCode,
|
||||
warehouseId: info.warehouseId,
|
||||
storeId: info.storeId,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user