添加主航班的共享航班信息
This commit is contained in:
+33
-1
@@ -7,10 +7,13 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.gzzn.omms.msgexchangeapi.entity.CminmsgWapper;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.MAFLDATA;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.MSG;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.SCHD;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.SCHD.FLTR;
|
||||
@@ -18,9 +21,11 @@ import com.gzzn.omms.msgexchangeapi.msghandler.MsgHandlerDispatcher;
|
||||
import com.gzzn.omms.msgexchangeapi.redis.RedisService;
|
||||
import com.gzzn.omms.msgexchangeapi.service.exchange.IExchangeService;
|
||||
|
||||
|
||||
@Service("flightInfoService")
|
||||
public class FlightInfoServiceImpl implements IFlightInfoService {
|
||||
private static final String redisKey="flightInfo";
|
||||
Logger logger = LoggerFactory.getLogger(FlightInfoServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
RedisService redisService;
|
||||
@@ -40,11 +45,38 @@ public class FlightInfoServiceImpl implements IFlightInfoService {
|
||||
.getSCHD()
|
||||
.getFLTR();
|
||||
|
||||
Map<String, Object> mapFltr = new HashMap();
|
||||
|
||||
//建立Map索引,便于查找
|
||||
Map<String, Object> mapFltr = new HashMap();
|
||||
for(FLTR fltr : lsFltr)
|
||||
{
|
||||
mapFltr.put(fltr.getFLID().toString(), fltr);
|
||||
}
|
||||
//设置主航班的共享航班信息
|
||||
for(FLTR fltr : lsFltr)
|
||||
{
|
||||
if(fltr.getMAID() == null)
|
||||
{
|
||||
continue; //不是共享航班
|
||||
}
|
||||
|
||||
String maid = fltr.getMAID().toString();
|
||||
FLTR fltrMa = (FLTR) mapFltr.get(maid);
|
||||
if(null == fltrMa)
|
||||
{
|
||||
logger.error("共享航班:{},未找到航班id为:{}的主航班信息{}",fltr.getFLID(),maid);
|
||||
continue;
|
||||
}
|
||||
|
||||
MAFLDATA mafldata = new MAFLDATA();
|
||||
mafldata.setFlid(fltr.getFLID());
|
||||
mafldata.setFlno(fltr.getFLNO());
|
||||
|
||||
fltrMa.getMafl().add(mafldata);
|
||||
}
|
||||
|
||||
|
||||
//保存到redis
|
||||
return redisService.hmset(redisKey, mapFltr);
|
||||
} //end function
|
||||
|
||||
|
||||
Reference in New Issue
Block a user