fix: 合并店铺流程重叠的一天停留筛选 #952
@ -40,8 +40,7 @@ class ShopInfoFlowMirrorRepository
|
||||
|
||||
/** 当前节点等待天数分档:值为该档包含的最小天数(含)和最大天数(不含)。 */
|
||||
public const WAITING_DAY_BUCKETS = [
|
||||
'1天内' => [0, 1],
|
||||
'1天' => [1, 2],
|
||||
'1天' => [0, 2],
|
||||
'2天' => [2, 3],
|
||||
'3天' => [3, 4],
|
||||
'4天' => [4, 5],
|
||||
@ -168,10 +167,13 @@ class ShopInfoFlowMirrorRepository
|
||||
$query->whereIn('o.flowStatus', $codes === [] ? [-1] : $codes);
|
||||
}
|
||||
|
||||
$waitingDays = array_values(array_intersect(
|
||||
$this->filterValues($filters['node_waiting_days'] ?? ''),
|
||||
$waitingDays = array_values(array_unique(array_intersect(
|
||||
array_map(
|
||||
static fn (string $label): string => $label === '1天内' ? '1天' : $label,
|
||||
$this->filterValues($filters['node_waiting_days'] ?? ''),
|
||||
),
|
||||
array_keys(self::WAITING_DAY_BUCKETS),
|
||||
));
|
||||
)));
|
||||
if ($waitingDays !== []) {
|
||||
$now = now();
|
||||
$query->where(function (Builder $buckets) use ($waitingDays, $now): void {
|
||||
@ -180,13 +182,13 @@ class ShopInfoFlowMirrorRepository
|
||||
$buckets->orWhere(function (Builder $bucket) use ($minimumDays, $maximumDays, $now): void {
|
||||
$bucket->whereIn('o.flowStatus', [1, 7])
|
||||
->where('o.updateTime', '<=', $now);
|
||||
if ($minimumDays === 0) {
|
||||
$bucket->where('o.updateTime', '>', $now->copy()->subDay());
|
||||
} elseif ($maximumDays === null) {
|
||||
if ($maximumDays === null) {
|
||||
$bucket->where('o.updateTime', '<=', $now->copy()->subDays($minimumDays));
|
||||
} else {
|
||||
$bucket->where('o.updateTime', '>', $now->copy()->subDays($maximumDays))
|
||||
->where('o.updateTime', '<=', $now->copy()->subDays($minimumDays));
|
||||
$bucket->where('o.updateTime', '>', $now->copy()->subDays($maximumDays));
|
||||
if ($minimumDays > 0) {
|
||||
$bucket->where('o.updateTime', '<=', $now->copy()->subDays($minimumDays));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -423,6 +423,7 @@ class NavigationTest extends FeatureTestCase
|
||||
->assertSee('data-directory-multi-select="flow_type"', false)
|
||||
->assertSee('data-directory-multi-select="approval_status"', false)
|
||||
->assertSee('data-directory-multi-select="node_waiting_days"', false)
|
||||
->assertDontSeeText('1天内')
|
||||
// 当前节点和进入时间只展示,不再生成查询条件。
|
||||
->assertDontSee('data-directory-query-field="current_node"', false)
|
||||
->assertDontSee('data-directory-query-field="node_entered_at"', false)
|
||||
|
||||
@ -110,7 +110,7 @@ class ShopInfoFlowMirrorRepositoryTest extends TestCase
|
||||
$this->assertSame('审批节点(审核人A)', $rows['shp-2']['current_node']);
|
||||
$this->assertSame('2026-10-02 10:00:00', $rows['shp-2']['node_entered_at']);
|
||||
$this->assertSame('2小时30分钟', $rows['shp-2']['node_waiting_duration']);
|
||||
$this->assertSame('1天内', $rows['shp-2']['node_waiting_days']);
|
||||
$this->assertSame('1天', $rows['shp-2']['node_waiting_days']);
|
||||
$this->assertSame('店铺关店', $rows['shp-3']['flow_type']);
|
||||
$this->assertSame('拒绝', $rows['shp-3']['approval_status']);
|
||||
$this->assertSame('已拒绝', $rows['shp-3']['current_node']);
|
||||
@ -145,6 +145,8 @@ class ShopInfoFlowMirrorRepositoryTest extends TestCase
|
||||
|
||||
try {
|
||||
$fixtures = [
|
||||
[8, 'waiting-under-1d', '流程中', '2026-11-05 02:00:00', '1天'],
|
||||
[9, 'waiting-exact-1d', '流程中', '2026-11-04 12:00:00', '1天'],
|
||||
[10, 'waiting-5d', '流程中', '2026-10-31 11:00:00', '5天'],
|
||||
[11, 'waiting-6d', '流程中', '2026-10-30 10:00:00', '6天'],
|
||||
[12, 'waiting-7d', '流程中', '2026-10-29 10:00:00', '7天'],
|
||||
@ -184,6 +186,8 @@ class ShopInfoFlowMirrorRepositoryTest extends TestCase
|
||||
'flow_id' => 'waiting-',
|
||||
'node_waiting_days' => $days,
|
||||
])['total'];
|
||||
$this->assertSame(2, $count(['1天']));
|
||||
$this->assertSame(2, $count(['1天内']));
|
||||
$this->assertSame(1, $count(['5天']));
|
||||
$this->assertSame(2, $count(['6天', '7天']));
|
||||
$this->assertSame(1, $count(['8-14天']));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user