Commit 8d0c13e8 by 杨树贤

审批流重新生成问题

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