消息处理修改方式及部分消息提示语修改

This commit is contained in:
zhouyuejun
2019-01-18 10:58:44 +08:00
parent 4bfc263fa3
commit 81b360d52b
6 changed files with 127 additions and 143 deletions
+32 -19
View File
@@ -25,19 +25,19 @@ export class AlertMessageHandle {
// }
public flopCncl(message, airports) {
if(message.FLOP.CNCL){
if (message.FLOP.CNCL) {
return message.FLOP.FFID + '航班取消';
}else{
} else {
return message.FLOP.FFID + '航班恢复';
}
}
public flopFret(message, airports) {
if (message.FLOP.FRET.REID === 'G') {
return message.FLOP.FFID + '航班从地面返回,返回原因:' + message.FLOP.FRET.content || message.FLOP.FRET.VALUE;
return message.FLOP.FFID + '航班从地面返回,返回原因:' + (message.FLOP.FRET.content || message.FLOP.FRET.VALUE);
} else if (message.FLOP.FRET.REID === 'A') {
return message.FLOP.FFID + '航班从空中返回,返回原因:' + message.FLOP.FRET.content || message.FLOP.FRET.VALUE;
return message.FLOP.FFID + '航班从空中返回,返回原因:' + (message.FLOP.FRET.content || message.FLOP.FRET.VALUE);
} else {
return message.FLOP.FFID + '航班从空中或地面返回,返回原因:' + message.FLOP.FRET.content || message.FLOP.FRET.VALUE;
return message.FLOP.FFID + '航班从空中或地面返回,返回原因:' + (message.FLOP.FRET.content || message.FLOP.FRET.VALUE);
}
}
public flopFdiv(message, airports) {
@@ -47,24 +47,37 @@ export class AlertMessageHandle {
airportName = airports[index].airportNameChn;
}
if (message.FLOP.FDIV.DDIR === 'FROM') {
return message.FLOP.FFID + '航班备降自' + airportName + ',备降原因:' + message.FLOP.FDIV.content || message.FLOP.FDIV.VALUE;
return message.FLOP.FFID + '航班备降自' + airportName + ',备降原因:' + (message.FLOP.FDIV.content || message.FLOP.FDIV.VALUE);
} else if (message.FLOP.FDIV.DDIR === 'TO') {
return message.FLOP.FFID + '航班备降到' + airportName + ',备降原因:' + message.FLOP.FDIV.content || message.FLOP.FDIV.VALUE;
return message.FLOP.FFID + '航班备降到' + airportName + ',备降原因:' + (message.FLOP.FDIV.content || message.FLOP.FDIV.VALUE);
} else {
return message.FLOP.FFID + '航班备降,备降原因:' + message.FLOP.FDIV.content || message.FLOP.FDIV.VALUE;
return message.FLOP.FFID + '航班备降,备降原因:' + (message.FLOP.FDIV.content || message.FLOP.FDIV.VALUE);
}
}
public flopFdel(message, airports) {
return message.FLOP.FFID + '航班被删除了'
}
public flopDely(message, airports) {
return message.FLOP.FFID + '航班延误' + message.FLOP.DELY.DURA + '分钟;延误码:' + message.FLOP.DELY.CODE + ';延误信息:' + message.FLOP.DELY.content || message.FLOP.DELY.VALUE
let delyArray = message.FLOP.DELY;
let delyMessage = delyArray[delyArray.length - 1];
return message.FLOP.FFID + '航班延误' + (parseInt(delyMessage.DURA.substr(0, 2)) * 60 + parseInt(delyMessage.DURA.substr(2, 3))) + '分钟;延误码:' + delyMessage.CODE + '; 延误信息:' + (delyMessage.content || delyMessage.VALUE)
}
public flopActt(message, airports) {
return message.FLOP.FFID + '航班实际时间:' + dateFormatter(message.FLOP.ACTT);
}
public flopGtdt(message, airports) {
return message.FLOP.FFID + '登机门分配为:' + message.FLOP.GTDT.GATE
if (Array.isArray(message.FLOP['GTDT']) && message.FLOP['GTDT'].length > 0) {
let gate = [];
for (let i = 0; i < message.FLOP['GTDT'].length; i++) {
gate.push(message.FLOP['GTDT'][i]['GATE']);
}
let set = new Set(gate);
return message.FLOP.FFID + '登机门分配为:' + Array.from(set).join(',');
} else if (Object.prototype.toString.call(message.FLOP['GTDT']) === '[object Object]') {
return message.FLOP.FFID + '登机门分配为:' + message.FLOP['GTDT']['GATE'];
} else {
return message.FLOP.FFID + '登机门分配为:';
}
}
public flopPsdt(message, airports) {
if (Array.isArray(message.FLOP['PSDT']) && message.FLOP['PSDT'].length > 0) {
@@ -140,27 +153,27 @@ export class AlertMessageHandle {
return message.FLOP.FFID + '航线更改为:' + rout.join(' - ');
}
public flopVipp(message, airports, citys) {
return message.FLOP.FFID + 'VIP旅客:' + message.FLOP.VIPP + '';
return message.FLOP.FFID + 'VIP旅客:' + (message.FLOP.VIPP || '');
}
public flopHnag() {
return '航班代理事件';
}
public flopFlbg(message,airports,citys) {
public flopFlbg(message, airports, citys) {
return message.FLOP.FFID + '首末件行李到达时间消息';
}
public flopReno(message,airports,citys) {
return message.FLOP.FFID + '更换飞机号:' + message.FLOP.RENO;
public flopReno(message, airports, citys) {
return message.FLOP.FFID + '更换飞机号:' + message.FLOP.RENO;
}
public flopAbtm(message,airports,citys) {
public flopAbtm(message, airports, citys) {
return message.FLOP.FFID + '靠桥撤桥消息';
}
public flopChot(message,airports,citys) {
public flopChot(message, airports, citys) {
return message.FLOP.FFID + '上下轮档消息';
}
public flopTrml(message,airports,citys) {
return message.FLOP.FFID + '航站楼:' + message.FLOP.TRML;
public flopTrml(message, airports, citys) {
return message.FLOP.FFID + '航站楼:' + message.FLOP.TRML;
}
public schdDnld(message,airports,citys){
public schdDnld(message, airports, citys) {
return '收到日航班计划';
}
}
+33 -3
View File
@@ -1,4 +1,4 @@
export default function (dynamicData) {
export default function (dynamicData?) {
if (typeof Object.assign != 'function') {
// Must be writable: true, enumerable: false, configurable: true
Object.defineProperty(Object, "assign", {
@@ -30,13 +30,38 @@ export default function (dynamicData) {
}
let raw_data = dynamicData.raw_data,
let messageArray = dynamicData.message,
airlinesSelections = dynamicData.airlinesSelections,
flightTypeSelections = dynamicData.flightTypeSelections,
raw_data = dynamicData.raw_data,
col_lists = dynamicData.col_lists,
airports = dynamicData.airports,
citys = dynamicData.citys,
airlines = dynamicData.airlines,
flightStatus = dynamicData.flightStatus,
flightTypes = dynamicData.flightTypes
if (messageArray && Array.isArray(messageArray) && messageArray.length > 0) {
messageArray.forEach(message => {
let index = raw_data.findIndex(element => element['FLID'] === message.FLID);
if (index > -1) {
raw_data[index] = message;
} else {
raw_data.push(message);
}
if (airlinesSelections.findIndex(airline => airline.airlineCodeIata === message['ALCD']) === -1) {
let index = airlines.findIndex(val => val.airlineCodeIata === message['ALCD']);
airlinesSelections.push(airlines[index]);
}
if (flightTypeSelections.findIndex(flightType => flightType.flightTypeCode === message['FLTY']) === -1) {
let index = flightTypes.findIndex(val => val.flightTypeCode === message['FLTY']);
flightTypeSelections.push(flightTypes[index]);
}
})
}
/**
* 时间转换
* @param dataString
@@ -1101,5 +1126,10 @@ export default function (dynamicData) {
return (a['ORDER'] - b['ORDER']);
})
return combined_data;
return {
"raw_data": raw_data,
"airlinesSelections": airlinesSelections,
"flightTypeSelections": flightTypeSelections,
"combined_data": combined_data,
};
}