From 2034006fb95839ce4ce29089384587f997c35fe6 Mon Sep 17 00:00:00 2001 From: 92451 <924518135@qq.com> Date: Mon, 26 Oct 2026 22:33:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=85=A5=E5=BA=97=E9=93=BA=E5=8F=B0?= =?UTF-8?q?=E8=B4=A6=E8=B4=9F=E8=B4=A3=E4=BA=BA=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/FinanceLedgerShopDirectory.php | 32 +++++++++++++++++++ .../View/FinanceLedgerPageData.php | 2 ++ .../pages/financial-ledger/ledger.blade.php | 6 ++-- .../FinanceLedgerHeaderControlsTest.php | 6 ++-- .../FinanceLedgerShopDirectoryTest.php | 28 ++++++++++++++++ 5 files changed, 70 insertions(+), 4 deletions(-) diff --git a/modules/EcommerceFinance/Services/FinanceLedgerShopDirectory.php b/modules/EcommerceFinance/Services/FinanceLedgerShopDirectory.php index 451f0c90..5a734bf8 100644 --- a/modules/EcommerceFinance/Services/FinanceLedgerShopDirectory.php +++ b/modules/EcommerceFinance/Services/FinanceLedgerShopDirectory.php @@ -6,6 +6,7 @@ use Illuminate\Database\DatabaseManager; use Illuminate\Support\Facades\Schema; use Modules\EcommerceFinance\Repositories\BusinessInformationMirrorRepository; use Modules\EcommerceFinance\Repositories\JushuitanShopBalanceRepository; +use Modules\EcommerceFinance\Repositories\StoreAccountMirrorRepository; use Throwable; /** @@ -20,6 +21,7 @@ class FinanceLedgerShopDirectory public function __construct( private readonly BusinessInformationMirrorRepository $storeInformation, private readonly StoreReportPeriodBuilder $periods, + private readonly StoreAccountMirrorRepository $storeAccounts, private readonly DatabaseManager $databases, ) { } @@ -34,6 +36,8 @@ class FinanceLedgerShopDirectory * company_name:?string, * account_short:?string, * status:string, + * store_manager:?string, + * department_manager:?string, * payout_account:?string, * shop_balance:float, * shop_balance_date:?string, @@ -72,6 +76,7 @@ class FinanceLedgerShopDirectory $financeShops = $this->financeShops(); $accountMaster = $this->accountMaster(); + $ownership = $this->storeOwnership(); $rows = []; foreach ($openStores as $store) { $erpStoreName = trim((string) ($store['erp_store_name'] ?? '')); @@ -95,6 +100,17 @@ class FinanceLedgerShopDirectory $this->nullableString($financeShop->account_short ?? null), $accountMaster, ); + $storeManager = $this->nullableString($store['store_manager'] ?? null); + $departmentManager = $this->nullableString($store['department_manager'] ?? null); + $ownershipMatch = $ownership[StoreAccountMirrorRepository::storeNameKey($erpStoreName)] ?? null; + if ($ownershipMatch !== null) { + if (trim((string) ($ownershipMatch['operation_owner'] ?? '')) !== '') { + $storeManager = trim((string) $ownershipMatch['operation_owner']); + } + if (trim((string) ($ownershipMatch['operation_department_head'] ?? '')) !== '') { + $departmentManager = trim((string) $ownershipMatch['operation_department_head']); + } + } $rows[] = [ 'id' => (int) ($store['id'] ?? 0), 'account_match_key' => $this->normalizeAccountValue($storePayoutAccount ?? $financePayoutAccount), @@ -103,6 +119,8 @@ class FinanceLedgerShopDirectory 'company_name' => $companyName, 'account_short' => $account['account_short'] ?? null, 'status' => '在营', + 'store_manager' => $storeManager, + 'department_manager' => $departmentManager, 'payout_account' => $this->nullableString($account['account_no'] ?? null), 'shop_balance' => round((float) ($financeShop->shop_balance ?? 0), 2), 'shop_balance_date' => $this->nullableString($financeShop->shop_balance_date ?? null), @@ -113,6 +131,20 @@ class FinanceLedgerShopDirectory return $this->propagateAccountLinks($rows); } + /** + * 与店铺维度报表一致:店铺账号镜像有值时覆盖店铺资料中的负责人字段。 + * + * @return array + */ + private function storeOwnership(): array + { + try { + return $this->storeAccounts->ownershipByStoreName(); + } catch (Throwable) { + return []; + } + } + /** @return array{exact:array,normalized:array} */ private function financeShops(): array { diff --git a/modules/EcommerceFinance/View/FinanceLedgerPageData.php b/modules/EcommerceFinance/View/FinanceLedgerPageData.php index 1eaea40d..6fe76377 100644 --- a/modules/EcommerceFinance/View/FinanceLedgerPageData.php +++ b/modules/EcommerceFinance/View/FinanceLedgerPageData.php @@ -848,6 +848,8 @@ class FinanceLedgerPageData 'company_name' => ['sort' => 'company_name', 'type' => 'text'], 'account_short' => ['sort' => 'account_short', 'type' => 'text'], 'status' => ['sort' => 'status', 'type' => 'text'], + 'store_manager' => ['sort' => 'shop_name', 'type' => 'text'], + 'department_manager' => ['sort' => 'shop_name', 'type' => 'text'], 'payout_account' => ['sort' => 'payout_account', 'type' => 'text'], 'shop_balance' => ['sort' => 'shop_balance', 'type' => 'number'], 'remark' => ['sort' => 'remark', 'type' => 'text'], diff --git a/resources/views/business/pages/financial-ledger/ledger.blade.php b/resources/views/business/pages/financial-ledger/ledger.blade.php index 2614ea48..34afa3d3 100644 --- a/resources/views/business/pages/financial-ledger/ledger.blade.php +++ b/resources/views/business/pages/financial-ledger/ledger.blade.php @@ -115,6 +115,8 @@ ['company_name', '店铺主体', 'text'], ['account_short', '账户简称', 'text'], ['status', '店铺状态', 'text'], + ['store_manager', '店铺负责人', 'text'], + ['department_manager', '部门负责人', 'text'], ['payout_account', '回款账户', 'text'], ['shop_balance', '店铺余额', 'number', ['headerClass' => 'num', 'align' => 'end']], ['remark', '备注', 'text'], @@ -801,7 +803,7 @@ @endif
店铺数{{ number_format((int) ($ledgerShopSummary['count'] ?? 0)) }}
店铺余额合计{{ $money($ledgerShopSummary['balance'] ?? 0) }}
余额口径{{ $shopBalanceDate ? '上一晚店铺余额(' . $shopBalanceDate . ')' : '尚未同步' }}
- +
@foreach ($ledgerTableHeaders['shops'] as $header) @include('business.pages.financial-ledger.partials.table-header', [ 'column' => $header[0], @@ -815,7 +817,7 @@ ]) @endforeach - @forelse ($ledgerShops as $row)@empty@endforelse + @forelse ($ledgerShops as $row)@empty@endforelse
{{ $row->platform }}{{ $row->shop_name }}{{ $row->company_name }}{{ $row->account_short }}{{ $row->status }}{{ $row->payout_account }}shop_balance_date ?? null) title="余额日期:{{ $row->shop_balance_date }}" @endif>{{ $money($row->shop_balance) }}{{ $row->remark }}
没有匹配的店铺数据。
{{ $row->platform }}{{ $row->shop_name }}{{ $row->company_name }}{{ $row->account_short }}{{ $row->status }}{{ $row->store_manager ?? '' }}{{ $row->department_manager ?? '' }}{{ $row->payout_account }}shop_balance_date ?? null) title="余额日期:{{ $row->shop_balance_date }}" @endif>{{ $money($row->shop_balance) }}{{ $row->remark }}
没有匹配的店铺数据。
@include('business.pages.financial-ledger.partials.pagination', [ 'rows' => $ledgerShops, diff --git a/tests/Feature/Business/FinanceLedgerHeaderControlsTest.php b/tests/Feature/Business/FinanceLedgerHeaderControlsTest.php index c53d25cc..84524ef2 100644 --- a/tests/Feature/Business/FinanceLedgerHeaderControlsTest.php +++ b/tests/Feature/Business/FinanceLedgerHeaderControlsTest.php @@ -130,8 +130,8 @@ class FinanceLedgerHeaderControlsTest extends FeatureTestCase $response = $this->loginAs()->get($this->pageUrl()); $html = $response->assertOk()->getContent(); - $this->assertSame(63, preg_match_all('/]*data-ledger-header-details/', $html)); - $this->assertSame(63, preg_match_all('/]*data-ledger-header-label/', $html)); + $this->assertSame(65, preg_match_all('/]*data-ledger-header-details/', $html)); + $this->assertSame(65, preg_match_all('/]*data-ledger-header-label/', $html)); $this->assertSame(2, preg_match_all('/