Bladeren bron

[智价云] 合并省份城市查询

tangyuanwang 2 dagen geleden
bovenliggende
commit
5ae93a519a

+ 26 - 3
app/Http/Controllers/Manager/Process/LowPriceGoods.php

@@ -76,6 +76,8 @@ class LowPriceGoods extends Controller
         $online_posting_min_price = request('online_posting_min_price', '');
         $online_posting_max_price = request('online_posting_max_price', '');
         $is_ultra_low_price = request('is_ultra_low_price', '');
+        $merge_city_ids = request('merge_city_ids', '');
+        $merge_province_ids = request('merge_province_ids', '');
         // 时间条件
         if ($collection_time_start_time) $map[] = ['collection_time', '>=', strtotime($collection_time_start_time)];
         if ($collection_time_end_time) $map[] = ['collection_time', '<=', strtotime($collection_time_end_time)];
@@ -95,7 +97,6 @@ class LowPriceGoods extends Controller
         if ($online_posting_max_price) $map[] = ['online_posting_price', '<=', $online_posting_max_price];
         if ($is_ultra_low_price) $map[] = ['is_ultra_low_price', '=', $is_ultra_low_price];
 
-
         $low_price_goods_where = [];
         // 权限判断
         if ($is_admin != 1 && $company_id != 0) {
@@ -188,6 +189,16 @@ class LowPriceGoods extends Controller
             $shipment_city_ids = explode(',', $shipment_city_ids);
             $LowPriceGoodsModel = $LowPriceGoodsModel->whereIn('shipment_city_id', $shipment_city_ids);
         }
+        //多合并省份
+        if ($merge_province_ids && is_string($merge_province_ids)) {
+            $merge_province_ids = explode(',', $merge_province_ids);
+            $LowPriceGoodsModel = $LowPriceGoodsModel->whereIn('merge_province_id', $merge_province_ids);
+        }
+        //多合并市
+        if ($merge_city_ids && is_string($merge_city_ids)) {
+            $merge_city_ids = explode(',', $merge_city_ids);
+            $LowPriceGoodsModel = $LowPriceGoodsModel->whereIn('merge_city_id', $merge_city_ids);
+        }
         $personnel_roles_info = $EmployeeModel->leftjoin('personnel_roles', 'personnel_roles.id', '=', 'personnel_employee.role_id')
             ->where('personnel_employee.id', $user_id)->select(['personnel_employee.id', 'personnel_roles.identity'])
             ->first();
@@ -279,6 +290,8 @@ class LowPriceGoods extends Controller
         $message_data['online_posting_min_price'] = request('online_posting_min_price', '');
         $message_data['online_posting_max_price'] = request('online_posting_max_price', '');
         $message_data['is_ultra_low_price'] = request('is_ultra_low_price','');
+        $message_data['merge_city_ids'] = request('merge_city_ids', '');
+        $message_data['merge_province_ids'] = request('merge_province_ids', 1);
 
         $low_price_goods_where = [];
         // 权限判断
@@ -316,9 +329,10 @@ class LowPriceGoods extends Controller
         $is_ultra_low_price = $message_data['is_ultra_low_price'] ?? '';
         $online_posting_min_price = $message_data['online_posting_min_price'] ?? '';
         $online_posting_max_price = $message_data['online_posting_max_price'] ?? '';
-
         $collection_time_start_time = $message_data['collection_time_start_time'] ?? '';
         $collection_time_end_time = $message_data['collection_time_end_time'] ?? '';
+        $merge_city_ids = $message_data['merge_city_ids'] ?? '';
+        $merge_province_ids = $message_data['merge_province_ids'] ?? '';
         // 时间条件
         if ($collection_time_start_time) $map[] = ['collection_time', '>=', strtotime($collection_time_start_time)];
         if ($collection_time_end_time) $map[] = ['collection_time', '<=', strtotime($collection_time_end_time)];
@@ -334,7 +348,6 @@ class LowPriceGoods extends Controller
         if ($online_posting_max_price) $map[] = ['online_posting_price', '<=', $online_posting_max_price];
         if ($is_ultra_low_price) $map[] = ['is_ultra_low_price', '=', $is_ultra_low_price];
 
-
         $admin_company_id = $message_data['admin_company_id'];
         $company_id = $message_data['company_id'];
         $is_admin = $message_data['is_admin']; //是否管理员操作 0=是1=否
