| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.iailab.module.data.common.utils.HttpRequest; |
| | | import com.iailab.framework.common.util.http.HttpUtils; |
| | | import com.iailab.module.data.channel.kio.dto.*; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | form.put("username", username); |
| | | form.put("password", password); |
| | | this.logint_time = System.currentTimeMillis(); |
| | | String responseStr = HttpRequest.sendPost(this.url + "/login", JSON.toJSONString(form)); |
| | | String responseStr = HttpUtils.sendPost(this.url + "/login", JSON.toJSONString(form)); |
| | | JSONObject responseObj = JSON.parseObject(responseStr); |
| | | if (S_CODE != Integer.parseInt(responseObj.get(R_CODE).toString())) { |
| | | bLogin = false; |
| | |
| | | return bConnect; |
| | | } |
| | | Map<String, String> map = new HashMap<>(); |
| | | String responseStr = HttpRequest.sendPost(this.url + "/heartbeat", "", this.authorization); |
| | | String responseStr = HttpUtils.sendPost(this.url + "/heartbeat", "", this.authorization); |
| | | JSONObject responseObj = JSON.parseObject(responseStr); |
| | | if (S_CODE != Integer.parseInt(responseObj.get(R_CODE).toString())) { |
| | | bConnect = false; |
| | |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("projectInstanceName", this.instanceName); |
| | | map.put("TagName", tagName); |
| | | String responseStr = HttpRequest.sendGet(this.url + "/realvalue", map, this.authorization); |
| | | String responseStr = HttpUtils.sendGet(this.url + "/realvalue", map, this.authorization); |
| | | JSONObject responseObj = JSON.parseObject(responseStr); |
| | | if (S_CODE != Integer.parseInt(responseObj.get(R_CODE).toString())) { |
| | | return null; |
| | |
| | | objs.add(dto); |
| | | }); |
| | | queryDto.setObjs(objs); |
| | | String responseStr = HttpRequest.sendPost(this.url + "/batchrealvalue", JSONObject.toJSONString(queryDto), this.authorization); |
| | | String responseStr = HttpUtils.sendPost(this.url + "/batchrealvalue", JSONObject.toJSONString(queryDto), this.authorization); |
| | | JSONObject responseObj = JSON.parseObject(responseStr); |
| | | if (S_CODE != Integer.parseInt(responseObj.get(R_CODE).toString())) { |
| | | return null; |
| | |
| | | objs.add(writeDTO); |
| | | writeObj.setObjs(objs); |
| | | String writeStr = JSONObject.toJSONString(writeObj); |
| | | String responseStr = HttpRequest.sendPost(this.url + "/realvariables", writeStr, this.authorization); |
| | | String responseStr = HttpUtils.sendPost(this.url + "/realvariables", writeStr, this.authorization); |
| | | JSONObject responseObj = JSON.parseObject(responseStr); |
| | | if (S_CODE != Integer.parseInt(responseObj.get(R_CODE).toString())) { |
| | | throw new Exception(responseObj.getString(R_MSG)); |
| | |
| | | writeDTO.setV(newValue); |
| | | objs.add(writeDTO); |
| | | writeObj.setObjs(objs); |
| | | String responseStr = HttpRequest.sendPost(this.url + "/realvariables", JSONObject.toJSONString(writeObj), this.authorization); |
| | | String responseStr = HttpUtils.sendPost(this.url + "/realvariables", JSONObject.toJSONString(writeObj), this.authorization); |
| | | JSONObject responseObj = JSON.parseObject(responseStr); |
| | | if (S_CODE != Integer.parseInt(responseObj.get(R_CODE).toString())) { |
| | | throw new Exception(responseObj.getString(R_MSG)); |
| | |
| | | writeDTO.setV(newValue); |
| | | objs.add(writeDTO); |
| | | writeObj.setObjs(objs); |
| | | String responseStr = HttpRequest.sendPost(this.url + "/realvariables", JSONObject.toJSONString(writeObj), this.authorization); |
| | | String responseStr = HttpUtils.sendPost(this.url + "/realvariables", JSONObject.toJSONString(writeObj), this.authorization); |
| | | JSONObject responseObj = JSON.parseObject(responseStr); |
| | | if (S_CODE != Integer.parseInt(responseObj.get(R_CODE).toString())) { |
| | | throw new Exception(responseObj.getString(R_MSG)); |