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

Loading…
Cancel
Save