vince
2024-08-13 6c76ad7d3c1e6b2a2cea4986f9bcb0f7215c3563
src/main/java/com/fzzy/protocol/weightyh/GatewaySyncWeightImplHttp.java
@@ -48,16 +48,22 @@
            String responseText = GatewayHttpUtil.doGet(device.getHttpUrl(), paramsMap);
            log.debug("--HTTP-WEIGHT-请求返回--{}", responseText);
            log.info("--HTTP-WEIGHT-请求返回--{}", responseText);
            if(StringUtils.isEmpty(responseText)) {
                return new BaseResp(500, "后台执行失败");
            }
            JSONObject resp;
            String jsonStr;
            //说明是JSONP格式-jsonpCallback({"content":""})
            if (responseText.indexOf("jsonpCallback") >= 0) {
                responseText = responseText.substring(responseText.indexOf("(") + 1, responseText.length() - 1);
                resp = JSONObject.parseObject(responseText);
                jsonStr = responseText.substring(responseText.indexOf("(") + 1, responseText.length() - 1);
                resp = JSONObject.parseObject(jsonStr);
                resp.put("code", "200");
            } else {
                resp = JSONObject.parseObject(responseText);
                jsonStr = responseText;
                resp = JSONObject.parseObject(jsonStr);
            }
            if ("200".equals(resp.get("code"))) {
@@ -73,7 +79,7 @@
                gatewayRemoteManager.getDeviceReportService(device.getPushProtocol()).reportWeightData(reqData);
            }
        } catch (Exception e) {
            log.error("--------------地磅-HTTP协议执行异常----{}", e.getMessage());
            log.error("--------------地磅-HTTP协议执行异常----{}", e);
        }
        return new BaseResp(500, "后台执行失败");
    }