diff --git a/app/Business/TableRegistry.php b/app/Business/TableRegistry.php index a2840a0c..612a084b 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 e806e810..d0272aa0 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 6b1cf609..8209e734 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 0c41b66d..7b62d695 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();