@@ -432,6 +445,16 @@ class LowPriceGoods extends Controller
             $shipment_city_ids = explode(',', $shipment_city_ids);
             $LowPriceGoodsModel = $LowPriceGoodsModel->whereIn('shipment_city_id', $shipment_city_ids);
         }
+        //多合并省份
+        if ($merge_province_ids && is_string($merge_province_ids)) {
+            $merge_province_ids = explode(',', $merge_province_ids);
+            $LowPriceGoodsModel = $LowPriceGoodsModel->whereIn('merge_province_id', $merge_province_ids);
+        }
+        //多合并市
+        if ($merge_city_ids && is_string($merge_city_ids)) {
+            $merge_city_ids = explode(',', $merge_city_ids);
+            $LowPriceGoodsModel = $LowPriceGoodsModel->whereIn('merge_city_id', $merge_city_ids);
+        }
         $personnel_roles_info = $EmployeeModel->leftjoin('personnel_roles', 'personnel_roles.id', '=', 'personnel_employee.role_id')
             ->where('personnel_employee.id', $user_id)->select(['personnel_employee.id', 'personnel_roles.identity'])
             ->first();

+ 26 - 0
app/Http/Controllers/Manager/Process/ViolationProduct.php

@@ -73,6 +73,8 @@ class ViolationProduct extends Controller
         $product_brand = request('product_brand', '');
         $collection_time_start_time = request('collection_time_start_time', '');
         $collection_time_end_time = request('collection_time_end_time', '');
+        $merge_province_ids = request('merge_province_ids', '');
+        $merge_city_ids = request('merge_city_ids', '');
         // 时间条件
         if ($collection_time_start_time) $map[] = ['collection_time', '>=', strtotime($collection_time_start_time)];
         if ($collection_time_end_time) $map[] = ['collection_time', '<=', strtotime($collection_time_end_time)];
@@ -182,6 +184,16 @@ class ViolationProduct extends Controller
             $shipment_city_ids = explode(',', $shipment_city_ids);
             $ViolationProductModel = $ViolationProductModel->whereIn('shipment_city_id', $shipment_city_ids);
         }
+        //多合并省份
+        if ($merge_province_ids && is_string($merge_province_ids)) {
+            $merge_province_ids = explode(',', $merge_province_ids);
+            $ViolationProductModel = $ViolationProductModel->whereIn('merge_province_id', $merge_province_ids);
+        }
+        //多合并市
+        if ($merge_city_ids && is_string($merge_city_ids)) {
+            $merge_city_ids = explode(',', $merge_city_ids);
+            $ViolationProductModel = $ViolationProductModel->whereIn('merge_city_id', $merge_city_ids);
+        }
         $personnel_roles_info = $EmployeeModel->leftjoin('personnel_roles', 'personnel_roles.id', '=', 'personnel_employee.role_id')
             ->where('personnel_employee.id', $user_id)->select(['personnel_employee.id', 'personnel_roles.identity'])
             ->first();
@@ -270,6 +282,8 @@ class ViolationProduct extends Controller
         $message_data['product_brand'] = request('product_brand', '');
         $message_data['collection_time_start_time'] = request('collection_time_start_time', '');
         $message_data['collection_time_end_time'] = request('collection_time_end_time', '');
+        $message_data['merge_province_ids'] = request('merge_province_ids', '');
+        $message_data['merge_city_ids'] = request('merge_city_ids', '');
 
         $violation_product_where = [];
         // 权限判断
@@ -309,6 +323,8 @@ class ViolationProduct extends Controller
         $product_brand = $message_data['product_brand'];
         $collection_time_start_time = $message_data['collection_time_start_time'];
         $collection_time_end_time = $message_data['collection_time_end_time'];
+        $merge_province_ids = $message_data['merge_province_ids'];
+        $merge_city_ids = $message_data['merge_city_ids'];
         // 时间条件
         if ($collection_time_start_time) $map[] = ['collection_time', '>=', strtotime($collection_time_start_time)];
         if ($collection_time_end_time) $map[] = ['collection_time', '<=', strtotime($collection_time_end_time)];
@@ -413,6 +429,16 @@ class ViolationProduct extends Controller
             $shipment_city_ids = explode(',', $shipment_city_ids);
             $ViolationProductModel = $ViolationProductModel->whereIn('shipment_city_id', $shipment_city_ids);
         }
