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 | 68 ++++++++++++++++++++++++++--------
1 files changed, 52 insertions(+), 16 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 315f9ab..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;
@@ -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;
@@ -287,12 +296,6 @@
//鍚姩椤典笌mainActivity鏍峰紡涓�鏍凤紝杩欐牱鍚姩椤靛拰mainActivity鐪嬩笂鍘绘槸涓�涓晫闈紝鐩殑鏄负浜唌ainActivity閬綇涓嬩竴椤碉紱
// AppManagerUtils.getAppManager().finishActivity(StartActivity.class);
portConflictDialog();
-// Intent intent = new Intent(_mActivity, BPowerStationActivity.class);
-// intent.setFlags(Intent.Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
-// intent.putExtra("skip", "skip");//閲岄潰鍒ゆ柇鏈夎繖涓爣璇嗗氨璺宠浆鍒版秷鎭腑蹇冪晫闈�
-// _mActivity.startActivity(intent);
- //鐐瑰嚮鏋佸厜閫氱煡鏍忔秷鎭繘鏉�
-// this.clickJpushNotificationMessage();
}
@@ -325,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) {
@@ -359,24 +362,53 @@
* @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) {
-
- if (!TextUtils.isEmpty(pushId)) {
- UserConfigManage.getInstance().setToken(token);
- UserConfigManage.getInstance().setPushId(pushId);
- UserConfigManage.getInstance().Save();
- }
HdlLogLogic.print("娣诲姞浠ょ墝鍒颁簯绔� PushToken:" + UserConfigManage.getInstance().getPushToken() + " pushId:" + pushId, true);
}
@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);
}
});
}
@@ -815,6 +847,9 @@
showFragment();
}
} else if (event.getTopic().contains(ConstantManage.refresh_push_token)) {
+ String token = event.getType();
+ UserConfigManage.getInstance().setPushToken(token);
+ UserConfigManage.getInstance().Save();
//pushToken鏇存柊
sendPushTokenToServer(UserConfigManage.getInstance().getPushToken());
}
@@ -883,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