fix: 补全OA审批中流程当前办理人 (#775)
This commit is contained in:
parent
8ae27c56eb
commit
4c746d488d
@ -948,7 +948,7 @@ class DingProcessDetailMirrorSynchronizer
|
||||
);
|
||||
$needsCashierApi = $this->needsCashierApi($process, $workflow);
|
||||
$approvalSnapshot = null;
|
||||
if ($needsPaymentApi || $needsCashierApi) {
|
||||
if ($needsPaymentApi || $needsCashierApi || $status === '审批中') {
|
||||
$approvalSnapshot = $this->approvalApiSnapshot($workflow);
|
||||
}
|
||||
if ($needsPaymentApi && $approvalSnapshot !== null) {
|
||||
|
||||
@ -334,6 +334,55 @@ class DingProcessDetailMirrorSynchronizerTest extends TestCase
|
||||
$this->assertSame('2026-10-29 18:50:00', (string) $row->current_task_started_at);
|
||||
}
|
||||
|
||||
public function test_running_workflow_without_payment_fields_resolves_current_task_and_approver(): void
|
||||
{
|
||||
config([
|
||||
'upstream_mirrors.ding_process_details.processes.PROC-ACF09A14-B094-46B1-A9E2-8BB1F4E1FDCF' => [
|
||||
'document_type' => '种菜核销',
|
||||
'detail_table' => '收款费用明细',
|
||||
'detail_amount_fields' => ['代发订单金额'],
|
||||
'amount_total_fields' => ['收款合计'],
|
||||
],
|
||||
]);
|
||||
$this->query->workflows = [[
|
||||
'processInstanceId' => 'process-running-without-payment',
|
||||
'processCode' => 'PROC-ACF09A14-B094-46B1-A9E2-8BB1F4E1FDCF',
|
||||
'businessId' => '202610291915000052466',
|
||||
'title' => '苏木提交的种菜核销种菜报销流程',
|
||||
'status' => 'RUNNING',
|
||||
'result' => 'NONE',
|
||||
'originatorUserId' => 'user-1',
|
||||
'joinAt' => '2026-10-29 19:15:00',
|
||||
]];
|
||||
$this->query->scheme = [
|
||||
'收款费用明细' => json_encode([[
|
||||
'rowValue' => [
|
||||
['label' => '代发订单金额', 'value' => '100.00'],
|
||||
],
|
||||
]], JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR),
|
||||
'收款合计' => 100,
|
||||
];
|
||||
$this->approvalClient->tasksByInstance['process-running-without-payment'] = [[
|
||||
'taskGroupName' => '行政核价',
|
||||
'status' => 'RUNNING',
|
||||
'result' => 'NONE',
|
||||
'userId' => 'user-2',
|
||||
'createTime' => '2026-10-29T19:20Z',
|
||||
'finishTime' => '',
|
||||
]];
|
||||
|
||||
$this->synchronizer->sync(true);
|
||||
|
||||
$row = DB::connection('business_mirror')
|
||||
->table('ding_process_detail_mirror')
|
||||
->where('business_id', '202610291915000052466')
|
||||
->first();
|
||||
$this->assertSame('行政核价', $row->current_task_name);
|
||||
$this->assertSame('王五', $row->current_approver_name);
|
||||
$this->assertSame('2026-10-29 19:20:00', (string) $row->current_task_started_at);
|
||||
$this->assertSame('not_applicable', $row->payment_source_state);
|
||||
}
|
||||
|
||||
public function test_validation_failure_keeps_the_previous_published_rows(): void
|
||||
{
|
||||
$this->query->workflows = [[
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user