Commit 71f9b2ee by 孙香冬

no message

parent 8306a6a3
...@@ -50,7 +50,7 @@ export async function getCSGK(req, res) { ...@@ -50,7 +50,7 @@ export async function getCSGK(req, res) {
let 今日功能测试data = {"里程":"1478km", "时长":"421.3h"}; let 今日功能测试data = {"里程":"1478km", "时长":"421.3h"};
ret["api4"] = getKeyValueNumberOutData("今日功能测试", 今日功能测试data); ret["api4"] = getKeyValueNumberOutData("今日功能测试", 今日功能测试data);
let 测试牌照分布data = {"http://192.168.0.117:30001/img/AUTO X.png":"61辆", "http://192.168.0.117:30001/img/阿利昂斯.png":"45辆", let 测试牌照分布data = {"http://192.168.0.117:30001/img/AutoX.png":"61辆", "http://192.168.0.117:30001/img/阿利昂斯.png":"45辆",
"http://192.168.0.117:30001/img/百度.png":"31辆", "http://192.168.0.117:30001/img/宝马.png":"47辆", "http://192.168.0.117:30001/img/百度.png":"31辆", "http://192.168.0.117:30001/img/宝马.png":"47辆",
"http://192.168.0.117:30001/img/初速度.png":"65辆", "http://192.168.0.117:30001/img/滴滴.png":"71辆", "http://192.168.0.117:30001/img/初速度.png":"65辆", "http://192.168.0.117:30001/img/滴滴.png":"71辆",
"http://192.168.0.117:30001/img/丰田.png":"18辆", "http://192.168.0.117:30001/img/华为.png":"23辆", "http://192.168.0.117:30001/img/丰田.png":"18辆", "http://192.168.0.117:30001/img/华为.png":"23辆",
...@@ -66,8 +66,8 @@ export async function getCSGK(req, res) { ...@@ -66,8 +66,8 @@ export async function getCSGK(req, res) {
ret["api5"] = getKeyValueNumberOutData("测试牌照分布", 测试牌照分布data); ret["api5"] = getKeyValueNumberOutData("测试牌照分布", 测试牌照分布data);
let 路侧监控视频data = {"路侧监控视频":"http://10.51.50.53:8278/live/13060200882000000001@31011402601318800184@34020000001320000001.m3u8?vhost=bduv0utmss4c3nzidjn.a.e-web.com.cn"}; let 路侧监控视频data = {"src":"http://10.51.50.53:8278/live/13060200882000000001@31011402601318800184@34020000001320000001.m3u8?vhost=bduv0utmss4c3nzidjn.a.e-web.com.cn", "type": 'application/x-mpegURL'};
ret["api6"] = getKeyValueNumberOutData("路侧监控视频", 路侧监控视频data); ret["api6"] = ({title:"路侧监控视频", dataList: 路侧监控视频data});
res.send(ret); res.send(ret);
} }
......
import moment = require("moment") import moment = require("moment")
import { get } from "../../util/request"; import { get } from "../../util/request";
let 月里程数据 = [];//格式 [{key:"日期 格式是 2021.1", count:"测试里程", autoCount:"功能测试里程"}] let 月里程数据 = [{key:"2021.01", count:"31km", autoCount:"45km"}];//格式 [{key:"日期 格式是 2021.1", count:"测试里程", autoCount:"功能测试里程"}]
let 企业日里程数据 = {}; //格式 {"企业名称":{count:"测试里程", autoCount:"功能测试里程"} } let 企业日里程数据 = {}; //格式 {"企业名称":{count:"测试里程", autoCount:"功能测试里程"} }
let lastMonths = ""; let lastMonths = "";
//数据库源数据接口 //数据库源数据接口
export async function getTestAnalysis() { export async function getTestAnalysis() {
//在月里程数据集合中 从后往前拿20个月份的数据,动态的拿本月的数据 拼接好返回 不要改变源数据 //在月里程数据集合中 从后往前拿20个月份的数据,动态的拿本月的数据 拼接好返回 不要改变源数据
let {newDateArr, whereDateArr} = getPreMonthDay(20);
let monthMileage = [];
let testMileage = [];
let functionTestMileage = [];
for (let i = 0; i < newDateArr.length; i++) {
let months = newDateArr[i];
月里程数据.forEach(item => {
let {key, count, autoCount} = item;
if (months == key) {
testMileage.push({key, value:count});
functionTestMileage.push({key, value:autoCount});
}
})
}
} }
...@@ -46,7 +60,8 @@ export async function initData() { ...@@ -46,7 +60,8 @@ export async function initData() {
企业日里程数据[enterprise].autoCount += auto_mileage; 企业日里程数据[enterprise].autoCount += auto_mileage;
}); });
月里程数据.push( {count, autoCount:testCount, key} ); let addItem = {count, autoCount:testCount, key};
月里程数据.push(addItem );
lastMonths = months; lastMonths = months;
} }
...@@ -126,4 +141,21 @@ async function getInterfaceData(st, et, index) { ...@@ -126,4 +141,21 @@ async function getInterfaceData(st, et, index) {
console.log(); console.log();
return []; return [];
} }
}
/**
* 获取几个月前的日期
* @param monthNum 月数
* @returns
*/
function getPreMonthDay(monthNum) {
let whereDateArr = [];
let newDateArr = [];
for (let i = 1; i <= monthNum; i++) {
let whereDate = moment().subtract(i, "months").format("YYMM");
whereDateArr.push(whereDate);
let newDate = moment().subtract(i, "months").format("YYYY.MM");
newDateArr.push(newDate);
}
return {newDateArr, whereDateArr};
} }
\ No newline at end of file
import { initConfig, port } from "./config/serverConfig"; import { initConfig, port } from "./config/serverConfig";
import { getTestAnalysis } from "./data/interface/interfaceService";
import { httpServer } from "./net/http_server"; import { httpServer } from "./net/http_server";
async function lanuch() { async function lanuch() {
// await initConfig(); // await initConfig();
httpServer.createServer(port); httpServer.createServer(port);
console.log('This indicates that the server is started successfully.'); console.log('This indicates that the server is started successfully.');
await getTestAnalysis();
} }
lanuch(); lanuch();
\ No newline at end of file
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