航班定位实现

This commit is contained in:
zhouyuejun
2019-02-14 14:45:40 +08:00
parent 33a685e4ce
commit 107494c097
18 changed files with 412 additions and 1573 deletions
+49 -41
View File
@@ -1,6 +1,7 @@
import timeFormatter from './time-formatter';
import dateWithNotimeFormatter from './date-with-notime-formatter';
import { Utils } from './utils'
export class TransferRenderHandle {
private utils = new Utils();
public arsfFormatter(flight) {
if (flight['MVIN'] === 'A') {
if (Array.isArray(flight['MAFL']) && flight['MAFL'].length > 0) {
@@ -59,9 +60,16 @@ export class TransferRenderHandle {
public gctmFormatter(flight) {
if (flight['GTDT']) {
if (Array.isArray(flight['GTDT']) && flight['GTDT'].length > 0) {
return timeFormatter(flight['GTDT'][0]['GCTM']);
let gtdt = flight['GTDT'];
gtdt.forEach(element => {
});
return this.utils.timeFormatter(flight['GTDT'][0]['GCTM']);
} else if (Object.prototype.toString.call(flight['GTDT']) === '[object Object]') {
return timeFormatter(flight['GTDT']['GCTM']);
return this.utils.timeFormatter(flight['GTDT']['GCTM']);
} else {
return '';
}
@@ -71,7 +79,7 @@ export class TransferRenderHandle {
}
public botmFormatter(flight) {
if (flight['BOTM']) {
return timeFormatter(flight['BOTM']);
return this.utils.timeFormatter(flight['BOTM']);
} else {
return '';
}
@@ -99,12 +107,12 @@ export class TransferRenderHandle {
if (Array.isArray(flight['ABTM']) && flight['ABTM'].length > 0) {
for (let i = 0; i < flight['ABTM'].length; i++) {
if (flight['ABTM'][i]['ABOP'] === 'A') {
return timeFormatter(flight['ABTM'][i]['AOTM']);
return this.utils.timeFormatter(flight['ABTM'][i]['AOTM']);
}
}
} else if (Object.prototype.toString.call(flight['ABTM']) === '[object Object]') {
if (flight['ABTM']['ABOP'] === 'A') {
return timeFormatter(flight['ABTM']['AOTM']);
return this.utils.timeFormatter(flight['ABTM']['AOTM']);
} else {
return '';
}
@@ -121,12 +129,12 @@ export class TransferRenderHandle {
if (Array.isArray(flight['ABTM']) && flight['ABTM'].length > 0) {
for (let i = 0; i < flight['ABTM'].length; i++) {
if (flight['ABTM'][i]['ABOP'] === 'D') {
return timeFormatter(flight['ABTM'][i]['AOTM']);
return this.utils.timeFormatter(flight['ABTM'][i]['AOTM']);
}
}
} else if (Object.prototype.toString.call(flight['ABTM']) === '[object Object]') {
if (flight['ABTM']['ABOP'] === 'D') {
return timeFormatter(flight['ABTM']['AOTM']);
return this.utils.timeFormatter(flight['ABTM']['AOTM']);
} else {
return '';
}
@@ -177,9 +185,9 @@ export class TransferRenderHandle {
public cctmFormatter(flight) {
if (flight['CKDT']) {
if (Array.isArray(flight['CKDT']) && flight['CKDT'].length > 0) {
return timeFormatter(flight['CKDT'][0]['CCTM']);
return this.utils.timeFormatter(flight['CKDT'][0]['CCTM']);
} else if (Object.prototype.toString.call(flight['CKDT']) === '[object Object]') {
return timeFormatter(flight['CKDT']['CCTM']);
return this.utils.timeFormatter(flight['CKDT']['CCTM']);
} else {
return '';
}
@@ -190,9 +198,9 @@ export class TransferRenderHandle {
public cotmFormatter(flight) {
if (flight['CKDT']) {
if (Array.isArray(flight['CKDT']) && flight['CKDT'].length > 0) {
return timeFormatter(flight['CKDT'][0]['COTM']);
return this.utils.timeFormatter(flight['CKDT'][0]['COTM']);
} else if (Object.prototype.toString.call(flight['CKDT']) === '[object Object]') {
return timeFormatter(flight['CKDT']['COTM']);
return this.utils.timeFormatter(flight['CKDT']['COTM']);
} else {
return '';
}
@@ -205,12 +213,12 @@ export class TransferRenderHandle {
if (Array.isArray(flight['CHOT']) && flight['CHOT'].length > 0) {
for (let i = 0; i < flight['CHOT'].length; i++) {
if (flight['CHOT'][i]['CHID'] === 'ON') {
return timeFormatter(flight['CHOT'][i]['CHTM']);
return this.utils.timeFormatter(flight['CHOT'][i]['CHTM']);
}
}
} else if (Object.prototype.toString.call(flight['CHOT']) === '[object Object]') {
if (flight['CHOT']['CHID'] === 'ON') {
return timeFormatter(flight['CHOT']['CHTM']);
return this.utils.timeFormatter(flight['CHOT']['CHTM']);
} else {
return '';
}
@@ -226,12 +234,12 @@ export class TransferRenderHandle {
if (Array.isArray(flight['CHOT']) && flight['CHOT'].length > 0) {
for (let i = 0; i < flight['CHOT'].length; i++) {
if (flight['CHOT'][i]['CHID'] === 'OFF') {
return timeFormatter(flight['CHOT'][i]['CHTM']);
return this.utils.timeFormatter(flight['CHOT'][i]['CHTM']);
}
}
} else if (Object.prototype.toString.call(flight['CHOT']) === '[object Object]') {
if (flight['CHOT']['CHID'] === 'OFF') {
return timeFormatter(flight['CHOT']['CHTM']);
return this.utils.timeFormatter(flight['CHOT']['CHTM']);
} else {
return '';
}
@@ -244,7 +252,7 @@ export class TransferRenderHandle {
}
public laclFormatter(flight) {
if (flight['LACL']) {
return timeFormatter(flight['LACL']);
return this.utils.timeFormatter(flight['LACL']);
} else {
return '';
}
@@ -269,7 +277,7 @@ export class TransferRenderHandle {
}
public acttFormatter(flight) {
if (flight['ACTT']) {
return timeFormatter(flight['ACTT']);
return this.utils.timeFormatter(flight['ACTT']);
} else {
return '';
}
@@ -320,7 +328,7 @@ export class TransferRenderHandle {
}
public esttFormatter(flight) {
if (flight['ESTT']) {
return timeFormatter(flight['ESTT']);
return this.utils.timeFormatter(flight['ESTT']);
} else {
return '';
}
@@ -368,7 +376,7 @@ export class TransferRenderHandle {
}
public sodtFormatter(flight) {
if (flight['SODT']) {
return timeFormatter(flight['SODT']);
return this.utils.timeFormatter(flight['SODT']);
} else {
return '';
}
@@ -396,45 +404,45 @@ export class TransferRenderHandle {
if (flight['PADT']) {
if (Array.isArray(flight['ROUT']) && flight['ROUT'].length > 0) {
let lastRout = flight['ROUT'][flight['ROUT'].length - 1];
if (lastRout['SCDT']){
return timeFormatter(flight['PADT']) + '(' + timeFormatter(lastRout['SCDT']) + ')';
}else{
return timeFormatter(flight['PADT']);
if (lastRout['SCDT']) {
return this.utils.timeFormatter(flight['PADT']) + '(' + this.utils.timeFormatter(lastRout['SCDT']) + ')';
} else {
return this.utils.timeFormatter(flight['PADT']);
}
} else if (Object.prototype.toString.call(flight['ROUT']) === '[object Object]') {
if (flight['ROUT']['SCDT']){
return timeFormatter(flight['PADT']) + '(' + timeFormatter(flight['ROUT']['SCDT']) + ')';
}else{
return timeFormatter(flight['PADT']);
if (flight['ROUT']['SCDT']) {
return this.utils.timeFormatter(flight['PADT']) + '(' + this.utils.timeFormatter(flight['ROUT']['SCDT']) + ')';
} else {
return this.utils.timeFormatter(flight['PADT']);
}
}else{
return timeFormatter(flight['PADT']);
} else {
return this.utils.timeFormatter(flight['PADT']);
}
} else {
if (Array.isArray(flight['ROUT']) && flight['ROUT'].length > 0) {
let lastRout = flight['ROUT'][flight['ROUT'].length - 1];
if (lastRout['SCDT']){
return '(' + timeFormatter(lastRout['SCDT']) + ')';
}else{
if (lastRout['SCDT']) {
return '(' + this.utils.timeFormatter(lastRout['SCDT']) + ')';
} else {
return '';
}
} else if (Object.prototype.toString.call(flight['ROUT']) === '[object Object]') {
if (flight['ROUT']['SCDT']){
return '(' + timeFormatter(flight['ROUT']['SCDT']) + ')';
}else{
if (flight['ROUT']['SCDT']) {
return '(' + this.utils.timeFormatter(flight['ROUT']['SCDT']) + ')';
} else {
return '';
}
}else{
return '';
} else {
return '';
}
}
}else{
} else {
return '';
}
}
public fldtFormatter(flight) {
if (flight['SODT']) {
return dateWithNotimeFormatter(flight['SODT']);
return this.utils.dateWithoutTime(flight['SODT']);
} else {
return '';
}