Commit 44712769 by 毛树良

<fix>:优化

1 parent 816bd579
package com.viontech.scheduled;
import com.alibaba.fastjson.JSONObject;
import com.viontech.config.Gb1400Config;
import com.viontech.constant.Gb1400Constants;
import com.viontech.service.Gb1400Service;
......@@ -52,7 +53,15 @@ public class Gb1400KeepAlive {
ResponseEntity<String> postForEntity = restTemplate.postForEntity(url, entity, String.class);
String body = postForEntity.getBody();
log.info("keepalive.result:{}", body);
JSONObject aliveResult = JSONObject.parseObject(body);
if (aliveResult != null && aliveResult.getJSONObject("ResponseStatusObject") != null) {
JSONObject responseStatusObject = aliveResult.getJSONObject("ResponseStatusObject");
if (!"0".equals(responseStatusObject.getString("StatusCode"))) {
Gb1400Constants.LinkStatus = false;
}
}
}catch (Exception e){
Gb1400Constants.LinkStatus = false;
log.error("keepalive.Exception",e);
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!