From a9819ce6d0a1f0f82881e78144126e4f78af4060 Mon Sep 17 00:00:00 2001 From: limeng <1131177064@qq.com> Date: Sun, 11 Oct 2026 12:25:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=A1=A5=E9=BD=90=E4=BE=9B=E5=BA=94?= =?UTF-8?q?=E5=95=86=E7=AE=A1=E7=90=86=E5=85=B1=E4=BA=AB=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/business_data.php | 4 ++++ .../SupplierManagementSyncScheduleTest.php | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/config/business_data.php b/config/business_data.php index 212426f7..da05a165 100644 --- a/config/business_data.php +++ b/config/business_data.php @@ -155,6 +155,10 @@ return [ 'jiansun.dbo.fys_supplierGoods_sttlement_purchase' => ['role' => 'serving_fact', 'target_store' => 'mariadb', 'consumer' => '货款采购对账'], 'jiansun.dbo.fys_supplierGoods_sttlement_sale' => ['role' => 'serving_fact', 'target_store' => 'mariadb', 'consumer' => '货款销售对账'], 'jiansun.dbo.pm_purchaseIn' => ['role' => 'serving_fact', 'target_store' => 'mariadb', 'consumer' => '采购入库'], + 'jiansun.dbo.js_supplier_View' => ['role' => 'dimension', 'target_store' => 'mariadb', 'consumer' => '供应商管理'], + 'jiansun.dbo.js_supplier_contract_View' => ['role' => 'operational', 'target_store' => 'mariadb', 'consumer' => '供应商管理/合同信息'], + 'jiansun.dbo.js_supplier_linkers' => ['role' => 'dimension', 'target_store' => 'mariadb', 'consumer' => '供应商管理/联系信息'], + 'jiansun.dbo.js_supplier_payinfo' => ['role' => 'dimension', 'target_store' => 'mariadb', 'consumer' => '供应商管理/打款信息'], 'jiansun.dbo.wp_express' => ['role' => 'dimension', 'target_store' => 'mariadb', 'consumer' => '快递资料'], 'jiansun.dbo.wp_express_expNet' => ['role' => 'dimension', 'target_store' => 'mariadb', 'consumer' => '快递网点'], 'jiansun.dbo.wp_express_account' => ['role' => 'dimension', 'target_store' => 'mariadb', 'consumer' => '快递打款账户'], diff --git a/tests/Unit/EcommerceFinance/SupplierManagementSyncScheduleTest.php b/tests/Unit/EcommerceFinance/SupplierManagementSyncScheduleTest.php index 39f1ba51..4716a9fe 100644 --- a/tests/Unit/EcommerceFinance/SupplierManagementSyncScheduleTest.php +++ b/tests/Unit/EcommerceFinance/SupplierManagementSyncScheduleTest.php @@ -12,6 +12,16 @@ use Tests\TestCase; class SupplierManagementSyncScheduleTest extends TestCase { + public function test_supplier_datasets_have_explicit_shared_row_store_policies(): void + { + $policies = config('business_data.datasets'); + foreach ([SupplierManagementMirrorRepository::DATASET, ...array_values(SupplierManagementMirrorRepository::RELATED)] as $key) { + $this->assertArrayHasKey($key, $policies); + $this->assertSame('mariadb', $policies[$key]['target_store']); + $this->assertStringStartsWith('供应商管理', $policies[$key]['consumer']); + } + } + public function test_supplier_reconciliation_refreshes_old_rows_and_resumes_partial_full_runs_only_when_opted_in(): void { Carbon::setTestNow('2026-10-11 12:00:00'); -- 2.47.2 From 4cd6013dc9d1780caf3cb1528ed080fceb152490 Mon Sep 17 00:00:00 2001 From: limeng <1131177064@qq.com> Date: Sun, 11 Oct 2026 12:33:34 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BE=9B=E5=BA=94?= =?UTF-8?q?=E5=95=86=E7=AE=A1=E7=90=86=E5=85=B3=E8=81=94=E8=B5=84=E6=96=99?= =?UTF-8?q?=E7=9A=84=E9=95=9C=E5=83=8F=E7=B4=A2=E5=BC=95=E9=95=BF=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/upstream_mirrors.php | 6 ++--- ...SupplierManagementMirrorRepositoryTest.php | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/config/upstream_mirrors.php b/config/upstream_mirrors.php index 7e1b3ca9..474c34a7 100644 --- a/config/upstream_mirrors.php +++ b/config/upstream_mirrors.php @@ -221,7 +221,7 @@ return [ 'full_reconcile_hours' => 1, 'columns' => ['id', 'ordernum', 'originname', 'title', 'tradebody', 'company', 'eSignDocTemplateId', 'type', 'tradebtime', 'tradeetime', 'sendTime', 'completeTime', 'state', 'createUser'], - 'indexes' => [['tradebody(64)', 'company(64)']], + 'indexes' => [['tradebody', 'company']], ], 'jiansun.dbo.js_supplier_linkers' => [ 'source_key' => 'jiansun', 'schema' => 'dbo', 'object' => 'js_supplier_linkers', @@ -229,7 +229,7 @@ return [ 'full_reconcile_hours' => 24, 'columns' => ['Id', 'sourcefrom', 'scmname', 'linker', 'linkmobile', 'linkweixin', 'linkjob', 'memo', 'local_created', 'local_updated'], - 'indexes' => [['scmname(64)', 'Id']], + 'indexes' => [['scmname', 'Id']], ], 'jiansun.dbo.js_supplier_payinfo' => [ 'source_key' => 'jiansun', 'schema' => 'dbo', 'object' => 'js_supplier_payinfo', @@ -238,7 +238,7 @@ return [ 'columns' => ['Id', 'sourcefrom', 'scmname', 'enable', 'accounttype', 'account', 'accountname', 'accountbank', 'memo', 'invoice', 'accountnature', 'creator', 'updator', 'local_created', 'local_updated'], - 'indexes' => [['scmname(64)', 'Id']], + 'indexes' => [['scmname', 'Id']], ], // 经营分析副本库:组织资料、订单、退款和聚水潭基础数据。 'operations_replica.rpt.fys_companyInfo' => ['source_key' => 'operations_replica', 'schema' => 'rpt', 'object' => 'fys_companyInfo', 'target' => 'ops_fys_company_info', 'keys' => ['Id'], 'watermark' => 'updateTIme'], diff --git a/tests/Unit/EcommerceFinance/SupplierManagementMirrorRepositoryTest.php b/tests/Unit/EcommerceFinance/SupplierManagementMirrorRepositoryTest.php index be598fef..709e82d6 100644 --- a/tests/Unit/EcommerceFinance/SupplierManagementMirrorRepositoryTest.php +++ b/tests/Unit/EcommerceFinance/SupplierManagementMirrorRepositoryTest.php @@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Schema; use Modules\EcommerceFinance\Repositories\GenericBusinessMirrorRepository; use Modules\EcommerceFinance\Repositories\SupplierManagementMirrorRepository; use Modules\EcommerceFinance\Services\BusinessMirrorDatasetRegistry; +use Modules\EcommerceFinance\Services\BusinessMirrorSchemaManager; use Tests\TestCase; class SupplierManagementMirrorRepositoryTest extends TestCase @@ -49,6 +50,27 @@ class SupplierManagementMirrorRepositoryTest extends TestCase $this->assertSame([1, 2], array_map(fn ($row) => $row->Id, iterator_to_array($this->repository->exportRows($filters)))); } + public function test_related_mirror_indexes_can_be_built_from_the_50_character_source_fields(): void + { + $registry = new BusinessMirrorDatasetRegistry(); + foreach (SupplierManagementMirrorRepository::RELATED as $key) { + $dataset = $registry->get($key); + foreach ($registry->columnSelection($key) as $position => $name) { + DB::table('upstream_schema_columns')->insert([ + 'source_key' => 'jiansun', 'schema_name' => 'dbo', 'object_name' => $dataset->sourceObject(), + 'object_type' => 'VIEW', 'column_name' => $name, 'ordinal_position' => $position + 1, + 'data_type' => strtolower($name) === 'id' ? 'int' : 'varchar', 'max_length' => 50, + 'is_nullable' => true, 'synchronized_at' => now(), + 'created_at' => now(), 'updated_at' => now(), + ]); + } + (new BusinessMirrorSchemaManager())->ensure($dataset); + $indexes = collect(Schema::connection('business_mirror')->getIndexes($dataset->targetTable())) + ->pluck('columns')->all(); + foreach ($dataset->indexDefinitions() as $columns) $this->assertContains($columns, $indexes); + } + } + public function test_details_do_not_mix_suppliers_or_contract_signing_companies(): void { foreach (SupplierManagementMirrorRepository::RELATED as $key) $this->ready($key); -- 2.47.2