From 80f2ca2df62ff1cd03046864af504245be078eb2 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期四, 05 六月 2025 10:37:28 +0800 Subject: [PATCH] 2025年06月05日10:37:26 --- app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java | 206 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 186 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java index 3e61f84..afd5eaf 100644 --- a/app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java +++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java @@ -4,6 +4,7 @@ import android.graphics.BitmapFactory; import android.os.Build; import android.text.TextUtils; +import android.util.Log; import com.google.gson.Gson; import com.google.gson.JsonObject; @@ -86,6 +87,33 @@ return mHouseIdList; } + /** + * 璁剧疆鍒楄〃鏁版嵁 + * + * @param list 鏂板垪琛� + * @param isClear 鏄惁娓呴櫎鏃ф暟鎹�,true琛ㄧず娓呴櫎,鍚﹀垯涓嶆竻闄�; + */ + public void setHouseIdList(List<HouseIdBean> list, boolean isClear) { + if (list == null || list.size() == 0) { + return; + } + if (isClear) { + this.clearHouseList(); + } + if (this.mHouseIdList.size() == 0) { + this.mHouseIdList.addAll(list); + return; + } + for (int i = 0; i < list.size(); i++) { + this.setSingleHouseId(list.get(i)); + } + } + + /** + * 璁剧疆鍒楄〃鏁版嵁 + * + * @param list 鏂板垪琛ㄦ暟鎹� + */ public void setHouseIdList(List<HouseIdBean> list) { if (list == null || list.size() == 0) { return; @@ -258,7 +286,6 @@ * ascending:鍗囧簭), */ public void getResidenceIdList(String key, String keyValue, CloudCallBeak<List<HouseIdBean>> cloudCallBeak) { - String requestUrl = HttpApi.POST_PowerStation_List; JsonObject json = new JsonObject(); if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(keyValue)) { @@ -319,7 +346,6 @@ } }); } - } @Override @@ -343,19 +369,12 @@ * ascending:鍗囧簭), * @param installedCapacityMin 鏈�灏忕粍涓插閲�(瑁呮満瀹归噺) * @param installedCapacityMax 鏈�澶х粍涓插閲�(瑁呮満瀹归噺) - * @param gridType 骞剁綉鐘舵�� (鍏ㄩ儴 锛�"";FULL_GRID 锛� 骞剁綉;OFFLINE 锛氱缃�) + * @param debugStatus 璋冭瘯鐘舵��(鍏ㄩ儴;璋冭瘯涓�;璋冭瘯瀹屾垚;宸蹭氦浠�;鎺堟潈璋冭瘯) * @param powerStationStatus 鐢电珯鐘舵�� (鍏ㄩ儴 锛�"";1 锛� 姝e父;2 锛� 绂荤嚎; 3 锛� 寰呮帴鍏�;4 锛� 鏁呴殰) * @param pageNo 椤电爜 * @param pageSize 椤垫暟锛堜竴椤靛灏戞暟鎹級 */ - public void getResidenceIdList( - String key, - String keyValue, - String installedCapacityMin, - String installedCapacityMax, - String gridType, - String powerStationStatus, - long pageNo, long pageSize, CloudCallBeak<HouseBeanClass> cloudCallBeak) { + public void getResidenceIdList(String key, String keyValue, String installedCapacityMin, String installedCapacityMax, String debugStatus, String powerStationStatus, long pageNo, long pageSize, CloudCallBeak<HouseBeanClass> cloudCallBeak) { String requestUrl = HttpApi.POST_PowerStation_List; JsonObject json = new JsonObject(); @@ -376,9 +395,9 @@ } catch (Exception ignored) { } } - if (!TextUtils.isEmpty(gridType)) { + if (!TextUtils.isEmpty(debugStatus)) { try { - json.addProperty("gridType", gridType); + json.addProperty("debugStatus", debugStatus); } catch (Exception ignored) { } } @@ -573,10 +592,25 @@ /** * 鐢电珯鐘舵�佹瑙�(瀹夎鍟�) + * + * @param debugStatus (璋冭瘯鐘舵��:Debugging = 璋冭瘯涓�,WAIT_DELIVERED = 璋冭瘯瀹屾垚,Delivered = 宸蹭氦浠�,SECONDARY_DEBUGGIN = 鎺堟潈璋冭瘯) + * @param installedCapacityMin 鏈�灏忕粍涓插閲�(瑁呮満瀹归噺) + * @param installedCapacityMax 鏈�澶х粍涓插閲�(瑁呮満瀹归噺) */ - public void getStatusOverview(CloudCallBeak<StatusOverviewBean> cloudCallBeak) { + public void getStatusOverview(String debugStatus, String installedCapacityMin, String installedCapacityMax, CloudCallBeak<StatusOverviewBean> cloudCallBeak) { String requestUrl = HttpApi.POST_statusOverview; JsonObject json = new JsonObject(); + if (!TextUtils.isEmpty(installedCapacityMin)) { + json.addProperty("installedCapacityMin", installedCapacityMin); + } + if (!TextUtils.isEmpty(installedCapacityMax)) { + json.addProperty("installedCapacityMax", installedCapacityMax); + } + if (!TextUtils.isEmpty(debugStatus)) { + json.addProperty("debugStatus", debugStatus); + } + + // json.addProperty("zoneType", zoneType);//鍖哄煙 HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() { @Override @@ -859,13 +893,16 @@ /** * 鍒囨崲浣忓畢 * - * @param houseIdBean 浣忓畢Id瀵硅薄 + * @param houseIdBean 浣忓畢Id瀵硅薄 + * @param checkStationId 琛ㄧず鏄惁鍚姩妫�楠岀數绔橧d鐨勯�昏緫锛坱rue琛ㄧず妫�娴�,鍚﹀垯涓嶆楠岋級 */ - public void switchHouse(HouseIdBean houseIdBean) { + public void switchHouse(HouseIdBean houseIdBean, boolean checkStationId) { String homeId = UserConfigManage.getInstance().getHomeId(); - if (houseIdBean.getHomeId().equals(homeId)) { - HdlLogLogic.print("鐐瑰嚮鍚屼竴涓綇瀹�--->" + homeId); - return; + if (checkStationId) { + if (houseIdBean.getHomeId().equals(homeId)) { + HdlLogLogic.print("鐐瑰嚮鍚屼竴涓綇瀹�--->" + homeId); + return; + } } //璁㈤槄瑕佸叏閮ㄥ彇娑� if (MqttRecvClient.getInstance() != null) { @@ -887,7 +924,7 @@ //閲嶆柊鍒涘缓浣忓畢鏂囦欢澶� HdlFileLogic.getInstance().createDirectory(); //杩涘幓浣忓畢璇︽儏鎼滅储涓�涓嬮�嗗彉鍣ㄥ垪琛�,鐩殑鏄缓绔嬮�氳閫氶亾; - HdlDeviceLogic.getInstance().searchCurrentHomeGateway(houseIdBean.getHomeId(),null); + HdlDeviceLogic.getInstance().searchCurrentHomeGateway(houseIdBean.getHomeId(), null); } @@ -918,6 +955,135 @@ }); } + /** + * 鐢电珯鎺堟潈瀹夎鍟嗭紙C绔級 + * 鎻忚堪锛氫氦浠樺悗鐨勪綇瀹咃紝C绔敤鎴峰彲浠ュ紑鍚巿鏉冨悗瀹夎鍟嗗彲浠ョ户缁皟璇曠數绔� + * + * @param homeId 鐢电珯id + * @param debugPerm 鎺堟潈鐘舵�侊紙true鍙互缁х画璋冭瘯锛� + * @param cloudCallBeak - + */ + public void homeUpdateDebugPerm(String homeId, boolean debugPerm, CloudCallBeak<Boolean> cloudCallBeak) { + String requestUrl = HttpApi.C_POST_HOME_UPDATEDEBUGPERM; + JsonObject json = new JsonObject(); + json.addProperty("homeId", homeId); + json.addProperty("debugPerm", debugPerm); +// json.addProperty("zoneType", memberBean.getId());//鍖哄煙 + + HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() { + @Override + public void onSuccess(String jsonStr) { + if (cloudCallBeak != null) { + cloudCallBeak.onSuccess(true); + } + } + + @Override + public void onFailure(HDLException e) { + if (cloudCallBeak != null) { + cloudCallBeak.onFailure(e); + } + } + }); + + } + + /** + * 鑾峰彇鐢电珯浜や粯浜岀淮鐮侊紙B绔級 + * 鎻忚堪锛氬畨瑁呭晢鐢电珯鐨勪氦浠樹簩缁寸爜 + * + * @param homeId 鐢电珯id + * @param cloudCallBeak - + */ + public void getDeliveryUrlQrcode(String homeId, CloudCallBeak<String> cloudCallBeak) { + String requestUrl = HttpApi.POST_getDeliveryUrlQrcode; + JsonObject json = new JsonObject(); + json.addProperty("homeId", homeId); +// json.addProperty("zoneType", memberBean.getId());//鍖哄煙 + + HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() { + @Override + public void onSuccess(String jsonStr) { + if (cloudCallBeak != null) { + cloudCallBeak.onSuccess(jsonStr); + } + } + + @Override + public void onFailure(HDLException e) { + if (cloudCallBeak != null) { + cloudCallBeak.onFailure(e); + } + } + }); + + } + + + /** + * 鑾峰彇鐢电珯浜や粯URl锛圔绔級 + * 鎻忚堪锛氬畨瑁呭晢鐢电珯鐨勪氦浠楿Rl + * + * @param homeId 鐢电珯id + * @param cloudCallBeak - + */ + public void getDeliveryUrl(String homeId, CloudCallBeak<String> cloudCallBeak) { + String requestUrl = HttpApi.POST_getDeliveryUrl; + JsonObject json = new JsonObject(); + json.addProperty("homeId", homeId); +// json.addProperty("zoneType", memberBean.getId());//鍖哄煙 + + HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() { + @Override + public void onSuccess(String jsonStr) { + if (cloudCallBeak != null) { + cloudCallBeak.onSuccess(jsonStr); + } + } + + @Override + public void onFailure(HDLException e) { + if (cloudCallBeak != null) { + cloudCallBeak.onFailure(e); + } + } + }); + + } + + + /** + * 鐢电珯鎵嬪姩浜や粯(B绔�) + * 鎻忚堪锛氬畨瑁呭晢鎵嬪姩浜や粯鐢电珯缁欐寚瀹氱殑C绔处鍙� + * + * @param homeId 鐢电珯id + * @param account C绔处鍙� + * @param cloudCallBeak - + */ + public void getDeliverToAccount(String homeId, String account, CloudCallBeak<Boolean> cloudCallBeak) { + String requestUrl = HttpApi.POST_deliverToAccount; + JsonObject json = new JsonObject(); + json.addProperty("homeId", homeId); + json.addProperty("account", account);//C绔处鍙� +// json.addProperty("zoneType", memberBean.getId());//鍖哄煙 + + HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() { + @Override + public void onSuccess(String jsonStr) { + if (cloudCallBeak != null) { + cloudCallBeak.onSuccess(true); + } + } + + @Override + public void onFailure(HDLException e) { + if (cloudCallBeak != null) { + cloudCallBeak.onFailure(e); + } + } + }); + + } /** * 娣诲姞鎺ㄩ�乀oken -- Gitblit v1.8.0