|
@@ -613,4 +613,69 @@ class RouteMap extends CatchController
|
|
return CatchResponse::success($rows);
|
|
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;
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|