Commit ef4cf926 by mushishixian

ok

parent b926420a
...@@ -86,17 +86,17 @@ class DataService ...@@ -86,17 +86,17 @@ class DataService
$cooperation_agreement = array_get($files, 'cooperation_agreement'); $cooperation_agreement = array_get($files, 'cooperation_agreement');
$other_attachment = array_get($files, 'other_attachment'); $other_attachment = array_get($files, 'other_attachment');
$attachment = [ $attachment = [
'business_license' => $business_license?[$business_license]:'', 'business_license' => $business_license ? [$business_license] : '',
'billing_information' => $billing_information?[$billing_information]:'', 'billing_information' => $billing_information ? [$billing_information] : '',
'registration_certificate' => $registration_certificate?[$registration_certificate]:'', 'registration_certificate' => $registration_certificate ? [$registration_certificate] : '',
'incorporation_certificate' => $incorporation_certificate?[$incorporation_certificate]:'', 'incorporation_certificate' => $incorporation_certificate ? [$incorporation_certificate] : '',
'certification_notice' => $certification_notice?[$certification_notice]:'', 'certification_notice' => $certification_notice ? [$certification_notice] : '',
'supplier_survey' => $supplier_survey?[$supplier_survey]:'', 'supplier_survey' => $supplier_survey ? [$supplier_survey] : '',
'proxy_certificate' => $proxy_certificate?[$proxy_certificate]:'', 'proxy_certificate' => $proxy_certificate ? [$proxy_certificate] : '',
'quality_assurance_agreement' => $quality_assurance_agreement?[$quality_assurance_agreement]:'', 'quality_assurance_agreement' => $quality_assurance_agreement ? [$quality_assurance_agreement] : '',
'confidentiality_agreement' => $confidentiality_agreement?[$confidentiality_agreement]:'', 'confidentiality_agreement' => $confidentiality_agreement ? [$confidentiality_agreement] : '',
'cooperation_agreement' => $cooperation_agreement?[$cooperation_agreement]:'', 'cooperation_agreement' => $cooperation_agreement ? [$cooperation_agreement] : '',
'other_attachment' => $other_attachment?[$other_attachment]:'', 'other_attachment' => $other_attachment ? [$other_attachment] : '',
'create_time' => time(), 'create_time' => time(),
'update_time' => time(), 'update_time' => time(),
'supplier_id' => $supplierId, 'supplier_id' => $supplierId,
...@@ -175,6 +175,67 @@ class DataService ...@@ -175,6 +175,67 @@ class DataService
} }
} }
//导入黑名单供应商(前提是不存在)
public function importBlockSupplier()
{
$supplierNames = [
'Electronics Depot',
'Assured Electronics Corp.',
'深圳市力特电子有限公司',
'深圳市铭盛微电子科技有限公司',
'Aegis Components Inc',
'深圳市亿博创电子公司',
];
//构建插入数据
$supplierModel = new SupplierChannelModel();
foreach ($supplierNames as $supplierName) {
$supplierName = trim($supplierName);
$exist = $supplierModel->where('supplier_name', $supplierName)->count();
if (!$exist) {
$insertData = [
'supplier_name' => $supplierName,
'create_uid' => 1000,
'create_time' => time(),
'status' => $supplierModel::STATUS_BLOCK,
'is_type' => 0,
'create_name' => 'admin',
'block_reason'=> '系统拉黑',
];
$supplierId = $supplierModel->insertGetId($insertData);
$supplierService = new SupplierService();
$supplierService->saveSupplierCode($supplierId);
}
}
}
//给特定类型的供应商打上标签
//找出 国内/港台 + 贸易商性质的,而且没有上传品质协议的供应商,自动打上临时供应商标签
public function makeSupplierSystemTag()
{
$channelModel = new SupplierChannelModel();
$suppliers = $channelModel->leftjoin('supplier_attachment', 'supplier_channel.supplier_id', '=',
'supplier_attachment.supplier_id')
->whereIn('region', [2, 4])
->where('supplier_group', 2)
->where('quality_assurance_agreement', '')->where('system_tags', 'not like', '%临时供应商%')
->get()->toArray();
$tagService = new SupplierTagService();
//找到后打上标签
foreach ($suppliers as $supplier) {
$supplierId = $supplier['supplier_id'];
$oldTags = $supplier['system_tags'];
$newTags = $supplier['system_tags'] ? rtrim($supplier['system_tags'], ',') . ',临时供应商' : '临时供应商';
if ($tagService->saveTags($supplierId, 14, $newTags, $oldTags)) {
$channelModel->where('supplier_id', $supplierId)->update([
'system_tags' => $newTags
]);
}
}
}
} }
...@@ -201,7 +201,7 @@ class SupplierService ...@@ -201,7 +201,7 @@ class SupplierService
} }
//报错供应商编码,包括系统生成的和自定义规则生成的 //报错供应商编码,包括系统生成的和自定义规则生成的
private function saveSupplierCode($supplierId) public function saveSupplierCode($supplierId)
{ {
$model = new SupplierChannelModel(); $model = new SupplierChannelModel();
$supplier = $model->where('supplier_id', $supplierId)->first(); $supplier = $model->where('supplier_id', $supplierId)->first();
......
...@@ -44,6 +44,8 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () { ...@@ -44,6 +44,8 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () {
}); });
Route::match(['get', 'post'], '/test', function () { Route::match(['get', 'post'], '/test', function () {
$service = new \App\Http\Services\DataService(); $service = new \App\Http\Services\DataService();
$service->importBlockSupplier();
// $service->makeSupplierSystemTag();
// $service->initSystemTag(); // $service->initSystemTag();
// $service->transferFileData(); // $service->transferFileData();
// $service->changeSupplierIsTypeByCheckChannelUidOrPurchaseUid(); // $service->changeSupplierIsTypeByCheckChannelUidOrPurchaseUid();
......
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