Commit 6d44cb33 by lixinming

no message

parent e86e383a
No preview for this file type
......@@ -5,7 +5,7 @@ import { appConfig, dataCenterInterfaceConfig, getImageIp, systemConfig} from ".
import { getHardware } from "../../data/interface/hardwareData";
// import { getCsgkData, getDetachmentRatio, getTestAnalysis, getTestTotalTime } from "../../data/interface/interfaceService";
import { getMap } from "../../data/interface/mapInterfaceData";
import { getOnlieCarCount, vehicleLocData } from "../../data/interface/wsData";
import { getDriveModeAndVelocity, getOnlieCarCount, vehicleLocData } from "../../data/interface/wsData";
import { getQycs, getQytlzdjs, getYdcs } from "../../data/dataCenterInterface/csfxData";
import { getInterfaceData, getJrsj } from "../../data/dataCenterInterface/csgkData";
import { getCarVideo, getInterfaceByInterfaceName } from "../../data/cronJob";
......@@ -157,6 +157,8 @@ export async function carInfo(req, res) {
//获取
let ret:any = {};
let driveModeAndVelocity = getDriveModeAndVelocity(carId);
ret["info"] = {
enterprise:carInfo.enterprise,
validityBegin:carInfo.validityBegin,
......@@ -164,9 +166,9 @@ export async function carInfo(req, res) {
vehicleNo:carInfo.vehicleNo,//车牌号
vin:carInfo.vin,
vehicleType:carInfo.vehicleType,
type:"自动驾驶",
velocity:"45公里/小时"
}
type:driveModeAndVelocity.driveMode,
velocity:driveModeAndVelocity.velocity
}
let endTime = moment().format("YYYY-MM-DD hh:mm:ss");
let startTime = moment().subtract(10, 'd').format("YYYY-MM-DD hh:mm:ss");
......
......@@ -92,6 +92,16 @@ let dpNewDate = '';
let test = {};
// let = 0;
//模式缓存
let driveModeQueue = {};//{"vid":{driveMode, velocity}}
export function getDriveModeAndVelocity(vin) {
if (!driveModeQueue[vin]) return {driveMode:"人工", velocity:"0公里/小时"};
return {
driveMode:driveModeQueue[vin].driveMode == 1? "自动":"人工",
velocity:`${Math.round(driveModeQueue[vin].velocity)}公里/小时`
}
}
export function stats(data) {
let dateFormat = moment().format('YYYYMMDD');
......@@ -103,7 +113,7 @@ export function stats(data) {
let dataJson = JSON.parse(data);
if (dataJson.VehicleLoc) {
let {vin, latitude, longitude, positionTime, vehicleId, velocity, daymileage, dayduration, totalMileage, totalDuration} = dataJson.VehicleLoc;
let {vin, latitude, longitude, positionTime, driveMode, vehicleId, velocity, daymileage, dayduration, totalMileage, totalDuration} = dataJson.VehicleLoc;
vehicleLocData.push({vin, daymileage, dayduration, totalMileage, totalDuration}); //当日实时测试里程,当日实时测试时长,累计测试里程,累计测试时长
// console.log("收到小车位置", vin);
// broadcastMsg({lng:longitude||0.0, lat:latitude||0.0, vin, vehicleid:vehicleId});
......@@ -117,6 +127,8 @@ export function stats(data) {
dp[vin].index += 1;
if (dp[vin].index > 4) dp[vin].index = 0;
driveModeQueue[vin] = {velocity, driveMode};
//==测试代码
if (!positionTime) return;
if (!test[vin] ) test[vin] = {s:{lng:longitude||0.0, lat:latitude||0.0}, e:{lng:0, lat:0}, st:positionTime, et:0, lastCheckMs:new Date().valueOf()};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment