Browse Source

alarm push debug

dev
CODE 1 year ago
parent
commit
1b2b2975ae
  1. 52
      api/app/lib/schedule/alarms_push.js

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

@ -97,8 +97,7 @@ module.exports = function (app, opts) {
return title
}
pLog('EM推送列表',);
pLog(configListRes)
pLog('EM推送列表_' + configListRes.length,);
for (let { dataValues: c } of configListRes) {
@ -109,37 +108,44 @@ module.exports = function (app, opts) {
const { interval, deviceProportion } = c.tacticsParams
if (curMinOfYear % parseInt(interval) == 0 || isDev) {
pLog(`符合时间断点`)
const corPomsProject = pomsProjectRes.filter(poms => pomsProjectId.includes(poms.id))
let curAnxinProjectId = new Set()
let pepProjectName_ = []
let pepProject_name = [] //当前有关联的项目,后面往对应项目里面插入对应的结构物-监测因素-告警源
for (let { dataValues: poms } of corPomsProject) {
if (poms.pepProjectId) {
// 找对应的项企项目
const corPepProject =
pepProjectRes.find(p => p.id == poms.pepProjectId)
if (corPepProject && c.timeType.some(ct => ct == corPepProject.construction_status_id)) {
pepProjectName_.push(corPepProject.project_name)
pepProject_name.push({ id: poms.id, anxinProjectId: poms.anxinProjectId, name: corPepProject.project_name })
try {
for (let { dataValues: poms } of corPomsProject) {
if (poms.pepProjectId) {
// 找对应的项企项目
const corPepProject =
pepProjectRes.find(p => p.id == poms.pepProjectId)
if (corPepProject && c.timeType.some(ct => ct == corPepProject.construction_status_id)) {
pepProjectName_.push(corPepProject.project_name)
pepProject_name.push({ id: poms.id, anxinProjectId: poms.anxinProjectId, name: corPepProject.project_name })
} else {
// 不符合当前项目的时间节点
continue
}
} else {
// 不符合当前项目的时间节点
continue
// 是自定义项目
if (poms.name) {
pepProjectName_.push(poms.name)
pepProject_name.push({ id: poms.id, anxinProjectId: poms.anxinProjectId, name: poms.name })
}
}
} else {
// 是自定义项目
if (poms.name) {
pepProjectName_.push(poms.name)
pepProject_name.push({ id: poms.id, anxinProjectId: poms.anxinProjectId, name: poms.name })
// 筛选全部的 anxinProjectId pepProjectId
for (let axId of poms.anxinProjectId) {
curAnxinProjectId.add(axId)
}
}
// 筛选全部的 anxinProjectId pepProjectId
for (let axId of poms.anxinProjectId) {
curAnxinProjectId.add(axId)
}
} catch (error) {
console.error(error);
throw error
}
const anxinProjectId = [...curAnxinProjectId]
// 查当前 poms 下的结构物 并把不包含的去掉
// 可能有结构物已解绑

Loading…
Cancel
Save