|
|
@@ -13,6 +13,8 @@ use App\Models\Manager\Process\ViolationProduct as ViolationProductModel;
|
|
|
use App\Models\Manager\Personnel\Employee as EmployeeModel;
|
|
|
use App\Models\Api\Process\ExecuteLog as ExecuteLogModel;
|
|
|
use App\Models\Manager\Process\ScrapeData as ScrapeDataModel;
|
|
|
+use App\Models\Manager\WashConfig\ViolationStore as ViolationStoreModel;
|
|
|
+use App\Models\Manager\WashConfig\ViolationCompanyMember as ViolationCompanyMemberModel;
|
|
|
|
|
|
/**
|
|
|
* 数据清洗-违规挂网商品数据队列
|
|
|
@@ -60,6 +62,8 @@ class ViolationProductDataJobs implements ShouldQueue
|
|
|
$EmployeeModel = new EmployeeModel();
|
|
|
$ViolationProductModel = new ViolationProductModel();
|
|
|
$ScrapeDataModel = new ScrapeDataModel();
|
|
|
+ $ViolationStoreModel = new ViolationStoreModel();
|
|
|
+ $ViolationCompanyMemberModel = new ViolationCompanyMemberModel();
|
|
|
$platform = $message_data['platform'];//多个平台配置
|
|
|
$product_name = $message_data['product_name'];//商品名称
|
|
|
$product_specs = $message_data['product_specs'];//商品规格
|
|
|
@@ -103,14 +107,30 @@ class ViolationProductDataJobs implements ShouldQueue
|
|
|
'city_id' => $product_data['city_id'],
|
|
|
'area_info' => $product_data['area_info'],
|
|
|
];
|
|
|
+ //获取公司绑定责任人信息
|
|
|
+ $company_data = $ViolationStoreModel->where('social_credit_code',$product_data['qualification_number'])->first();
|
|
|
+ $employee_id_list=[];
|
|
|
+ if($company_data){
|
|
|
+ $employee_id_list =$ViolationCompanyMemberModel->where('company_logid',$company_data->id)->pluck('employee_id')->toarray();
|
|
|
+ }
|
|
|
//查询配置的第一责任人
|
|
|
- $where_query1[] = ['city_ids', 'like', '%,' . $product_data['city_id'] . ',%'];
|
|
|
+ if(!empty($employee_id_list)){
|
|
|
+ $EmployeeModel = $EmployeeModel->whereIn('id',$employee_id_list);
|
|
|
+ }else{
|
|
|
+ $where_query1[] = ['city_ids', 'like', '%,' . $product_data['city_id'] . ',%'];
|
|
|
+ }
|
|
|
$where_query1[] = ['status', '=', 0];
|
|
|
$where_query1[] = ['duty_type', '=', 1]; //责任类型1=第一责任人,2=责任人
|
|
|
$first_responsible_person = $EmployeeModel->where($where_query1)->pluck('id')->implode(',');
|
|
|
$insert_product_data['first_responsible_person'] = $first_responsible_person;
|
|
|
+
|
|
|
//查询配置的责任人
|
|
|
- $where_query2[] = ['city_ids', 'like', '%,' . $product_data['city_id'] . ',%'];
|
|
|
+ $EmployeeModel = new EmployeeModel();
|
|
|
+ if(!empty($employee_id_list)){
|
|
|
+ $EmployeeModel = $EmployeeModel->whereIn('id',$employee_id_list);
|
|
|
+ }else{
|
|
|
+ $where_query2[] = ['city_ids', 'like', '%,' . $product_data['city_id'] . ',%'];
|
|
|
+ }
|
|
|
$where_query2[] = ['status', '=', 0];
|
|
|
$where_query2[] = ['duty_type', '=', 2]; //责任类型1=第一责任人,2=责任人
|
|
|
$responsible_person = $EmployeeModel->where($where_query2)->pluck('id')->implode(',');
|