优化worker处理及航线修改为简称

This commit is contained in:
zhouyuejun
2019-01-09 19:21:07 +08:00
parent 6f486bad94
commit ec59a1dc4c
10 changed files with 1321 additions and 72 deletions
+100 -10
View File
@@ -27,13 +27,42 @@ export class FlightsDataHandle {
'SODT': this.transferHandle.sodtFormatter.bind(this.transferHandle),
'GTDT': this.transferHandle.gateFormatter.bind(this.transferHandle),
'PADT': this.transferHandle.padtFormatter.bind(this.transferHandle),
'FLDT':this.transferHandle.fldtFormatter.bind(this.transferHandle)
'FLDT': this.transferHandle.fldtFormatter.bind(this.transferHandle)
}
public orderHandle = new DynamicFlightOrder();
public findLinkFlights(raw_flights) {
if (typeof Object.assign != 'function') {
// Must be writable: true, enumerable: false, configurable: true
Object.defineProperty(Object, "assign", {
value: function assign(target, varArgs) { // .length of function is 2
'use strict';
if (target == null) { // TypeError if undefined or null
throw new TypeError('Cannot convert undefined or null to object');
}
var to = Object(target);
for (var index = 1; index < arguments.length; index++) {
var nextSource = arguments[index];
if (nextSource != null) { // Skip over if undefined or null
for (var nextKey in nextSource) {
// Avoid bugs when hasOwnProperty is shadowed
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
to[nextKey] = nextSource[nextKey];
}
}
}
}
return to;
},
writable: true,
configurable: true
});
}
let combined_raw_flights: Array<any> = [];
let copy_raw_flights = [];
raw_flights.forEach(element => {
@@ -76,6 +105,35 @@ export class FlightsDataHandle {
}
public flightsRenderTransfer(item, col_lists) {
if (typeof Object.assign != 'function') {
// Must be writable: true, enumerable: false, configurable: true
Object.defineProperty(Object, "assign", {
value: function assign(target, varArgs) { // .length of function is 2
'use strict';
if (target == null) { // TypeError if undefined or null
throw new TypeError('Cannot convert undefined or null to object');
}
var to = Object(target);
for (var index = 1; index < arguments.length; index++) {
var nextSource = arguments[index];
if (nextSource != null) { // Skip over if undefined or null
for (var nextKey in nextSource) {
// Avoid bugs when hasOwnProperty is shadowed
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
to[nextKey] = nextSource[nextKey];
}
}
}
}
return to;
},
writable: true,
configurable: true
});
}
let render_flight = {},
render_pre_flight = {},
render_rea_flight = {},
@@ -125,7 +183,11 @@ export class FlightsDataHandle {
}
} else if (preHasValue && reaHasValue) {
if (preHasValue === reaHasValue) {
render_flight[key] = preHasValue;
if(key==='FLNO'){
render_flight[key] = preHasValue + ' / ' + reaHasValue;
}else{
render_flight[key] = preHasValue;
}
} else {
if (key === 'ERUT') {
render_flight[key] = preHasValue.split(' - ').slice(0, -1).join(' - ') + ' - ' + reaHasValue;
@@ -160,8 +222,15 @@ export class FlightsDataHandle {
for (let i = 0; i < erutCodeArray.length; i++) {
try {
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutCodeArray[i]);
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
erutChnArray.push(citys[cityIndex].cityNameChn);
if(airportIndex>-1){
if(airports[airportIndex].briefNameChn){
erutChnArray.push(airports[airportIndex].briefNameChn);
}else{
erutChnArray.push(airports[airportIndex].airportNameChn);
}
}else{
erutChnArray.push(erutCodeArray[i]);
}
} catch (error) {
erutChnArray.push(erutCodeArray[i]);
}
@@ -181,8 +250,15 @@ export class FlightsDataHandle {
for (let i = 0; i < erutLinkCodeArray.length; i++) {
try {
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutLinkCodeArray[i]);
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
erutLinkChnArray.push(citys[cityIndex].cityNameChn);
if(airportIndex>-1){
if(airports[airportIndex].briefNameChn){
erutLinkChnArray.push(airports[airportIndex].briefNameChn);
}else{
erutLinkChnArray.push(airports[airportIndex].airportNameChn);
}
}else{
erutLinkChnArray.push(erutLinkCodeArray[i]);
}
} catch (error) {
erutLinkChnArray.push(erutLinkCodeArray[i]);
}
@@ -213,8 +289,15 @@ export class FlightsDataHandle {
for (let i = 0; i < erutPreCodeArray.length; i++) {
try {
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutPreCodeArray[i]);
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
erutPreChnArray.push(citys[cityIndex].cityNameChn);
if(airportIndex>-1){
if(airports[airportIndex].briefNameChn){
erutPreChnArray.push(airports[airportIndex].briefNameChn);
}else{
erutPreChnArray.push(airports[airportIndex].airportNameChn);
}
}else{
erutPreChnArray.push(erutPreCodeArray[i]);
}
} catch (error) {
erutPreChnArray.push(erutPreCodeArray[i]);
}
@@ -235,8 +318,15 @@ export class FlightsDataHandle {
for (let i = 0; i < erutReaCodeArray.length; i++) {
try {
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutReaCodeArray[i]);
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
erutReaChnArray.push(citys[cityIndex].cityNameChn);
if(airportIndex>-1){
if(airports[airportIndex].briefNameChn){
erutReaChnArray.push(airports[airportIndex].briefNameChn);
}else{
erutReaChnArray.push(airports[airportIndex].airportNameChn);
}
}else{
erutReaChnArray.push(erutReaCodeArray[i]);
}
} catch (error) {
erutReaChnArray.push(erutReaCodeArray[i]);
}