快手发码数据接入发单平台工单侧
- 新增 sync-work-orders-from-send-code 服务:91 先到则回填 shopId/补建工单/凭证回填 material_json;91 未到则兜底建单建工单 - order-service 与 ninetyone order-service 改用 findLatestOrderByPlatformOrderId,放宽 shopId 查重避免重复建单 - work-order-repo 新增 listWorkOrdersByPlatformOrderId 供兜底查重 - send-code-service 挂接同步逻辑并吞错,不影响发码主流程 - ProductRulesPanel 新增店铺列 - .gitignore 忽略 send_code/ 与 .reasonix/
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
createOrder,
|
||||
findOrderByPlatformOrderId,
|
||||
findLatestOrderByPlatformOrderId,
|
||||
updateOrder,
|
||||
} from '../../repositories/order-repo.js'
|
||||
import { replaceOrderItems } from '../../repositories/order-item-repo.js'
|
||||
@@ -94,10 +94,9 @@ export async function upsertOrderFromSource(
|
||||
{ sourceLabel = 'source' }: UpsertOrderSourceOptions = {},
|
||||
): Promise<UpsertOrderResult> {
|
||||
const now = nowIso()
|
||||
const existing = await findOrderByPlatformOrderId({
|
||||
const existing = await findLatestOrderByPlatformOrderId({
|
||||
provider: event.provider,
|
||||
platform: event.platform,
|
||||
shopId: event.shopId,
|
||||
platformOrderId: event.platformOrderId,
|
||||
})
|
||||
|
||||
@@ -146,8 +145,8 @@ export async function upsertOrderFromSource(
|
||||
const basePayload = {
|
||||
provider: event.provider,
|
||||
platform: event.platform,
|
||||
shopId: event.shopId,
|
||||
shopName: event.shopName,
|
||||
shopId: String(existing?.shop_id || event.shopId || '').trim(),
|
||||
shopName: String(existing?.shop_name || event.shopName || '').trim(),
|
||||
platformOrderId: event.platformOrderId,
|
||||
orderStatus: event.orderStatus,
|
||||
payStatus: event.payStatus,
|
||||
|
||||
Reference in New Issue
Block a user