Commit 530cef05 by 杨树贤

跳过逻辑

parent 2da77b44
Showing with 23 additions and 16 deletions
...@@ -124,20 +124,23 @@ class SyncSupplierService ...@@ -124,20 +124,23 @@ class SyncSupplierService
} }
$message['reviewProcess'] = $reviewProcess; $message['reviewProcess'] = $reviewProcess;
if ($conn) { if ($conn) {
} else { } else {
$conn = new AMQPStreamConnection(config('database.connections.rabbitmq.host'), $conn = new AMQPStreamConnection(
config('database.connections.rabbitmq.host'),
config('database.connections.rabbitmq.port'), config('database.connections.rabbitmq.port'),
config('database.connections.rabbitmq.login'), config('database.connections.rabbitmq.login'),
config('database.connections.rabbitmq.password')); config('database.connections.rabbitmq.password')
);
} }
$channel = $conn->channel(); $channel = $conn->channel();
$channel->queue_declare('supplier_sync', false, true, false, false); $channel->queue_declare('supplier_sync', false, true, false, false);
Log::warning(json_encode($message)); Log::warning(json_encode($message));
$msg = new AMQPMessage(json_encode($message), $msg = new AMQPMessage(
array('content_type' => 'text/plain')); json_encode($message),
array('content_type' => 'text/plain')
);
$result = $channel->basic_publish($msg, '', 'supplier_sync'); $result = $channel->basic_publish($msg, '', 'supplier_sync');
// $result = $channel->basic_publish($msg); // $result = $channel->basic_publish($msg);
} }
//获取采购人员列表 //获取采购人员列表
...@@ -167,7 +170,7 @@ class SyncSupplierService ...@@ -167,7 +170,7 @@ class SyncSupplierService
//同步供应商信息到一体化中心 //同步供应商信息到一体化中心
public function syncSupplierToUnited($supplierId) public function syncSupplierToUnited($supplierId)
{ {
Log::error('同步供应商给一体化 : '. $supplierId); Log::error('同步供应商给一体化 : ' . $supplierId);
$supplier = SupplierChannelModel::where('supplier_id', $supplierId)->first()->toArray(); $supplier = SupplierChannelModel::where('supplier_id', $supplierId)->first()->toArray();
$fileUrl = SupplierAttachmentsModel::where('supplier_id', $supplierId) $fileUrl = SupplierAttachmentsModel::where('supplier_id', $supplierId)
->where('field_name', 'registration_certificate') ->where('field_name', 'registration_certificate')
...@@ -183,8 +186,11 @@ class SyncSupplierService ...@@ -183,8 +186,11 @@ class SyncSupplierService
'region' => $supplier['region'] == SupplierChannelModel::REGION_CN ? 1 : 2, 'region' => $supplier['region'] == SupplierChannelModel::REGION_CN ? 1 : 2,
'pi_file_url' => $fileUrl ?: '', 'pi_file_url' => $fileUrl ?: '',
]; ];
(new QueueDeliveryService())->push(QueueDeliveryService::PUSH_TYPE_SYNC_HTTP, '/sync/Company/syncCompany', (new QueueDeliveryService())->push(
$syncData); QueueDeliveryService::PUSH_TYPE_SYNC_HTTP,
'/sync/Company/syncCompany',
$syncData
);
} }
/** /**
...@@ -294,21 +300,22 @@ class SyncSupplierService ...@@ -294,21 +300,22 @@ class SyncSupplierService
} }
foreach ($suppliers as $supplier) { foreach ($suppliers as $supplier) {
//判断是否是同名多供应商,如果是的话,如果是之前已经禁用的,则直接跳过 //判断是否是同名多供应商,如果是的话,如果是之前已经禁用的,则直接跳过
if (count($suppliers) > 1) { if (count($suppliers) > 1) {
//判断是否是人工禁用的,是的话,也跳过
//线上数据,实体名单状态为普通,且供应商状态为禁止交易的,全部为手动禁用;
if (strpos($supplier['disable_reason'], '人工禁用') !== false || ($supplier['status'] == SupplierChannelModel::STATUS_DISABLE && $supplier['is_entity'] != SupplierChannelModel::IS_ENTITY_FALSE)) {
Log::warning("检测到同名供应商并且属于禁用(人工禁用)状态,跳过,供应商id为 : " . $supplier['supplier_id']);
continue;
}
if ($supplier['status'] == SupplierChannelModel::STATUS_DISABLE && $supplier['is_entity'] != SupplierChannelModel::IS_ENTITY_NEED_CONFIRM) { if ($supplier['status'] == SupplierChannelModel::STATUS_DISABLE && $supplier['is_entity'] != SupplierChannelModel::IS_ENTITY_NEED_CONFIRM) {
Log::warning("检测到同名供应商并且属于禁用(实体名单不为待处理)状态,跳过,供应商id为 : " . $supplier['supplier_id']); Log::warning("检测到同名供应商并且属于禁用(实体名单不为待处理)状态,跳过,供应商id为 : " . $supplier['supplier_id']);
continue; continue;
} }
} }
//判断是否是人工禁用的,是的话,也跳过
//线上数据,实体名单状态为普通,且供应商状态为禁止交易的,全部为手动禁用;
if (strpos($supplier['disable_reason'], '人工禁用') !== false || ($supplier['status'] == SupplierChannelModel::STATUS_DISABLE && $supplier['is_entity'] != SupplierChannelModel::IS_ENTITY_FALSE)) {
Log::warning("检测到同名供应商并且属于禁用(人工禁用)状态,跳过,供应商id为 : " . $supplier['supplier_id']);
continue;
}
$originIsEntity = $supplier['is_entity']; $originIsEntity = $supplier['is_entity'];
//$supplier = $supplier->toArray(); //$supplier = $supplier->toArray();
$supplierId = $supplier['supplier_id']; $supplierId = $supplier['supplier_id'];
......
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