|
|
@@ -16,6 +16,7 @@ use App\Models\Manager\Process\ScrapeData as ScrapeDataModel;
|
|
|
use App\Models\Manager\WashConfig\ViolationStore as ViolationStoreModel;
|
|
|
use App\Models\Manager\WashConfig\ViolationCompanyMember as ViolationCompanyMemberModel;
|
|
|
use App\Models\Manager\Citys as CitysModel;
|
|
|
+use App\Models\Manager\Personnel\EmployeePlatform as EmployeePlatformModel;
|
|
|
|
|
|
/**
|
|
|
* 数据清洗-违规挂网商品数据队列
|
|
|
@@ -66,6 +67,7 @@ class ViolationProductDataJobs implements ShouldQueue
|
|
|
$ScrapeDataModel = new ScrapeDataModel();
|
|
|
$ViolationStoreModel = new ViolationStoreModel();
|
|
|
$ViolationCompanyMemberModel = new ViolationCompanyMemberModel();
|
|
|
+ $EmployeePlatformModel = new EmployeePlatformModel();
|
|
|
$platform = $message_data['platform']; //多个平台配置
|
|
|
$product_name = $message_data['product_name']; //商品名称
|
|
|
$product_specs = $message_data['product_specs']; //商品规格
|
|
|
@@ -185,7 +187,17 @@ class ViolationProductDataJobs implements ShouldQueue
|
|
|
}
|
|
|
$where_query1[] = ['status', '=', 0];
|
|
|
$where_query1[] = ['duty_type', '=', 1]; //责任类型1=第一责任人,2=责任人
|
|
|
- $first_responsible_person = $EmployeeModel->where($where_query1)->pluck('id')->implode(',');
|
|
|
+ //查询平台配置的员工
|
|
|
+ $employee_id_platform = $EmployeePlatformModel->where('platform_id', $product_data['platform_id'])->pluck('employee_id')->toarray();
|
|
|
+ if(!empty($employee_id_platform)) {
|
|
|
+ //如果存在平台配置责任人,则查询地区相关的责任人或者平台配置的责任人
|
|
|
+ $where_query1_other[] = ['id', 'in', $employee_id_platform];
|
|
|
+ $where_query1_other[] = ['status', '=', 0];
|
|
|
+ $where_query1_other[] = ['duty_type', '=', 1]; //责任类型1=第一责任人,2=责任人
|
|
|
+ $first_responsible_person = $EmployeeModel->where($where_query1)->orWhere($where_query1_other)->pluck('id')->implode(',');
|
|
|
+ } else {
|
|
|
+ $first_responsible_person = $EmployeeModel->where($where_query1)->pluck('id')->implode(',');
|
|
|
+ }
|
|
|
$insert_product_data['first_responsible_person'] = $first_responsible_person;
|
|
|
|
|
|
//查询配置的责任人
|
|
|
@@ -199,7 +211,15 @@ class ViolationProductDataJobs implements ShouldQueue
|
|
|
}
|
|
|
$where_query2[] = ['status', '=', 0];
|
|
|
$where_query2[] = ['duty_type', '=', 2]; //责任类型1=第一责任人,2=责任人
|
|
|
- $responsible_person = $EmployeeModel->where($where_query2)->pluck('id')->implode(',');
|
|
|
+ if (!empty($employee_id_platform)) {
|
|
|
+ $where_query2_other[] = ['id', 'in', $employee_id_platform];
|
|
|
+ $where_query2_other[] = ['status', '=', 0];
|
|
|
+ $where_query2_other[] = ['duty_type', '=', 2]; //责任类型1=第一责任人,2=责任人
|
|
|
+ $responsible_person = $EmployeeModel->where($where_query2)->orWhere($where_query2_other)->pluck('id')->implode(',');
|
|
|
+ }else{
|
|
|
+ $responsible_person = $EmployeeModel->where($where_query2)->pluck('id')->implode(',');
|
|
|
+ }
|
|
|
+
|
|
|
$insert_product_data['responsible_person'] = $responsible_person;
|
|
|
//溯源责任人
|
|
|
$source_responsible_person = '';
|