| | |
| | | * @return |
| | | */ |
| | | public static String getElectricity(){ |
| | | String valueTotal = "0"; |
| | | String value = "0"; |
| | | HttpRequest post = HttpRequest.post("https://www.zsdcloud.cn:8443/openApi/equipment/select.action"); |
| | | post.form("token", accessToken); |
| | |
| | | } |
| | | String string1 = jsonObject.getString("result"); |
| | | JSONObject jsonObject1 = JSONObject.parseObject(string1); |
| | | String realInfo = jsonObject1.getString("realInfo"); |
| | | String realInfo = jsonObject1.getString("childList"); |
| | | JSONArray jsonArray = JSONArray.parseArray(realInfo); |
| | | for (Object o : jsonArray) { |
| | | JSONObject jsonObject2 = JSONObject.parseObject(o.toString()); |
| | | if(jsonObject2.get("Name").toString().equals("累积日充电量")){ |
| | | value= jsonObject2.get("Value").toString(); |
| | | break; |
| | | String string2 = jsonObject2.get("valueList").toString(); |
| | | JSONArray jsonArray1 = JSONArray.parseArray(string2); |
| | | for (Object o1 : jsonArray1) { |
| | | JSONObject jsonObject3 = JSONObject.parseObject(o1.toString()); |
| | | if(jsonObject3.get("Name").toString().equals("系统累计充电量")){ |
| | | valueTotal= jsonObject3.get("Value").toString(); |
| | | } |
| | | if(jsonObject3.get("Name").toString().equals("系统累计放电量")){ |
| | | value= jsonObject3.get("Value").toString(); |
| | | } |
| | | } |
| | | return value; |
| | | } |
| | | return valueTotal+"_"+value; |
| | | } |
| | | public static void main(String[] args) throws Exception { |
| | | String electricity = getElectricity(); |