Commit 8d0c13e8 by 杨树贤

审批流重新生成问题

parent 0ba3f372
......@@ -170,7 +170,7 @@ class SupplierSyncController extends BaseSyncController
'creator_name' => 'required',
'apply_uid' => 'required',
];
Log::info('[CRM同步]参数', $data);
$validator = Validator::make($data, $rules);
if ($validator->fails()) {
$error = $validator->errors()->first();
......@@ -193,16 +193,18 @@ class SupplierSyncController extends BaseSyncController
&& $existingSupplier['status'] == SupplierChannelModel::STATUS_CRM_REJECTED
) {
try {
// 先更新状态为待确认
SupplierChannelModel::where('supplier_id', $existingSupplier['supplier_id'])->update([
'status' => SupplierChannelModel::STATUS_CONFIRM,
'update_time' => time(),
]);
// 然后更新供应商信息
$this->updateCrmSupplier($existingSupplier, $data);
// 重新发起审核流(addApproveForCustomerConvert 内部已处理幂等:旧单据终态时会创建新单据)
$auditService = new SupplierAuditService();
$auditService->addApproveForCustomerConvert($existingSupplier['supplier_id'], $data['apply_uid'], '客户转化供应商审核');
DB::connection('web')->transaction(function () use ($existingSupplier, $data) {
// 先更新状态为待确认
SupplierChannelModel::where('supplier_id', $existingSupplier['supplier_id'])->update([
'status' => SupplierChannelModel::STATUS_CONFIRM,
'update_time' => time(),
]);
// 然后更新供应商信息
$this->updateCrmSupplier($existingSupplier, $data);
// 重新发起审核流(addApproveForCustomerConvert 内部已处理幂等:旧单据终态时会创建新单据)
$auditService = new SupplierAuditService();
$auditService->addApproveForCustomerConvert($existingSupplier['supplier_id'], $data['apply_uid'], '客户转化供应商审核');
});
$this->syncResponse(0, 'CRM重新同步,状态已恢复为待确认并更新信息,已重新发起审核', ['supplier_id' => $existingSupplier['supplier_id']]);
LogService::AddLog($existingSupplier['supplier_id'], LogModel::UPDATE_OPERATE, 'CRM重新同步', 'CRM重新同步,状态已恢复为待确认并更新信息,已重新发起审核');
} catch (\Exception $e) {
......@@ -540,4 +542,4 @@ class SupplierSyncController extends BaseSyncController
$this->syncResponse(-1, '更新失败: ' . $e->getMessage());
}
}
}
}
\ No newline at end of file
......@@ -583,9 +583,10 @@ class SupplierAuditService
// 先获取审核流节点数据
$flowInfo = AuditCenterService::getAuditFlowInfo(
AuditCenterService::TYPE_CUSTOMER_CONVERT_SUPPLIER_AUDIT,
array_get(request()->user, 'userId', 1000),
$applyUid,
1
);
// dd($flowInfo);
// 创建审批单据
$billInfo = AuditCenterService::addAudit([
"flow_id" => $flowInfo['flow_info']['id'],
......@@ -732,4 +733,4 @@ class SupplierAuditService
);
return $flowInfo;
}
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment