wjc
2026-03-24 c4ae4589c6c001329ebb731589b209e8ddcbf7ca
app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java
@@ -11,6 +11,7 @@
import com.hdl.linkpm.sdk.core.exception.HDLException;
import com.hdl.photovoltaic.config.AppConfigManage;
import com.hdl.photovoltaic.config.UserConfigManage;
import com.hdl.photovoltaic.enums.PowerStationType;
import com.hdl.photovoltaic.enums.ProjectOperation;
import com.hdl.photovoltaic.internet.HttpClient;
import com.hdl.photovoltaic.internet.api.HttpApi;
@@ -19,6 +20,7 @@
import com.hdl.photovoltaic.ui.bean.HouseInfoBean;
import com.hdl.photovoltaic.ui.bean.HouseIdBean;
import com.hdl.photovoltaic.ui.bean.StatusOverviewBean;
import com.hdl.photovoltaic.uni.HDLUniMP;
import com.hdl.sdk.link.core.config.HDLLinkConfig;
import com.hdl.sdk.link.core.utils.mqtt.MqttRecvClient;
@@ -391,10 +393,11 @@
     * @param installedCapacityMax 最大组串容量(装机容量)
     * @param debugStatus          调试状态(全部;调试中;调试完成;已交付;授权调试)
     * @param powerStationStatus   电站状态 (全部  :"";1 : 正常;2 : 离线; 3 : 待接入;4 : 故障)
     * @param powerStationType     电站类型(INV = 逆变器电站;BMS = BMS电站)
     * @param pageNo               页码
     * @param pageSize             页数(一页多少数据)
     */
    public void getResidenceIdList(String key, String keyValue, String installedCapacityMin, String installedCapacityMax, String debugStatus, String powerStationStatus, long pageNo, long pageSize, CloudCallBeak<HouseBeanClass> cloudCallBeak) {
    public void getResidenceIdList(String key, String keyValue, String installedCapacityMin, String installedCapacityMax, String debugStatus, String powerStationStatus, String powerStationType, long pageNo, long pageSize, CloudCallBeak<HouseBeanClass> cloudCallBeak) {
        String requestUrl = HttpApi.POST_PowerStation_List;
        JsonObject json = new JsonObject();
@@ -425,6 +428,12 @@
            try {
                int value = Integer.parseInt(powerStationStatus);
                json.addProperty("powerStationStatus", value);
            } catch (Exception ignored) {
            }
        }
        if (!TextUtils.isEmpty(powerStationType)) {
            try {
                json.addProperty("powerStationType", powerStationType);
            } catch (Exception ignored) {
            }
        }
@@ -616,8 +625,9 @@
     * @param debugStatus          (调试状态:Debugging = 调试中,WAIT_DELIVERED = 调试完成,Delivered = 已交付,SECONDARY_DEBUGGIN = 授权调试)
     * @param installedCapacityMin 最小组串容量(装机容量)
     * @param installedCapacityMax 最大组串容量(装机容量)
     * @param powerStationType     电站类型(逆变器,BMS)
     */
    public void getStatusOverview(String debugStatus, String installedCapacityMin, String installedCapacityMax, CloudCallBeak<StatusOverviewBean> cloudCallBeak) {
    public void getStatusOverview(String debugStatus, String installedCapacityMin, String installedCapacityMax, String powerStationType, CloudCallBeak<StatusOverviewBean> cloudCallBeak) {
        String requestUrl = HttpApi.POST_statusOverview;
        JsonObject json = new JsonObject();
        if (!TextUtils.isEmpty(installedCapacityMin)) {
@@ -628,6 +638,10 @@
        }
        if (!TextUtils.isEmpty(debugStatus)) {
            json.addProperty("debugStatus", debugStatus);
        }
        if (!TextUtils.isEmpty(powerStationType)) {
            json.addProperty("powerStationType", powerStationType);
        }
@@ -934,6 +948,7 @@
//        HdlFileLogic.getInstance().deleteDirectory(HdlFileLogic.getInstance().getCurrentHomeRootPath());
        //重新设置住宅id
        UserConfigManage.getInstance().setHomeId(houseIdBean.getHomeId());
        UserConfigManage.getInstance().setPowerStationType(houseIdBean.getPowerStationType());
        UserConfigManage.getInstance().setHomeName(houseIdBean.getHomeName());
        //重新设置本地通讯秘钥
        UserConfigManage.getInstance().setLocalSecret(houseIdBean.getLocalSecret());
@@ -947,6 +962,30 @@
        HdlDeviceLogic.getInstance().searchCurrentHomeGateway(houseIdBean.getHomeId(), null);
    }
    /**
     * 打开电站详情(uni界面)
     *
     * @param houseIdBean 住宅Id对象
     */
    public void openPowerStationDetails(HouseIdBean houseIdBean) {
        if (UserConfigManage.getInstance().isBAccount()) {
            if (houseIdBean.getPowerStationType().equals(PowerStationType.BMS)) {
                String path = HDLUniMP.UNI_EVENT_OPEN_BMSPLANT_DETAILS + "?homeId=" + houseIdBean.getHomeId() + "&homeName=" + houseIdBean.getHomeName() + "&isInstaller=true";
                HdlUniLogic.getInstance().openUniMP(path, null);
            } else {
                String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS + "?homeId=" + houseIdBean.getHomeId() + "&homeName=" + houseIdBean.getHomeName() + "&powerStationStatus=" + houseIdBean.getPowerStationStatus();
                HdlUniLogic.getInstance().openUniMP(path, null);
            }
        } else {
            if (houseIdBean.getPowerStationType().equals(PowerStationType.BMS)) {
                String path = HDLUniMP.UNI_EVENT_OPEN_BMSPLANT_DETAILS + "?homeId=" + houseIdBean.getHomeId() + "&homeName=" + houseIdBean.getHomeName() + "&isInstaller=false";
                HdlUniLogic.getInstance().openUniMP(path, null);
            } else {
                String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS_C + "?homeId=" + houseIdBean.getHomeId() + "&homeName=" + houseIdBean.getHomeName() + "&powerStationStatus=" + houseIdBean.getPowerStationStatus();
                HdlUniLogic.getInstance().openUniMP(path, null);
            }
        }
    }
    /**
     * 电站数据(统计)
@@ -1140,75 +1179,6 @@
    }
    /**
     * 添加推送Token
     *
     * @param cloudCallBeak -
     */
    public void pushAdd(CloudCallBeak<String> cloudCallBeak) {
        String requestUrl = HttpApi.POST_push_add;
        JsonObject json = new JsonObject();
        json.addProperty("deviceName", Build.MODEL);//设备名称
        json.addProperty("deviceType", "Android");//设备类型
        json.addProperty("produce", AppConfigManage.isIsOnlineServer());//表示是否是正式服务器
        json.addProperty("pushToken", UserConfigManage.getInstance().getPushToken());//App的推送Token,在极光为RegId
        json.addProperty("software", "PHOTOVOLTAIC");//软件来源
        json.addProperty("language", UserConfigManage.getInstance().getCurrentAppLanguage());//2.0追加的字段
        HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() {
            @Override
            public void onSuccess(String pushId) {
                if (!TextUtils.isEmpty(pushId)) {
                    UserConfigManage.getInstance().setPushId(pushId);
                    UserConfigManage.getInstance().Save();
                }
                if (cloudCallBeak != null) {
                    cloudCallBeak.onSuccess(pushId);
                }
            }
            @Override
            public void onFailure(HDLException e) {
                if (cloudCallBeak != null) {
                    cloudCallBeak.onFailure(e);
                }
            }
        });
    }
    /**
     * 删除推送Token
     *
     * @param cloudCallBeak -
     */
    public void pushDel(CloudCallBeak<String> cloudCallBeak) {
        String requestUrl = HttpApi.POST_push_del;
        JsonObject json = new JsonObject();
        json.addProperty("pushId", UserConfigManage.getInstance().getPushId());
        json.addProperty("pushToken", UserConfigManage.getInstance().getPushToken());
        HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() {
            @Override
            public void onSuccess(String jsonStr) {
                if (cloudCallBeak != null) {
                    cloudCallBeak.onSuccess(jsonStr);
                }
            }
            @Override
            public void onFailure(HDLException e) {
                if (cloudCallBeak != null) {
                    cloudCallBeak.onFailure(e);
                }
            }
        });
    }
    public static class HouseBeanClass {