|
|
@@ -169,6 +169,10 @@ class ViolationProductDataJobs implements ShouldQueue
|
|
|
'responsible_person' => '',
|
|
|
'source_responsible_person' => '',
|
|
|
'scrape_date' => $product_data['scrape_date'],
|
|
|
+ 'shipment_province_id' => $product_data['shipment_province_id'],
|
|
|
+ 'shipment_province_name' => $product_data['shipment_province_name'],
|
|
|
+ 'shipment_city_id' => $product_data['shipment_city_id'],
|
|
|
+ 'shipment_city_name' => $product_data['shipment_city_name'],
|
|
|
];
|
|
|
//获取公司绑定责任人信息
|
|
|
$company_data = $ViolationStoreModel->leftjoin('washconfig_company_category', 'washconfig_company_category.id', '=', 'washconfig_violation_store.category_id')
|
|
|
@@ -232,6 +236,19 @@ class ViolationProductDataJobs implements ShouldQueue
|
|
|
}
|
|
|
});
|
|
|
$first_responsible_person = $EmployeeModel->pluck('id')->implode(',');
|
|
|
+
|
|
|
+ //当以上规则匹配不到责任人时,则去查询发货地区信息关联责任人
|
|
|
+ if (trim($first_responsible_person) == '' && trim($product_data['shipment_city_id']) !='') {
|
|
|
+ $employee_id_area = $EmployeeAreaModel->where('city_id', $product_data['city_id'])->pluck('employee_id')->toarray();
|
|
|
+ if (!empty($employee_id_area)) {
|
|
|
+ $where_city[] = ['company_id', '=', $company_id];
|
|
|
+ $where_city[] = ['id', 'in', $employee_id_area];
|
|
|
+ $where_city[] = ['status', '=', 0];
|
|
|
+ $where_city[] = ['duty_type', '=', 1]; //责任类型1=第一责任人,2=责任人
|
|
|
+ $EmployeeModel = new EmployeeModel();
|
|
|
+ $first_responsible_person = $EmployeeModel->where($where_city)->pluck('id')->implode(',');
|
|
|
+ }
|
|
|
+ }
|
|
|
//调试记录查询条件
|
|
|
$insert_product_data['first_responsible_person'] = $first_responsible_person;
|
|
|
//查询责任人
|
|
|
@@ -286,6 +303,19 @@ class ViolationProductDataJobs implements ShouldQueue
|
|
|
}
|
|
|
});
|
|
|
$responsible_person = $EmployeeModel->pluck('id')->implode(',');
|
|
|
+
|
|
|
+ //当以上规则匹配不到责任人时,则去查询发货地区信息关联责任人
|
|
|
+ if (trim($responsible_person) == '' && trim($product_data['shipment_city_id']) !='') {
|
|
|
+ $employee_id_area = $EmployeeAreaModel->where('city_id', $product_data['city_id'])->pluck('employee_id')->toarray();
|
|
|
+ if (!empty($employee_id_area)) {
|
|
|
+ $where_city[] = ['company_id', '=', $company_id];
|
|
|
+ $where_city[] = ['id', 'in', $employee_id_area];
|
|
|
+ $where_city[] = ['status', '=', 0];
|
|
|
+ $where_city[] = ['duty_type', '=', 2]; //责任类型1=第一责任人,2=责任人
|
|
|
+ $EmployeeModel = new EmployeeModel();
|
|
|
+ $responsible_person = $EmployeeModel->where($where_city)->pluck('id')->implode(',');
|
|
|
+ }
|
|
|
+ }
|
|
|
$insert_product_data['responsible_person'] = $responsible_person;
|
|
|
|
|
|
//溯源责任人
|