You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.9 KiB
55 lines
1.9 KiB
'use strict';
|
|
|
|
function getRealStateData(opts) {
|
|
return async function (ctx, next) {
|
|
|
|
const models = ctx.fs.dc.models;
|
|
let errMsg = { message: '获取水务实时态势数据失败' }
|
|
try {
|
|
const res = await models.FloodControlHeadquarters.findAll();
|
|
ctx.status = 200;
|
|
ctx.body = res;
|
|
} catch (error) {
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
|
|
ctx.status = 400;
|
|
ctx.body = errMsg
|
|
}
|
|
}
|
|
}
|
|
|
|
function getEmergencyList(opts) {
|
|
return async function (ctx, next) {
|
|
|
|
const models = ctx.fs.dc.models;
|
|
let errMsg = { message: '获取水利应急抢险数据失败' }
|
|
try {
|
|
//EmergencyMaterialStatistics 应急物资
|
|
//EmergencyShelterBasicInfoStatistics 应急避难场所
|
|
//RescueTeams(医疗救援队伍 人民武装部救援队伍 消防救援救援队伍)
|
|
const emergencyMaterial = await models.EmergencyMaterialStatistics.findAll();
|
|
const eEmergencyShelter = await models.EmergencyShelterBasicInfoStatistics.findAll();
|
|
const rescue = await models.RescueTeams.findAll();
|
|
|
|
const rslt = {
|
|
yjwz: emergencyMaterial,//应急物资
|
|
xfjy: rescue.filter(s => s.teamCategory == '消防救援救援队伍'),//消防救援
|
|
rmwzb: rescue.filter(s => s.teamCategory == '人民武装部救援队伍'),//人民武装部
|
|
yljy: rescue.filter(s => s.teamCategory == '医疗救援队伍'),//医疗救援
|
|
yjbns: eEmergencyShelter, //应急避难场所
|
|
}
|
|
|
|
ctx.status = 200;
|
|
ctx.body = rslt;
|
|
} catch (error) {
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
|
|
ctx.status = 400;
|
|
ctx.body = errMsg
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
module.exports = {
|
|
getRealStateData,
|
|
getEmergencyList
|
|
}
|