巴林闲侠 2 years ago
parent
commit
1e580b0c63
  1. 17
      api/app/lib/schedule/alarms_push.js
  2. 2
      api/app/lib/utils/alarmHandle.js

17
api/app/lib/schedule/alarms_push.js

@ -893,7 +893,10 @@ module.exports = function (app, opts) {
} }
if (Object.keys(apMergeDeVeAlarms).length) { if (Object.keys(apMergeDeVeAlarms).length) {
if (proDebug) {
console.log(`查得数据异常、视频异常合并の告警:`);
console.log(apMergeDeVeAlarms);
}
let deviceSensorRes = [] let deviceSensorRes = []
if (deviceIds.size) { if (deviceIds.size) {
const device4Search = [...deviceIds] const device4Search = [...deviceIds]
@ -902,7 +905,10 @@ module.exports = function (app, opts) {
SELECT iota_device_id, sensor FROM t_device_sensor WHERE iota_device_id IN (${device4Search.join(',')}, '-1') SELECT iota_device_id, sensor FROM t_device_sensor WHERE iota_device_id IN (${device4Search.join(',')}, '-1')
`).toPromise() `).toPromise()
} }
if (proDebug) {
console.log(`相关设备及测点信息:`);
console.log(deviceSensorRes);
}
let alarmTitle = dataAlarmTitle.concat( let alarmTitle = dataAlarmTitle.concat(
videoAlarmTitle.slice(2).map(v => { videoAlarmTitle.slice(2).map(v => {
return { return {
@ -917,12 +923,7 @@ module.exports = function (app, opts) {
let alarmData = [] let alarmData = []
for (let aKey in apMergeDeVeAlarms) { for (let aKey in apMergeDeVeAlarms) {
let curStrucAlarm = apMergeDeVeAlarms[aKey] let curStrucAlarm = apMergeDeVeAlarms[aKey]
if (proDebug) {
console.log(`查得数据异常、视频异常合并の告警:`);
console.log(apMergeDeVeAlarms);
console.log(`相关设备及测点信息:`);
console.log(deviceSensorRes);
}
for (let de of curStrucAlarm.data_exception) { for (let de of curStrucAlarm.data_exception) {
if (!de.id) { if (!de.id) {
let corSensor = deviceSensorRes.find(ds => ds.iota_device_id == de.SourceId) let corSensor = deviceSensorRes.find(ds => ds.iota_device_id == de.SourceId)

2
api/app/lib/utils/alarmHandle.js

@ -110,7 +110,7 @@ module.exports = function (app, opts) {
} }
let pepProjects = pepPojectIds.size ? await clickHouse.projectManage.query(` let pepProjects = pepPojectIds.size ? await clickHouse.projectManage.query(`
SELECT id, project_name FROM t_pim_project WHERE id IN (${[...pepPojectIds]}, -1)` SELECT id, project_name FROM t_pim_project WHERE id IN (${[...pepPojectIds].join(',')}, -1)`
).toPromise() : []; ).toPromise() : [];
return { projects, pepProjects }; return { projects, pepProjects };

Loading…
Cancel
Save