From 4ef3a49a14724f608d9b17c56b8b7984a014a078 Mon Sep 17 00:00:00 2001 From: yueyang <2495544247@qq.com> Date: Mon, 2 Nov 2026 17:31:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BA=B3=E5=85=A5=E6=9C=89=E6=89=93?= =?UTF-8?q?=E6=AC=BE=E6=97=B6=E9=97=B4=E7=9A=84=E6=89=BF=E5=85=91=E4=BB=98?= =?UTF-8?q?=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DingProcessDetailMirrorSynchronizer.php | 6 ++- ...ingProcessDetailMirrorSynchronizerTest.php | 52 +++++++++++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/modules/EcommerceFinance/Services/DingProcessDetailMirrorSynchronizer.php b/modules/EcommerceFinance/Services/DingProcessDetailMirrorSynchronizer.php index 028d480c..6cfb3be4 100644 --- a/modules/EcommerceFinance/Services/DingProcessDetailMirrorSynchronizer.php +++ b/modules/EcommerceFinance/Services/DingProcessDetailMirrorSynchronizer.php @@ -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, diff --git a/tests/Unit/EcommerceFinance/DingProcessDetailMirrorSynchronizerTest.php b/tests/Unit/EcommerceFinance/DingProcessDetailMirrorSynchronizerTest.php index 5c1e3887..eb6f47a6 100644 --- a/tests/Unit/EcommerceFinance/DingProcessDetailMirrorSynchronizerTest.php +++ b/tests/Unit/EcommerceFinance/DingProcessDetailMirrorSynchronizerTest.php @@ -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 = [[ -- 2.47.2