Browse Source

EM推送配置项目多选

dev
巴林闲侠 2 years ago
parent
commit
8de7205d8d
  1. 22
      api/app/lib/schedule/alarms_push.js

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

@ -19,7 +19,7 @@ module.exports = function (app, opts) {
del: false, del: false,
disable: false disable: false
}, },
order: ['id'], order: ['id'],
}) })
let pomsProjectId = new Set() let pomsProjectId = new Set()
let pepProjectIds = new Set() let pepProjectIds = new Set()
@ -90,7 +90,7 @@ module.exports = function (app, opts) {
curAnxinProjectId.add(axId) curAnxinProjectId.add(axId)
} }
} }
const anxinProjectId = [...curAnxinProjectId] const anxinProjectId = [...curAnxinProjectId]
// 查当前 poms 下的结构物 并把不包含的去掉 // 查当前 poms 下的结构物 并把不包含的去掉
// 可能有结构物已解绑 // 可能有结构物已解绑
@ -151,7 +151,7 @@ module.exports = function (app, opts) {
let pepProjectName = let pepProjectName =
pepProjectName_.length ? pepProjectName_.length ?
pepProjectName_.join('<br/>') pepProjectName_.join('<br/>')
: '' : ''
let emailTitle = `${pepProjectName_.length ? let emailTitle = `${pepProjectName_.length ?
pepProjectName_.join('、') pepProjectName_.join('、')
@ -249,9 +249,15 @@ module.exports = function (app, opts) {
} }
if (c.alarmType.includes('video_exception')) { if (c.alarmType.includes('video_exception')) {
let videoAlarmSubType = c.alarmSubType ? c.alarmSubType['video_exception'] : [] let videoAlarmSubType = c.alarmSubType ? c.alarmSubType['video_exception'] : []
if (videoAlarmSubType.length == 1) videoAlarmSubType.push(-1) if (videoAlarmSubType.length == 1) {
videoAlarms = searchStrucIds.length && videoAlarmSubType.length ? await clickHouse.vcmp.query( videoAlarmSubType.push(-1)
` }
videoAlarms =
searchStrucIds.length && (
!c.alarmSubType || videoAlarmSubType.length > 0
) ?
await clickHouse.vcmp.query(
`
SELECT SELECT
cameraAlarm.cameraId AS cameraId, cameraAlarm.cameraId AS cameraId,
cameraAlarm.cameraName AS cameraName, cameraAlarm.cameraName AS cameraName,
@ -294,7 +300,7 @@ module.exports = function (app, opts) {
AND camera.channel_no = camera_status_alarm.channel_no AND camera.channel_no = camera_status_alarm.channel_no
AND camera.delete = false AND camera.delete = false
AND camera.recycle_time is null AND camera.recycle_time is null
${!c.alarmSubType ? `AND camera.kind_id in (${videoAlarmSubType.join(',')})` : ""} ${c.alarmSubType ? `AND camera.kind_id in (${videoAlarmSubType.join(',')})` : ""}
WHERE WHERE
camera_status_alarm.confirm_time IS null camera_status_alarm.confirm_time IS null
${videoAlarmWhereOption.length ? ` AND ${videoAlarmWhereOption.join(' AND ')}` : ''} ${videoAlarmWhereOption.length ? ` AND ${videoAlarmWhereOption.join(' AND ')}` : ''}
@ -318,7 +324,7 @@ module.exports = function (app, opts) {
ON anxinStation.id = anxinIpcStation.station ON anxinStation.id = anxinIpcStation.station
ORDER BY cameraAlarm.createTime DESC ORDER BY cameraAlarm.createTime DESC
` `
).toPromise() : [] ).toPromise() : []
let returnD = [] let returnD = []
let positionD = {} let positionD = {}

Loading…
Cancel
Save