| | |
| | | |
| | | log.debug("--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"))) { |
| | |
| | | gatewayRemoteManager.getDeviceReportService(device.getPushProtocol()).reportWeightData(reqData); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("--------------地磅-HTTP协议执行异常----{}", e.getMessage()); |
| | | log.error("--------------地磅-HTTP协议执行异常----{}", e); |
| | | } |
| | | return new BaseResp(500, "后台执行失败"); |
| | | } |