同步主体维度经营报表页面 (#103)
任务名称:同步主体维度经营报表页面 实际开发者: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 或真实数据。
This commit is contained in:
parent
ca131731f6
commit
6c574294f7
@ -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',
|
||||
|
||||
@ -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' => '主体'],
|
||||
|
||||
@ -366,6 +366,11 @@
|
||||
<span class="material-icons-outlined" aria-hidden="true">visibility</span>
|
||||
<span>当前页面只读显示既有上游资料;未匹配的 Excel 字段保留为空,不代表业务上没有数据。</span>
|
||||
</div>
|
||||
@elseif (($directory['status'] ?? null) === '共享镜像' && $directoryTotal > 0)
|
||||
<div class="directory-table-notice" role="status">
|
||||
<span class="material-icons-outlined" aria-hidden="true">cloud_done</span>
|
||||
<span>当前显示团队共享业务镜像数据,分页和汇总均基于已同步镜像。</span>
|
||||
</div>
|
||||
@else
|
||||
<div class="directory-table-notice" role="status">
|
||||
<span class="material-icons-outlined" aria-hidden="true">sync_problem</span>
|
||||
|
||||
@ -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();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user