获取地址调整

master^2
wj 2 years ago
parent 71152f3352
commit a0d847ec98

@ -1,6 +1,7 @@
package com.glxp.sale.admin.controller.sync;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@ -73,15 +74,15 @@ public class SyncController {
} else {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK.getCode(), request.getLocalAddr() + "服务缺少上级服务IP");
}
JSONObject jsonObject = null;
String str = null;
try {
jsonObject = redirect(request, upperServerHost);
str = HttpUtil.get(upperServerHost);
} catch (Exception e) {
e.printStackTrace();
return ResultVOUtils.error(ResultEnum.NOT_NETWORK.getCode(), request.getLocalAddr() + "服务访问上级服务" + upperServerHost + "异常");
}
BaseResponse response = JSONUtil.toBean(jsonObject.toJSONString(), BaseResponse.class);
if ("20000".equals(response.getCode())) {
BaseResponse response = JSONUtil.toBean(str, BaseResponse.class);
if (response.getCode().equals(20000)) {
return ResultVOUtils.success("连接成功");
} else {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK.getCode(), response.getMessage());

Loading…
Cancel
Save