完成整体航班动态消息处理框架
This commit is contained in:
+31
-5
@@ -1,5 +1,6 @@
|
||||
package com.gzzn.omms.msgexchangeapi.service.flightInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -9,6 +10,7 @@ import org.springframework.stereotype.Service;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.Cminmsg;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.schd.dnld.DnldMsg;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.schd.dnld.FLTR;
|
||||
import com.gzzn.omms.msgexchangeapi.msghandler.HandlerResult;
|
||||
import com.gzzn.omms.msgexchangeapi.msghandler.MsgHandlerDispatcher;
|
||||
import com.gzzn.omms.msgexchangeapi.redis.RedisService;
|
||||
import com.gzzn.omms.msgexchangeapi.service.IExchangeService;
|
||||
@@ -52,16 +54,40 @@ public class FlightInfoServiceImpl implements IFlightInfoService {
|
||||
|
||||
@Override
|
||||
public List<UpdateByCminmsgsResult> updateByCminmsgs(List<Cminmsg> lsCminmsgs) {
|
||||
List<UpdateByCminmsgsResult> resultUpdated = new ArrayList();//更新结果
|
||||
|
||||
for (Cminmsg cminmsg : lsCminmsgs) {
|
||||
//更新动态航班消息
|
||||
String strClobMsg = cminmsg.getCminmsgsClobMsg();
|
||||
msgHandlerDispatcher.dispatch(strClobMsg);
|
||||
|
||||
|
||||
}
|
||||
return null;
|
||||
HandlerResult handlerResult = msgHandlerDispatcher.dispatch(strClobMsg);
|
||||
UpdateByCminmsgsResult updateResult = null;
|
||||
if(handlerResult.getIsSuccess())
|
||||
{
|
||||
updateResult = UpdateByCminmsgsResult.success(cminmsg, handlerResult.getFltrs());
|
||||
}
|
||||
else {
|
||||
updateResult = UpdateByCminmsgsResult.failure(cminmsg);
|
||||
}
|
||||
resultUpdated.add(updateResult);
|
||||
}//end for
|
||||
|
||||
return resultUpdated;
|
||||
}//end function
|
||||
|
||||
|
||||
@Override
|
||||
public FLTR getByFlid(String flid) {
|
||||
FLTR fltr = (FLTR) redisGet(flid);
|
||||
return fltr;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean saveFltr(FLTR fltr) {
|
||||
return redisSet(fltr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 重新包装的set
|
||||
* @param fltr
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.gzzn.omms.msgexchangeapi.service.flightInfo;
|
||||
import java.util.List;
|
||||
|
||||
import com.gzzn.omms.msgexchangeapi.entity.Cminmsg;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.schd.dnld.FLTR;
|
||||
|
||||
public interface IFlightInfoService {
|
||||
/**
|
||||
@@ -16,4 +17,16 @@ public interface IFlightInfoService {
|
||||
* @return 返回被更新了的动态航班信息
|
||||
*/
|
||||
public List<UpdateByCminmsgsResult> updateByCminmsgs(List<Cminmsg> lsCminmsgs);
|
||||
|
||||
/**
|
||||
* 通过航班id获取航班动态
|
||||
* @param flid
|
||||
* @return
|
||||
*/
|
||||
public FLTR getByFlid(String flid);
|
||||
|
||||
/**
|
||||
* 保存航班动态信息,新增或更新
|
||||
*/
|
||||
public boolean saveFltr(FLTR fltr);
|
||||
}
|
||||
|
||||
+59
-3
@@ -1,12 +1,68 @@
|
||||
package com.gzzn.omms.msgexchangeapi.service.flightInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gzzn.omms.msgexchangeapi.entity.Cminmsg;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.schd.dnld.FLTR;
|
||||
|
||||
public class UpdateByCminmsgsResult {
|
||||
Boolean isSuccess;//是否更新成功
|
||||
Cminmsg cminmsg; //消息
|
||||
List<FLTR> fltrs; //影响的航班动态信息
|
||||
private Boolean isSuccess;//是否更新成功
|
||||
private Cminmsg cminmsg; //消息
|
||||
private List<FLTR> fltrs; //影响的航班动态信息
|
||||
|
||||
public Boolean getIsSuccess() {
|
||||
return isSuccess;
|
||||
}
|
||||
public void setIsSuccess(Boolean isSuccess) {
|
||||
this.isSuccess = isSuccess;
|
||||
}
|
||||
public Cminmsg getCminmsg() {
|
||||
return cminmsg;
|
||||
}
|
||||
public void setCminmsg(Cminmsg cminmsg) {
|
||||
this.cminmsg = cminmsg;
|
||||
}
|
||||
public List<FLTR> getFltrs() {
|
||||
return fltrs;
|
||||
}
|
||||
public void setFltrs(List<FLTR> fltrs) {
|
||||
this.fltrs = fltrs;
|
||||
}
|
||||
|
||||
|
||||
public static UpdateByCminmsgsResult success(Cminmsg cminmsg,FLTR fltr)
|
||||
{
|
||||
UpdateByCminmsgsResult updateByCminmsgsResult = new UpdateByCminmsgsResult();
|
||||
updateByCminmsgsResult.isSuccess = true;
|
||||
updateByCminmsgsResult.cminmsg = cminmsg;
|
||||
|
||||
List<FLTR> fltrs = new ArrayList();
|
||||
fltrs.add(fltr);
|
||||
|
||||
updateByCminmsgsResult.fltrs = fltrs;
|
||||
|
||||
return updateByCminmsgsResult;
|
||||
}//end function
|
||||
|
||||
public static UpdateByCminmsgsResult success(Cminmsg cminmsg,List<FLTR> fltrs)
|
||||
{
|
||||
|
||||
UpdateByCminmsgsResult updateByCminmsgsResult = new UpdateByCminmsgsResult();
|
||||
updateByCminmsgsResult.isSuccess = true;
|
||||
updateByCminmsgsResult.cminmsg = cminmsg;
|
||||
updateByCminmsgsResult.fltrs = fltrs;
|
||||
|
||||
|
||||
return updateByCminmsgsResult;
|
||||
}//end function
|
||||
|
||||
public static UpdateByCminmsgsResult failure(Cminmsg cminmsg)
|
||||
{
|
||||
UpdateByCminmsgsResult updateByCminmsgsResult = new UpdateByCminmsgsResult();
|
||||
updateByCminmsgsResult.isSuccess = false;
|
||||
updateByCminmsgsResult.cminmsg = cminmsg;
|
||||
|
||||
return updateByCminmsgsResult;
|
||||
}//end function
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user