修复由于resttemplate返回的list元素为linkedhashmap导致的获取基础数据失败的问题。

This commit is contained in:
zhouxiunai
2019-02-19 14:23:28 +08:00
parent e8348be5ab
commit e345f2854d
5 changed files with 65 additions and 3 deletions
@@ -1,5 +1,7 @@
package com.gzzn.omms.msgexchangeapi.basicdata.service;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
@@ -8,6 +10,8 @@ import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.gzzn.omms.msgexchangeapi.basicdata.entity.OrmsStand;
import com.gzzn.omms.msgexchangeapi.dto.ResponseDto;
@@ -29,7 +33,12 @@ public class OrmsStandServiceImpl implements IOrmsStandService{
ResponseDto responseDto = responseEntity.getBody();
if (responseDto.getIs_success()) {
List<OrmsStand> rt = (List<OrmsStand>)responseDto.getBody();
List<LinkedHashMap> lsLinked = (List<LinkedHashMap>)responseDto.getBody();
//
ObjectMapper mapper = new ObjectMapper();
List<OrmsStand> rt = mapper.convertValue(lsLinked, new TypeReference<List<OrmsStand>>() { });
return rt;
}
else {
@@ -54,7 +54,7 @@ public class PSDTHandler extends FlopBaseHandler {
fltr.getPSDT().add(standata);
//如果是近机位
//获取机位
OrmsStand ormsStand = OrmsStandManager
.getInstance()
.getOrmsStandByStandCode(standata.getPSST());
@@ -64,6 +64,7 @@ public class PSDTHandler extends FlopBaseHandler {
continue;
}
//获取机位对应的登机桥
if("near".equalsIgnoreCase(ormsStand.getStandType()))
{
String abdg = fltr.getAbdg() + "," + standata.getPSST();//登机桥