tongshanglei 2 years ago
parent
commit
ed2406a9b5

+ 10 - 0
catch/device/controller/Station.php

@@ -215,6 +215,16 @@ class Station extends CatchController
     }
 
     /**
+     * 基站地图额
+     * @time 2022年01月20日 10:09
+     * @param Request $request 
+     */
+    public function getMapList(Request $request) 
+    {
+        return CatchResponse::paginate($this->stationModel->getMapList());
+    }
+    
+    /**
      * 所有列表
      * @time 2022年01月20日 10:09
      * @param Request $request 

+ 23 - 2
catch/device/model/Station.php

@@ -46,7 +46,7 @@ class Station extends Model
     {
         $res = $this->dataRange()
             ->catchSearch()
-            ->append(['is_online'])
+            ->append(['is_online','is_online_text'])
             ->order($this->aliasField('online_time'), 'desc')
             ->paginate()->each(function($item, $key)  {
                 $wgsLoc = \algorithm\Geometry::convertGcj02ToBd09((float)$item['latitude'],(float)$item['longitude']);
@@ -56,6 +56,20 @@ class Station extends Model
             
         return $res;
     }
+
+    public function getMapList(){
+        $res = $this->dataRange()
+            ->catchSearch()
+            ->append(['is_online','is_online_text'])
+            ->order($this->aliasField('online_time'), 'desc')
+            ->paginate()->each(function($item, $key)  {
+                $wgsLoc = \algorithm\Geometry::gcj02ToWgs84((float)$item['latitude'],(float)$item['longitude']);
+                $item['longitude']=$wgsLoc['lng'];
+                $item['latitude']=$wgsLoc['lat'];
+            });
+            
+        return $res;
+    }
     public function getAllList(){
         $res = $this
             ->catchSearch()
@@ -68,7 +82,7 @@ class Station extends Model
                 $item['longitude']=$wgsLoc['lng'];
                 $item['latitude']=$wgsLoc['lat'];
             })->toArray();
-        
+
         return $res;
     }
     /**
@@ -86,6 +100,13 @@ class Station extends Model
         return $query->where('shortcode|mac', 'like', '%'.$value.'%');
     }
     /**
+     * 关键字
+     */
+    public function searchKeywordsAttr($query, $value, $data)
+    {
+        return $query->where('name|mac', 'like', '%'.$value.'%');
+    }
+    /**
      * 根据状态搜索
      */
     public function searchOnlineStateAttr($query, $value, $data)

+ 1 - 0
catch/device/route.php

@@ -16,6 +16,7 @@ $router->group(function () use ($router) {
 	// station路由
 	$router->get('station/getdeviceListByStation','\catchAdmin\device\controller\Station@getdeviceListByStation');
 	$router->get('station/getAllListForTrans','\catchAdmin\device\controller\Station@getAllListForTrans');
+	$router->get('station/getMapList','\catchAdmin\device\controller\Station@getMapList');
 	$router->get('station/getAllList','\catchAdmin\device\controller\Station@getAllList');
 	//导入基站
 	$router->post('station/importStation', '\catchAdmin\device\controller\Station@importStation');

+ 46 - 0
catch/map/controller/RouteMap.php

@@ -759,4 +759,50 @@ class RouteMap extends CatchController
         return $response;
         
     }
+    /**
+     * 统计条数
+     * @time 2022年09月18日 10:15
+     * 
+     */
+    public function queryCountSearchDevice(Request $request)
+    {
+      
+        $params=$request->param();
+        $cond=[];
+        $keywords=$params['keywords'];
+        if(!$keywords){
+            return [
+                'code'=>10000,
+                'message'=>'查询成功',
+                'station'=>0,
+                'vehicle'=>0,
+            ];
+  
+        }
+        $station_count=Db::table('stations')->where('name|mac', 'like', '%'.$keywords.'%')->count();
+       
+
+        $conn=getOracleConnect();
+        $COUNT=0;
+
+        $vehicle_sql='SELECT count(*) as COUNT FROM DSSC3.W_DW_NON_MOTOR o,DSSC3.W_DW_RFID_TAGS s WHERE (s.RFID_SN like \'%'.$keywords.'%\' OR  o.PLATE_NO like \'%'.$keywords.'%\') AND o.rfid_id = s.id';
+        $vtid = oci_parse($conn, $vehicle_sql);
+        oci_define_by_name($vtid, 'COUNT', $COUNT);
+        oci_execute($vtid);
+        oci_fetch($vtid);
+        oci_free_statement($vtid);
+        oci_close($conn);
+        
+
+        $response=[
+            'code'=>10000,
+            'message'=>'查询成功',
+            'station'=>$station_count,
+            'vehicle'=>$COUNT,
+           
+        ];
+        
+        return $response;
+        
+    }
 }

+ 2 - 1
catch/map/route.php

