重新更加xsd生成所有的消息pojo类 。并完整重构代码
This commit is contained in:
@@ -3,11 +3,11 @@ package com.gzzn.omms.msgexchangeapi.msghandler;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.schd.dnld.FLTR;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.SCHD;
|
||||
|
||||
public class HandlerResult {
|
||||
private Boolean isSuccess;//是否更新成功
|
||||
private List<FLTR> fltrs; //影响的航班动态信息
|
||||
private List<SCHD.FLTR> fltrs; //影响的航班动态信息
|
||||
|
||||
public Boolean getIsSuccess() {
|
||||
return isSuccess;
|
||||
@@ -15,20 +15,20 @@ public class HandlerResult {
|
||||
public void setIsSuccess(Boolean isSuccess) {
|
||||
this.isSuccess = isSuccess;
|
||||
}
|
||||
public List<FLTR> getFltrs() {
|
||||
public List<SCHD.FLTR> getFltrs() {
|
||||
return fltrs;
|
||||
}
|
||||
public void setFltrs(List<FLTR> fltrs) {
|
||||
public void setFltrs(List<SCHD.FLTR> fltrs) {
|
||||
this.fltrs = fltrs;
|
||||
}
|
||||
|
||||
|
||||
public static HandlerResult success(FLTR fltr)
|
||||
public static HandlerResult success(SCHD.FLTR fltr)
|
||||
{
|
||||
HandlerResult handlerResult = new HandlerResult();
|
||||
handlerResult.isSuccess = true;
|
||||
|
||||
List<FLTR> fltrs = new ArrayList();
|
||||
List<SCHD.FLTR> fltrs = new ArrayList();
|
||||
fltrs.add(fltr);
|
||||
|
||||
handlerResult.fltrs = fltrs;
|
||||
@@ -36,7 +36,7 @@ public class HandlerResult {
|
||||
return handlerResult;
|
||||
}//end function
|
||||
|
||||
public static HandlerResult success(List<FLTR> fltrs)
|
||||
public static HandlerResult success(List<SCHD.FLTR> fltrs)
|
||||
{
|
||||
HandlerResult handlerResult = new HandlerResult();
|
||||
handlerResult.isSuccess = true;
|
||||
|
||||
@@ -9,8 +9,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.gzzn.omms.msgexchangeapi.entity.Cminmsg;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.Msg;
|
||||
import com.gzzn.omms.msgexchangeapi.service.IExchangeService;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.MSG;
|
||||
import com.gzzn.omms.msgexchangeapi.service.exchange.IExchangeService;
|
||||
|
||||
@Service("msgHandlerDispatcher")
|
||||
public class MsgHandlerDispatcher {
|
||||
@@ -21,9 +21,9 @@ public class MsgHandlerDispatcher {
|
||||
|
||||
public HandlerResult dispatch(Cminmsg cminmsg)
|
||||
{
|
||||
Msg msg = exchangeService.xmlstrToObject(cminmsg.getCminmsgsClobMsg(), Msg.class);
|
||||
String type = msg.getMeta().getType();
|
||||
String subType = msg.getMeta().getStyp();
|
||||
MSG msg = exchangeService.xmlstrToObject(cminmsg.getCminmsgsClobMsg(), MSG.class);
|
||||
String type = msg.getMETA().getTYPE().name();
|
||||
String subType = msg.getMETA().getSTYP().name();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
package com.gzzn.omms.msgexchangeapi.msghandler.flop;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.gzzn.omms.msgexchangeapi.entity.Cminmsg;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.flop.acft.ACFTMsg;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.schd.dnld.FLTR;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.MSG;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.SCHD;
|
||||
import com.gzzn.omms.msgexchangeapi.msghandler.HandlerResult;
|
||||
import com.gzzn.omms.msgexchangeapi.utils.JsonUtil;
|
||||
|
||||
/**
|
||||
* 航班机型事件
|
||||
@@ -27,12 +24,12 @@ public class ACFTHandler extends FlopBaseHandler {
|
||||
*/
|
||||
@Override
|
||||
public HandlerResult run(Cminmsg cminmsg) {
|
||||
ACFTMsg acftMsg = exchangeService.xmlstrToObject(cminmsg.getCminmsgsClobMsg(), ACFTMsg.class);
|
||||
FLTR fltr = flightInfoService.getByFlid(acftMsg.getFLOP().getFLID());
|
||||
MSG acftMsg = exchangeService.xmlstrToObject(cminmsg.getCminmsgsClobMsg(), MSG.class);
|
||||
SCHD.FLTR fltr = flightInfoService.getByFlid(acftMsg.getFLOP().get(0).getFLID().toString());
|
||||
if(null != fltr)
|
||||
{
|
||||
//save
|
||||
fltr.setACFT(acftMsg.getFLOP().getACFT());
|
||||
fltr.setACFT(acftMsg.getFLOP().get(0).getACFT());
|
||||
flightInfoService.saveFltr(fltr);
|
||||
|
||||
//send and update
|
||||
@@ -43,7 +40,7 @@ public class ACFTHandler extends FlopBaseHandler {
|
||||
}
|
||||
else {
|
||||
//没有该动态航班信息
|
||||
logger.warn("没有flid为:{}的消息",acftMsg.getFLOP().getFLID());
|
||||
logger.warn("没有flid为:{}的消息",acftMsg.getFLOP().get(0).getFLID());
|
||||
}
|
||||
|
||||
return HandlerResult.failure();
|
||||
|
||||
@@ -4,8 +4,8 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.gzzn.omms.msgexchangeapi.entity.Cminmsg;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.flop.actt.ACTTMsg;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.schd.dnld.FLTR;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.MSG;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.SCHD;
|
||||
import com.gzzn.omms.msgexchangeapi.msghandler.HandlerResult;
|
||||
|
||||
/**
|
||||
@@ -18,12 +18,12 @@ public class ACTTHandler extends FlopBaseHandler{
|
||||
|
||||
@Override
|
||||
public HandlerResult run(Cminmsg cminmsg) {
|
||||
ACTTMsg acttMsg = exchangeService.xmlstrToObject(cminmsg.getCminmsgsClobMsg(), ACTTMsg.class);
|
||||
FLTR fltr = flightInfoService.getByFlid(acttMsg.getFLOP().getFLID());
|
||||
MSG acttMsg = exchangeService.xmlstrToObject(cminmsg.getCminmsgsClobMsg(), MSG.class);
|
||||
SCHD.FLTR fltr = flightInfoService.getByFlid(acttMsg.getFLOP().get(0).getFLID().toString());
|
||||
if(null != fltr)
|
||||
{
|
||||
//save
|
||||
fltr.setACTT(acttMsg.getFLOP().getACTT());
|
||||
fltr.setACTT(acttMsg.getFLOP().get(0).getACTT());
|
||||
flightInfoService.saveFltr(fltr);
|
||||
|
||||
//send and update
|
||||
@@ -34,7 +34,7 @@ public class ACTTHandler extends FlopBaseHandler{
|
||||
}
|
||||
else {
|
||||
//没有该动态航班信息
|
||||
logger.warn("没有flid为:{}的消息",acttMsg.getFLOP().getFLID());
|
||||
logger.warn("没有flid为:{}的消息",acttMsg.getFLOP().get(0).getFLID());
|
||||
}
|
||||
|
||||
return HandlerResult.failure();
|
||||
|
||||
@@ -4,10 +4,10 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.gzzn.omms.msgexchangeapi.entity.Cminmsg;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.flop.bdpb.BDPBMsg;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.schd.dnld.FLTR;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.MSG;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.SCHD;
|
||||
import com.gzzn.omms.msgexchangeapi.msghandler.HandlerResult;
|
||||
import com.gzzn.omms.msgexchangeapi.service.IExchangeService;
|
||||
import com.gzzn.omms.msgexchangeapi.service.exchange.IExchangeService;
|
||||
import com.gzzn.omms.msgexchangeapi.service.flightInfo.IFlightInfoService;
|
||||
import com.gzzn.omms.msgexchangeapi.utils.SpringUtil;
|
||||
|
||||
@@ -19,8 +19,8 @@ public class BDPBHandler extends FlopBaseHandler {
|
||||
IExchangeService exchangeService = (IExchangeService) SpringUtil.getBean("exchangeService");
|
||||
IFlightInfoService flightInfoService = (IFlightInfoService) SpringUtil.getBean("flightInfoService");
|
||||
|
||||
BDPBMsg bdpbMsg = exchangeService.xmlstrToObject(cminmsg.getCminmsgsClobMsg(), BDPBMsg.class);
|
||||
FLTR fltr = flightInfoService.getByFlid(bdpbMsg.getFLOP().getFLID());
|
||||
MSG bdpbMsg = exchangeService.xmlstrToObject(cminmsg.getCminmsgsClobMsg(), MSG.class);
|
||||
SCHD.FLTR fltr = flightInfoService.getByFlid(bdpbMsg.getFLOP().get(0).getFLID().toString());
|
||||
if(null != fltr)
|
||||
{
|
||||
//TO: 文档未描述该事件是什么
|
||||
@@ -35,7 +35,7 @@ public class BDPBHandler extends FlopBaseHandler {
|
||||
}
|
||||
else {
|
||||
//没有该动态航班信息
|
||||
logger.warn("没有flid为:{}的消息",bdpbMsg.getFLOP().getFLID());
|
||||
logger.warn("没有flid为:{}的消息",bdpbMsg.getFLOP().get(0).getFLID());
|
||||
}
|
||||
|
||||
return HandlerResult.failure();
|
||||
|
||||
@@ -4,8 +4,8 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.gzzn.omms.msgexchangeapi.entity.Cminmsg;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.flop.botm.BOTMMsg;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.schd.dnld.FLTR;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.MSG;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.SCHD;
|
||||
import com.gzzn.omms.msgexchangeapi.msghandler.HandlerResult;
|
||||
|
||||
/**
|
||||
@@ -18,12 +18,12 @@ public class BOTMHandler extends FlopBaseHandler {
|
||||
|
||||
@Override
|
||||
public HandlerResult run(Cminmsg cminmsg) {
|
||||
BOTMMsg botmMsg = exchangeService.xmlstrToObject(cminmsg.getCminmsgsClobMsg(), BOTMMsg.class);
|
||||
FLTR fltr = flightInfoService.getByFlid(botmMsg.getFLOP().getFLID());
|
||||
MSG botmMsg = exchangeService.xmlstrToObject(cminmsg.getCminmsgsClobMsg(), MSG.class);
|
||||
SCHD.FLTR fltr = flightInfoService.getByFlid(botmMsg.getFLOP().get(0).getFLID().toString());
|
||||
if(null != fltr)
|
||||
{
|
||||
//save
|
||||
fltr.setBOTM(botmMsg.getFLOP().getBOTM());
|
||||
fltr.setBOTM(botmMsg.getFLOP().get(0).getBOTM());
|
||||
flightInfoService.saveFltr(fltr);
|
||||
|
||||
//send and update
|
||||
@@ -34,7 +34,7 @@ public class BOTMHandler extends FlopBaseHandler {
|
||||
}
|
||||
else {
|
||||
//没有该动态航班信息
|
||||
logger.warn("没有flid为:{}的消息",botmMsg.getFLOP().getFLID());
|
||||
logger.warn("没有flid为:{}的消息",botmMsg.getFLOP().get(0).getFLID());
|
||||
}
|
||||
|
||||
return HandlerResult.failure();
|
||||
|
||||
@@ -4,8 +4,8 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.gzzn.omms.msgexchangeapi.entity.Cminmsg;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.flop.ckdt.CKDTMsg;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.schd.dnld.FLTR;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.MSG;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.SCHD;
|
||||
import com.gzzn.omms.msgexchangeapi.msghandler.HandlerResult;
|
||||
|
||||
/**
|
||||
@@ -18,12 +18,12 @@ public class CKDTHandler extends FlopBaseHandler {
|
||||
|
||||
@Override
|
||||
public HandlerResult run(Cminmsg cminmsg) {
|
||||
CKDTMsg ckdtMsg = exchangeService.xmlstrToObject(cminmsg.getCminmsgsClobMsg(), CKDTMsg.class);
|
||||
FLTR fltr = flightInfoService.getByFlid(ckdtMsg.getFLOP().getFLID());
|
||||
MSG ckdtMsg = exchangeService.xmlstrToObject(cminmsg.getCminmsgsClobMsg(), MSG.class);
|
||||
SCHD.FLTR fltr = flightInfoService.getByFlid(ckdtMsg.getFLOP().get(0).getFLID().toString());
|
||||
if(null != fltr)
|
||||
{
|
||||
//TODO: update ckdt
|
||||
//save
|
||||
fltr.setCKDT(ckdtMsg.getFLOP().getCKDT());
|
||||
flightInfoService.saveFltr(fltr);
|
||||
|
||||
//send and update
|
||||
@@ -34,7 +34,7 @@ public class CKDTHandler extends FlopBaseHandler {
|
||||
}
|
||||
else {
|
||||
//没有该动态航班信息
|
||||
logger.warn("没有flid为:{}的消息",ckdtMsg.getFLOP().getFLID());
|
||||
logger.warn("没有flid为:{}的消息",ckdtMsg.getFLOP().get(0).getFLID());
|
||||
}
|
||||
|
||||
return HandlerResult.failure();
|
||||
|
||||
@@ -3,13 +3,13 @@ package com.gzzn.omms.msgexchangeapi.msghandler.flop;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.gzzn.omms.msgexchangeapi.entity.Cminmsg;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.schd.dnld.FLTR;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.SCHD;
|
||||
import com.gzzn.omms.msgexchangeapi.msghandler.HandlerResult;
|
||||
import com.gzzn.omms.msgexchangeapi.msghandler.IBaseHandler;
|
||||
import com.gzzn.omms.msgexchangeapi.redis.RedisService;
|
||||
import com.gzzn.omms.msgexchangeapi.service.ICminmsgService;
|
||||
import com.gzzn.omms.msgexchangeapi.service.IExchangeService;
|
||||
import com.gzzn.omms.msgexchangeapi.service.IKafkaService;
|
||||
import com.gzzn.omms.msgexchangeapi.service.exchange.IExchangeService;
|
||||
import com.gzzn.omms.msgexchangeapi.service.flightInfo.IFlightInfoService;
|
||||
import com.gzzn.omms.msgexchangeapi.utils.JsonUtil;
|
||||
import com.gzzn.omms.msgexchangeapi.utils.SpringUtil;
|
||||
@@ -46,7 +46,7 @@ public class FlopBaseHandler implements IBaseHandler {
|
||||
* @param fltr
|
||||
* @param cminmsg
|
||||
*/
|
||||
protected void sendFltrAndMsg(FLTR fltr,Cminmsg cminmsg)
|
||||
protected void sendFltrAndMsg(SCHD.FLTR fltr,Cminmsg cminmsg)
|
||||
{
|
||||
//send schd
|
||||
String schdMsg = JsonUtil.getString(fltr);
|
||||
|
||||
Reference in New Issue
Block a user