Commit 6648e1a1 by 黄小葱

处理异常

1 parent 90ce949a
...@@ -30,23 +30,28 @@ public class RemoteDeviceService { ...@@ -30,23 +30,28 @@ public class RemoteDeviceService {
//加密得到sign //加密得到sign
String sign = GopUtil.sign(tparams, appSecret); String sign = GopUtil.sign(tparams, appSecret);
tparams.put("sign", sign); tparams.put("sign", sign);
String result = HttpUtils.get(url, tparams); try {
JSONObject resultObj = JSONObject.parseObject(result); String result = HttpUtils.get(url, tparams);
if (resultObj == null) { JSONObject resultObj = JSONObject.parseObject(result);
log.info("remote getInfoBysn result is null"); if (resultObj == null) {
return null; log.info("remote getInfoBysn result is null");
return null;
}
String returnCode = resultObj.getString("returnCode");
String message = resultObj.getString("message");
if (StringUtils.isBlank(returnCode) || !"0".equals(returnCode)) {
log.info("remote getInfoBysn fail! returnCode:" + returnCode + "; message:" + message);
return null;
}
String data = resultObj.getString("data");
if (StringUtils.isBlank(data)) {
return null;
}
TrackInfoBo trackInfoBo = JSONObject.parseObject(data, TrackInfoBo.class);
return trackInfoBo;
} catch (Exception e) {
log.info("调用虎哥E盾标准接口查询设备信息异常:{}", e.getMessage());
} }
String returnCode = resultObj.getString("returnCode"); return null;
String message = resultObj.getString("message");
if (StringUtils.isBlank(returnCode) || !"0".equals(returnCode)) {
log.info("remote getInfoBysn fail! returnCode:" + returnCode + "; message:" + message);
return null;
}
String data = resultObj.getString("data");
if (StringUtils.isBlank(data)) {
return null;
}
TrackInfoBo trackInfoBo = JSONObject.parseObject(data, TrackInfoBo.class);
return trackInfoBo;
} }
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!