修复完善登机桥关联更新。只取最后计划机位的登机桥信息
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
package com.gzzn.omms.msgexchangeapi.msghandler.flop;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.gzzn.omms.msgexchangeapi.basicdata.entity.OrmsStand;
|
||||
import com.gzzn.omms.msgexchangeapi.basicdata.manager.OrmsStandAirbridgeManager;
|
||||
@@ -34,6 +36,7 @@ public class PSDTHandler extends FlopBaseHandler {
|
||||
return fltr;
|
||||
}
|
||||
|
||||
|
||||
//先保存当前航班机位数据
|
||||
if(!CollectionUtils.isEmpty(fltr.getPSDT()))
|
||||
{
|
||||
@@ -43,37 +46,74 @@ public class PSDTHandler extends FlopBaseHandler {
|
||||
|
||||
//更新计划机位
|
||||
fltr.getPSDT().clear(); //清空旧数据
|
||||
for(OPTSTANDDATA optStandata : flop.getPSDT() )
|
||||
|
||||
//
|
||||
if(!isClearPsdtMsg(flop.getPSDT()) )
|
||||
{
|
||||
STANDDATA standata = new STANDDATA();
|
||||
BeanUtils.copyProperties(optStandata, standata);
|
||||
|
||||
fltr.getPSDT().add(standata);
|
||||
}
|
||||
for(OPTSTANDDATA optStandata : flop.getPSDT() )
|
||||
{
|
||||
STANDDATA standata = new STANDDATA();
|
||||
BeanUtils.copyProperties(optStandata, standata);
|
||||
|
||||
fltr.getPSDT().add(standata);
|
||||
}
|
||||
} //end if
|
||||
|
||||
|
||||
//更新登机桥信息
|
||||
return updateAbg(fltr,flop.getPSDT());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断是否清空计划机位事件,内容为空的情况,<PSDT PSNO = "0"></PSDT>
|
||||
* @param flop 航班事件
|
||||
* @return true 清空计划航班事件 ,false 非清空计划航班事件
|
||||
*/
|
||||
private Boolean isClearPsdtMsg(List<OPTSTANDDATA> lsOptstanddata)
|
||||
{
|
||||
return (
|
||||
lsOptstanddata.size() == 1
|
||||
&& lsOptstanddata.get(0).getPSNO().equals(new BigInteger("0"))
|
||||
&& StringUtils.isEmpty(lsOptstanddata.get(0).getPSST())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断计划机位是否相等
|
||||
* @param psdt 原机位信息
|
||||
* @param optPsdt 新机位信息
|
||||
* @return
|
||||
* @return true 相同,false 不相同
|
||||
*/
|
||||
private Boolean isTheSamePSDT(List<STANDDATA> psdt ,List<OPTSTANDDATA> optPsdt)
|
||||
{
|
||||
//特殊处理清空航班事件
|
||||
if(
|
||||
isClearPsdtMsg(optPsdt)
|
||||
&&
|
||||
CollectionUtils.isEmpty(psdt)
|
||||
)
|
||||
{
|
||||
return true;//当前为清除机位信息,同时当前机位信息为空
|
||||
}
|
||||
|
||||
//不相等,必然不同
|
||||
if (psdt.size() != optPsdt.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
psdt.sort((node1,node2)-> node1.getPSST().compareTo(node2.getPSST()));
|
||||
optPsdt.sort((node1,node2)-> node1.getPSST().compareTo(node2.getPSST()));
|
||||
|
||||
//生成序列比较是否相等
|
||||
StringBuffer strPsdt = new StringBuffer();
|
||||
StringBuilder strPsdt = new StringBuilder();
|
||||
psdt.forEach(node->{
|
||||
strPsdt.append(node.getPSST());
|
||||
strPsdt.append(",");
|
||||
});
|
||||
|
||||
StringBuffer strOptPsdt = new StringBuffer();
|
||||
StringBuilder strOptPsdt = new StringBuilder();
|
||||
optPsdt.forEach(node->{
|
||||
strOptPsdt.append(node.getPSST());
|
||||
strOptPsdt.append(",");
|
||||
@@ -88,19 +128,25 @@ public class PSDTHandler extends FlopBaseHandler {
|
||||
*/
|
||||
private String getPsdtAsStr(List<STANDDATA> lsStanddata)
|
||||
{
|
||||
//先保存当前航班机位数据
|
||||
String lpsdt="";
|
||||
for(STANDDATA node : lsStanddata)
|
||||
if(CollectionUtils.isEmpty(lsStanddata))
|
||||
{
|
||||
lpsdt += node.getPSST();
|
||||
lpsdt += ",";
|
||||
}
|
||||
if(lpsdt.endsWith(","))
|
||||
{
|
||||
lpsdt = lpsdt.substring(0, lpsdt.length() - 1);
|
||||
return "";
|
||||
}
|
||||
|
||||
return lpsdt;
|
||||
|
||||
//先保存当前航班机位数据
|
||||
StringBuilder lpsdt= new StringBuilder();
|
||||
for(STANDDATA node : lsStanddata)
|
||||
{
|
||||
lpsdt.append(node.getPSST());
|
||||
lpsdt.append(",");
|
||||
}
|
||||
if(lpsdt.toString().endsWith(","))
|
||||
{
|
||||
lpsdt.deleteCharAt(lpsdt.length()-1);
|
||||
}
|
||||
|
||||
return lpsdt.toString();
|
||||
}//end function
|
||||
|
||||
/**
|
||||
@@ -110,51 +156,66 @@ public class PSDTHandler extends FlopBaseHandler {
|
||||
*/
|
||||
private SCHD.FLTR updateAbg(SCHD.FLTR fltr,List<OPTSTANDDATA> lsOptstanddata)
|
||||
{
|
||||
for(OPTSTANDDATA optStandata : lsOptstanddata ) {
|
||||
STANDDATA standata = new STANDDATA();
|
||||
BeanUtils.copyProperties(optStandata, standata);
|
||||
|
||||
try {
|
||||
//获取机位
|
||||
OrmsStand ormsStand = OrmsStandManager
|
||||
.getInstance()
|
||||
.getOrmsStandByStandCode(standata.getPSST());
|
||||
if(null == ormsStand)
|
||||
{
|
||||
logger.error("机位:{},基础数据获取失败",standata.getPSST());
|
||||
continue;
|
||||
}
|
||||
|
||||
//获取机位对应的登机桥
|
||||
if("near".equalsIgnoreCase(ormsStand.getStandType()) == false)
|
||||
{
|
||||
//远机位,清空登机桥信息
|
||||
fltr.setAbdg("");
|
||||
}
|
||||
|
||||
//近机位处理
|
||||
String standCode = standata.getPSST();//登机桥
|
||||
|
||||
|
||||
List<String> lsBridge = OrmsStandAirbridgeManager
|
||||
.getInstance()
|
||||
.getAirbridgeCodeByStandCodeCode(standCode);
|
||||
//
|
||||
StringBuffer abdgBuffer = new StringBuffer();
|
||||
lsBridge.forEach(node->{
|
||||
abdgBuffer.append(node);
|
||||
abdgBuffer.append(",");
|
||||
});
|
||||
if(abdgBuffer.toString().endsWith(","))
|
||||
{
|
||||
abdgBuffer.deleteCharAt(abdgBuffer.length() - 1);
|
||||
}
|
||||
|
||||
fltr.setAbdg(abdgBuffer.toString());//登机桥叠加
|
||||
} catch (Exception e) {
|
||||
logger.error("获取登机桥信息失败,msg:{},trace:{}",e.getMessage(),e);
|
||||
//清空计划机位事件,同时清除登机桥信息
|
||||
if (isClearPsdtMsg(lsOptstanddata)) {
|
||||
fltr.setAbdg("");
|
||||
return fltr;
|
||||
}
|
||||
|
||||
|
||||
//多个机位信息,取最后一个机位的登机桥信息
|
||||
if (CollectionUtils.isEmpty(lsOptstanddata)) {
|
||||
return fltr;
|
||||
}//end if
|
||||
|
||||
|
||||
|
||||
OPTSTANDDATA optStandata = lsOptstanddata.get(lsOptstanddata.size() - 1);
|
||||
STANDDATA standata = new STANDDATA();
|
||||
BeanUtils.copyProperties(optStandata, standata);
|
||||
|
||||
|
||||
//获取机位
|
||||
OrmsStand ormsStand = OrmsStandManager
|
||||
.getInstance()
|
||||
.getOrmsStandByStandCode(standata.getPSST());
|
||||
if(null == ormsStand)
|
||||
{
|
||||
logger.error("机位:{},基础数据获取失败",standata.getPSST());
|
||||
return fltr;
|
||||
}
|
||||
|
||||
//远机位,清空登机桥信息
|
||||
if("near".equalsIgnoreCase(ormsStand.getStandType()) == false)
|
||||
{
|
||||
fltr.setAbdg("");
|
||||
return fltr;
|
||||
}
|
||||
|
||||
|
||||
//近机位,获取登机桥
|
||||
String standCode = standata.getPSST();//登机桥
|
||||
|
||||
try {
|
||||
List<String> lsBridge = OrmsStandAirbridgeManager
|
||||
.getInstance()
|
||||
.getAirbridgeCodeByStandCodeCode(standCode);
|
||||
//
|
||||
StringBuilder abdgBuffer = new StringBuilder();
|
||||
lsBridge.forEach(node->{
|
||||
abdgBuffer.append(node);
|
||||
abdgBuffer.append(",");
|
||||
});
|
||||
if(abdgBuffer.toString().endsWith(","))
|
||||
{
|
||||
abdgBuffer.deleteCharAt(abdgBuffer.length() - 1);
|
||||
}
|
||||
}//end for
|
||||
|
||||
fltr.setAbdg(abdgBuffer.toString());//登机桥叠加
|
||||
return fltr;
|
||||
} catch (Exception e) {
|
||||
logger.error("msg:{},trace:{}",e.getMessage(),e);
|
||||
}
|
||||
|
||||
return fltr;
|
||||
} //end function
|
||||
|
||||
Reference in New Issue
Block a user