From cdcd08459665a89844a14c1d376995ebc501e018 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期三, 22 五月 2024 16:23:49 +0800 Subject: [PATCH] 2024年05月22日16:23:47 --- app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java | 71 ++++++++++------------------------- 1 files changed, 21 insertions(+), 50 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java index 0a1e88a..5d4748c 100644 --- a/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java +++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java @@ -44,6 +44,8 @@ import java.lang.reflect.Type; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; @@ -72,11 +74,9 @@ return sHdlDeviceLogic; } - public static final String kWp = "kWp"; - public static final String kWh = "kW.h"; - public static final String kW = "kW"; private List<DeviceBean> mListDevice = new ArrayList<>(); + public void clearDeviceList() { if (mListDevice == null) { @@ -213,36 +213,6 @@ }); } - /** - * 鐢电珯鐘舵�佹瑙�(瀹夎鍟�) - */ - public void getStatusOverview(CloudCallBeak<StatusOverviewBean> cloudCallBeak) { - String requestUrl = HttpApi.POST_statusOverview; - JsonObject json = new JsonObject(); -// json.addProperty("zoneType", zoneType);//鍖哄煙 - HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() { - @Override - public void onSuccess(String jsonStr) { - if (TextUtils.isEmpty(jsonStr)) { - if (cloudCallBeak != null) { - cloudCallBeak.onSuccess(new StatusOverviewBean()); - } - } - Gson gson = new Gson(); - StatusOverviewBean statusOverviewBean = gson.fromJson(jsonStr, StatusOverviewBean.class); - if (cloudCallBeak != null) { - cloudCallBeak.onSuccess(statusOverviewBean); - } - } - - @Override - public void onFailure(HDLException e) { - if (cloudCallBeak != null) { - cloudCallBeak.onFailure(e); - } - } - }); - } /** * 娣诲姞銆愯澶囧垪琛ㄣ�戝埌鏈湴缂撳瓨 @@ -291,7 +261,7 @@ } } catch (Exception e) { String mes = e.getMessage(); - HdlLogLogic.print("--->" + mes); + HdlLogLogic.print("---" + mes); } } @@ -316,19 +286,19 @@ @Override public void onSuccess(List<OidBean> oidBeanList) { if (oidBeanList == null) { - HdlLogLogic.print("涓婁紶oid鍒楄〃鍒颁簯绔垚鍔�--->浣忓畢id:" + homeId + "--->mac:" + gatewayBean.getDevice_mac() + "--->鏁版嵁鏄痭ull", true); + HdlLogLogic.print("涓婁紶oid鍒楄〃鍒颁簯绔垚鍔�---浣忓畢id:" + homeId + "---mac:" + gatewayBean.getDevice_mac() + "---鏁版嵁鏄痭ull", true); return; } //澧為噺娣诲姞oid updateOidAdd(homeId, oidBeanList, new CloudCallBeak<Boolean>() { @Override public void onSuccess(Boolean obj) { - HdlLogLogic.print("涓婁紶oid鍒楄〃鍒颁簯绔垚鍔�(澧為噺)--->浣忓畢id:" + homeId + "--->mac:" + gatewayBean.getDevice_mac() + "--->\r\n鏁版嵁--->" + new Gson().toJson(oidBeanList), true); + HdlLogLogic.print("涓婁紶oid鍒楄〃鍒颁簯绔垚鍔�(澧為噺)---浣忓畢id:" + homeId + "---mac:" + gatewayBean.getDevice_mac() + "---\r\n鏁版嵁---" + new Gson().toJson(oidBeanList), true); } @Override public void onFailure(HDLException e) { - HdlLogLogic.print("涓婁紶oid鍒楄〃鍒颁簯绔け璐�(澧為噺)--->浣忓畢id:" + homeId + "--->mac:" + gatewayBean.getDevice_mac() + "-->" + e.getMsg() + "(" + e.getCode() + ")", true); + HdlLogLogic.print("涓婁紶oid鍒楄〃鍒颁簯绔け璐�(澧為噺)---浣忓畢id:" + homeId + "---mac:" + gatewayBean.getDevice_mac() + "-->" + e.getMsg() + "(" + e.getCode() + ")", true); } }); @@ -365,12 +335,12 @@ // updateOidAdd(homeId, oidList, new CloudCallBeak<Boolean>() { // @Override // public void onSuccess(Boolean obj) { -// HdlLogLogic.print("涓婁紶oid鍒楄〃鍒颁簯绔垚鍔�--->浣忓畢id:" + homeId + "--->mac:" + gatewayBean.getDevice_mac(), true); +// HdlLogLogic.print("涓婁紶oid鍒楄〃鍒颁簯绔垚鍔�---浣忓畢id:" + homeId + "---mac:" + gatewayBean.getDevice_mac(), true); // } // // @Override // public void onFailure(HDLException e) { -// HdlLogLogic.print("涓婁紶oid鍒楄〃鍒颁簯绔け璐�--->浣忓畢id:" + homeId + "--->mac:" + gatewayBean.getDevice_mac() + "-->" + e.getMsg() + "(" + e.getCode() + ")", true); +// HdlLogLogic.print("涓婁紶oid鍒楄〃鍒颁簯绔け璐�---浣忓畢id:" + homeId + "---mac:" + gatewayBean.getDevice_mac() + "-->" + e.getMsg() + "(" + e.getCode() + ")", true); // } // }); @@ -378,12 +348,12 @@ fullUpdateOid(homeId, newOidList, new CloudCallBeak<Boolean>() { @Override public void onSuccess(Boolean obj) { - HdlLogLogic.print("涓婁紶oid鍒楄〃鍒颁簯绔垚鍔�(鍏ㄩ噺)--->浣忓畢id:" + homeId + "--->mac:" + gatewayBean.getDevice_mac() + "--->\r\n鏁版嵁--->" + new Gson().toJson(newOidList), true); + HdlLogLogic.print("涓婁紶oid鍒楄〃鍒颁簯绔垚鍔�(鍏ㄩ噺)---浣忓畢id:" + homeId + "---mac:" + gatewayBean.getDevice_mac() + "---\r\n鏁版嵁---" + new Gson().toJson(newOidList), true); } @Override public void onFailure(HDLException e) { - HdlLogLogic.print("涓婁紶oid鍒楄〃鍒颁簯绔け璐�(鍏ㄩ噺)--->浣忓畢id:" + homeId + "--->mac:" + gatewayBean.getDevice_mac() + "-->" + e.getMsg() + "(" + e.getCode() + ")", true); + HdlLogLogic.print("涓婁紶oid鍒楄〃鍒颁簯绔け璐�(鍏ㄩ噺)---浣忓畢id:" + homeId + "---mac:" + gatewayBean.getDevice_mac() + "-->" + e.getMsg() + "(" + e.getCode() + ")", true); } }); } @@ -394,19 +364,19 @@ atomicInteger.set(atomicInteger.get() + 1); if (atomicInteger.get() == list.size()) { if (newOidList.size() == 0) { - HdlLogLogic.print("鑾峰彇閫嗗彉鍣╫id鍒楄〃澶辫触--->浣忓畢id:" + homeId + "--->mac:" + gatewayBean.getDevice_mac() + "-->" + e.getMsg() + "(" + e.getCode() + ")", true); + HdlLogLogic.print("鑾峰彇閫嗗彉鍣╫id鍒楄〃澶辫触---浣忓畢id:" + homeId + "---mac:" + gatewayBean.getDevice_mac() + "-->" + e.getMsg() + "(" + e.getCode() + ")", true); return; } //澧為噺娣诲姞oid updateOidAdd(homeId, newOidList, new CloudCallBeak<Boolean>() { @Override public void onSuccess(Boolean obj) { - HdlLogLogic.print("涓婁紶oid鍒楄〃鍒颁簯绔垚鍔�(澧為噺)--->浣忓畢id:" + homeId + "--->mac:" + gatewayBean.getDevice_mac() + "--->\r\n鏁版嵁--->" + new Gson().toJson(newOidList), true); + HdlLogLogic.print("涓婁紶oid鍒楄〃鍒颁簯绔垚鍔�(澧為噺)---浣忓畢id:" + homeId + "---mac:" + gatewayBean.getDevice_mac() + "---\r\n鏁版嵁---" + new Gson().toJson(newOidList), true); } @Override public void onFailure(HDLException e) { - HdlLogLogic.print("涓婁紶oid鍒楄〃鍒颁簯绔け璐�(澧為噺)--->浣忓畢id:" + homeId + "--->mac:" + gatewayBean.getDevice_mac() + "-->" + e.getMsg() + "(" + e.getCode() + ")", true); + HdlLogLogic.print("涓婁紶oid鍒楄〃鍒颁簯绔け璐�(澧為噺)---浣忓畢id:" + homeId + "---mac:" + gatewayBean.getDevice_mac() + "-->" + e.getMsg() + "(" + e.getCode() + ")", true); } }); } @@ -620,7 +590,7 @@ */ public void fullUpdateOid(String homeId, List<OidBean> oidList, CloudCallBeak<Boolean> cloudCallBeak) { if (oidList == null || oidList.size() == 0) { - HdlLogLogic.print("oid鍒楄〃涓虹┖锛屾棤娉曞叏閲忔洿鏂皁id鍒颁簯绔�--->", true); + HdlLogLogic.print("oid鍒楄〃涓虹┖锛屾棤娉曞叏閲忔洿鏂皁id鍒颁簯绔�---", true); return; } String requestUrl = HttpApi.POST_Device_Oid; @@ -675,7 +645,7 @@ */ public void updateOidAdd(String homeId, List<OidBean> oidList, CloudCallBeak<Boolean> cloudCallBeak) { if (oidList == null || oidList.size() == 0) { - HdlLogLogic.print("oid鍒楄〃涓虹┖锛屾棤娉曞閲忔坊鍔爋id鍒颁簯绔�--->", true); + HdlLogLogic.print("oid鍒楄〃涓虹┖锛屾棤娉曞閲忔坊鍔爋id鍒颁簯绔�---", true); return; } String requestUrl = HttpApi.POST_Device_IncrAdd; @@ -706,7 +676,7 @@ if (cloudCallBeak != null) { cloudCallBeak.onSuccess(true); } - HdlLogLogic.print("澧為噺娣诲姞oid鍒颁簯绔垚鍔�--->"); + HdlLogLogic.print("澧為噺娣诲姞oid鍒颁簯绔垚鍔�---"); } @Override @@ -714,7 +684,7 @@ if (cloudCallBeak != null) { cloudCallBeak.onFailure(e); } - HdlLogLogic.print("澧為噺娣诲姞oid鍒颁簯绔け璐�--->" + e.getMsg() + "(" + e.getCode() + ")", true); + HdlLogLogic.print("澧為噺娣诲姞oid鍒颁簯绔け璐�---" + e.getMsg() + "(" + e.getCode() + ")", true); } }); @@ -922,7 +892,7 @@ if (linkCallBack != null) { linkCallBack.onError(e); } - HdlLogLogic.print("鍒濆鍖栭�嗗彉鍣ㄥけ璐�-->mac:" + mac + "--->" + e.getMsg() + "(" + e.getCode() + ")", true); + HdlLogLogic.print("鍒濆鍖栭�嗗彉鍣ㄥけ璐�-->mac:" + mac + "---" + e.getMsg() + "(" + e.getCode() + ")", true); } }); @@ -1144,7 +1114,7 @@ cloudCallBeak.onSuccess(getCurrentHomeGatewayList(homeId)); } } - HdlLogLogic.print("鑾峰彇璁惧杩滅▼閫氳淇℃伅澶辫触--->msg--->" + e.getMsg() + "(" + e.getCode() + ")"); + HdlLogLogic.print("鑾峰彇璁惧杩滅▼閫氳淇℃伅澶辫触---msg---" + e.getMsg() + "(" + e.getCode() + ")"); } }); } @@ -1421,6 +1391,7 @@ gatewayBean.setSystemStatusDesc(cloudInverterDeviceBean.getSystemStatusDesc());//璁惧鐘舵�� gatewayBean.setHwVersion(cloudInverterDeviceBean.getHwVersion());//杞欢鐗堟湰鍙� gatewayBean.setCategorySecondName(cloudInverterDeviceBean.getCategorySecondName());//璁惧绫诲瀷(浜у搧浜岀骇鍒嗙被鍚嶇О + gatewayBean.setDeviceType(cloudInverterDeviceBean.getDeviceType());//璁惧绫诲瀷(INV:閫嗗彉鍣�;BMS:BMS鎺у埗鐩�;BATTERY:鐢垫睜鍗曞厓) gatewayBean.setAddresses(cloudInverterDeviceBean.getAddresses());//瀛愮綉鍙�/璁惧鍙�,閫嗗彉鍣ㄥ湴鍧� gatewayBean.setPowerPvNow(cloudInverterDeviceBean.getPowerPvNow());//鍙戠數鍔熺巼 gatewayBean.setTotalElectricityPvToday(cloudInverterDeviceBean.getTotalElectricityPvToday());//浠婃棩鍙戠數閲� -- Gitblit v1.8.0