diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/SyncController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/SyncController.java index 3783bb3..889d715 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/SyncController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/SyncController.java @@ -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());