fix: 修正负数预警最晚出账时间匹配 #1127
@ -99,7 +99,7 @@ class SupplierPayableReportRepository
|
||||
* 按月份读取供应商应付表最晚出账时间(上游 modifiedTime)。
|
||||
*
|
||||
* @param list<string> $months
|
||||
* @return list<array{month:string,supplier:string,checker:string,settlement_method:string,modified_at:string}>
|
||||
* @return list<array{month:string,supplier:string,modified_at:string}>
|
||||
*/
|
||||
public function latestModifiedTimes(array $months): array
|
||||
{
|
||||
@ -115,19 +115,15 @@ class SupplierPayableReportRepository
|
||||
$sql = 'SELECT '
|
||||
. '[Month] AS month, '
|
||||
. '[supplier] AS supplier, '
|
||||
. '[checker] AS checker, '
|
||||
. '[settleway] AS settlement_method, '
|
||||
. 'CONVERT(varchar(19), MAX([modifiedTime]), 120) AS modified_at '
|
||||
. 'FROM [dbo].[fys_supplierPaymentSummary] '
|
||||
. "WHERE [Month] IN ({$placeholders}) "
|
||||
. 'GROUP BY [Month], [supplier], [checker], [settleway]';
|
||||
. 'GROUP BY [Month], [supplier]';
|
||||
|
||||
return array_map(
|
||||
static fn (array $row): array => [
|
||||
'month' => trim((string) ($row['month'] ?? '')),
|
||||
'supplier' => trim((string) ($row['supplier'] ?? '')),
|
||||
'checker' => trim((string) ($row['checker'] ?? '')),
|
||||
'settlement_method' => trim((string) ($row['settlement_method'] ?? '')),
|
||||
'modified_at' => trim((string) ($row['modified_at'] ?? '')),
|
||||
],
|
||||
$this->query->select($sql, $months),
|
||||
|
||||
@ -297,8 +297,6 @@ class SupplierNegativeAlertPageData
|
||||
return implode("\0", [
|
||||
trim((string) ($row['summary_month'] ?? $row['month'] ?? '')),
|
||||
trim((string) ($row['supplier'] ?? '')),
|
||||
trim((string) ($row['checker'] ?? '')),
|
||||
trim((string) ($row['settlement_method'] ?? '')),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@ -82,15 +82,15 @@ class NegativeAlertPagesTest extends FeatureTestCase
|
||||
[
|
||||
'month' => '2026-09',
|
||||
'supplier' => '负余额供应商',
|
||||
'checker' => '',
|
||||
'settlement_method' => '',
|
||||
'checker' => '上游原对账人',
|
||||
'settlement_method' => '上游原结算方式',
|
||||
'modified_at' => '2026-11-09 09:30:00',
|
||||
],
|
||||
[
|
||||
'month' => '2026-09',
|
||||
'supplier' => '公式命中供应商',
|
||||
'checker' => '',
|
||||
'settlement_method' => '',
|
||||
'checker' => '上游原对账人',
|
||||
'settlement_method' => '上游原结算方式',
|
||||
'modified_at' => '2026-11-09 10:15:00',
|
||||
],
|
||||
]);
|
||||
|
||||
@ -81,7 +81,7 @@ class SupplierPayableReportRepositoryTest extends TestCase
|
||||
$this->assertTrue($result['rows'][0]['is_payment']);
|
||||
}
|
||||
|
||||
public function test_latest_modified_times_are_grouped_by_month_supplier_checker_and_settlement(): void
|
||||
public function test_latest_modified_times_are_grouped_by_month_and_supplier(): void
|
||||
{
|
||||
$query = $this->createMock(UpstreamReadOnlyQuery::class);
|
||||
$query->expects($this->once())->method('select')->willReturnCallback(
|
||||
@ -89,14 +89,12 @@ class SupplierPayableReportRepositoryTest extends TestCase
|
||||
UpstreamReadOnlyQuery::assertReadOnlySql($sql);
|
||||
$this->assertStringContainsString('[dbo].[fys_supplierPaymentSummary]', $sql);
|
||||
$this->assertStringContainsString('MAX([modifiedTime])', $sql);
|
||||
$this->assertStringContainsString('[settleway] AS settlement_method', $sql);
|
||||
$this->assertStringContainsString('GROUP BY [Month], [supplier]', $sql);
|
||||
$this->assertSame(['2026-09', '2026-10'], $bindings);
|
||||
|
||||
return [[
|
||||
'month' => '2026-09',
|
||||
'supplier' => '供应商甲',
|
||||
'checker' => '陈亲园',
|
||||
'settlement_method' => '月结',
|
||||
'modified_at' => '2026-11-09 09:30:00',
|
||||
]];
|
||||
},
|
||||
@ -111,8 +109,6 @@ class SupplierPayableReportRepositoryTest extends TestCase
|
||||
|
||||
$this->assertSame('2026-09', $result[0]['month']);
|
||||
$this->assertSame('供应商甲', $result[0]['supplier']);
|
||||
$this->assertSame('陈亲园', $result[0]['checker']);
|
||||
$this->assertSame('月结', $result[0]['settlement_method']);
|
||||
$this->assertSame('2026-11-09 09:30:00', $result[0]['modified_at']);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user