fix(procurement): read MySQL fulfillment timestamps with JDBC types

This commit is contained in:
2026-10-10 02:42:59 +08:00
parent a973be2103
commit c0fbe2698b
9 changed files with 37 additions and 20 deletions
+7 -3
View File
@@ -14,6 +14,12 @@ export function options(args) {
if (value('--environment') !== 'TEST' || !/^[A-Za-z0-9-]{1,32}$/.test(runId) || !/^[1-9]\d*$/.test(warehouseId)) throw new Error('须显式指定 TEST、唯一 run-id 和已核对的有效收货仓')
return { execute: true, runId, warehouseId }
}
export function accountForCustomer(data, customerId) {
if (!Array.isArray(data)) throw new Error('Finance账户响应须为正式数组结构')
const account = data.find(row => String(row.customerId) === String(customerId))
if (!account) throw new Error('账户响应未包含本轮独立客户')
return account
}
export async function execute(args = process.argv.slice(2), execArgs = process.execArgv) {
const config = options(args)
if (!config.execute) return { mode: 'PLAN', writes: ['创建独立客户并审核资质', '仅为本轮客户充值10元', '上传样品凭证和面单', '执行采购两箱完整正常流程'], sql: false, deploy: false, cleanup: '保留样本,退出自身会话;未知结果不自动重跑' }
@@ -80,9 +86,7 @@ export async function execute(args = process.argv.slice(2), execArgs = process.e
const customerId = String(fixture.tenantId), customerToken = await login(fixture.username,fixture.password,'customer')
const readWallet = async () => {
const page = requireSuccess(await context.request('GET',`/api/platform/finance/v1/accounts?page=1&pageSize=20&customerId=${customerId}`))
const account = page.records?.find(row => String(row.customerId) === customerId)
if (!account) throw new Error('本轮独立客户钱包尚未初始化')
return account
return accountForCustomer(page, customerId)
}
const before = await readWallet()
requireSuccess(await context.request('POST',`/api/platform/finance/v1/accounts/${customerId}/adjustments`,{ type:'RECHARGE', amount:'10.00', occurredDate:new Date().toISOString().slice(0,10), paymentMethod:'BANK_TRANSFER', referenceNo:context.marker, remark:context.marker, expectedAccountVersion:before.accountVersion },context.token,{'Idempotency-Key':`${context.marker}-fund`}))