mac
2024-03-20 5ca2b601848c62607d88fee5afdae6af80f6eea7
app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -67,6 +67,7 @@
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
@@ -115,8 +116,9 @@
                return;
            }
            String type = getKeyValue("type", data);//小类
            String logTag = getKeyValue("logTag", data);//标记uni指令
            String mode_type = "大类->" + topic + "--->" + "小类->" + type;//用来打印的
            HdlLogLogic.print("uni--->发送--->" + mode_type + "\r\n" + data, true);
            HdlLogLogic.print(logTag + ":" + "uni--->发送--->" + mode_type + "\r\n" + data, true);
            if (HDLUniMP.UNI_EVENT_REPLY_USER_MODEL.equals(topic)) {
                //用户模块
                switch (type) {
@@ -124,6 +126,7 @@
                    case HDLUniMP.UNI_EVENT_REPLY_USER_INFO: {
                        this.uniGetUserInfo(mode_type, data, callback);
                    }
                    break;
                    //用户头像(旧平台逻辑是头像单独获取下载地址)
                    case HDLUniMP.UNI_EVENT_REPLY_USER_IMAGE: {
                        uniGetImageKey(mode_type, data, callback);
@@ -1121,6 +1124,7 @@
                UserConfigManage.getInstance().Save();
                //获取用户头像路径
                if (cUserInfo.getMemberHeadIcon().contains("http")) {
                    UserConfigManage.getInstance().setUserImageUrl(cUserInfo.getMemberHeadIcon());
                    //更新用户头像
                    uniCallbackData(type, cUserInfo, callback);
                } else {
@@ -1128,12 +1132,13 @@
                        @Override
                        public void onSuccess(String url) {
                            cUserInfo.setMemberHeadIcon(url);
                            UserConfigManage.getInstance().setUserImageUrl(cUserInfo.getMemberHeadIcon());
                            uniCallbackData(type, cUserInfo, callback);
                        }
                        @Override
                        public void onFailure(HDLException e) {
                            uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
                            uniCallbackData(type, cUserInfo, callback);
                        }
                    });
                }
@@ -1379,7 +1384,7 @@
                                atomicInteger.set(atomicInteger.get() + 1);
                                //最后一条才做添加逆变器逻辑处理
                                if (atomicInteger.get() == list.size()) {
                                    HdlDeviceLogic.getInstance().addAllInverterDeviceToCloud(homeId, gatewayBean.getDevice_mac(), list, new CloudCallBeak<Boolean>() {
                                    HdlDeviceLogic.getInstance().addAllInverterDeviceToCloud(homeId, list, new CloudCallBeak<Boolean>() {
                                        @Override
                                        public void onSuccess(Boolean obj) {
                                            uniCallbackData(type, null, callback);
@@ -1448,7 +1453,7 @@
    private void uniSearchGateway(String type, DCUniMPJSCallback callback) {
        HdlDeviceLogic.getInstance().searchCurrentHomeGateway(new GatewayCallBack() {
        HdlDeviceLogic.getInstance().searchAllNetworkGateway(new GatewayCallBack() {
            @Override
            public void onSuccess(List<GatewayBean> gatewayBeanList) {
                uniCallbackData(type, gatewayBeanList, callback);
@@ -1480,16 +1485,16 @@
                    }
                    return;
                }
                //进来住宅详情都要上传一次oid列表到云端;
                HdlDeviceLogic.getInstance().uploadDataToCloud(homeId, list, null);
                if (callback != null) {
                    uniCallbackData(type, list, callback);
                }
                //EventBus事件分发,进入住宅开始订阅主题
                BaseEventBus baseEventBus = new BaseEventBus();
                baseEventBus.setType(HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST);
                baseEventBus.setData(list);
                EventBus.getDefault().post(baseEventBus);
                if (callback != null) {
                    uniCallbackData(type, list, callback);
                }
                //进来住宅详情都要上传一次oid列表到云端;
                HdlDeviceLogic.getInstance().uploadDataToCloud(homeId, list, null);
            }
            @Override
@@ -1550,7 +1555,7 @@
            @Override
            public void onError(HDLLinkException e) {
                uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
                //HdlLogLogic.print("uni--->接收--->ModBus--->" + e.getMsg() + "(" + e.getCode() + ")", true);
//                HdlLogLogic.print("uni--->接收--->ModBus--->" + e.getMsg() + "(" + e.getCode() + ")", true);
            }
        });
    }