Browse Source

非机预警

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

26
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); 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); JSONObject jsonObject = JSONObject.parseObject(jsonString);
String code = jsonObject.getString("code"); String code = jsonObject.getString("code");
@ -292,13 +304,8 @@ public class NonAutomaticWarningController extends BaseController {
//client.subscribe(topicName.getString("7835340801"), 1); //client.subscribe(topicName.getString("7835340801"), 1);
//logger.info("开始监听" + topicName.getString("7835340801")); //logger.info("开始监听" + topicName.getString("7835340801"));
} catch (MqttException e) { } catch (MqttException e) {
if (e.getReasonCode() == MqttException.REASON_CODE_CLIENT_TIMEOUT) { logger.warn("连接异常");
logger.warn("连接超时."); getAjaxResult(parameter);
// 尝试重连
getAjaxResult(parameter);
} else {
throw e; // 抛出其他类型的异常
}
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -316,6 +323,7 @@ public class NonAutomaticWarningController extends BaseController {
stringStringHashMap.setAPPSECRET(nonAutomaticWarning.getString("APPSECRET")); stringStringHashMap.setAPPSECRET(nonAutomaticWarning.getString("APPSECRET"));
stringStringHashMap.setURI(nonAutomaticWarning.getString("URI")); stringStringHashMap.setURI(nonAutomaticWarning.getString("URI"));
stringStringHashMap.setIP(nonAutomaticWarning.getString("IP")); stringStringHashMap.setIP(nonAutomaticWarning.getString("IP"));
return getAjaxResult(stringStringHashMap); getAjaxResult(stringStringHashMap);
return AjaxResult.success();
} }
} }

Loading…
Cancel
Save