提交整体消息转换分发处理框架
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
package com.gzzn.omms.msgexchangeapi.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.gzzn.omms.msgexchangeapi.domain.primary.entity.Cminmsg;
|
||||
import com.gzzn.omms.msgexchangeapi.domain.primary.entity.msg.Msg;
|
||||
import com.gzzn.omms.msgexchangeapi.domain.primary.entity.msg.schd.dnld.DnldMsg;
|
||||
import com.gzzn.omms.msgexchangeapi.domain.secondary.dao.FlightInfoDao;
|
||||
import com.gzzn.omms.msgexchangeapi.domain.secondary.entity.FlightInfo;
|
||||
import com.gzzn.omms.msgexchangeapi.msghandler.MsgHandlerDispatcher;
|
||||
import com.gzzn.omms.msgexchangeapi.utils.JsonUtil;
|
||||
|
||||
public class FlightInfoServiceImpl implements IFlightInfoService {
|
||||
@Autowired
|
||||
private FlightInfoDao flightInfoDao;
|
||||
|
||||
@Autowired
|
||||
IExchangeService exchangeService;
|
||||
|
||||
@Autowired
|
||||
MsgHandlerDispatcher msgHandlerDispatcher;
|
||||
|
||||
@Override
|
||||
public Boolean updateByDaySchd(Cminmsg cminmsg) {
|
||||
String clobMsg = cminmsg.getCminmsgsClobMsg();
|
||||
DnldMsg dnldMsg = exchangeService.xmlstrToObject(clobMsg, DnldMsg.class);
|
||||
|
||||
List<FlightInfo> flightSchdInfo = dnldMsg
|
||||
.getSchd()
|
||||
.getFltr()
|
||||
.stream()
|
||||
.map(x->{
|
||||
FlightInfo node = new FlightInfo();
|
||||
node.setFlightId(x.getFlid());
|
||||
node.setContext(JsonUtil.getString(x));
|
||||
return node;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
List<FlightInfo> flightInfos = (List<FlightInfo>) flightInfoDao.save(flightSchdInfo);
|
||||
return flightInfos != null;
|
||||
} //end function
|
||||
|
||||
|
||||
@Override
|
||||
public List<FlightInfo> updateByCminmsgs(List<Cminmsg> lsCminmsgs) {
|
||||
MsgHandlerDispatcher msgHandlerDispatcher = new MsgHandlerDispatcher();
|
||||
|
||||
for (Cminmsg cminmsg : lsCminmsgs) {
|
||||
//更新动态航班消息
|
||||
String strClobMsg = cminmsg.getCminmsgsClobMsg();
|
||||
msgHandlerDispatcher.dispatch(strClobMsg);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}//end function
|
||||
}
|
||||
Reference in New Issue
Block a user