|
|
@ -7,7 +7,7 @@ module.exports = function (app, opts) { |
|
|
|
const { database: anxinyun } = clickHouse.anxinyun.opts.config |
|
|
|
const alarmHandleStatistics = app.fs.scheduleInit( |
|
|
|
{ |
|
|
|
interval: '30 59 14 * * *', |
|
|
|
interval: '0 58 9 * * *', |
|
|
|
// immediate: true,
|
|
|
|
//proRun: true,
|
|
|
|
}, |
|
|
@ -290,53 +290,14 @@ module.exports = function (app, opts) { |
|
|
|
// 每个设备一个告警
|
|
|
|
for (let a of alarmRes) { |
|
|
|
if (positionD[a.cameraId]) { |
|
|
|
//let curD = returnD[positionD[a.cameraId].positionReturnD]
|
|
|
|
// if (a.resolveId && !curD.resolve.some(r => r.id == a.resolveId)) {
|
|
|
|
// curD.resolve.push({
|
|
|
|
// id: a.resolveId,
|
|
|
|
// resolve: a.resolve
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// if (a.strucId && !curD.struc.some(s => s.id == a.strucId)) {
|
|
|
|
// curD.struc.push({
|
|
|
|
// id: a.strucId,
|
|
|
|
// projectId: a.projectId,
|
|
|
|
// name: a.strucName
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// if (a.anxinStationId && !curD.station.some(s => s.id == a.anxinStationId)) {
|
|
|
|
// curD.station.push({
|
|
|
|
// id: a.anxinStationId,
|
|
|
|
// name: a.anxinStationName,
|
|
|
|
// position: a.anxinIpcPosition
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
} else { |
|
|
|
let d = { |
|
|
|
cameraId: a.cameraId, |
|
|
|
//cameraName: a.cameraName,
|
|
|
|
//camerOnline: a.cameraOnline,
|
|
|
|
//cameraSerialNo: a.cameraSerialNo,
|
|
|
|
//cameraChannelNo: a.cameraChannelNo,
|
|
|
|
autoRestore: a.autoRestore, |
|
|
|
createTime: a.createTime, |
|
|
|
//updateTime: a.updateTime,
|
|
|
|
//platform: a.platform,
|
|
|
|
//statusDescribe: a.statusDescribe,
|
|
|
|
alarmId: a.alarmId, |
|
|
|
//confirmContent: a.confirmContent,
|
|
|
|
confirmTime: a.confirmTime, |
|
|
|
|
|
|
|
// venderId: a.venderId,
|
|
|
|
// venderName: a.venderName,
|
|
|
|
// cameraKindId: a.cameraKindId,
|
|
|
|
// yingshiToken: a.yingshiToken,
|
|
|
|
|
|
|
|
// resolve: [],
|
|
|
|
// struc: [],
|
|
|
|
// station: []
|
|
|
|
} |
|
|
|
|
|
|
|
// pep 项目
|
|
|
|
d.pomsProject = ( |
|
|
|
anxinStruc.find(as => as.strucId == a.strucId) || |
|
|
@ -346,27 +307,6 @@ module.exports = function (app, opts) { |
|
|
|
] |
|
|
|
} |
|
|
|
).pomsProject.map(d => d.id) |
|
|
|
|
|
|
|
// if (a.resolveId) {
|
|
|
|
// d.resolve.push({
|
|
|
|
// id: a.resolveId,
|
|
|
|
// resolve: a.resolve
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// if (a.strucId) {
|
|
|
|
// d.struc.push({
|
|
|
|
// id: a.strucId,
|
|
|
|
// projectId: a.projectId,
|
|
|
|
// name: a.strucName
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// if (a.anxinStationId) {
|
|
|
|
// d.station.push({
|
|
|
|
// id: a.anxinStationId,
|
|
|
|
// name: a.anxinStationName,
|
|
|
|
// position: a.anxinIpcPosition
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
returnD.push(d) |
|
|
|
positionD[a.cameraId] = { |
|
|
|
positionReturnD: returnD.length - 1 |
|
|
@ -493,23 +433,40 @@ module.exports = function (app, opts) { |
|
|
|
// 并保存信息至数据
|
|
|
|
let undelStruc = [] |
|
|
|
for (let s of undelStrucRes) { |
|
|
|
if (!undelStruc.some(us => us.strucId == s.strucId)) { |
|
|
|
let pomsProject = [] |
|
|
|
for (let { dataValues: br } of bindRes) { |
|
|
|
if (br.anxinProjectId.some(braId => braId == s.projectId)) { |
|
|
|
let corPepProject = pepProjectRes.find(pp => pp.id == br.pepProjectId) |
|
|
|
pomsProject.push({ |
|
|
|
let corStruc = undelStruc.find(us => us.strucId == s.strucId) |
|
|
|
if (corStruc) { |
|
|
|
if (!corStruc.project.some(cp => cp.id == s.projectId)) { |
|
|
|
corStruc.project.push({ |
|
|
|
id: s.projectId |
|
|
|
}) |
|
|
|
} |
|
|
|
} else { |
|
|
|
corStruc = { |
|
|
|
strucId: s.strucId, |
|
|
|
strucName: s.strucName, |
|
|
|
projectId: s.projectId, |
|
|
|
project: [{ |
|
|
|
id: s.projectId, |
|
|
|
}], |
|
|
|
pomsProject: [] |
|
|
|
} |
|
|
|
undelStruc.push(corStruc) |
|
|
|
} |
|
|
|
for (let { dataValues: br } of bindRes) { |
|
|
|
if (br.anxinProjectId.some(braId => braId == s.projectId)) { |
|
|
|
let corPepProject = pepProjectRes.find(pp => pp.id == br.pepProjectId) |
|
|
|
let corPomsProject = corStruc.pomsProject.find(cp => cp.id == br.id) |
|
|
|
|
|
|
|
if (corPomsProject) { |
|
|
|
// poms 的 project 和 pep 的 project 是一对一的关系 所以这个情况不用处理
|
|
|
|
} else { |
|
|
|
corStruc.pomsProject.push({ |
|
|
|
...br, |
|
|
|
pepProject: corPepProject |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
undelStruc.push({ |
|
|
|
strucId: s.strucId, |
|
|
|
strucName: s.strucName, |
|
|
|
projectId: s.projectId, |
|
|
|
pomsProject: pomsProject |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
return undelStruc |
|
|
|