明树Git Lab

Commit 8ea31534 authored by zfp1's avatar zfp1

update

parent 18c3ecd1
......@@ -54,7 +54,7 @@ const cron = () => {
if (sysConfig && sysConfig.cron && sysConfig.cron.collectDeviceInfo) {
console.log("collectDeviceInfo1:", new Date());
// 每10分钟
new nodeCron.schedule('40 */5 * * * *', async () => {
new nodeCron.schedule('40 */1 * * * *', async () => {
await smcCron.collectDeviceInfo1({ deviceHQType: 1 });
}, { timezone: "Asia/Shanghai" });
}
......@@ -63,7 +63,7 @@ const cron = () => {
if (sysConfig && sysConfig.cron && sysConfig.cron.collectDeviceInfo) {
console.log("collectDeviceInfo2:", new Date());
new nodeCron.schedule('30 */5 * * * *', async () => {
new nodeCron.schedule('30 */1 * * * *', async () => {
await smcCron.collectDeviceInfo1({ deviceHQType: 2 });
}, { timezone: "Asia/Shanghai" });
}
......
......@@ -40,7 +40,7 @@ async function collectDeviceInfo4({ deviceHQType }) {
if(result && result.data && result.status && result.data.state == "success") {
let obj = result.data.data || {};
obj.name = dev.name || obj.name ;
console.log(obj);
// console.log(obj);
await collectIPSModule.insertHQData(obj);
// 3. 处理虫情每日种类数量记录
......
......@@ -73,7 +73,7 @@ async function handleCJData(colInfo, deviceHQType) {
let handleData = {}, attrExistMap = {};
//1. 先获取到attr配置
let attrs = await DB.CollectAttribute.find({ del: 0, enable: true, deviceHQType: { $in: [0, deviceHQType] } });
console.log(attrs)
// console.log(attrs)
let types = colInfo.type.split('/');
let data = colInfo.data.split('|');
for (let i = 0; i < types.length; i++) {
......@@ -161,7 +161,7 @@ async function handleDeviceThreshold(obj) {
}
}
}
console.log(exceeds);
// console.log(exceeds);
// 处理通知模板
if (exceeds.length) {
let role = await DB.Role.findOne({ key: "notice_role" });
......
......@@ -70,7 +70,7 @@ async function handleCJData(colInfo, deviceHQType) {
let handleData = {};
//1. 先获取到attr配置
let attrs = await DB.CollectAttribute.find({del: 0, enable: true, deviceHQType: {$in: [0, deviceHQType]}});
console.log(attrs)
// console.log(attrs)
let types = colInfo.type.split('/');
let data = colInfo.data.split('|');
for (let i = 0; i < types.length; i++) {
......@@ -88,7 +88,7 @@ async function handleCJData(colInfo, deviceHQType) {
}
}
}
console.log(handleData, "======1")
// console.log(handleData, "======1")
return handleData;
}
......@@ -145,7 +145,7 @@ async function handleDeviceThreshold(obj) {
}
}
}
console.log(exceeds);
// console.log(exceeds);
// 处理通知模板
if (exceeds.length) {
let role = await DB.Role.findOne({ key: "notice_role" });
......
......@@ -34,10 +34,14 @@ async function insertHQData(data) {
}
// return await DB.CollectSMC.findOneAndUpdate({time: data.time}, data, {upsert: true})
let check = await DB.CollectSMC.findOne({time: data.time});
console.log(err, "--------20241219", check);
if(!check) {
// 没有就新增
await DB.CollectSMC.create(data);
await DB.CollectSMC.create(data).catch(err => {
console.log(err, "--------20241219");
});
}
console.log(err, "--------20241219");
return !!check;
} catch (error) {
console.log(error);
......
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