From 44ba605a4e850efa757020da5fb4cf02bdf6e3ab Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期一, 08 九月 2025 10:55:18 +0800
Subject: [PATCH] 2025年09月08日10:55:15
---
app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java | 97 +++++++++++++++++++++++++++++++++++++++---------
1 files changed, 79 insertions(+), 18 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java
index 45e84c4..fd8969e 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java
@@ -12,6 +12,7 @@
import com.google.gson.Gson;
+import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import com.hdl.linkpm.sdk.core.exception.HDLException;
import com.hdl.linkpm.sdk.home.type.HomeType;
@@ -25,6 +26,7 @@
import com.hdl.photovoltaic.databinding.ActivityCpowerStationBinding;
import com.hdl.photovoltaic.enums.NetworkType;
import com.hdl.photovoltaic.listener.CloudCallBeak;
+import com.hdl.photovoltaic.other.HdlCommonLogic;
import com.hdl.photovoltaic.other.HdlDeviceLogic;
import com.hdl.photovoltaic.other.HdlESLocalJsonLogic;
import com.hdl.photovoltaic.other.HdlLogLogic;
@@ -37,6 +39,8 @@
import com.hdl.photovoltaic.ui.bean.DeviceRemoteInfo;
import com.hdl.photovoltaic.ui.bean.HouseIdBean;
import com.hdl.photovoltaic.ui.bean.OidBean;
+import com.hdl.photovoltaic.ui.newC.PowerStationsListActivity;
+import com.hdl.photovoltaic.ui.newC.PowerStationsMoveActivity;
import com.hdl.photovoltaic.uni.HDLUniMP;
import com.hdl.photovoltaic.uni.HDLUniMPSDKManager;
import com.hdl.photovoltaic.utils.AppManagerUtils;
@@ -149,7 +153,7 @@
return;
}
int index = -1;
- List<GatewayBean> list = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(UserConfigManage.getInstance().getHomeId(), null);
+ List<GatewayBean> list = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(UserConfigManage.getInstance().getHomeId());
for (int i = 0; i < list.size(); i++) {
GatewayBean gatewayBean = list.get(i);
if (gatewayBean.getGatewayId().equals(topics[2])) {
@@ -223,8 +227,8 @@
}
String homeId = event.getData().toString();
//杩涘幓浣忓畢璇︽儏uni璇诲彇閫嗗彉鍣ㄥ垪琛ㄦ垚鍔熷悗閫氱煡
- for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId, null).size(); i++) {
- String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId, null).get(i).getGatewayId();
+ for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId).size(); i++) {
+ String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId).get(i).getGatewayId();
//瀛楃涓叉槸鑷繁鎸夎鍒欐嫾鎺ョ殑,閲岄潰娉ㄥ唽涓婚鏃朵細瑙f瀽瀛楃涓�,鍙嬁getGatewayId()鍊�;
String topic = "/user/" + gatewayId + "/#";
//杩涘幓浣忓畢璇︽儏寮�濮嬭闃呬富棰�
@@ -249,26 +253,31 @@
// }
if (TextUtils.isEmpty(HDLLinkPMUser.getInstance().getAccessToken())) {
//鍏跺疄鍒锋柊token澶辫触宸查�氱煡閫�鍑虹櫥褰曪紝鏁版嵁宸茬粡娓呯┖锛屽洜涓虹瓑2s uni鍔犺浇鎱㈠鑷磋姹傞摼鎺ョ殑鏃跺�欏嚭鐜皌oken涓虹┖
- HdlLogLogic.print("杩斿洖鍘�---",true);
+ HdlLogLogic.print("杩斿洖鍘�---", true);
return;
}
UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(0);
List<HouseIdBean> HouseIdList = HdlResidenceLogic.getInstance().getHouseIdList();
if (HouseIdList.isEmpty()) {
- if (TextUtils.isEmpty(UserConfigManage.getInstance().getHomeId())) {
- String path = HDLUniMP.UNI_EVENT_OPEN_HOME_Null_C;
- HdlUniLogic.getInstance().openUniMP(path, null);
- } else {
- //瑙e喅闂鎵嬫満娌℃湁缃戣嚜鍔ㄧ櫥褰曡繘鏉ワ紝榛樿浼犱笂涓�娆$殑浣忓畢id
- String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS_C + "?homeId=" + UserConfigManage.getInstance().getHomeId() + "&homeName=" + UserConfigManage.getInstance().getHomeName();
- HdlUniLogic.getInstance().openUniMP(path, null);
- }
+// if (TextUtils.isEmpty(UserConfigManage.getInstance().getHomeId())) {
+ String path = HDLUniMP.UNI_EVENT_OPEN_HOME_Null_C;
+ HdlUniLogic.getInstance().openUniMP(path, null);
+// } else {
+// //鏆傛椂涓嶈�冭檻杩欑鎯呭喌
+// //1锛岃В鍐虫墜鏈烘病鏈夊缃戯紝鑾峰彇涓嶅埌鐢电珯鍒楄〃锛岃嚜鍔ㄧ櫥褰曡繘鏉ワ紝榛樿浼犱笂涓�娆$殑浣忓畢id锛�
+// //2锛屼箣鍓嶇數绔欏垪琛ㄥ彧鏈変竴涓數绔欙紝鐒跺悗鍒犻櫎鎺夌數绔欙紝杩欐椂浣忓畢id杩樼紦瀛樼潃锛屽啀涓�娆¤繘鏉ワ紝榛樿浼犱笂涓�娆$殑浣忓畢id锛�
+// String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS_C + "?homeId=" + UserConfigManage.getInstance().getHomeId() + "&homeName=" + UserConfigManage.getInstance().getHomeName();
+// HdlUniLogic.getInstance().openUniMP(path, null);
+// }
} else {
+
int select_home = 0;
- for (int i = 0; i < HouseIdList.size(); i++) {
- if (HouseIdList.get(i).getHomeId().equals(UserConfigManage.getInstance().getHomeId())) {
- select_home = i;
- break;
+ if (!TextUtils.isEmpty(UserConfigManage.getInstance().getHomeId())) {//鏈湴缂撳瓨浣忓畢id涓嶄负绌哄啀閬嶅巻鏌ユ壘
+ for (int i = 0; i < HouseIdList.size(); i++) {
+ if (HouseIdList.get(i).getHomeId().equals(UserConfigManage.getInstance().getHomeId())) {
+ select_home = i;
+ break;
+ }
}
}
HouseIdBean houseIdBean = HouseIdList.get(select_home);
@@ -357,14 +366,15 @@
}
}
if (!TextUtils.isEmpty(registrationID)) {
- UserConfigManage.getInstance().setRegistrationID(registrationID);
- UserConfigManage.getInstance().Save();
+// UserConfigManage.getInstance().setRegistrationID(registrationID);
+// UserConfigManage.getInstance().Save();
String finalRegistrationID = registrationID;
HdlResidenceLogic.getInstance().pushAdd(new CloudCallBeak<String>() {
@Override
public void onSuccess(String pushId) {
if (!TextUtils.isEmpty(pushId)) {
+ UserConfigManage.getInstance().setRegistrationID(finalRegistrationID);
UserConfigManage.getInstance().setPushId(pushId);
UserConfigManage.getInstance().Save();
}
@@ -485,6 +495,57 @@
uniCallBackBaseBean.setType(linkResponse.getTopic());
uniCallBackBaseBean.setData(linkResponse.getData());
HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_MODEL, uniCallBackBaseBean);
+ } else if (linkResponse.getTopic().endsWith("custom/wifi/notify")) {
+ //閫嗗彉鍣ㄨ繛鎺ヨ矾鐢辩姸鎬侀�氱煡
+// HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean();
+// uniCallBackBaseBean.setType(linkResponse.getTopic());
+// uniCallBackBaseBean.setData(linkResponse.getData());
+// HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_MODEL, uniCallBackBaseBean);
+ HdlLogLogic.print(linkResponse.getTopic() + new Gson().toJson(linkResponse.getData()), true);
+// HdlDeviceLogic.getInstance().searchAllNetworkGateway(null);//閫嗗彉鍣╳ifi鐘舵��-閲嶆柊鎼滅储涓�涓嬮�嗗彉鍣�-閲嶆柊鏇存柊杩炴帴鐘舵��
+ } else if (linkResponse.getTopic().endsWith("/app/thing/event/appHomeDeliverRollbackRefresh/up")) {
+ try {
+ //浣忓畢浜や粯鐘舵�佸洖婊氶�氱煡
+ String[] topicArray = linkResponse.getTopic().split("/");
+ if (topicArray.length < 2) {
+ return;
+ }
+ final String HomeId = topicArray[2];
+ //鍏堝垹闄ょ數绔�
+ HdlResidenceLogic.getInstance().delHouseId(HomeId);
+ List<HouseIdBean> localHouseIdList = HdlResidenceLogic.getInstance().getHouseIdList();
+ if (localHouseIdList.isEmpty()) {
+ JsonObject jsonObject = new JsonObject();
+ jsonObject.addProperty("homeId", "");
+ HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean();
+ uniCallBackBaseBean.setType(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_REFRESH_DETAILS);
+ uniCallBackBaseBean.setData(jsonObject);
+ HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_MODEL, uniCallBackBaseBean);
+ UserConfigManage.getInstance().setHomeId("");
+ UserConfigManage.getInstance().Save();
+ } else {
+ if (HomeId.equals(UserConfigManage.getInstance().getHomeId()) || TextUtils.isEmpty(UserConfigManage.getInstance().getHomeId())) {
+ HouseIdBean houseIdBean = localHouseIdList.get(0);
+ HdlResidenceLogic.getInstance().switchHouse(houseIdBean, true);
+ JsonObject jsonObject = new JsonObject();
+ jsonObject.addProperty("homeId", houseIdBean.getHomeId());
+ jsonObject.addProperty("homeName", houseIdBean.getHomeName());
+ jsonObject.addProperty("powerStationStatus", houseIdBean.getPowerStationStatus() + "");
+ HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean();
+ uniCallBackBaseBean.setType(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_REFRESH_DETAILS);
+ uniCallBackBaseBean.setData(jsonObject);
+ HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_MODEL, uniCallBackBaseBean);
+ }
+ }
+
+ } catch (Exception e) {
+ HdlLogLogic.print("鍥炴粴寮傚父", false);
+ }
+ if (AppManagerUtils.getAppManager().existsTopActivity(PowerStationsListActivity.class, PowerStationsMoveActivity.class)) {
+ //瀛樺湪鏍堥噷鍐嶉�氱煡鏇存柊
+ HdlCommonLogic.getInstance().postEventBus(ConstantManage.REFRESH_HOME_LIST, ConstantManage.REFRESH_HOME_LIST);
+ }
+ HdlLogLogic.print(linkResponse.getTopic() + new Gson().toJson(linkResponse.getData()), true);
}
}
--
Gitblit v1.8.0