CaiWuXiTong/app/Console/Commands/ImportActualTax.php
2026-11-19 17:28:52 +08:00

37 lines
1.0 KiB
PHP

<?php
namespace App\Console\Commands;
use App\Business\ActualTax\ActualTaxWorkbookImporter;
use Illuminate\Console\Command;
use Throwable;
class ImportActualTax extends Command
{
protected $signature = 'actual-tax:import
{path : 实际税金表工作簿或 CSV 路径}';
protected $description = '导入实际税金表,整份替换共享业务镜像中的上一版数据';
public function handle(ActualTaxWorkbookImporter $importer): int
{
try {
$result = $importer->import((string) $this->argument('path'));
} catch (Throwable $exception) {
report($exception);
$this->error('实际税金表导入失败:' . $exception->getMessage());
return self::FAILURE;
}
$this->info(sprintf(
'实际税金表导入完成:%s 条,跳过空行 %s 条,来源文件 %s。',
number_format($result['imported']),
number_format($result['skipped']),
$result['source_file'],
));
return self::SUCCESS;
}
}