fix: 增加OA流程定向快速补刷新
This commit is contained in:
parent
c8a941e085
commit
618739ead6
@ -11,6 +11,7 @@ class SyncDingProcessDetailMirror extends Command
|
||||
protected $signature = 'business-mirror:sync-ding-process-details
|
||||
{--full : 从配置起始日期完整重建明细和付款事实}
|
||||
{--business-id= : 只同步指定审批编号,多个用逗号分隔(最多 50 个)}
|
||||
{--skip-approval-api : 定向同步时不调用钉钉官方审批接口}
|
||||
{--dry-run : 只读取上游并校验,不写入镜像}';
|
||||
|
||||
protected $description = '从结构化审批镜像同步流程明细,并用钉钉官方接口补取缺失付款';
|
||||
@ -30,6 +31,7 @@ class SyncDingProcessDetailMirror extends Command
|
||||
$result = $synchronizer->syncBusinessIds(
|
||||
$businessIds,
|
||||
(bool) $this->option('dry-run'),
|
||||
! (bool) $this->option('skip-approval-api'),
|
||||
);
|
||||
} else {
|
||||
$result = $synchronizer->sync(
|
||||
|
||||
@ -160,7 +160,11 @@ class DingProcessDetailMirrorSynchronizer
|
||||
* bank_amount_total:float
|
||||
* }
|
||||
*/
|
||||
public function syncBusinessIds(array $businessIds, bool $dryRun = false): array
|
||||
public function syncBusinessIds(
|
||||
array $businessIds,
|
||||
bool $dryRun = false,
|
||||
bool $allowApprovalApi = true,
|
||||
): array
|
||||
{
|
||||
$businessIds = array_values(array_unique(array_filter(array_map(
|
||||
static fn (mixed $value): string => trim((string) $value),
|
||||
@ -174,7 +178,7 @@ class DingProcessDetailMirrorSynchronizer
|
||||
}
|
||||
|
||||
$this->approvalApiAttempts = 0;
|
||||
$this->approvalApiAvailable = true;
|
||||
$this->approvalApiAvailable = $allowApprovalApi;
|
||||
$this->approvalSnapshots = [];
|
||||
$scope = $this->scope();
|
||||
$state = $this->state();
|
||||
|
||||
@ -16,6 +16,7 @@ class SyncDingProcessDetailMirrorTest extends FeatureTestCase
|
||||
->with(
|
||||
['202610151743000310225', '202610151743000310226'],
|
||||
true,
|
||||
true,
|
||||
)
|
||||
->andReturn([
|
||||
'status' => 'validated',
|
||||
@ -36,6 +37,29 @@ class SyncDingProcessDetailMirrorTest extends FeatureTestCase
|
||||
->assertSuccessful();
|
||||
}
|
||||
|
||||
public function test_business_id_option_can_skip_approval_api(): void
|
||||
{
|
||||
$synchronizer = Mockery::mock(DingProcessDetailMirrorSynchronizer::class);
|
||||
$synchronizer->shouldReceive('syncBusinessIds')
|
||||
->once()
|
||||
->with(['202610151743000310225'], false, false)
|
||||
->andReturn([
|
||||
'status' => 'succeeded',
|
||||
'run_mode' => 'business_ids',
|
||||
'workflows' => 1,
|
||||
'details' => 1,
|
||||
'payments' => 1,
|
||||
'amount_total' => 100.0,
|
||||
'bank_amount_total' => 100.0,
|
||||
]);
|
||||
$this->app->instance(DingProcessDetailMirrorSynchronizer::class, $synchronizer);
|
||||
|
||||
$this->artisan('business-mirror:sync-ding-process-details', [
|
||||
'--business-id' => '202610151743000310225',
|
||||
'--skip-approval-api' => true,
|
||||
])->assertSuccessful();
|
||||
}
|
||||
|
||||
public function test_full_and_business_id_cannot_be_combined(): void
|
||||
{
|
||||
$synchronizer = Mockery::mock(DingProcessDetailMirrorSynchronizer::class);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user