+        //多合并省份
+        if ($merge_province_ids && is_string($merge_province_ids)) {
+            $merge_province_ids = explode(',', $merge_province_ids);
+            $ViolationProductModel = $ViolationProductModel->whereIn('merge_province_id', $merge_province_ids);
+        }
+        //多合并市
+        if ($merge_city_ids && is_string($merge_city_ids)) {
+            $merge_city_ids = explode(',', $merge_city_ids);
+            $ViolationProductModel = $ViolationProductModel->whereIn('merge_city_id', $merge_city_ids);
+        }
         $personnel_roles_info = $EmployeeModel->leftjoin('personnel_roles', 'personnel_roles.id', '=', 'personnel_employee.role_id')
             ->where('personnel_employee.id', $user_id)->select(['personnel_employee.id', 'personnel_roles.identity'])
             ->first();

+ 12 - 0
app/Jobs/Manager/Other/ExportLowPriceGoodsJobs.php

@@ -120,6 +120,8 @@ class ExportLowPriceGoodsJobs implements ShouldQueue
         $online_posting_min_price = $message_data['online_posting_min_price'] ?? '';
         $online_posting_max_price = $message_data['online_posting_max_price'] ?? '';
         $is_ultra_low_price = $message_data['is_ultra_low_price'] ?? '';
+        $merge_city_ids = $message_data['merge_city_ids'] ?? '';
+        $merge_province_ids = $message_data['merge_province_ids'] ?? '';
 
         // 时间条件
         if ($collection_time_start_time) $map[] = ['collection_time', '>=', strtotime($collection_time_start_time)];
@@ -228,6 +230,16 @@ class ExportLowPriceGoodsJobs implements ShouldQueue
             $shipment_city_ids = explode(',', $shipment_city_ids);
             $LowPriceGoodsModel = $LowPriceGoodsModel->whereIn('shipment_city_id', $shipment_city_ids);
         }
+        //多合并省份
+        if ($merge_province_ids && is_string($merge_province_ids)) {
+            $merge_province_ids = explode(',', $merge_province_ids);
+            $LowPriceGoodsModel = $LowPriceGoodsModel->whereIn('merge_province_id', $merge_province_ids);
+        }
+        //多合并市
+        if ($merge_city_ids && is_string($merge_city_ids)) {
+            $merge_city_ids = explode(',', $merge_city_ids);
+            $LowPriceGoodsModel = $LowPriceGoodsModel->whereIn('merge_city_id', $merge_city_ids);
+        }
         $key_name = 'ExportLowPriceGoodsJobs_' . $low_price_goods_where['company_id'];
         //创建缓存
         Cache::put($key_name, [], 60 * 60 * 24);

+ 12 - 0
app/Jobs/Manager/Other/ExportViolationProductJobs.php

@@ -114,6 +114,8 @@ class ExportViolationProductJobs implements ShouldQueue
         $product_brand = $message_data['product_brand'];
         $collection_time_start_time = $message_data['collection_time_start_time'] ?? '';
         $collection_time_end_time = $message_data['collection_time_end_time'] ?? '';
+        $merge_province_ids = $message_data['merge_province_ids'] ?? '';
+        $merge_city_ids = $message_data['merge_city_ids'] ?? '';
         // 时间条件
         if ($collection_time_start_time) $map[] = ['collection_time', '>=', strtotime($collection_time_start_time)];
         if ($collection_time_end_time) $map[] = ['collection_time', '<=', strtotime($collection_time_end_time)];
@@ -218,6 +220,16 @@ class ExportViolationProductJobs implements ShouldQueue
             $shipment_city_ids = explode(',', $shipment_city_ids);
             $ViolationProductModel = $ViolationProductModel->whereIn('shipment_city_id', $shipment_city_ids);
         }
+        //多合并省份
+        if ($merge_province_ids && is_string($merge_province_ids)) {
+            $merge_province_ids = explode(',', $merge_province_ids);
+            $ViolationProductModel = $ViolationProductModel->whereIn('merge_province_id', $merge_province_ids);
+        }
+        //多合并市
+        if ($merge_city_ids && is_string($merge_city_ids)) {
+            $merge_city_ids = explode(',', $merge_city_ids);
+            $ViolationProductModel = $ViolationProductModel->whereIn('merge_city_id', $merge_city_ids);
+        }
         $this->company_id = $violation_product_where['company_id'];
         $key_name = 'ExportViolationProductJobs_' . $violation_product_where['company_id'];
         //创建缓存