소스 검색

化工人员定位接口

任敬轩 5 달 전
부모
커밋
1e45adfa39
1개의 변경된 파일339개의 추가작업 그리고 1개의 파일을 삭제
  1. 339 1
      app/Http/Controllers/TestsController.php

+ 339 - 1
app/Http/Controllers/TestsController.php

@@ -55,10 +55,16 @@ class TestsController {
         // $this->camera_all_list();
 
         //检查摄像头质量
-        $this->checkCameraQuality();
+//        $this->checkCameraQuality();
 
         //化工人员定位煤制油部门信息录入
 //        $this->mzyBmxxInsert();
+
+        //化工人员定位煤制油区域信息录入
+//        $this->mzyQyxxInsert();
+
+        //化工人员定位精蜡区域信息录入
+//        $this->jlQyxxInsert();
     }
 
     //区域列表接口测试
@@ -398,6 +404,338 @@ class TestsController {
 
         dd('success');
     }
+
+    //化工人员定位煤制油区域信息录入
+    public function mzyQyxxInsert(){
+        //获取token
+        $url = 'http://10.186.64.30:8091/chem/api/getToken?username=super&password=meizhiyou';
+
+        $result = $this->httpRequest($url,'post');
+
+        if($result['data']){
+            //获取部门列表
+            $url = 'http://10.186.64.30:8091/chem/api/getAreaInfo?token='.$result['data'];
+
+            $result2 = $this->httpRequest($url);
+            // dd($result2);
+            if($result2['data'] && count($result2['data']) > 0){
+                //uf_mzy_total
+                $total['total'] = $result2['data']['total'];
+                $total['staffNumb'] = $result2['data']['staffNumb'];
+                $total['callerNumb'] = $result2['data']['callerNumb'];
+                $total['carNumb'] = $result2['data']['carNumb'];
+                $total['contractorNumb'] = $result2['data']['contractorNumb'];
+                $total['toolcarNumb'] = $result2['data']['toolcarNumb'];
+                DB::connection('mysql_fwe10')->table('uf_mzy_total')->insert($total);
+
+                $counts_list = $result2['data']['counts'];
+                if(count($counts_list) > 0){
+                    for($i=0;$i<count($counts_list);$i++){
+                        //uf_mzy_parent_counts
+                        $pcounts['organName'] = $counts_list[$i]['organName'];
+                        $pcounts['staffNumb'] = $counts_list[$i]['staffNumb'];
+                        $pcounts['contractorNumb'] = $counts_list[$i]['contractorNumb'];
+                        $pcounts['callerNumb'] = $counts_list[$i]['callerNumb'];
+                        $pcounts['carNumb'] = $counts_list[$i]['carNumb'];
+                        $id = DB::connection('mysql_fwe10')->table('uf_mzy_parent_counts')->insertGetId($pcounts);
+                        if(count($counts_list[$i]['counts']) > 0){
+                            for($j=0;$j<count($counts_list[$i]['counts']);$j++){
+                                //uf_mzy_counts
+                                $counts['parent_id'] = $id;
+                                $counts['fid'] = $counts_list[$i]['counts'][$j]['fid'];
+                                $counts['areaName'] = $counts_list[$i]['counts'][$j]['areaName'];
+                                $counts['staffNumb'] = $counts_list[$i]['counts'][$j]['staffNumb'];
+                                $counts['contractorNumb'] = $counts_list[$i]['counts'][$j]['contractorNumb'];
+                                $counts['callerNumb'] = $counts_list[$i]['counts'][$j]['callerNumb'];
+                                $counts['carNumb'] = $counts_list[$i]['counts'][$j]['carNumb'];
+                                $counts['isSafe'] = $counts_list[$i]['counts'][$j]['isSafe'];
+                                DB::connection('mysql_fwe10')->table('uf_mzy_counts')->insert($counts);
+                                $persons = $counts_list[$i]['counts'][$j]['persons'];
+                                $personContractor = $counts_list[$i]['counts'][$j]['personContractor'];
+                                $personCaller = $counts_list[$i]['counts'][$j]['personCaller'];
+                                $car = $counts_list[$i]['counts'][$j]['car'];
+                                if(count($persons) > 0){
+                                    for($x=0;$x<count($persons);$x++){
+                                        //uf_mzy_type
+                                        $type['deviceId'] = $persons[$x]['deviceId'];
+                                        $type['timestamp'] = $persons[$x]['timestamp'];
+                                        $type['lon'] = $persons[$x]['lon'];
+                                        $type['lat'] = $persons[$x]['lat'];
+                                        $type['fid'] = $persons[$x]['fid'];
+                                        $type['name'] = $persons[$x]['name'];
+                                        $type['weekSel'] = $persons[$x]['weekSel'];
+                                        $type['stime1'] = $persons[$x]['stime1'];
+                                        $type['etime1'] = $persons[$x]['etime1'];
+                                        $type['stime2'] = $persons[$x]['stime2'];
+                                        $type['etime2'] = $persons[$x]['etime2'];
+                                        $type['stime3'] = $persons[$x]['stime3'];
+                                        $type['etime3'] = $persons[$x]['etime3'];
+                                        $type['organId'] = $persons[$x]['organId'];
+                                        $type['work'] = $persons[$x]['work'];
+                                        $type['minMaxCount'] = $persons[$x]['minMaxCount'];
+                                        $type['personOrganId'] = $persons[$x]['personOrganId'];
+                                        $type['inRegion'] = $persons[$x]['inRegion'];
+                                        $type['mode'] = $persons[$x]['mode'];
+                                        $type['type'] = 'persons';
+                                        DB::connection('mysql_fwe10')->table('uf_mzy_type')->insert($type);
+                                    }
+                                }
+                                if(count($personContractor) > 0){
+                                    for($x=0;$x<count($personContractor);$x++){
+                                        //uf_mzy_type
+                                        $type['deviceId'] = $personContractor[$x]['deviceId'];
+                                        $type['timestamp'] = $personContractor[$x]['timestamp'];
+                                        $type['lon'] = $personContractor[$x]['lon'];
+                                        $type['lat'] = $personContractor[$x]['lat'];
+                                        $type['fid'] = $personContractor[$x]['fid'];
+                                        $type['name'] = $personContractor[$x]['name'];
+                                        $type['weekSel'] = $personContractor[$x]['weekSel'];
+                                        $type['stime1'] = $personContractor[$x]['stime1'];
+                                        $type['etime1'] = $personContractor[$x]['etime1'];
+                                        $type['stime2'] = $personContractor[$x]['stime2'];
+                                        $type['etime2'] = $personContractor[$x]['etime2'];
+                                        $type['stime3'] = $personContractor[$x]['stime3'];
+                                        $type['etime3'] = $personContractor[$x]['etime3'];
+                                        $type['organId'] = $personContractor[$x]['organId'];
+                                        $type['work'] = $personContractor[$x]['work'];
+                                        $type['minMaxCount'] = $personContractor[$x]['minMaxCount'];
+                                        $type['personOrganId'] = $personContractor[$x]['personOrganId'];
+                                        $type['inRegion'] = $personContractor[$x]['inRegion'];
+                                        $type['mode'] = $personContractor[$x]['mode'];
+                                        $type['type'] = 'personContractor';
+                                        DB::connection('mysql_fwe10')->table('uf_mzy_type')->insert($type);
+                                    }
+                                }
+                                if(count($personCaller) > 0){
+                                    for($x=0;$x<count($personCaller);$x++){
+                                        //uf_mzy_type
+                                        $type['deviceId'] = $personCaller[$x]['deviceId'];
+                                        $type['timestamp'] = $personCaller[$x]['timestamp'];
+                                        $type['lon'] = $personCaller[$x]['lon'];
+                                        $type['lat'] = $personCaller[$x]['lat'];
+                                        $type['fid'] = $personCaller[$x]['fid'];
+                                        $type['name'] = $personCaller[$x]['name'];
+                                        $type['weekSel'] = $personCaller[$x]['weekSel'];
+                                        $type['stime1'] = $personCaller[$x]['stime1'];
+                                        $type['etime1'] = $personCaller[$x]['etime1'];
+                                        $type['stime2'] = $personCaller[$x]['stime2'];
+                                        $type['etime2'] = $personCaller[$x]['etime2'];
+                                        $type['stime3'] = $personCaller[$x]['stime3'];
+                                        $type['etime3'] = $personCaller[$x]['etime3'];
+                                        $type['organId'] = $personCaller[$x]['organId'];
+                                        $type['work'] = $personCaller[$x]['work'];
+                                        $type['minMaxCount'] = $personCaller[$x]['minMaxCount'];
+                                        $type['personOrganId'] = $personCaller[$x]['personOrganId'];
+                                        $type['inRegion'] = $personCaller[$x]['inRegion'];
+                                        $type['mode'] = $personCaller[$x]['mode'];
+                                        $type['type'] = 'personCaller';
+                                        DB::connection('mysql_fwe10')->table('uf_mzy_type')->insert($type);
+                                    }
+                                }
+                                if(count($car) > 0){
+                                    for($x=0;$x<count($car);$x++){
+                                        //uf_mzy_type
+                                        $type['deviceId'] = $car[$x]['deviceId'];
+                                        $type['timestamp'] = $car[$x]['timestamp'];
+                                        $type['lon'] = $car[$x]['lon'];
+                                        $type['lat'] = $car[$x]['lat'];
+                                        $type['fid'] = $car[$x]['fid'];
+                                        $type['name'] = $car[$x]['name'];
+                                        $type['weekSel'] = $car[$x]['weekSel'];
+                                        $type['stime1'] = $car[$x]['stime1'];
+                                        $type['etime1'] = $car[$x]['etime1'];
+                                        $type['stime2'] = $car[$x]['stime2'];
+                                        $type['etime2'] = $car[$x]['etime2'];
+                                        $type['stime3'] = $car[$x]['stime3'];
+                                        $type['etime3'] = $car[$x]['etime3'];
+                                        $type['organId'] = $car[$x]['organId'];
+                                        $type['work'] = $car[$x]['work'];
+                                        $type['minMaxCount'] = $car[$x]['minMaxCount'];
+                                        $type['personOrganId'] = $car[$x]['personOrganId'];
+                                        $type['inRegion'] = $car[$x]['inRegion'];
+                                        $type['mode'] = $car[$x]['mode'];
+                                        $type['type'] = 'persons';
+                                        DB::connection('mysql_fwe10')->table('uf_mzy_type')->insert($type);
+                                    }
+                                }
+                            }
+                        }
+                        // dd($id);
+                    }
+                }
+
+                // dd(123);
+            }
+        }
+
+        dd('success');
+    }
+
+    //化工人员定位精蜡区域信息录入
+    public function jlQyxxInsert(){
+        //获取token
+        $url = 'http://10.186.64.31:8091/chem/api/getToken?username=test&password=123456';
+
+        $result = $this->httpRequest($url,'post');
+
+        if($result['data']){
+            //获取部门列表
+            $url = 'http://10.186.64.31:8091/chem/api/getAreaInfo?token='.$result['data'];
+
+            $result2 = $this->httpRequest($url);
+            // dd($result2);
+            if($result2['data'] && count($result2['data']) > 0){
+                //uf_mzy_total
+                $total['total'] = $result2['data']['total'];
+                $total['staffNumb'] = $result2['data']['staffNumb'];
+                $total['callerNumb'] = $result2['data']['callerNumb'];
+                $total['carNumb'] = $result2['data']['carNumb'];
+                $total['contractorNumb'] = $result2['data']['contractorNumb'];
+                $total['toolcarNumb'] = $result2['data']['toolcarNumb'];
+                DB::connection('mysql_fwe10')->table('uf_jl_total')->insert($total);
+
+                $counts_list = $result2['data']['counts'];
+                if(count($counts_list) > 0){
+                    for($i=0;$i<count($counts_list);$i++){
+                        //uf_mzy_parent_counts
+                        $pcounts['organName'] = $counts_list[$i]['organName'];
+                        $pcounts['staffNumb'] = $counts_list[$i]['staffNumb'];
+                        $pcounts['contractorNumb'] = $counts_list[$i]['contractorNumb'];
+                        $pcounts['callerNumb'] = $counts_list[$i]['callerNumb'];
+                        $pcounts['carNumb'] = $counts_list[$i]['carNumb'];
+                        $id = DB::connection('mysql_fwe10')->table('uf_jl_parent_counts')->insertGetId($pcounts);
+                        if(count($counts_list[$i]['counts']) > 0){
+                            for($j=0;$j<count($counts_list[$i]['counts']);$j++){
+                                //uf_mzy_counts
+                                $counts['parent_id'] = $id;
+                                $counts['fid'] = $counts_list[$i]['counts'][$j]['fid'];
+                                $counts['areaName'] = $counts_list[$i]['counts'][$j]['areaName'];
+                                $counts['staffNumb'] = $counts_list[$i]['counts'][$j]['staffNumb'];
+                                $counts['contractorNumb'] = $counts_list[$i]['counts'][$j]['contractorNumb'];
+                                $counts['callerNumb'] = $counts_list[$i]['counts'][$j]['callerNumb'];
+                                $counts['carNumb'] = $counts_list[$i]['counts'][$j]['carNumb'];
+                                $counts['isSafe'] = $counts_list[$i]['counts'][$j]['isSafe'];
+                                DB::connection('mysql_fwe10')->table('uf_jl_counts')->insert($counts);
+                                $persons = $counts_list[$i]['counts'][$j]['persons'];
+                                $personContractor = $counts_list[$i]['counts'][$j]['personContractor'];
+                                $personCaller = $counts_list[$i]['counts'][$j]['personCaller'];
+                                $car = $counts_list[$i]['counts'][$j]['car'];
+                                if(count($persons) > 0){
+                                    for($x=0;$x<count($persons);$x++){
+                                        //uf_mzy_type
+                                        $type['deviceId'] = $persons[$x]['deviceId'];
+                                        $type['timestamp'] = $persons[$x]['timestamp'];
+                                        $type['lon'] = $persons[$x]['lon'];
+                                        $type['lat'] = $persons[$x]['lat'];
+                                        $type['fid'] = $persons[$x]['fid'];
+                                        $type['name'] = $persons[$x]['name'];
+                                        $type['weekSel'] = $persons[$x]['weekSel'];
+                                        $type['stime1'] = $persons[$x]['stime1'];
+                                        $type['etime1'] = $persons[$x]['etime1'];
+                                        $type['stime2'] = $persons[$x]['stime2'];
+                                        $type['etime2'] = $persons[$x]['etime2'];
+                                        $type['stime3'] = $persons[$x]['stime3'];
+                                        $type['etime3'] = $persons[$x]['etime3'];
+                                        $type['organId'] = $persons[$x]['organId'];
+                                        $type['work'] = $persons[$x]['work'];
+                                        $type['minMaxCount'] = $persons[$x]['minMaxCount'];
+                                        $type['personOrganId'] = $persons[$x]['personOrganId'];
+                                        $type['inRegion'] = $persons[$x]['inRegion'];
+                                        $type['mode'] = $persons[$x]['mode'];
+                                        $type['type'] = 'persons';
+                                        DB::connection('mysql_fwe10')->table('uf_jl_type')->insert($type);
+                                    }
+                                }
+                                if(count($personContractor) > 0){
+                                    for($x=0;$x<count($personContractor);$x++){
+                                        //uf_mzy_type
+                                        $type['deviceId'] = $personContractor[$x]['deviceId'];
+                                        $type['timestamp'] = $personContractor[$x]['timestamp'];
+                                        $type['lon'] = $personContractor[$x]['lon'];
+                                        $type['lat'] = $personContractor[$x]['lat'];
+                                        $type['fid'] = $personContractor[$x]['fid'];
+                                        $type['name'] = $personContractor[$x]['name'];
+                                        $type['weekSel'] = $personContractor[$x]['weekSel'];
+                                        $type['stime1'] = $personContractor[$x]['stime1'];
+                                        $type['etime1'] = $personContractor[$x]['etime1'];
+                                        $type['stime2'] = $personContractor[$x]['stime2'];
+                                        $type['etime2'] = $personContractor[$x]['etime2'];
+                                        $type['stime3'] = $personContractor[$x]['stime3'];
+                                        $type['etime3'] = $personContractor[$x]['etime3'];
+                                        $type['organId'] = $personContractor[$x]['organId'];
+                                        $type['work'] = $personContractor[$x]['work'];
+                                        $type['minMaxCount'] = $personContractor[$x]['minMaxCount'];
+                                        $type['personOrganId'] = $personContractor[$x]['personOrganId'];
+                                        $type['inRegion'] = $personContractor[$x]['inRegion'];
+                                        $type['mode'] = $personContractor[$x]['mode'];
+                                        $type['type'] = 'personContractor';
+                                        DB::connection('mysql_fwe10')->table('uf_jl_type')->insert($type);
+                                    }
+                                }
+                                if(count($personCaller) > 0){
+                                    for($x=0;$x<count($personCaller);$x++){
+                                        //uf_mzy_type
+                                        $type['deviceId'] = $personCaller[$x]['deviceId'];
+                                        $type['timestamp'] = $personCaller[$x]['timestamp'];
+                                        $type['lon'] = $personCaller[$x]['lon'];
+                                        $type['lat'] = $personCaller[$x]['lat'];
+                                        $type['fid'] = $personCaller[$x]['fid'];
+                                        $type['name'] = $personCaller[$x]['name'];
+                                        $type['weekSel'] = $personCaller[$x]['weekSel'];
+                                        $type['stime1'] = $personCaller[$x]['stime1'];
+                                        $type['etime1'] = $personCaller[$x]['etime1'];
+                                        $type['stime2'] = $personCaller[$x]['stime2'];
+                                        $type['etime2'] = $personCaller[$x]['etime2'];
+                                        $type['stime3'] = $personCaller[$x]['stime3'];
+                                        $type['etime3'] = $personCaller[$x]['etime3'];
+                                        $type['organId'] = $personCaller[$x]['organId'];
+                                        $type['work'] = $personCaller[$x]['work'];
+                                        $type['minMaxCount'] = $personCaller[$x]['minMaxCount'];
+                                        $type['personOrganId'] = $personCaller[$x]['personOrganId'];
+                                        $type['inRegion'] = $personCaller[$x]['inRegion'];
+                                        $type['mode'] = $personCaller[$x]['mode'];
+                                        $type['type'] = 'personCaller';
+                                        DB::connection('mysql_fwe10')->table('uf_jl_type')->insert($type);
+                                    }
+                                }
+                                if(count($car) > 0){
+                                    for($x=0;$x<count($car);$x++){
+                                        //uf_mzy_type
+                                        $type['deviceId'] = $car[$x]['deviceId'];
+                                        $type['timestamp'] = $car[$x]['timestamp'];
+                                        $type['lon'] = $car[$x]['lon'];
+                                        $type['lat'] = $car[$x]['lat'];
+                                        $type['fid'] = $car[$x]['fid'];
+                                        $type['name'] = $car[$x]['name'];
+                                        $type['weekSel'] = $car[$x]['weekSel'];
+                                        $type['stime1'] = $car[$x]['stime1'];
+                                        $type['etime1'] = $car[$x]['etime1'];
+                                        $type['stime2'] = $car[$x]['stime2'];
+                                        $type['etime2'] = $car[$x]['etime2'];
+                                        $type['stime3'] = $car[$x]['stime3'];
+                                        $type['etime3'] = $car[$x]['etime3'];
+                                        $type['organId'] = $car[$x]['organId'];
+                                        $type['work'] = $car[$x]['work'];
+                                        $type['minMaxCount'] = $car[$x]['minMaxCount'];
+                                        $type['personOrganId'] = $car[$x]['personOrganId'];
+                                        $type['inRegion'] = $car[$x]['inRegion'];
+                                        $type['mode'] = $car[$x]['mode'];
+                                        $type['type'] = 'persons';
+                                        DB::connection('mysql_fwe10')->table('uf_jl_type')->insert($type);
+                                    }
+                                }
+                            }
+                        }
+                        // dd($id);
+                    }
+                }
+
+                // dd(123);
+            }
+        }
+
+        dd('success');
+    }
     
     public function getDcsApiData() {
         $apiUrl = "http://7.250.4.3:4300/v1/common/GetPointRealDataByPageV3";