修改添加redis相关代码

This commit is contained in:
zhouxiunai
2018-12-04 09:57:02 +08:00
parent 8767070fdf
commit 0cc33b89c5
14 changed files with 607 additions and 144 deletions
@@ -1,22 +1,21 @@
package com.gzzn.omms.msgexchangeapi.service;
import java.util.List;
import java.util.stream.Collectors;
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.schd.dnld.DnldMsg;
import com.gzzn.omms.msgexchangeapi.entity.msg.schd.dnld.FLTR;
import com.gzzn.omms.msgexchangeapi.msghandler.MsgHandlerDispatcher;
import com.gzzn.omms.msgexchangeapi.redis.dao.FlightInfoDao;
import com.gzzn.omms.msgexchangeapi.redis.entity.FlightInfo;
import com.gzzn.omms.msgexchangeapi.utils.JsonUtil;
import com.gzzn.omms.msgexchangeapi.redis.RedisService;
@Service
public class FlightInfoServiceImpl implements IFlightInfoService {
@Autowired
private FlightInfoDao flightInfoDao;
RedisService redisService;
@Autowired
IExchangeService exchangeService;
@@ -29,24 +28,21 @@ public class FlightInfoServiceImpl implements IFlightInfoService {
String clobMsg = cminmsg.getCminmsgsClobMsg();
DnldMsg dnldMsg = exchangeService.xmlstrToObject(clobMsg, DnldMsg.class);
List<FlightInfo> flightSchdInfo = dnldMsg
List<FLTR> lsFltr = dnldMsg
.getSchd()
.getFltr()
.stream()
.map(x->{
FlightInfo node = new FlightInfo();
node.setFlightId(x.getFlid());
node.setContext(JsonUtil.getString(x));
return node;
}).collect(Collectors.toList());
.getFltr();
List<FlightInfo> flightInfos = (List<FlightInfo>) flightInfoDao.save(flightSchdInfo);
return flightInfos != null;
for(FLTR fltr : lsFltr)
{
redisService.set(fltr.getFlid(), fltr);
}
return true;
} //end function
@Override
public List<FlightInfo> updateByCminmsgs(List<Cminmsg> lsCminmsgs) {
public List<FLTR> updateByCminmsgs(List<Cminmsg> lsCminmsgs) {
MsgHandlerDispatcher msgHandlerDispatcher = new MsgHandlerDispatcher();
for (Cminmsg cminmsg : lsCminmsgs) {
@@ -3,7 +3,7 @@ package com.gzzn.omms.msgexchangeapi.service;
import java.util.List;
import com.gzzn.omms.msgexchangeapi.entity.Cminmsg;
import com.gzzn.omms.msgexchangeapi.redis.entity.FlightInfo;
import com.gzzn.omms.msgexchangeapi.entity.msg.schd.dnld.FLTR;
public interface IFlightInfoService {
/**
@@ -16,5 +16,5 @@ public interface IFlightInfoService {
* @param lsCminmsgs
* @return 返回被更新了的动态航班信息
*/
public List<FlightInfo> updateByCminmsgs(List<Cminmsg> lsCminmsgs);
public List<FLTR> updateByCminmsgs(List<Cminmsg> lsCminmsgs);
}