@@ -26,11 +26,12 @@ $router->group(function () use ($router){
 	$router->get('map/queryDeviceRouteOracle', '\catchAdmin\map\controller\RouteMap@queryDeviceRouteOracle');
 	$router->get('map/queryDeviceRouteList', '\catchAdmin\map\controller\RouteMap@queryDeviceRouteList');
 	$router->get('map/queryDeviceRouteCount', '\catchAdmin\map\controller\RouteMap@queryDeviceRouteCount');
+	$router->get('map/queryCountSearchDevice', '\catchAdmin\map\controller\RouteMap@queryCountSearchDevice');
 	
 
 
 	$router->post('/map/queryDeviceRealTimeInfo', '\catchAdmin\map\controller\RouteMap@queryDeviceRealTimeInfo');
-	
+
 	
 })->middleware('auth');
 $router->post('map/queryAlarmFenceList', '\catchAdmin\map\controller\RouteMap@queryAlarmFenceList');

+ 56 - 0
catch/yunying/controller/Vehicle.php

@@ -70,6 +70,62 @@ class Vehicle extends CatchController
         ];
         return $response;
     }
+    public function getMapList(Request $request)
+    {
+        $param=$request->param();
+        //联表条件o.rfid_id = s.id and o.owner_id = r.id 
+        $cond=[
+            '_string'=>'o.rfid_id = s.id',
+        ];
+        $keywords=$param['keywords'];
+        if($keywords){
+           $cond['_string']= '(s.RFID_SN like \'%'.$keywords.'%\' OR  o.PLATE_NO like \'%'.$keywords.'%\') AND o.rfid_id = s.id';
+        }
+
+        $count=queryOracleCount('DSSC3.W_DW_NON_MOTOR o,DSSC3.W_DW_RFID_TAGS s',$cond);
+
+        $cond['page']=isset($param['page'])?$param['page']:1;
+        $cond['limit']=isset($param['limit'])?$param['limit']:10;
+        $rows=queryOracleSelect('DSSC3.W_DW_NON_MOTOR o,DSSC3.W_DW_RFID_TAGS s',$cond,'o.PLATE_NO,o.CAR_TYPE,o.CAR_BRAND,s.ID,s.RFID_SN,s.INSTALLER,to_char(s.INSTA_DATE,\'yyyy-mm-dd hh24:mi:ss\') INSTA_DATE');
+        $conn=getOracleConnect();
+        foreach($rows as &$val){
+            $val['CAR_BRAND_TEXT']=(new SysDictData())->getValueByCode('CAR_BRAND_OPTION',$val['CAR_BRAND']);
+            $val['CAR_TYPE_TEXT']=(new SysDictData())->getValueByCode('CAR_TYPE_OPTION',$val['CAR_TYPE']);
+
+
+            $route_sql='select * from(SELECT RF_ID,to_char(RF_DATE,\'yyyy-mm-dd hh24:mi:ss\') RF_DATE FROM DSSC2.W_DW_RF_RECORD WHERE RF_FLAGID =\''.$val['RFID_SN'].'\' ORDER BY RF_DATE DESC )where rownum < 2';
+          
+          
+            $stid = oci_parse($conn, $route_sql);
+            oci_define_by_name($stid, 'RF_ID', $val['mac']);
+            oci_define_by_name($stid, 'RF_DATE',  $val['online_time']);
+            oci_execute($stid);
+            oci_fetch($stid);
+            oci_free_statement($stid);
+            $staion_info =Db::table('stations')->where('mac',$val['mac'])->find();
+            if($staion_info){
+                $wgsLoc = \algorithm\Geometry::gcj02ToWgs84((float)$staion_info['latitude'],(float)$staion_info['longitude']);
+                $val['longitude']=$wgsLoc['lng'];
+                $val['latitude']=$wgsLoc['lat'];
+                $val['address']=$staion_info['name'];
+            }else{
+                $val['longitude']='';
+                $val['latitude']='';
+                $val['address']='';
+
+            }
+           
+        }
+        $response=[
+            'code'=>10000,
+            'message'=>'查询成功',
+            'count'=>$count,
+            'data'=>$rows,
+            'current'=>isset($param['page'])?(int)$param['page']:1,
+            'limit'=>isset($param['limit'])?(int)$param['limit']:10,
+        ];
+        return $response;
+    }
     public function getRfidTagsList(Request $request) {
         $param=$request->param();
         //联表条件o.rfid_id = s.id and o.owner_id = r.id 

+ 1 - 0
catch/yunying/route.php

@@ -13,6 +13,7 @@
 $router->group(function () use ($router){
 	// vehicle路由
 	$router->get('vehicle/getRfidTagsList', '\catchAdmin\yunying\controller\Vehicle@getRfidTagsList');
+	$router->get('vehicle/getMapList', '\catchAdmin\yunying\controller\Vehicle@getMapList');
 	$router->post('vehicle/importVehicle', '\catchAdmin\yunying\controller\Vehicle@importVehicle');
 	$router->resource('vehicle', '\catchAdmin\yunying\controller\Vehicle');