From 6c574294f7ff7f8c5f0737b3c46bbc554c459a57 Mon Sep 17 00:00:00 2001 From: yueyang <2495544247@qq.com> Date: Fri, 4 Sep 2026 17:40:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=B8=BB=E4=BD=93=E7=BB=B4?= =?UTF-8?q?=E5=BA=A6=E7=BB=8F=E8=90=A5=E6=8A=A5=E8=A1=A8=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=20(#103)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 任务名称:同步主体维度经营报表页面 实际开发者:yueyang 目标结果:让主体维度经营报表接入团队共享业务镜像,显示分页、主体销量汇总及明确的数据来源提示。 实际修改: - 注册 company-management/subject-operating-report 到只读页面映射并复用 StoreReportRepository。 - 页面标识改为共享镜像;有数据时显示共享镜像提示。 - 新增页面读取共享报表服务的回归测试。 修改文件:app/Business/TableRegistry.php;config/business_navigation.php;resources/views/business/pages/partials/directory-table.blade.php;tests/Feature/Business/PrototypePageTest.php 验证:容器内临时加载当前测试文件后执行相关套件,9 tests、53 assertions 全部通过;git diff --check 通过;实际页面首页共 2073 条,第 2 页及第 42/42 页可读。 风险:不涉及数据库迁移、生产配置或业务数据写入;未提交凭据、.env 或真实数据。 --- app/Business/TableRegistry.php | 2 ++ config/business_navigation.php | 6 ++-- .../pages/partials/directory-table.blade.php | 5 +++ tests/Feature/Business/PrototypePageTest.php | 35 +++++++++++++++++++ 4 files changed, 45 insertions(+), 3 deletions(-) diff --git a/app/Business/TableRegistry.php b/app/Business/TableRegistry.php index a2840a0c3..612a084bf 100644 --- a/app/Business/TableRegistry.php +++ b/app/Business/TableRegistry.php @@ -144,6 +144,7 @@ class TableRegistry { return [ 'company-management/basic-information' => CompanyInformation::class, + 'company-management/subject-operating-report' => StoreInformation::class, 'company-management/registration' => CompanyRegistration::class, 'company-management/changes' => CompanyChange::class, 'company-management/cancellation' => CompanyCancellation::class, @@ -252,6 +253,7 @@ class TableRegistry { return in_array("{$section}/{$page}", [ 'company-management/basic-information', + 'company-management/subject-operating-report', 'store-management/basic-information', 'store-management/store-report', 'trademark-management/information', diff --git a/config/business_navigation.php b/config/business_navigation.php index e806e810d..d0272aa0f 100644 --- a/config/business_navigation.php +++ b/config/business_navigation.php @@ -11,9 +11,9 @@ return [ 'title' => '主体维度经营报表', 'directory' => [ 'icon' => 'query_stats', - 'status' => '尚未同步', - 'description' => '按店铺唯一 ID 和主体生效、失效日期归属销量;自动汇总前,先固定 Excel 中的报表字段。', - 'empty' => '经营报表尚未同步。完成店铺主体和销量镜像接入后,这里会显示可追溯的主体数据。', + 'status' => '共享镜像', + 'description' => '店铺主体和销量统一读取团队共享业务镜像;销量按主体生效区间归属并汇总。', + 'empty' => '经营报表共享镜像尚未完成同步。', 'fields' => [ ['name' => 'city', 'label' => '市'], ['name' => 'entity', 'label' => '主体'], diff --git a/resources/views/business/pages/partials/directory-table.blade.php b/resources/views/business/pages/partials/directory-table.blade.php index 6b1cf6092..8209e734b 100644 --- a/resources/views/business/pages/partials/directory-table.blade.php +++ b/resources/views/business/pages/partials/directory-table.blade.php @@ -366,6 +366,11 @@ 当前页面只读显示既有上游资料;未匹配的 Excel 字段保留为空,不代表业务上没有数据。 + @elseif (($directory['status'] ?? null) === '共享镜像' && $directoryTotal > 0) +
+ + 当前显示团队共享业务镜像数据,分页和汇总均基于已同步镜像。 +
@else
diff --git a/tests/Feature/Business/PrototypePageTest.php b/tests/Feature/Business/PrototypePageTest.php index 0c41b66d1..7b62d6953 100644 --- a/tests/Feature/Business/PrototypePageTest.php +++ b/tests/Feature/Business/PrototypePageTest.php @@ -2,7 +2,10 @@ namespace Tests\Feature\Business; +use App\Business\UpstreamBusinessInformation; +use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Carbon; +use Mockery; use Tests\Feature\FeatureTestCase; class PrototypePageTest extends FeatureTestCase @@ -33,6 +36,38 @@ class PrototypePageTest extends FeatureTestCase ->assertOk()->assertSeeText('请连接团队共享数据库')->assertDontSeeText('共 0 条'); } + public function testSubjectOperatingReportReadsSharedStoreReportRows(): void + { + $service = Mockery::mock(UpstreamBusinessInformation::class); + $service->shouldReceive('paginate')->once()->with('company-management', 'subject-operating-report', 50) + ->andReturn(new LengthAwarePaginator([ + (object) [ + 'entity' => '测试主体', + 'erp_store_name' => '测试店铺', + 'recent_three_month_sales_1' => 10, + 'recent_three_month_sales_2' => 20, + 'recent_three_month_sales_3' => 30, + 'store_sales_12m' => 60, + 'entity_sales_12m' => 60, + ], + ], 1, 50, 1, ['path' => '/'])); + $this->app->instance(UpstreamBusinessInformation::class, $service); + + $this->loginAs() + ->get(route('business.pages.show', [ + 'section' => 'company-management', + 'page' => 'subject-operating-report', + ])) + ->assertOk() + ->assertSeeText('共享镜像') + ->assertSeeText('测试主体') + ->assertSeeText('测试店铺') + ->assertSeeText('共 1 条') + ->assertSeeText('当前显示团队共享业务镜像数据') + ->assertDontSeeText('经营报表尚未同步。完成店铺主体和销量镜像接入后') + ->assertDontSeeText('经营报表共享镜像尚未完成同步。'); + } + protected function tearDown(): void { Carbon::setTestNow();