From 9616ad18890ee87a3989b404a86f9f400b4dc8a6 Mon Sep 17 00:00:00 2001 From: yueyang <2495544247@qq.com> Date: Thu, 29 Oct 2026 22:59:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A1=A5=E5=85=A8OA=E7=A6=BB=E8=81=8C?= =?UTF-8?q?=E5=91=98=E5=B7=A5=E5=AE=A1=E6=89=B9=E4=BA=BA=E5=A7=93=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DingProcessDetailMirrorSynchronizer.php | 20 +++++++++++++++++-- .../process-details-content.blade.php | 8 +++++++- ...ingProcessDetailMirrorSynchronizerTest.php | 9 +++++++-- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/modules/EcommerceFinance/Services/DingProcessDetailMirrorSynchronizer.php b/modules/EcommerceFinance/Services/DingProcessDetailMirrorSynchronizer.php index 7c0a28af..5f50ed71 100644 --- a/modules/EcommerceFinance/Services/DingProcessDetailMirrorSynchronizer.php +++ b/modules/EcommerceFinance/Services/DingProcessDetailMirrorSynchronizer.php @@ -823,11 +823,27 @@ class DingProcessDetailMirrorSynchronizer /** @return array */ private function employees(UpstreamReadOnlyQuery $query): array { + $rows = $query->select('SELECT userid, name FROM rpt.hr_employee'); + try { + $rows = [ + ...$rows, + ...$query->select('SELECT userid, name, realName FROM rpt.hr_employee_dimission'), + ]; + } catch (Throwable) { + // 离职目录短暂不可用时不阻断审批同步,已解析的在职姓名继续使用。 + } + $employees = []; - foreach ($query->select('SELECT userid, name FROM rpt.hr_employee') as $row) { + foreach ($rows as $row) { $id = trim((string) ($row['userid'] ?? '')); + if ($id === '' || isset($employees[$id])) { + continue; + } $name = trim((string) ($row['name'] ?? '')); - if ($id !== '' && $name !== '') { + if ($name === '') { + $name = trim((string) ($row['realName'] ?? '')); + } + if ($name !== '') { $employees[$id] = $name; } } 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 81387e1e..aec0ad3b 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 @@ -84,7 +84,13 @@ return $approver; } - return ($row->status ?? '') === '审批中' ? '审批人待同步' : '-'; + if (($row->status ?? '') === '审批中') { + return trim((string) ($row->current_task_name ?? '')) === '' + ? '无在途任务' + : '审批人待补全'; + } + + return '-'; }; $pageUrl ??= route('business.pages.show', [ 'section' => 'process-data', diff --git a/tests/Unit/EcommerceFinance/DingProcessDetailMirrorSynchronizerTest.php b/tests/Unit/EcommerceFinance/DingProcessDetailMirrorSynchronizerTest.php index fa77a077..becc497c 100644 --- a/tests/Unit/EcommerceFinance/DingProcessDetailMirrorSynchronizerTest.php +++ b/tests/Unit/EcommerceFinance/DingProcessDetailMirrorSynchronizerTest.php @@ -367,7 +367,7 @@ class DingProcessDetailMirrorSynchronizerTest extends TestCase 'taskGroupName' => '行政核价', 'status' => 'RUNNING', 'result' => 'NONE', - 'userId' => 'user-2', + 'userId' => 'user-3', 'createTime' => '2026-10-29T19:20Z', 'finishTime' => '', ]]; @@ -379,7 +379,7 @@ class DingProcessDetailMirrorSynchronizerTest extends TestCase ->where('business_id', '202610291915000052466') ->first(); $this->assertSame('行政核价', $row->current_task_name); - $this->assertSame('王五', $row->current_approver_name); + $this->assertSame('赵六', $row->current_approver_name); $this->assertSame('2026-10-29 19:20:00', (string) $row->current_task_started_at); $this->assertSame('not_applicable', $row->payment_source_state); } @@ -1059,6 +1059,11 @@ class FakeDingProcessDetailQuery extends UpstreamReadOnlyQuery { $this->calls[] = compact('sql', 'bindings'); + if (str_contains($sql, 'FROM rpt.hr_employee_dimission')) { + return [ + ['userid' => 'user-3', 'name' => '赵六', 'realName' => '赵六'], + ]; + } if (str_contains($sql, 'FROM rpt.hr_employee')) { return [ ['userid' => 'user-1', 'name' => '陈芝豹'], -- 2.47.2