Browse Source

非机预警

develop
wangsixiang 4 months ago
parent
commit
c3e1a37545
  1. 24
      zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java

24
zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java

@ -94,7 +94,19 @@ public class NonAutomaticWarningController extends BaseController {
put(UniversalEnum.HTTPS.getValue(), getCamsApi);
}
};
String jsonString = ArtemisHttpUtil.doPostStringArtemis(config, path, body, null, null, "application/json");
String jsonString = "";
try {
jsonString = ArtemisHttpUtil.doPostStringArtemis(config, path, body, null, null, "application/json");
} catch (Exception e){
logger.warn("非机预警请求账号密码失败");
scheduler.schedule(() -> {
try {
getAjaxResult(parameter);
} catch (Exception e2) {
throw new RuntimeException(e2);
}
}, UniversalEnum.TEN.getNumber(), TimeUnit.SECONDS);
}
JSONObject jsonObject = JSONObject.parseObject(jsonString);
String code = jsonObject.getString("code");
@ -292,13 +304,8 @@ public class NonAutomaticWarningController extends BaseController {
//client.subscribe(topicName.getString("7835340801"), 1);
//logger.info("开始监听" + topicName.getString("7835340801"));
} catch (MqttException e) {
if (e.getReasonCode() == MqttException.REASON_CODE_CLIENT_TIMEOUT) {
logger.warn("连接超时.");
// 尝试重连
logger.warn("连接异常");
getAjaxResult(parameter);
} else {
throw e; // 抛出其他类型的异常
}
}
} catch (Exception e) {
e.printStackTrace();
@ -316,6 +323,7 @@ public class NonAutomaticWarningController extends BaseController {
stringStringHashMap.setAPPSECRET(nonAutomaticWarning.getString("APPSECRET"));
stringStringHashMap.setURI(nonAutomaticWarning.getString("URI"));
stringStringHashMap.setIP(nonAutomaticWarning.getString("IP"));
return getAjaxResult(stringStringHashMap);
getAjaxResult(stringStringHashMap);
return AjaxResult.success();
}
}

Loading…
Cancel
Save