完善计划机位和登机桥联动变更,同时加入基础数据缓存

This commit is contained in:
zhouxiunai
2019-01-28 15:46:06 +08:00
parent 3373457171
commit 9f80b92587
9 changed files with 478 additions and 9 deletions
@@ -0,0 +1,281 @@
package com.gzzn.omms.msgexchangeapi.basicdata.entity;
import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
/**
* 机位
* @author zhouxiunai
*/
public class OrmsStand {
private String standCode; //停机位号
private BigDecimal currentFlightId; //当前航班ID
private String ddgt; //该机位默认的国内登机门
private String digt; //该机位默认的国际登机门
private String fstandCode; //父停机位号
private BigDecimal iconLength; //资源图标长度(单位:像素)
private BigDecimal iconWidth; //资源图标宽度(单位:像素)
private String lstandCode;
private BigDecimal maxPermit; //该停机位可容纳的最大旅客数/最大翼展
private BigDecimal maxflightnum; //最大可停靠航班数
private BigDecimal operate;
private String pierCode; //指廊代码
private BigDecimal posX; //坐标位置的X值
private BigDecimal posY; //坐标位置的Y值
private String rstandCode;
private String satc; //该停机位可以停放的最大机型种类
private String standAreaCode; //停机位区域代码
private BigDecimal standLayouted; //资源已布局标志:1-已布局 0-未布局
private BigDecimal standLength; //停机位长度(单位:米)
private String standName; //停机位名称
private BigDecimal standOrder; //停机位顺序号
private BigDecimal standStatus; //停机位状态(0-可用、1-在用、2-锁定、3-禁用、4-预分...)
//停机位类别可取值:bridge-靠桥机位、remote-远机位、near-近机位、night-过夜机位、specific-专机位...
private String standType;
private BigDecimal standWidth; //停机位宽度
private String stml; //航站楼代码
private String terminalAreaCode; //航站楼区域代码
public OrmsStand() {
}
public String getStandCode() {
return this.standCode;
}
public void setStandCode(String standCode) {
this.standCode = standCode;
}
public BigDecimal getCurrentFlightId() {
return this.currentFlightId;
}
public void setCurrentFlightId(BigDecimal currentFlightId) {
this.currentFlightId = currentFlightId;
}
public String getDdgt() {
return this.ddgt;
}
public void setDdgt(String ddgt) {
this.ddgt = ddgt;
}
public String getDigt() {
return this.digt;
}
public void setDigt(String digt) {
this.digt = digt;
}
public String getFstandCode() {
return this.fstandCode;
}
public void setFstandCode(String fstandCode) {
this.fstandCode = fstandCode;
}
public BigDecimal getIconLength() {
return this.iconLength;
}
public void setIconLength(BigDecimal iconLength) {
this.iconLength = iconLength;
}
public BigDecimal getIconWidth() {
return this.iconWidth;
}
public void setIconWidth(BigDecimal iconWidth) {
this.iconWidth = iconWidth;
}
public String getLstandCode() {
return this.lstandCode;
}
public void setLstandCode(String lstandCode) {
this.lstandCode = lstandCode;
}
public BigDecimal getMaxPermit() {
return this.maxPermit;
}
public void setMaxPermit(BigDecimal maxPermit) {
this.maxPermit = maxPermit;
}
public BigDecimal getMaxflightnum() {
return this.maxflightnum;
}
public void setMaxflightnum(BigDecimal maxflightnum) {
this.maxflightnum = maxflightnum;
}
public BigDecimal getOperate() {
return this.operate;
}
public void setOperate(BigDecimal operate) {
this.operate = operate;
}
public String getPierCode() {
return this.pierCode;
}
public void setPierCode(String pierCode) {
this.pierCode = pierCode;
}
public BigDecimal getPosX() {
return this.posX;
}
public void setPosX(BigDecimal posX) {
this.posX = posX;
}
public BigDecimal getPosY() {
return this.posY;
}
public void setPosY(BigDecimal posY) {
this.posY = posY;
}
public String getRstandCode() {
return this.rstandCode;
}
public void setRstandCode(String rstandCode) {
this.rstandCode = rstandCode;
}
public String getSatc() {
return this.satc;
}
public void setSatc(String satc) {
this.satc = satc;
}
public String getStandAreaCode() {
return this.standAreaCode;
}
public void setStandAreaCode(String standAreaCode) {
this.standAreaCode = standAreaCode;
}
public BigDecimal getStandLayouted() {
return this.standLayouted;
}
public void setStandLayouted(BigDecimal standLayouted) {
this.standLayouted = standLayouted;
}
public BigDecimal getStandLength() {
return this.standLength;
}
public void setStandLength(BigDecimal standLength) {
this.standLength = standLength;
}
public String getStandName() {
return this.standName;
}
public void setStandName(String standName) {
this.standName = standName;
}
public BigDecimal getStandOrder() {
return this.standOrder;
}
public void setStandOrder(BigDecimal standOrder) {
this.standOrder = standOrder;
}
public BigDecimal getStandStatus() {
return this.standStatus;
}
public void setStandStatus(BigDecimal standStatus) {
this.standStatus = standStatus;
}
public String getStandType() {
return this.standType;
}
public void setStandType(String standType) {
this.standType = standType;
}
public BigDecimal getStandWidth() {
return this.standWidth;
}
public void setStandWidth(BigDecimal standWidth) {
this.standWidth = standWidth;
}
public String getStml() {
return this.stml;
}
public void setStml(String stml) {
this.stml = stml;
}
public String getTerminalAreaCode() {
return this.terminalAreaCode;
}
public void setTerminalAreaCode(String terminalAreaCode) {
this.terminalAreaCode = terminalAreaCode;
}
}
@@ -0,0 +1,56 @@
package com.gzzn.omms.msgexchangeapi.basicdata.manager;
import java.util.Hashtable;
import java.util.List;
import com.gzzn.omms.msgexchangeapi.basicdata.entity.OrmsStand;
import com.gzzn.omms.msgexchangeapi.basicdata.service.IOrmsStandService;
import com.gzzn.omms.msgexchangeapi.utils.SpringUtil;
/**
* 登记位基础数据管理
* @author zhouxiunai
*
*/
public class OrmsStandManager {
private static Hashtable dataCache = null;
private static OrmsStandManager instance = new OrmsStandManager();
private OrmsStandManager()
{
}
public static OrmsStandManager getInstance()
{
return instance;
}
public OrmsStand getOrmsStandByStandCode(String standCode)
{
OrmsStand ormsStand = null;
synchronized (OrmsStandManager.class) {
if(null == dataCache)
{
//远程获取
IOrmsStandService ormsStandService = (IOrmsStandService) SpringUtil
.getBean("ormsStandService");
List<OrmsStand> lsOrmsStand = ormsStandService.findAll();
dataCache = new Hashtable<>();
for(OrmsStand node: lsOrmsStand)
{
dataCache.put(node.getStandCode(), node);
}
}
//本地获取
ormsStand = (OrmsStand) dataCache.get(standCode);
}
return ormsStand;
}
}
@@ -0,0 +1,18 @@
package com.gzzn.omms.msgexchangeapi.basicdata.service;
import java.util.List;
import com.gzzn.omms.msgexchangeapi.basicdata.entity.OrmsStand;
/**
* 停机位service
* @author zhouxiunai
*
*/
public interface IOrmsStandService {
/**
* 获取所有停机位信息
* @return
*/
public List<OrmsStand> findAll();
}
@@ -0,0 +1,39 @@
package com.gzzn.omms.msgexchangeapi.basicdata.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import com.gzzn.omms.msgexchangeapi.basicdata.entity.OrmsStand;
import com.gzzn.omms.msgexchangeapi.dto.ResponseDto;
@Service("ormsStandService")
public class OrmsStandServiceImpl implements IOrmsStandService{
@Value("${adminApi.ormsStandsUrl}")
private String ormsStandsUrl;
@Autowired
private RestTemplate restTemplate;
@Override
public List<OrmsStand> findAll() {
ResponseEntity<ResponseDto> responseEntity = restTemplate
.getForEntity(
ormsStandsUrl,
ResponseDto.class);
ResponseDto responseDto = responseEntity.getBody();
if (responseDto.getIs_success()) {
List<OrmsStand> rt = (List<OrmsStand>)responseDto.getBody();
return rt;
}
else {
throw new RuntimeException("未知错误"+responseDto.getErr_msg());
}
}//end function
}
@@ -0,0 +1,25 @@
package com.gzzn.omms.msgexchangeapi.config;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
@Configuration
public class RestTemplateConfig {
@Bean
@LoadBalanced
public RestTemplate restTemplate(ClientHttpRequestFactory factory){
return new RestTemplate(factory);
}
@Bean
public ClientHttpRequestFactory simpleClientHttpRequestFactory(){
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
factory.setReadTimeout(5000);//单位为ms
factory.setConnectTimeout(5000);//单位为ms
return factory;
}
}
@@ -4,6 +4,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import com.gzzn.omms.msgexchangeapi.basicdata.entity.OrmsStand;
import com.gzzn.omms.msgexchangeapi.basicdata.manager.OrmsStandManager;
import com.gzzn.omms.msgexchangeapi.entity.msg.FLOP;
import com.gzzn.omms.msgexchangeapi.entity.msg.OPTSTANDDATA;
import com.gzzn.omms.msgexchangeapi.entity.msg.SCHD;
@@ -43,11 +45,24 @@ public class PSDTHandler extends FlopBaseHandler {
BeanUtils.copyProperties(optStandata, standata);
fltr.getPSDT().add(standata);
//如果是近机位
OrmsStand ormsStand = OrmsStandManager
.getInstance()
.getOrmsStandByStandCode(standata.getPSST());
if(null == ormsStand)
{
logger.error("机位:{},基础数据获取失败",standata.getPSST());
continue;
}
if("near".equalsIgnoreCase(ormsStand.getStandType()))
{
String abdg = fltr.getAbdg() + "," + standata.getPSST();//登机桥
fltr.setAbdg(abdg);//登机桥叠加
}
} //添加新数据
//联动变更登机桥
return fltr;
}
}
+8 -2
View File
@@ -71,7 +71,7 @@ scheduled:
hstCondition:
#航班到达超过多久则成为历史航班数据(单位:毫秒)
ARRIVE_HST_TIME: 3600000
#航班取消超过多久则成为历史航班数据(单位:秒)
#航班取消超过多久则成为历史航班数据(单位:秒)
CANCEL_HST_TIME: 3600000
#备降超过多久则成为历史航班数据 FROM CTU 本应降落到成都备降到其他地方(单位:毫秒)
FDIV_HST_TIME: 59400000
@@ -92,4 +92,10 @@ eureka:
service-url:
defaultZone: http://130.120.3.231:94/eureka/
instance:
prefer-ip-address: true
prefer-ip-address: true
adminApi:
host: 130.120.3.231
port: 92
schema: http
baseUrl: ${adminApi.schema}://ADMINAPI
ormsStandsUrl: ${adminApi.baseUrl}/basicdata/ormsStands
+4 -4
View File
@@ -69,13 +69,13 @@ scheduled:
flightSendCron: "*/3 * * * * ?"
#计入历史航班数据的条件
hstCondition:
#航班到达超过多久则成为历史航班数据(单位:秒)
#航班到达超过多久则成为历史航班数据(单位:秒)
ARRIVE_HST_TIME: 3600000
#航班取消超过多久则成为历史航班数据(单位:秒)
#航班取消超过多久则成为历史航班数据(单位:秒)
CANCEL_HST_TIME: 3600000
#备降超过多久则成为历史航班数据 FROM CTU 本应降落到成都备降到其他地方(单位:秒)
#备降超过多久则成为历史航班数据 FROM CTU 本应降落到成都备降到其他地方(单位:秒)
FDIV_HST_TIME: 59400000
#计划时间超过多久则成为历史航班数据(单位:秒)
#计划时间超过多久则成为历史航班数据(单位:秒)
SODT_HST_TIME: 259200000
# Elasticsearch
@@ -0,0 +1,29 @@
package com.gzzn.omms.msgexchangeapi.basicdata;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import com.gzzn.omms.msgexchangeapi.basicdata.entity.OrmsStand;
import com.gzzn.omms.msgexchangeapi.basicdata.service.IOrmsStandService;
@RunWith(SpringRunner.class)
@SpringBootTest
public class OrmsStandServiceImplTest {
@Autowired
IOrmsStandService ormsStandService;
@Test
public void testFindAll()
{
List<OrmsStand> lsOrmsStands = ormsStandService.findAll();
assertThat(lsOrmsStands).isNotEmpty();
}
}