From b9408687a3c0490289206b7e3b623d1490b38afd Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期五, 06 三月 2026 09:52:30 +0800
Subject: [PATCH] 2026年03月06日09:52:20 增加AI接口

---
 app/src/main/java/com/hdl/photovoltaic/ui/BPowerStationActivity.java |   60 +++++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 49 insertions(+), 11 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 e70dad0..ef0499e 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;
@@ -141,7 +145,7 @@
         this.getUnreadCount();
         //鑾峰彇浜戠鑴氭湰
         HdlESLocalJsonLogic.getInstance().getAllHdlESLocalJson();
-
+        this.getChatInfo();
 
     }
 
@@ -371,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);
             }
         });
     }
@@ -878,16 +916,16 @@
      */
     private void clickNotificationMessageTab() {
         //瑙﹀彂娑堟伅鐐瑰嚮浜嬩欢
-//        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.refresh_message_house, ConstantManage.refresh_message_house);
+        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.refresh_message_house, ConstantManage.refresh_message_house);
     }
 
 

--
Gitblit v1.8.0