Browse Source

fix:export6

Xu·LinPeng 15 giờ trước cách đây
mục cha
commit
4bb0637c03
1 tập tin đã thay đổi với 21 bổ sung20 xóa
  1. 21 20
      Modules/Camera/Http/Controllers/Api/CameraApiController.php

+ 21 - 20
Modules/Camera/Http/Controllers/Api/CameraApiController.php

@@ -4351,11 +4351,11 @@ class CameraApiController extends BaseController
         // 洗煤厂数据
         $coal_washery_list = DB::connection('mysql_fwe10')->table('uf_xx_coal_washery as t')->where('t.is_delete',0);
         if (!empty($coal_washery_id)) $coal_washery_list->where('t.id', $coal_washery_id); // 筛选洗煤厂
-        // 筛选片区
-        if (!empty($area_id)) {
-            $coal_washery_list->leftJoin('uf_xx_area as t1','t1.id','=','t.area_id')
-                ->where('t1.id', $area_id);
-        }
+        // 不要按片区筛选洗煤厂,因为有可能宁东片区的洗煤厂的施工地点在太西洗煤厂,反之亦然
+//        if (!empty($area_id)) {
+//            $coal_washery_list->leftJoin('uf_xx_area as t1','t1.id','=','t.area_id')
+//                ->where('t1.id', $area_id);
+//        }
 
         $coal_washery_list = $coal_washery_list->select('t.*')->orderBy('t.sort')->get();
 
@@ -4418,13 +4418,6 @@ class CameraApiController extends BaseController
                 $res['di']++;
             }
 
-            // 洗煤厂类型统计(委外、自营)
-//            $coal_washery_type = $coal_washery_dict[$coal_washery_id]->obj_type ?? "<请检查洗煤厂是否已被删除!>";
-//            if($coal_washery_type == 0) {
-//                $res['ziying']++;
-//            } else if ($coal_washery_type == 1) {
-//                $res['waiwei']++;
-//            }
             // 煤矿风险列表
             $coal_washery_risk_list[$coal_washery_id][] = $value;
         }
@@ -4471,6 +4464,9 @@ class CameraApiController extends BaseController
                 $wwdw = [];
                 $sgdd = [];
 
+                $gao = 0;
+                $zhong = 0;
+                $di = 0;
 
                 foreach ($coal_washery_risk_info_arr as $k => $v) {
                     if(!in_array($v->wwdw,$wwdw)){
@@ -4480,7 +4476,19 @@ class CameraApiController extends BaseController
                     if (!in_array($temp,$sgdd)){
                         $sgdd[] = $temp;
                     }
+                    if ($v->risk_level == 0){
+                        $gao++;
+                    } else if ($v->risk_level == 1){
+                        $zhong++;
+                    }else{
+                        $di++;
+                    }
+
                 }
+                $level_total = '';
+                if ($gao   > 0) $level_total .= '高风险'.$line['gao']."项\n";
+                if ($zhong > 0) $level_total .= '中风险'.$line['zhong']."项\n";
+                if ($di    > 0) $level_total .= '低风险'.$line['di'].'项';
 
                 $wwdw_num = count($wwdw);
                 $sgdd_num = count($sgdd);
@@ -4517,8 +4525,7 @@ class CameraApiController extends BaseController
                     $line['work_place_num'] = $v->sgdsl;
                     $line['wwdw'] = $v->wwdw;
                     $line['place'] = $temp;
-
-
+                    $line['level'] = $level_total;
 
                     $risk_info = '';
                     if ($v->risk_level == 0) {
@@ -4541,12 +4548,6 @@ class CameraApiController extends BaseController
 
                     $line['content'] = ++$risk_index.".".$v->risk_name.$risk_info."盯控人:".$v->work_people;
 
-                    $level_total = '';
-                    if ($line['gao']   > 0) $level_total .= '高风险'.$line['gao']."项\n";
-                    if ($line['zhong'] > 0) $level_total .= '中风险'.$line['zhong']."项\n";
-                    if ($line['di']    > 0) $level_total .= '低风险'.$line['di'].'项';
-                    $line['level'] = $level_total;
-
                     $res['risk_list'][] = $line;