wjc
2026-03-24 c4ae4589c6c001329ebb731589b209e8ddcbf7ca
app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java
@@ -29,6 +29,7 @@
import com.hdl.photovoltaic.databinding.ActivityCpowerStationBinding;
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;
@@ -41,6 +42,9 @@
import com.hdl.photovoltaic.other.HdlUniLogic;
import com.hdl.photovoltaic.push.PushMessageInfoBean;
import com.hdl.photovoltaic.services.ForeService;
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.HouseIdBean;
import com.hdl.photovoltaic.ui.bean.MessageBean;
@@ -105,6 +109,7 @@
        this.initMqttClient();
//        //上传极光注册ID到云端
//        this.pushTokens();
        this.getChatInfo();
        //上传推动令牌到云端(谷歌FCM推送)
        this.sendPushTokenToServer(UserConfigManage.getInstance().getPushToken());
        //点击通知栏消息进来
@@ -113,6 +118,41 @@
        HdlESLocalJsonLogic.getInstance().getAllHdlESLocalJson();
//        mForegroundService= new Intent(this, ForeService.class);
//        startService();
    }
    /**
     * 查看智能体详情
     *
     */
    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("获取智能体详情失败:" + e.getMessage(), true);
            }
        });
    }
    Intent mForegroundService;
@@ -155,6 +195,7 @@
            if (TextUtils.isEmpty(pushMessageInfoBean.getMsgId()) && !pushMessageInfoBean.isAiPrompt()) {
                return;
            }
            Log.d("==========111111", tag);
            HDLUniMPSDKManager.uinEnabled = false;
            if (tag.equals("onNewIntent")) {
                HDLUniMPSDKManager.uinEnabled = false;
@@ -211,7 +252,7 @@
                                    HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean();
                                    uniCallBackBaseBean.setType(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_open_ai_push_message);
                                    HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_MODEL, uniCallBackBaseBean);
//                                    HdlLogLogic.print("uni---原生主动向小程序发送通知AI事件---", false);
                                    HdlLogLogic.print("uni---原生主动向小程序发送通知AI事件---", false);
                                } else {
                                    MessageBean messageBean = new MessageBean();
                                    messageBean.setMsgId(Long.valueOf(pushMessageInfoBean.getMsgId()));
@@ -219,6 +260,7 @@
                                    intentMessageInfoActivity.setClass(_mActivity, MessageInfoActivity.class);
                                    intentMessageInfoActivity.putExtra("messageBean", JSONObject.toJSONString(messageBean));
                                    startActivity(intentMessageInfoActivity);
                                    HdlLogLogic.print("uni---原生主动向小程序发送通知AI事件---11111", false);
                                }
                            }
@@ -300,7 +342,7 @@
                        //防止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();
@@ -381,8 +423,7 @@
            }
            HouseIdBean houseIdBean = HouseIdList.get(select_home);
            HdlResidenceLogic.getInstance().switchHouse(houseIdBean, false);
            String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS_C + "?homeId=" + houseIdBean.getHomeId() + "&homeName=" + houseIdBean.getHomeName() + "&powerStationStatus=" + houseIdBean.getPowerStationStatus();
            HdlUniLogic.getInstance().openUniMP(path, null);
            HdlResidenceLogic.getInstance().openPowerStationDetails(houseIdBean);
        }
    }