From 474866b5f8988622f0cea5fe3e911a0beccdbca6 Mon Sep 17 00:00:00 2001
From: yueyang <2495544247@qq.com>
Date: Thu, 12 Nov 2026 09:25:52 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8C=BA=E5=88=86=20OA=20=E5=AE=A1?=
=?UTF-8?q?=E6=89=B9=E5=BA=94=E4=BB=98=E9=87=91=E9=A2=9D=E4=B8=8E=E5=AE=9E?=
=?UTF-8?q?=E9=99=85=E4=BB=98=E6=AC=BE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../DingProcessDetailMirrorRepository.php | 51 +++++++++++++++++++
.../process-details-content.blade.php | 27 ++++++++--
.../Business/ProcessDetailsPageTest.php | 8 ++-
.../DingProcessDetailMirrorRepositoryTest.php | 19 +++++++
.../ProcessDetailsPageDataTest.php | 6 +++
5 files changed, 105 insertions(+), 6 deletions(-)
diff --git a/modules/EcommerceFinance/Repositories/DingProcessDetailMirrorRepository.php b/modules/EcommerceFinance/Repositories/DingProcessDetailMirrorRepository.php
index 3946d0d4..02e0854f 100644
--- a/modules/EcommerceFinance/Repositories/DingProcessDetailMirrorRepository.php
+++ b/modules/EcommerceFinance/Repositories/DingProcessDetailMirrorRepository.php
@@ -246,6 +246,57 @@ class DingProcessDetailMirrorRepository
->forPage($page, $perPage)
->get()
->all();
+
+ $businessIds = array_map(
+ static fn (object $row): string => (string) $row->business_id,
+ $data,
+ );
+ if ($businessIds !== []) {
+ $purposes = [];
+ $purposeRows = $this->connection->table('ding_process_detail_mirror')
+ ->where('source_scope', $this->scope())
+ ->whereIn('business_id', $businessIds)
+ ->whereNotNull('purpose')
+ ->where('purpose', '!=', '')
+ ->orderBy('business_id')
+ ->orderBy('line_no')
+ ->get(['business_id', 'purpose']);
+ foreach ($purposeRows as $purposeRow) {
+ $businessId = (string) $purposeRow->business_id;
+ $purpose = trim((string) $purposeRow->purpose);
+ if ($purpose !== '' && ! in_array($purpose, $purposes[$businessId] ?? [], true)) {
+ $purposes[$businessId][] = $purpose;
+ }
+ }
+
+ $paymentTotals = [];
+ if ($this->structuredPaymentsEnabled()) {
+ $paymentTotals = $this->connection->table('ding_process_payment_mirror')
+ ->where('source_scope', $this->scope())
+ ->whereIn('business_id', $businessIds)
+ ->select('business_id')
+ ->selectRaw('SUM(COALESCE(amount, 0)) as payment_amount_total')
+ ->groupBy('business_id')
+ ->pluck('payment_amount_total', 'business_id')
+ ->all();
+ } else {
+ $paymentTotals = $this->connection->table('ding_process_detail_mirror')
+ ->where('source_scope', $this->scope())
+ ->whereIn('business_id', $businessIds)
+ ->select('business_id')
+ ->selectRaw('SUM(COALESCE(bank_amount, 0)) as payment_amount_total')
+ ->groupBy('business_id')
+ ->pluck('payment_amount_total', 'business_id')
+ ->all();
+ }
+
+ foreach ($data as $row) {
+ $businessId = (string) $row->business_id;
+ $row->purpose = implode(';', $purposes[$businessId] ?? []);
+ $row->payment_amount_total = (float) ($paymentTotals[$businessId] ?? 0);
+ }
+ }
+
$state = $this->state();
$staleAfterMinutes = max(
15,
diff --git a/resources/views/business/pages/financial-operations/process-details-content.blade.php b/resources/views/business/pages/financial-operations/process-details-content.blade.php
index 566bab84..b9ddc145 100644
--- a/resources/views/business/pages/financial-operations/process-details-content.blade.php
+++ b/resources/views/business/pages/financial-operations/process-details-content.blade.php
@@ -680,7 +680,7 @@
}
.process-details-table.is-approval-summary {
- min-width: 42rem;
+ min-width: 68rem;
table-layout: fixed;
}
@@ -1299,8 +1299,14 @@
@endif
-
金额合计{{ $money($summary['amount_total'] ?? null) }}
- {{ $paymentSummaryLabel }}{{ $money($summary['bank_amount_total'] ?? null) }}
+
+ {{ $approvalSummaryMode ? '应付金额合计' : '金额合计' }}
+ {{ $money($summary['amount_total'] ?? null) }}
+
+
+ {{ $approvalSummaryMode ? '实际付款合计' : $paymentSummaryLabel }}
+ {{ $money($summary['bank_amount_total'] ?? null) }}
+
@@ -1309,6 +1315,12 @@
统计与口径说明
+ @if ($approvalSummaryMode)
+
+ 应付金额按审批费用明细汇总;实际付款按审批表单中的结构化付款明细汇总。
+ 未产生付款记录的审批,其实际付款按 0 元展示,因此应付金额与实际付款金额不要求相等。
+
+ @else
金额合计按审批费用明细汇总,付款明细合计按审批表单中的结构化付款明细汇总,不等同于出纳已确认付款;
打款日期以审批单为准:审批单在所选期间有打款记录时,整张审批单的明细和付款金额都计入汇总;
@@ -1319,6 +1331,7 @@
已完成流程不重复回查,其他时间直接显示最近镜像,已等待按实际小时显示。当前展示的是当前账号权限范围内可读取的钉钉OA审批流程;
审批中的金额和行项目仍可能随流程变化。企业级全量数据待领导开通 OA 权限后切换。
+ @endif
@@ -1329,7 +1342,9 @@
@if ($approvalSummaryMode)
| 审批编号 |
- 总金额 |
+ 用途 |
+ 应付金额 |
+ 实际付款 |
已等待 |
@else
@@ -1363,7 +1378,9 @@
@if ($approvalSummaryMode)
| {{ $row->business_id }} |
+ {{ $text($row->purpose ?? null) }} |
{{ $money($row->amount_total ?? null) }} |
+ {{ $money($row->payment_amount_total ?? null) }} |
{{ $waitText($row->current_task_started_at ?? null) }} |
@else
@@ -1397,7 +1414,7 @@
@endif
@empty
- |
+ |
当前筛选条件没有OA流程数据。可以调整月份、单据类型、状态或关键词后重试。
|
diff --git a/tests/Feature/Business/ProcessDetailsPageTest.php b/tests/Feature/Business/ProcessDetailsPageTest.php
index eee61f35..4da0d2f9 100644
--- a/tests/Feature/Business/ProcessDetailsPageTest.php
+++ b/tests/Feature/Business/ProcessDetailsPageTest.php
@@ -203,6 +203,8 @@ class ProcessDetailsPageTest extends FeatureTestCase
'business_id' => $businessId,
'status' => '审批中',
'amount_total' => 500.00,
+ 'payment_amount_total' => 200.00,
+ 'purpose' => '办公用品采购;交通费',
'current_task_started_at' => \Modules\EcommerceFinance\Support\OaProcessTime::now()
->subMinutes(90)
->startOfMinute()
@@ -234,9 +236,13 @@ class ProcessDetailsPageTest extends FeatureTestCase
->assertSee('审批汇总')
->assertSee($businessId)
->assertSee('审批编号 | ', false)
- ->assertSee('总金额 | ', false)
+ ->assertSee('用途 | ', false)
+ ->assertSee('应付金额 | ', false)
+ ->assertSee('实际付款 | ', false)
->assertSee('已等待 | ', false)
+ ->assertSee('办公用品采购;交通费')
->assertSee('500.00')
+ ->assertSee('200.00')
->assertSee('1小时')
->assertDontSee('发起人部门')
->assertDontSee('付款明细金额')
diff --git a/tests/Unit/EcommerceFinance/DingProcessDetailMirrorRepositoryTest.php b/tests/Unit/EcommerceFinance/DingProcessDetailMirrorRepositoryTest.php
index 4dafdba7..a82d5a4f 100644
--- a/tests/Unit/EcommerceFinance/DingProcessDetailMirrorRepositoryTest.php
+++ b/tests/Unit/EcommerceFinance/DingProcessDetailMirrorRepositoryTest.php
@@ -74,6 +74,7 @@ class DingProcessDetailMirrorRepositoryTest extends TestCase
$this->assertSame(4, $result['summary']['rows']);
$this->assertSame(2, $result['summary']['approvals']);
$this->assertEqualsWithDelta(650.5, $result['summary']['amount_total'], 0.001);
+ $this->assertEqualsWithDelta(350.5, $result['summary']['bank_amount_total'], 0.001);
$rows = collect($result['data'])->keyBy('business_id');
$this->assertEqualsWithDelta(
@@ -86,6 +87,24 @@ class DingProcessDetailMirrorRepositoryTest extends TestCase
(float) $rows['202602031200000000002']->amount_total,
0.001,
);
+ $this->assertSame(
+ '办公用品采购;交通费',
+ (string) $rows['202601011200000000001']->purpose,
+ );
+ $this->assertSame(
+ '供应商货款',
+ (string) $rows['202602031200000000002']->purpose,
+ );
+ $this->assertEqualsWithDelta(
+ 150.5,
+ (float) $rows['202601011200000000001']->payment_amount_total,
+ 0.001,
+ );
+ $this->assertEqualsWithDelta(
+ 200,
+ (float) $rows['202602031200000000002']->payment_amount_total,
+ 0.001,
+ );
$this->assertSame(
'2026-02-03 09:00:00',
(string) $rows['202602031200000000002']->current_task_started_at,
diff --git a/tests/Unit/EcommerceFinance/ProcessDetailsPageDataTest.php b/tests/Unit/EcommerceFinance/ProcessDetailsPageDataTest.php
index 8bf9310a..38d06f9d 100644
--- a/tests/Unit/EcommerceFinance/ProcessDetailsPageDataTest.php
+++ b/tests/Unit/EcommerceFinance/ProcessDetailsPageDataTest.php
@@ -46,6 +46,12 @@ class ProcessDetailsPageDataTest extends TestCase
$this->assertStringContainsString('data-oa-refresh-button', $content);
$this->assertStringContainsString('$approvalSummaryUrl', $content);
$this->assertStringContainsString('查看按审批编号去重的审批汇总', $content);
+ $this->assertStringContainsString('应付金额合计', $content);
+ $this->assertStringContainsString('实际付款合计', $content);
+ $this->assertStringContainsString('应付金额与实际付款金额不要求相等', $content);
+ $this->assertStringContainsString('用途 | ', $content);
+ $this->assertStringContainsString('应付金额 | ', $content);
+ $this->assertStringContainsString('实际付款 | ', $content);
$this->assertStringNotContainsString('process-details-approval-link', $content);
$this->assertStringNotContainsString(
"route('business.process-details.detail'",