Commit b59fb88a by 丁伟峰

bugfix: 返回报文的异常处理

1 parent 9db5a71b
...@@ -63,19 +63,21 @@ public class SaasUtils { ...@@ -63,19 +63,21 @@ public class SaasUtils {
log.info("after call saas ==> {}", responseEntity.getBody()); log.info("after call saas ==> {}", responseEntity.getBody());
// 使用Jackson库解析JSON数据 // 使用Jackson库解析JSON数据
List<BlockInfo> blocks = new ArrayList<>();
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
try { try {
List<BlockInfo> blocks = new ArrayList<>();
JsonNode responseJson = objectMapper.readTree(responseBody); JsonNode responseJson = objectMapper.readTree(responseBody);
// 获取areaResults[0]的值 // 获取areaResults[0]的值
for (JsonNode r : responseJson.get("result").get(0).get("areaResults")) { for (JsonNode r : responseJson.get("result").get(0).get("areaResults")) {
// 分单接口暂时无图层返回 // 分单接口暂时无图层返回
if(r.get("field3") != null && r.get("field1") != null) {
blocks.add(new BlockInfo().setBlockId(r.get("field3").asText()).setBlockName(r.get("field1").asText())); blocks.add(new BlockInfo().setBlockId(r.get("field3").asText()).setBlockName(r.get("field1").asText()));
} }
return blocks; }
} catch (Exception e) { } catch (Exception e) {
return null; log.error(e.getMessage());
} }
return blocks;
} }
public List<String> queryBlockIds(String location, String address) { public List<String> queryBlockIds(String location, String address) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!