## 实际改动 - 招商银行账户即使数据来源为“手动”,也保持原有自动银企直连判定。 - 在编辑弹窗明确选择“非银企直连”时保存独立覆盖值,不会被自动直连规则覆盖。 - 同时让旧列设置自动升级,默认显示“连接方式”列。 ## 验证证据 - `FinanceLedgerManualEditTest`、`NonStoreAccountMonitorTest`:招商自动直连和明确非直连专项通过。 - 招商银行“手动”数据来源场景已纳入回归测试。 ## 风险检查 - 不涉及数据库迁移、生产配置、数据修复或权限变更。 - 仅调整连接方式判定与页面默认列。 Reviewed-on: #1577
51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Utilities;
|
|
|
|
final class FinanceLedgerFlowSummaryDataSource
|
|
{
|
|
public const MANUAL = '手动';
|
|
|
|
public const DIRECT = '银企直连';
|
|
|
|
public const NON_DIRECT = '非银企直连';
|
|
|
|
public const FILTER_UNFILLED = '__empty__';
|
|
|
|
public const OPTIONS = [self::MANUAL, self::DIRECT];
|
|
|
|
public const STORED_OPTIONS = [self::MANUAL, self::DIRECT, self::NON_DIRECT];
|
|
|
|
public const CONNECTION_OPTIONS = [self::NON_DIRECT, self::DIRECT];
|
|
|
|
public static function normalize(mixed $value): string
|
|
{
|
|
$text = self::stored($value);
|
|
|
|
return $text === self::NON_DIRECT ? self::MANUAL : $text;
|
|
}
|
|
|
|
public static function stored(mixed $value): string
|
|
{
|
|
$text = trim((string) ($value ?? ''));
|
|
|
|
return in_array($text, self::STORED_OPTIONS, true) ? $text : '';
|
|
}
|
|
|
|
public static function connectionLabel(mixed $value, bool $autoDirect = false): string
|
|
{
|
|
return match (self::stored($value)) {
|
|
self::DIRECT => self::DIRECT,
|
|
self::NON_DIRECT => self::NON_DIRECT,
|
|
default => $autoDirect ? self::DIRECT : self::NON_DIRECT,
|
|
};
|
|
}
|
|
|
|
public static function normalizeConnectionLabel(mixed $value): string
|
|
{
|
|
$text = trim((string) ($value ?? ''));
|
|
|
|
return in_array($text, self::CONNECTION_OPTIONS, true) ? $text : '';
|
|
}
|
|
}
|