From c4ae4589c6c001329ebb731589b209e8ddcbf7ca Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期二, 24 三月 2026 16:03:59 +0800
Subject: [PATCH] 2026年03月24日16:03:57

---
 app/src/main/java/com/hdl/photovoltaic/ui/BPowerStationActivity.java |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 51 insertions(+), 6 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/BPowerStationActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/BPowerStationActivity.java
index 0948a63..4f23843 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/BPowerStationActivity.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/BPowerStationActivity.java
@@ -37,6 +37,7 @@
 import com.hdl.photovoltaic.enums.LowerTagType;
 import com.hdl.photovoltaic.enums.NetworkType;
 import com.hdl.photovoltaic.listener.CloudCallBeak;
+import com.hdl.photovoltaic.other.HdlAiLogic;
 import com.hdl.photovoltaic.other.HdlCommonLogic;
 import com.hdl.photovoltaic.other.HdlDeviceLogic;
 import com.hdl.photovoltaic.other.HdlESLocalJsonLogic;
@@ -49,6 +50,9 @@
 import com.hdl.photovoltaic.other.HdlThreadLogic;
 import com.hdl.photovoltaic.other.HdlUniLogic;
 import com.hdl.photovoltaic.push.PushMessageInfoBean;
+import com.hdl.photovoltaic.ui.bean.ChatInfoBean;
+import com.hdl.photovoltaic.ui.bean.ChatMessageListBean;
+import com.hdl.photovoltaic.ui.bean.ChatMessagePageBean;
 import com.hdl.photovoltaic.ui.bean.DeviceRemoteInfo;
 import com.hdl.photovoltaic.ui.bean.MessageBean;
 import com.hdl.photovoltaic.ui.bean.OidBean;
@@ -111,6 +115,10 @@
 
     @Override
     public void onBindView(Bundle savedInstanceState) {
+////        //閫氱煡鏍忕偣鍑昏繘鏉ワ紝闃叉搴旂敤鍦ㄥ悗鍙版椂琚噸澶嶅惎鍔�,闃块噷浜戞帹鍔ㄩ�氱煡鎸囧畾鎵撳紑鏌愪釜Activity锛屾病鏈夎缃瓼lags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);榛樿鍚姩鏂板疄渚嬶紝瀵艰嚧澶氫釜瀹炰緥
+//        if (!isTaskRoot()) {
+//            finish();
+//        }
         setStatusBarTranslucent();
         getWindow().setNavigationBarColor(getColor(R.color.text_FF1C1C1E));
         //鍒濆鍖栫鐗�
@@ -137,7 +145,7 @@
         this.getUnreadCount();
         //鑾峰彇浜戠鑴氭湰
         HdlESLocalJsonLogic.getInstance().getAllHdlESLocalJson();
-
+        this.getChatInfo();
 
     }
 
@@ -151,6 +159,7 @@
             if (TextUtils.isEmpty(data)) {
                 return;
             }
