CaiWuXiTong/app/Console/Commands/ImportDingProcessDetails.php
yueyang 7ea2d9c7ef 修复钉钉流程明细漏抓与付款金额重复 (#651)
改为按审批主表、费用明细、付款明细结构化同步;补全14类财务流程,付款按对应序号只计一次,合计读取独立付款事实。
2026-10-26 20:46:13 +08:00

44 lines
1.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Modules\EcommerceFinance\Services\DingProcessDetailMirrorImporter;
use Throwable;
class ImportDingProcessDetails extends Command
{
protected $signature = 'ding:import-process-details
{file : 15 列流程明细 CSV 文件路径}
{--scope=personal_permission : 数据权限范围标识}
{--replace : 导入前清空同一范围的数据}';
protected $description = '兼容导入旧版铺平 CSV;生产请使用 business-mirror:sync-ding-process-details';
public function handle(DingProcessDetailMirrorImporter $importer): int
{
try {
$result = $importer->import(
(string) $this->argument('file'),
(string) $this->option('scope'),
(bool) $this->option('replace'),
);
} catch (Throwable $exception) {
$this->error('导入失败:' . $exception->getMessage());
return self::FAILURE;
}
$this->info(sprintf(
'导入完成:%d 行,跳过占位 %d 行,跳过无效 %d 行,重复 %d 行,范围 %s。',
$result['rows'],
$result['placeholders'],
$result['invalid'],
$result['duplicates'],
$result['scope'],
));
return self::SUCCESS;
}
}