tongshanglei 2 년 전
부모
커밋
e4a849ccac
4개의 변경된 파일73개의 추가작업 그리고 5개의 파일을 삭제
  1. 3 1
      app/common.php
  2. 4 4
      catch/device/controller/Station.php
  3. 65 0
      catch/map/controller/RouteMap.php
  4. 1 0
      catch/map/route.php

+ 3 - 1
app/common.php

@@ -1285,6 +1285,7 @@ use Aliyun\OTS\OTSClient;
         // $sql = 'SELECT * FROM ( SELECT '.$field.',ROWNUM RN FROM (SELECT * FROM '.$tableName.' '.$whereStr.' ORDER BY ID DESC) a WHERE ROWNUM <='.$end.' ) WHERE RN >='. $start;
         $sql='SELECT * FROM ( SELECT '.$field.',ROWNUM RN FROM '.$tableName.' WHERE ROWNUM <='.$end.' '.$whereStr.'  ) WHERE RN >'. $start;
         // var_dump($sql);
+        // return [];
         // 查询并渲染
         $stid = oci_parse($conn, $sql);
         $r = oci_execute($stid);
@@ -1389,7 +1390,8 @@ use Aliyun\OTS\OTSClient;
         }
         $whereStr=buildQueryCond($cond);
         $countQuery='SELECT count(*) as count FROM  '.$tableName.' '.$whereStr;
-        // var_dump($sql);
+        // var_dump($countQuery);
+        // return 0;
         // 查询并渲染
         $stid = oci_parse($conn, $countQuery);
         $r = oci_execute($stid);

+ 4 - 4
catch/device/controller/Station.php

@@ -101,10 +101,10 @@ class Station extends CatchController
             $end_time=date('Y-m-d H:i:s',strtotime($params['timeRange'][1]));
             $cond['RF_DATE']=['timeRange',$start_time,$end_time];
         }
-        $count=queryOracleCount('DSSC2.W_DW_RF_RECORD',$cond);
+        // $count=queryOracleCount('DSSC2.W_DW_RF_RECORD',$cond);
 
-        $cond['page']=isset($param['page'])?$param['page']:1;
-        $cond['limit']=isset($param['limit'])?$param['limit']:10;
+        $cond['page']=isset($params['page'])?$params['page']:1;
+        $cond['limit']=isset($params['limit'])?$params['limit']:10;
         
         $rows=queryOracleSelect('(SELECT * FROM DSSC2.W_DW_RF_RECORD  ORDER BY ID DESC) a',$cond,'a.RF_FLAGID,a.RF_STAT,to_char(a.RF_DATE,\'yyyy-mm-dd hh24:mi:ss\') RF_DATE');
         foreach($rows as &$val){
@@ -120,7 +120,7 @@ class Station extends CatchController
         $response=[
             'code'=>10000,
             'message'=>'查询成功',
-            'count'=>$count,
+            // 'count'=>$count,
             'data'=>$rows,
             'current'=>isset($params['page'])?(int)$params['page']:1,
             'limit'=>isset($params['limit'])?(int)$params['limit']:10,

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

@@ -613,4 +613,69 @@ class RouteMap extends CatchController
         return CatchResponse::success($rows);
         
     }
+    /**
+     * 查询设备轨迹
+     * @time 2022年09月18日 10:15
+     * 
+     */
+    public function queryDeviceRouteList(Request $request)
+    {
+      
+        $params=$request->param();
+        
+        $cond=[];
+        // $cond=[
+        //     '_string'=>'a.RF_FLAGID = s.RFID_SN AND o.rfid_id = s.id',
+        // ];
+        
+        // if($params['device_number']){
+        //     $cond['RF_FLAGID']=['=',$params['device_number']];
+        // }
+        $start_time = date('Y-m-d 00:00:00',time());
+        $end_time = date('Y-m-d 23:59:59',time());
+
+        if(isset($params['timeRange']) && $params['timeRange'] != ''){
+            $start_time=date('Y-m-d H:i:s',strtotime($params['timeRange'][0]));
+            $end_time=date('Y-m-d H:i:s',strtotime($params['timeRange'][1]));
+            $cond['a.RF_DATE']=['timeRange',$start_time,$end_time];
+        }
+        // $count=queryOracleCount('DSSC2.W_DW_RF_RECORD a',$cond);
+        
+        $cond['page']=isset($param['page'])?$param['page']:1;
+        $cond['limit']=isset($param['limit'])?$param['limit']:10;
+        $rows=[];
+        $rows=queryOracleSelect('(SELECT * FROM DSSC2.W_DW_RF_RECORD  ORDER BY ID DESC) a',$cond,'a.RF_FLAGID,a.RF_STAT,a.RF_ID,to_char(a.RF_DATE,\'yyyy-mm-dd hh24:mi:ss\') RF_DATE');
+        $conn=getOracleConnect();
+        foreach($rows as &$val){
+            $vehicle_sql='SELECT o.PLATE_NO FROM DSSC3.W_DW_NON_MOTOR o,DSSC3.W_DW_RFID_TAGS s WHERE s.RFID_SN =\''.$val['RF_FLAGID'].'\'  AND o.rfid_id = s.id  ';
+            $plate_no='';
+            $stid = oci_parse($conn, $vehicle_sql);
+            oci_define_by_name($stid, 'PLATE_NO', $plate_no);
+            oci_execute($stid);
+            oci_fetch($stid);
+            oci_free_statement($stid);
+            $val['PLATE_NO']=$plate_no;
+            $val['ADDRESS']=Db::table('stations')->where('mac',$val['RF_ID'])->cache(120)->value('name');
+            //状态: 0- 未知,1 - 进入,2 - 离开
+            if($val['RF_STAT']==1){
+                $val['RF_STAT_TEXT']='进入';
+            }elseif($val['RF_STAT']==2){
+                $val['RF_STAT_TEXT']='离开';
+            }else{
+                $val['RF_STAT_TEXT']='未知';
+            }
+        }
+        
+        oci_close($conn);
+        $response=[
+            'code'=>10000,
+            'message'=>'查询成功',
+            // 'count'=>$count,
+            'data'=>$rows,
+            'current'=>isset($params['page'])?(int)$params['page']:1,
+            'limit'=>isset($params['limit'])?(int)$params['limit']:10,
+        ];
+        return $response;
+        
+    }
 }

+ 1 - 0
catch/map/route.php

@@ -24,6 +24,7 @@ $router->group(function () use ($router){
 	$router->get('map/queryFenceList', '\catchAdmin\map\controller\RouteMap@queryFenceList');
 	$router->get('map/queryDeviceRoute', '\catchAdmin\map\controller\RouteMap@queryDeviceRoute');
 	$router->get('map/queryDeviceRouteOracle', '\catchAdmin\map\controller\RouteMap@queryDeviceRouteOracle');
+	$router->get('map/queryDeviceRouteList', '\catchAdmin\map\controller\RouteMap@queryDeviceRouteList');