fix: 纳入有打款时间的承兑付款 #827

Merged
yueyang merged 1 commits from fix/yueyang-oa-acceptance-payment into main 2026-11-02 17:32:16 +08:00
2 changed files with 56 additions and 2 deletions

View File

@ -1411,8 +1411,10 @@ class DingProcessDetailMirrorSynchronizer
}
$accountCode = trim((string) ($row['科目编码'] ?? ''));
$paidAt = trim((string) ($row['打款时间'] ?? ''));
if ($accountCode !== ''
&& ! preg_match('/^1(?:001|002|012|013)(?:\.|$)/', $accountCode)) {
&& ! preg_match('/^1(?:001|002|012|013)(?:\.|$)/', $accountCode)
&& $paidAt === '') {
continue;
}
@ -1430,7 +1432,7 @@ class DingProcessDetailMirrorSynchronizer
'account_code' => mb_substr($accountCode, 0, 64),
'account_name' => mb_substr(trim((string) ($row['科目名称'] ?? '')), 0, 255),
'payment_method' => mb_substr(trim((string) ($row['付款方式'] ?? '')), 0, 50),
'paid_at' => mb_substr(trim((string) ($row['打款时间'] ?? '')), 0, 50),
'paid_at' => mb_substr($paidAt, 0, 50),
'source_scope' => $scope,
'synced_at' => $now,
'created_at' => $now,

View File

@ -169,6 +169,58 @@ class DingProcessDetailMirrorSynchronizerTest extends TestCase
$this->assertSame('2026-10-15 10:32:00', $row->approval_finished_at);
}
public function test_payment_with_acceptance_bill_account_and_paid_time_is_included(): void
{
$workflow = [
'processInstanceId' => 'process-acceptance-payment',
'processCode' => 'PROC-ACF09A14-B094-46B1-A9E2-8BB1F4E1FDCF',
'businessId' => '202602081023000284562',
'title' => '欧伯娜项目,康达电梯款15万承兑',
'status' => 'COMPLETED',
'result' => 'AGREE',
'originatorUserId' => 'user-1',
'joinAt' => '2026-02-08 10:23:00',
'finishTime' => '2026-02-22 13:43:00',
];
$this->query->workflows = [$workflow];
$this->query->scheme = [
'收款费用明细' => json_encode([[
'rowValue' => [
['label' => '序号', 'value' => '1'],
['label' => '代发订单金额', 'value' => '150000'],
['label' => '科目编码', 'value' => '1221.04'],
['label' => '科目名称', 'value' => '其他应收款_借支销账'],
],
]], JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR),
'收款合计' => 150000,
'付款明细' => json_encode([[
'rowValue' => [
['label' => '对应序号', 'value' => '1'],
['label' => '付款方式', 'value' => '承兑汇票'],
['label' => '付款金额', 'value' => '150000'],
['label' => '科目编码', 'value' => '2201.01'],
['label' => '科目名称', 'value' => '应付票据_江南农村商业银行'],
['label' => '打款时间', 'value' => '2026-02-11 00:00'],
],
]], JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR),
'付款合计' => 150000,
];
$result = $this->synchronizer->sync(true);
$this->assertSame(1, $result['payments']);
$payment = DB::connection('business_mirror')
->table('ding_process_payment_mirror')
->where('business_id', $workflow['businessId'])
->first();
$this->assertSame('2201.01', $payment->account_code);
$this->assertSame('2026-02-11 00:00', $payment->paid_at);
$this->assertSame('2026-02', DB::connection('business_mirror')
->table('ding_process_payment_line_mirror')
->where('business_id', $workflow['businessId'])
->value('paid_month'));
}
public function test_top_level_account_fields_fill_subject_missing_from_detail_rows(): void
{
$this->query->workflows = [[