完善航班靠桥,撤桥,撤销的消息处理
This commit is contained in:
@@ -3,6 +3,7 @@ package com.gzzn.omms.msgexchangeapi.msghandler.flop;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.gzzn.omms.msgexchangeapi.entity.msg.BRIDGEDATA;
|
import com.gzzn.omms.msgexchangeapi.entity.msg.BRIDGEDATA;
|
||||||
import com.gzzn.omms.msgexchangeapi.entity.msg.FLOP;
|
import com.gzzn.omms.msgexchangeapi.entity.msg.FLOP;
|
||||||
@@ -31,16 +32,28 @@ public class ABTMHandler extends FlopBaseHandler{
|
|||||||
//
|
//
|
||||||
OPTBRIDGEDATA optbridgedata = flop.getABTM().get(0);
|
OPTBRIDGEDATA optbridgedata = flop.getABTM().get(0);
|
||||||
|
|
||||||
//更新对应的撤桥或者登桥数据,没有则新增
|
//更新对应的撤桥或者靠桥数据,没有则新增
|
||||||
Boolean updated = false;
|
Boolean updated = false;
|
||||||
for( BRIDGEDATA bridgedata: fltr.getABTM())
|
for(int i = 0; i < fltr.getABTM().size(); i++)
|
||||||
{
|
{
|
||||||
|
BRIDGEDATA bridgedata = fltr.getABTM().get(i);
|
||||||
|
|
||||||
if(bridgedata.getABOP().equals(optbridgedata.getABOP()))
|
if(bridgedata.getABOP().equals(optbridgedata.getABOP()))
|
||||||
{
|
{
|
||||||
BeanUtils.copyProperties(optbridgedata, bridgedata);
|
if(StringUtils.isEmpty(optbridgedata.getAOTM()))
|
||||||
|
{
|
||||||
|
//撤销靠桥或撤桥
|
||||||
|
fltr.getABTM().remove(i);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
BeanUtils.copyProperties(optbridgedata, bridgedata);
|
||||||
|
}
|
||||||
updated = true;
|
updated = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}//end for
|
||||||
|
|
||||||
|
//
|
||||||
if(updated == false)
|
if(updated == false)
|
||||||
{
|
{
|
||||||
BRIDGEDATA data = new BRIDGEDATA();
|
BRIDGEDATA data = new BRIDGEDATA();
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.gzzn.omms.msgexchangeapi.msghandler;
|
||||||
|
|
||||||
|
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.dao.CminmsgDao;
|
||||||
|
import com.gzzn.omms.msgexchangeapi.entity.Cminmsg;
|
||||||
|
import com.gzzn.omms.msgexchangeapi.entity.CminmsgWapper;
|
||||||
|
import com.gzzn.omms.msgexchangeapi.msghandler.flop.ABTMHandler;
|
||||||
|
import com.gzzn.omms.msgexchangeapi.service.exchange.IExchangeService;
|
||||||
|
import com.gzzn.omms.msgexchangeapi.utils.JsonUtil;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest
|
||||||
|
public class ABTMHandlerTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CminmsgDao cminmsgDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExchangeService exchangeService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRun()
|
||||||
|
{
|
||||||
|
Cminmsg cminmsg = cminmsgDao.findOne(99397L);
|
||||||
|
CminmsgWapper cminmsgWapper = new CminmsgWapper(cminmsg);
|
||||||
|
cminmsgWapper.setMsg(exchangeService.xmlToMsg(cminmsg.getCminmsgsClobMsg()));
|
||||||
|
|
||||||
|
ABTMHandler abtmHandler = new ABTMHandler();
|
||||||
|
HandlerResult result = abtmHandler.run(cminmsgWapper);
|
||||||
|
|
||||||
|
System.out.println(JsonUtil.getString(result));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user