From cca9b1957165948d050e0ef93ba5637bf3ad0215 Mon Sep 17 00:00:00 2001 From: qiuxiang <394405259@qq.com> Date: Mon, 26 Oct 2026 18:24:43 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E5=B9=B3=E5=8F=B0=E6=B1=87=E6=80=BB?= =?UTF-8?q?=E7=A7=BB=E5=88=B0=E6=98=8E=E7=BB=86=E8=A1=A8=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E4=B8=8A=E6=96=B9=20(#625)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../installation-fee-summary.blade.php | 24 +++++++++---------- tests/Feature/Business/ManagementCrudTest.php | 9 ++++++- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/resources/views/business/pages/partials/installation-fee-summary.blade.php b/resources/views/business/pages/partials/installation-fee-summary.blade.php index 83e4aab6..fabf2bc6 100644 --- a/resources/views/business/pages/partials/installation-fee-summary.blade.php +++ b/resources/views/business/pages/partials/installation-fee-summary.blade.php @@ -470,18 +470,6 @@
- - - - - - - - - - -
店铺名称安装公司收款渠道结算明细金额
-
请选择客服审核日期后查看明细

平台汇总

@@ -494,6 +482,18 @@
+ + + + + + + + + + +
店铺名称安装公司收款渠道结算明细金额
+
请选择客服审核日期后查看明细
共 0 条明细汇总 diff --git a/tests/Feature/Business/ManagementCrudTest.php b/tests/Feature/Business/ManagementCrudTest.php index f8198a69..d288f838 100644 --- a/tests/Feature/Business/ManagementCrudTest.php +++ b/tests/Feature/Business/ManagementCrudTest.php @@ -234,7 +234,7 @@ class ManagementCrudTest extends FeatureTestCase ]); $this->app->instance(InstallationDetailMirrorRepository::class, $mirror); - $this->loginAs() + $response = $this->loginAs() ->get(route('business.pages.show', [ 'section' => 'financial-operations', 'page' => 'installation-details', @@ -313,6 +313,13 @@ class ManagementCrudTest extends FeatureTestCase ->assertSeeText('测试安装公司') ->assertSeeText('120.50') ->assertSeeText('共 1 条'); + + $html = $response->getContent(); + $platformSummaryPosition = strpos($html, 'class="installation-fee-platform-summary"'); + $detailTablePosition = strpos($html, '店铺名称'); + $this->assertNotFalse($platformSummaryPosition); + $this->assertNotFalse($detailTablePosition); + $this->assertLessThan($detailTablePosition, $platformSummaryPosition); } public function testInstallationDetailsExportUsesFiltersAndMirrorRows(): void From 3309c2320c69bc025edb3d1f0ab77a0beab7757c Mon Sep 17 00:00:00 2001 From: yueyang <2495544247@qq.com> Date: Mon, 26 Oct 2026 18:31:46 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=8C=96=E5=BE=85?= =?UTF-8?q?=E5=8A=9E=E5=BA=8F=E5=8F=B7=E6=94=AF=E6=8C=81=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=B9=B6=E7=A7=BB=E9=99=A4=E5=BA=8F=E5=8F=B7=E7=AD=9B=E9=80=89?= =?UTF-8?q?=20(#626)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Business/SystemizationTodos.php | 86 +++++++++++++------ .../pages/systemization-todos.blade.php | 46 +++++----- .../Business/SystemizationTodosTest.php | 64 +++++++------- 3 files changed, 118 insertions(+), 78 deletions(-) diff --git a/app/Http/Controllers/Business/SystemizationTodos.php b/app/Http/Controllers/Business/SystemizationTodos.php index 1420c6aa..e1538461 100644 --- a/app/Http/Controllers/Business/SystemizationTodos.php +++ b/app/Http/Controllers/Business/SystemizationTodos.php @@ -106,27 +106,6 @@ class SystemizationTodos extends Controller }); $items = $items->sortBy('hierarchy_order')->values(); $positionGroups = $this->positionGroups($sequenceMap); - if ($filters['type_sequence'] > 0) { - $items = $items - ->filter(static fn (SystemizationTodo $todo): bool => - (int) $todo->type_sequence === $filters['type_sequence'] - ) - ->values(); - } - if ($filters['content_sequence'] > 0) { - $items = $items - ->filter(static fn (SystemizationTodo $todo): bool => - (int) $todo->content_sequence === $filters['content_sequence'] - ) - ->values(); - } - if ($filters['item_sequence'] > 0) { - $items = $items - ->filter(static fn (SystemizationTodo $todo): bool => - (int) $todo->item_sequence === $filters['item_sequence'] - ) - ->values(); - } $base = SystemizationTodo::query(); $categories = SystemizationTodo::query() @@ -428,7 +407,11 @@ class SystemizationTodos extends Controller ); } - private function contentSiblings(?string $category, ?string $section): Collection + private function contentSiblings( + ?string $category, + ?string $section, + ?int $excludeId = null, + ): Collection { $categoryKey = $this->hierarchyGroupKey($this->hierarchyLabel($category)); $sectionKey = $this->hierarchyGroupKey($this->hierarchyLabel($section)); @@ -439,12 +422,54 @@ class SystemizationTodos extends Controller ->lockForUpdate() ->get() ->filter(fn (SystemizationTodo $todo): bool => - $this->hierarchyGroupKey($this->hierarchyLabel($todo->category)) === $categoryKey + (int) $todo->id !== (int) $excludeId + && $this->hierarchyGroupKey($this->hierarchyLabel($todo->category)) === $categoryKey && $this->hierarchyGroupKey($this->hierarchyLabel($todo->section)) === $sectionKey ) ->values(); } + private function positionForUpdate( + SystemizationTodo $todo, + int $targetPosition, + array &$data, + ): void { + $currentCategoryKey = $this->hierarchyGroupKey($this->hierarchyLabel($todo->category)); + $currentSectionKey = $this->hierarchyGroupKey($this->hierarchyLabel($todo->section)); + $targetCategoryKey = $this->hierarchyGroupKey($this->hierarchyLabel($data['category'] ?? null)); + $targetSectionKey = $this->hierarchyGroupKey($this->hierarchyLabel($data['section'] ?? null)); + $sameGroup = $currentCategoryKey === $targetCategoryKey + && $currentSectionKey === $targetSectionKey; + + if ($sameGroup) { + $currentSiblings = $this->contentSiblings($todo->category, $todo->section); + $currentIndex = $currentSiblings->search( + static fn (SystemizationTodo $item): bool => (int) $item->id === (int) $todo->id + ); + if ($currentIndex !== false && $targetPosition === ((int) $currentIndex + 1)) { + return; + } + } + + $siblings = $this->contentSiblings( + $data['category'] ?? null, + $data['section'] ?? null, + (int) $todo->id, + ); + if ($siblings->isEmpty()) { + $insertOrder = (int) SystemizationTodo::query()->max('sort_order') + 1; + } elseif ($targetPosition <= $siblings->count()) { + $insertOrder = (int) $siblings[$targetPosition - 1]->sort_order; + } else { + $insertOrder = (int) $siblings->max('sort_order') + 1; + } + + SystemizationTodo::query() + ->where('sort_order', '>=', $insertOrder) + ->increment('sort_order'); + $data['sort_order'] = $insertOrder; + } + private function groupTodoIds(SystemizationTodo $todo, bool $includeSection): array { $categoryKey = $this->hierarchyGroupKey($this->hierarchyLabel($todo->category)); @@ -480,6 +505,7 @@ class SystemizationTodos extends Controller public function update(Request $request, SystemizationTodo $todo): RedirectResponse { $data = $this->validated($request); + $targetPosition = max(0, (int) ($data['position'] ?? 0)); unset($data['position']); $data['updated_by'] = user_id(); $this->normalizeCompletionDates($data); @@ -500,7 +526,16 @@ class SystemizationTodos extends Controller } } - $todo->update($data); + DB::transaction(function () use ($todo, $data, $targetPosition): void { + $lockedTodo = SystemizationTodo::query() + ->lockForUpdate() + ->findOrFail($todo->id); + if ($targetPosition > 0) { + $this->positionForUpdate($lockedTodo, $targetPosition, $data); + } + $lockedTodo->update($data); + $todo->setRawAttributes($lockedTodo->getAttributes(), true); + }); $this->storeAttachments($request, $todo); return $this->backToPage('待办事项已更新并定位。', 'success', $todo); @@ -572,9 +607,6 @@ class SystemizationTodos extends Controller 'assignees' => $this->peopleFilter('assignee'), 'start_date' => $this->normalizeDateFilter(request('start_date')), 'due_date' => $this->normalizeDateFilter(request('due_date')), - 'type_sequence' => max(0, (int) request('type_sequence', 0)), - 'content_sequence' => max(0, (int) request('content_sequence', 0)), - 'item_sequence' => max(0, (int) request('item_sequence', 0)), 'keyword' => trim((string) request('keyword', '')), ]; } diff --git a/resources/views/business/pages/systemization-todos.blade.php b/resources/views/business/pages/systemization-todos.blade.php index 2c555b77..380637b1 100644 --- a/resources/views/business/pages/systemization-todos.blade.php +++ b/resources/views/business/pages/systemization-todos.blade.php @@ -215,9 +215,6 @@ @endforeach - - - @php $selectedOwners = $todoOwners->filter( static fn (string $owner): bool => in_array($owner, $todoFilters['owners'], true) @@ -345,7 +342,7 @@ - + @@ -363,6 +360,7 @@ }; $todoPayload = [ 'id' => $item->id, + 'position' => (int) $item->item_sequence, 'category' => $item->category ?? '', 'section' => $sectionLabels[$loop->index] ?? '', 'title' => $titleLabels[$loop->index] ?? '', @@ -489,7 +487,7 @@ - ', false) + ->assertSee('', false) ->assertSee('sys-todo-table__type', false) ->assertSee('title="类型序号">1', false) ->assertSee('title="内容序号">1', false) @@ -320,22 +350,6 @@ class SystemizationTodosTest extends FeatureTestCase ->all(), ); - $sequenceResponse = $this->get(route('business.pages.show', [ - 'section' => 'other', - 'page' => 'systemization-todos', - 'category' => '收入', - 'item_sequence' => 2, - ]))->assertOk(); - $sequenceContent = $sequenceResponse->viewData('content'); - $this->assertSame(['2、收入事项 B'], $sequenceContent['items']->pluck('title')->all()); - - $typeSequenceContent = $this->get(route('business.pages.show', [ - 'section' => 'other', - 'page' => 'systemization-todos', - 'type_sequence' => 2, - ]))->assertOk()->viewData('content'); - $this->assertSame(['3、成本事项'], $typeSequenceContent['items']->pluck('title')->all()); - $highlightedTodo = $pageItems->firstWhere('title', '2、收入事项 B'); $this->get(route('business.pages.show', [ 'section' => 'other', @@ -430,16 +444,6 @@ class SystemizationTodosTest extends FeatureTestCase ->values() ->all(), ); - $contentResponse = $this->get(route('business.pages.show', [ - 'section' => 'other', - 'page' => 'systemization-todos', - 'type_sequence' => 1, - 'content_sequence' => 2, - ]))->assertOk(); - $this->assertSame( - [$secondContent->id], - $contentResponse->viewData('content')['items']->pluck('id')->all(), - ); $this->assertSame( [$completed->id, $inProgress->id], $items From fa92ae8b6e19c7b232ec3ee2574e4d913a43db4c Mon Sep 17 00:00:00 2001 From: 92451 <924518135@qq.com> Date: Mon, 26 Oct 2026 18:33:41 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E5=8F=B0=E8=B4=A6=E6=AF=8F=E6=97=A5=E8=87=AA=E5=8A=A8=E5=9B=9E?= =?UTF-8?q?=E5=A1=AB=20(#627)=20Co-authored-by:=2092451=20<924518135@qq.co?= =?UTF-8?q?m>=20Co-committed-by:=2092451=20<924518135@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/activate-incremental-release.sh | 4 ++-- deploy/activate-release.sh | 4 ++-- docs/财务台账开发说明.md | 9 ++++++++- tests/Unit/Deployment/BusinessMirrorScheduleTest.php | 11 +++++++++++ 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/deploy/activate-incremental-release.sh b/deploy/activate-incremental-release.sh index 131cc511..4321641b 100644 --- a/deploy/activate-incremental-release.sh +++ b/deploy/activate-incremental-release.sh @@ -225,8 +225,8 @@ CRON_TZ=Asia/Shanghai # 供应商管理每天北京时间 08:15 完整校准档案、合同、联系人与打款资料。 15 8 * * * root /usr/bin/flock -w 3600 /run/caiwu-upstream-sync.lock /usr/bin/docker exec -u www-data caiwu_app php artisan business-mirror:sync-supplier-management --quiet >/dev/null 2>&1 */2 * * * * root /usr/bin/flock -n /run/caiwu-esign-polling.lock /usr/bin/docker exec -u www-data caiwu_app php artisan esign:poll-signatures --quiet >/dev/null 2>&1 -# 财务台账:每天 02:30 同步 AI 库动账、上一晚店铺余额和平台提现,并重算流水。 -30 2 * * * root /usr/bin/flock -w 1800 /run/caiwu-upstream-sync.lock /bin/sh -c '/usr/bin/docker exec -u www-data caiwu_app php artisan finance-ledger:sync-rpt --days=7 --merge --quiet && /usr/bin/docker exec -u www-data caiwu_app php artisan finance-ledger:sync-shop-data --days=7 --quiet' >/dev/null 2>&1 +# 财务台账:每天 02:30 同步 AI 库动账并重算流水;店铺台账默认不自动回填。 +30 2 * * * root /usr/bin/flock -w 1800 /run/caiwu-upstream-sync.lock /usr/bin/docker exec -u www-data caiwu_app php artisan finance-ledger:sync-rpt --days=7 --merge --quiet >/dev/null 2>&1 # 科目映射保存后保留自动重跑队列,每分钟在受限容器内串行消费。 * * * * * root /usr/bin/flock -n /run/caiwu-account-mapping-resync.lock /bin/sh /opt/caiwuxitong/run-finance-batch.sh store-receipt:auto-resync --quiet >/dev/null 2>&1 * * * * * root /usr/bin/flock -n /run/caiwu-account-bills-export.lock /bin/sh /opt/caiwuxitong/run-finance-batch.sh account-bills:exports:run --quiet >/dev/null 2>&1 diff --git a/deploy/activate-release.sh b/deploy/activate-release.sh index 93efb479..5a6684e0 100644 --- a/deploy/activate-release.sh +++ b/deploy/activate-release.sh @@ -229,8 +229,8 @@ CRON_TZ=Asia/Shanghai # 供应商管理每天北京时间 08:15 完整校准档案、合同、联系人与打款资料。 15 8 * * * root /usr/bin/flock -w 3600 /run/caiwu-upstream-sync.lock /usr/bin/docker exec -u www-data caiwu_app php artisan business-mirror:sync-supplier-management --quiet >/dev/null 2>&1 */2 * * * * root /usr/bin/flock -n /run/caiwu-esign-polling.lock /usr/bin/docker exec -u www-data caiwu_app php artisan esign:poll-signatures --quiet >/dev/null 2>&1 -# 财务台账:每天 02:30 同步 AI 库动账、上一晚店铺余额和平台提现,并重算流水。 -30 2 * * * root /usr/bin/flock -w 1800 /run/caiwu-upstream-sync.lock /bin/sh -c '/usr/bin/docker exec -u www-data caiwu_app php artisan finance-ledger:sync-rpt --days=7 --merge --quiet && /usr/bin/docker exec -u www-data caiwu_app php artisan finance-ledger:sync-shop-data --days=7 --quiet' >/dev/null 2>&1 +# 财务台账:每天 02:30 同步 AI 库动账并重算流水;店铺台账默认不自动回填。 +30 2 * * * root /usr/bin/flock -w 1800 /run/caiwu-upstream-sync.lock /usr/bin/docker exec -u www-data caiwu_app php artisan finance-ledger:sync-rpt --days=7 --merge --quiet >/dev/null 2>&1 # 科目映射保存后保留自动重跑队列,每分钟在受限容器内串行消费。 * * * * * root /usr/bin/flock -n /run/caiwu-account-mapping-resync.lock /bin/sh /opt/caiwuxitong/run-finance-batch.sh store-receipt:auto-resync --quiet >/dev/null 2>&1 * * * * * root /usr/bin/flock -n /run/caiwu-account-bills-export.lock /bin/sh /opt/caiwuxitong/run-finance-batch.sh account-bills:exports:run --quiet >/dev/null 2>&1 diff --git a/docs/财务台账开发说明.md b/docs/财务台账开发说明.md index c5ac60c2..b654644a 100644 --- a/docs/财务台账开发说明.md +++ b/docs/财务台账开发说明.md @@ -66,7 +66,7 @@ docker compose -f docker-compose.local.yml exec -u www-data app \ - 账户总表支持导出空白 Excel 录入模板,包含页面列、状态和账户类型选项及填写说明 - 账户总表编辑模式支持直接新增公司和首个账户:公司不存在时同步写入公司台账,可维护注册地、企业类型、税务类型、公司状态、基本户信息和备注;账户简称必须唯一,可同时登记期初日期与期初余额 - 写权限:账户映射、账户状态和账户类型修改仅系统管理员及配置的财务台账管理员角色;其他账号只读 -- 调度:`finance-ledger:sync-rpt --days=7 --merge` 每天 02:30(Asia/Shanghai) +- 调度:`finance-ledger:sync-rpt --days=7 --merge` 每天 02:30(Asia/Shanghai);店铺台账默认不自动回填 账户状态独立保存在 `fin_account_statuses`,账户类型人工维护值独立保存在 `fin_account_type_overrides`,重新导入账户基础数据均不会覆盖;页面修改使用 @@ -128,6 +128,13 @@ docker exec -u www-data caiwu_app php artisan finance-ledger:verify 30 2 * * * root /usr/bin/flock -w 1800 /run/caiwu-upstream-sync.lock /usr/bin/docker exec -u www-data caiwu_app php artisan finance-ledger:sync-rpt --days=7 --merge --quiet >/dev/null 2>&1 ``` +店铺台账默认保持现有数据,不随每日动账同步自动回填。需要按上游重新拉取时, +先确认已部署包含 `sync-shop-data --rebuild` 的主线镜像,再手动执行: + +```bash +sh /opt/caiwuxitong/run-finance-batch.sh finance-ledger:sync-shop-data --rebuild +``` + 5. 在「系统设置 → 权限」把「财务台账」页面分配给财务角色;账户映射修改允许超级管理员和「财务台账管理员」角色(可用 `FINANCE_LEDGER_MAPPING_EDITOR_ROLES` 覆盖)。 生产环境不设置 `FINANCE_LEDGER_WINDOW_END` 时会同步到当天;本地为了复现 12,037 笔规格数据,在 `runtime/.env` 固定为 `2026-10-18`。 diff --git a/tests/Unit/Deployment/BusinessMirrorScheduleTest.php b/tests/Unit/Deployment/BusinessMirrorScheduleTest.php index 47fb49d1..c76bcbe4 100644 --- a/tests/Unit/Deployment/BusinessMirrorScheduleTest.php +++ b/tests/Unit/Deployment/BusinessMirrorScheduleTest.php @@ -125,6 +125,17 @@ class BusinessMirrorScheduleTest extends TestCase $this->assertStringContainsString('esign:poll-signatures --quiet', $contents, $script); $this->assertStringContainsString('/run/caiwu-esign-polling.lock', $contents, $script); $this->assertSame(1, substr_count($contents, 'esign:poll-signatures --quiet'), $script); + $this->assertStringNotContainsString('finance-ledger:sync-shop-data', $contents, $script); + $this->assertStringContainsString( + '# 财务台账:每天 02:30 同步 AI 库动账并重算流水;店铺台账默认不自动回填。', + $contents, + $script, + ); + $this->assertStringContainsString( + '30 2 * * * root /usr/bin/flock -w 1800 /run/caiwu-upstream-sync.lock /usr/bin/docker exec -u www-data caiwu_app php artisan finance-ledger:sync-rpt --days=7 --merge --quiet >/dev/null 2>&1', + $contents, + $script, + ); } }
类型内容待办序号待办事项总负责人责任人类型内容待办事项序号待办事项总负责人责任人 开始时间完成时间状态完成情况完成截图备注
内容待办序号待办事项内容待办事项序号待办事项