+//            PushMessageInfoBean pushMessageInfoBean = new Gson().fromJson(data, PushMessageInfoBean.class);
             PushMessageInfoBean pushMessageInfoBean = HdlPushLogic.getInstance().pushDataProcessing("", "", data);
             if (TextUtils.isEmpty(pushMessageInfoBean.getMsgId())) {
                 return;
@@ -319,7 +328,7 @@
 //                    UserConfigManage.getInstance().setRegistrationID(registrationID);
 //                    UserConfigManage.getInstance().Save();
                     String finalRegistrationID = registrationID;
-                    HdlResidenceLogic.getInstance().pushAdd(new CloudCallBeak<String>() {
+                    HdlPushLogic.getInstance().pushAdd(new CloudCallBeak<String>() {
                         @Override
                         public void onSuccess(String pushId) {
 
@@ -353,10 +362,11 @@
      * @param token 浠ょ墝
      */
     private void sendPushTokenToServer(final String token) {
+
         if (TextUtils.isEmpty(token)) {
             return;
         }
-        HdlResidenceLogic.getInstance().pushAdd(new CloudCallBeak<String>() {
+        HdlPushLogic.getInstance().pushAdd(new CloudCallBeak<String>() {
             @Override
             public void onSuccess(String pushId) {
                 HdlLogLogic.print("娣诲姞浠ょ墝鍒颁簯绔� PushToken:" + UserConfigManage.getInstance().getPushToken() + " pushId:" + pushId, true);
@@ -365,6 +375,40 @@
             @Override
             public void onFailure(HDLException e) {
                 HdlLogLogic.print("娣诲姞浠ょ墝鍒颁簯绔け璐� PushToken:" + UserConfigManage.getInstance().getPushToken() + " 閿欒锛�" + e.getMessage(), true);
+            }
+        });
+    }
+
+    /**
+     * 鏌ョ湅鏅鸿兘浣撹鎯�
+     *
+     */
+    private void getChatInfo() {
+        HdlAiLogic.getInstance().getChatInfo(new CloudCallBeak<ChatInfoBean>() {
+            @Override
+            public void onSuccess(ChatInfoBean chatInfoBean) {
+                UserConfigManage.getInstance().setAgentSecret(chatInfoBean.getAgentSecret());
+                UserConfigManage.getInstance().setAgentUrl(chatInfoBean.getAgentUrl());
+                UserConfigManage.getInstance().Save();
+                HdlAiLogic.getInstance().chatMessagesList(new CloudCallBeak<ChatMessagePageBean>() {
+                    @Override
+                    public void onSuccess(ChatMessagePageBean obj) {
+                        if (obj != null && !obj.getData().isEmpty()) {
+                            UserConfigManage.getInstance().setConversationId(obj.getData().get(0).getId());
+                            UserConfigManage.getInstance().Save();
+                        }
+                    }
+
+                    @Override
+                    public void onFailure(HDLException e) {
+
+                    }
+                });
+            }
+
+            @Override
+            public void onFailure(HDLException e) {
+                HdlLogLogic.print("鑾峰彇鏅鸿兘浣揂ppKey澶辫触 Pu" + e.getMessage(), true);
             }
         });
     }
@@ -781,7 +825,7 @@
                     public void run() {
                         //闃叉app鍚姩鐨勬椂鍊欐病鏈夌綉缁�(app涔熺櫥褰曚笉浜�),瀵艰嚧鑾峰彇涓嶄簡mqtt杩滅▼杩炴帴淇℃伅;
                         initMqttClient();
-                        HdlDeviceLogic.getInstance().getCurrentHomeLocalAndCloudGatewayList(UserConfigManage.getInstance().getHomeId(), new CloudCallBeak<List<GatewayBean>>() {
+                        HdlDeviceLogic.getInstance().getCurrentHomeLocalAndCloudGatewayList(UserConfigManage.getInstance().getHomeId(), UserConfigManage.getInstance().getPowerStationType(), new CloudCallBeak<List<GatewayBean>>() {
                             @Override
                             public void onSuccess(List<GatewayBean> obj) {
 //                                AppManagerUtils.getAppManager().hideLoading();
@@ -803,7 +847,7 @@
                 showFragment();
             }
         } else if (event.getTopic().contains(ConstantManage.refresh_push_token)) {
-            String token=event.getType();
+            String token = event.getType();
             UserConfigManage.getInstance().setPushToken(token);
             UserConfigManage.getInstance().Save();
             //pushToken鏇存柊
@@ -874,13 +918,14 @@
         //瑙﹀彂娑堟伅鐐瑰嚮浜嬩欢
         viewBinding.myMessageBottomIl2.clickTv.performClick();
 //        if (currentFragmentIndex == 2) {
+//            HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.refresh_message_house, ConstantManage.refresh_message_house);
 //            return;
 //        }
 //        currentFragmentIndex = 2;
 //        bottomViewChangeOfStyle();
 //        showFragment();
 //        HdlCommonLogic.lowerTagType = LowerTagType.message;
-//        HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.homepage_title_tab_switch, HomepageTitleTabSwitch.message.toString());
+//        HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.refresh_message_house, ConstantManage.refresh_message_house);
     }
 
 

--
Gitblit v1.8.0