fix: 审批人卡单数仅统计在途流程 #973

Merged
renshen merged 1 commits from fix/renshen-process-approver-active-counts into main 2026-11-06 23:32:14 +08:00
2 changed files with 21 additions and 0 deletions

View File

@ -135,6 +135,7 @@ class ShopInfoFlowMirrorRepository
->leftJoin($flow . ' as o', 'o.flowId', '=', 'f.flowId')
->whereNotNull('o.approver')
->where('o.approver', '!=', '')
->whereIn('o.flowStatus', [1, 7])
->selectRaw('o.approver, COUNT(*) AS total')
->groupBy('o.approver');
$this->applyFilters($query, $filters);

View File

@ -167,6 +167,25 @@ class ShopInfoFlowMirrorRepositoryTest extends TestCase
'updateTime' => '2026-10-05 10:00:00',
]);
}
$this->insertApplication(
13,
'approver-finished',
10,
'京东',
'历史审批人测试',
'ERP-历史审批人测试',
'申请人13',
'2026-10-05 09:00:00',
);
$db->table('oa_flow_flow')->insert([
'Id' => 13,
'flowId' => 'approver-finished',
'flowType' => 10,
'flowStatus' => 3,
'subject' => '[店铺关店-历史审批人测试]',
'approver' => '历史审批人',
'updateTime' => '2026-10-05 10:00:00',
]);
$options = $this->repository->currentApproverOptions([
'flow_type' => ['店铺关店'],
@ -178,6 +197,7 @@ class ShopInfoFlowMirrorRepositoryTest extends TestCase
'玉兔' => 1,
'常仪' => 1,
], array_column($options, 'count', 'value'));
$this->assertArrayNotHasKey('历史审批人', array_column($options, 'count', 'value'));
$this->assertSame([['value' => '审核人A', 'count' => 1]], $this->repository->currentApproverOptions([
'flow_type' => ['店铺变更'],
]));