diff --git a/modules/EcommerceFinance/Repositories/ShopInfoFlowMirrorRepository.php b/modules/EcommerceFinance/Repositories/ShopInfoFlowMirrorRepository.php index c76fdb1f..83b8be00 100644 --- a/modules/EcommerceFinance/Repositories/ShopInfoFlowMirrorRepository.php +++ b/modules/EcommerceFinance/Repositories/ShopInfoFlowMirrorRepository.php @@ -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); diff --git a/tests/Unit/EcommerceFinance/ShopInfoFlowMirrorRepositoryTest.php b/tests/Unit/EcommerceFinance/ShopInfoFlowMirrorRepositoryTest.php index b50f5232..e3dfc54d 100644 --- a/tests/Unit/EcommerceFinance/ShopInfoFlowMirrorRepositoryTest.php +++ b/tests/Unit/EcommerceFinance/ShopInfoFlowMirrorRepositoryTest.php @@ -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' => ['店铺变更'], ]));