mac
2024-05-21 125b1775618a0e6c650d76be051b6f16a559bb1a
2024年05月21日16:00:32

备份一下代码
9个文件已修改
164 ■■■■ 已修改文件
app/src/main/java/com/hdl/photovoltaic/config/ConstantManage.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/other/HdlCommonLogic.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/ui/BPowerStationActivity.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/ui/message/MessageInfoActivity.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/ui/message/SearchMessageActivity.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/ui/newC/MessageCenterList.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/config/ConstantManage.java
@@ -24,6 +24,8 @@
    //网络状态发生变化
    public static final String network_change_post = "network_change";
    //电站状态
    public static final String station_status = "station_status";
}
app/src/main/java/com/hdl/photovoltaic/other/HdlCommonLogic.java
@@ -14,10 +14,14 @@
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import com.hdl.linkpm.sdk.user.HDLLinkPMUser;
import com.hdl.photovoltaic.config.ConstantManage;
import com.hdl.photovoltaic.config.UserConfigManage;
import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch;
import com.hdl.photovoltaic.enums.UnitType;
import com.hdl.photovoltaic.utils.GlideUtils;
import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus;
import org.greenrobot.eventbus.EventBus;
import org.json.JSONObject;
import java.io.InputStream;
@@ -195,4 +199,62 @@
    }
    /**
     * 发布EventBus粘性事件
     * <p>
     * 注意:要取消粘性事件EventBus.getDefault().removeStickyEvent(eventBus);
     *
     * @param topic 主题
     * @param type  事件
     */
    public void postEventBusSticky(String topic, String type) {
        BaseEventBus baseEventBus = new BaseEventBus();
        baseEventBus.setTopic(topic);
        baseEventBus.setType(type);
        EventBus.getDefault().postSticky(baseEventBus);
    }
    /**
     * 发布EventBus粘性事件
     * <p>
     * 注意:要取消粘性事件EventBus.getDefault().removeStickyEvent(eventBus);
     *
     * @param topic 主题
     * @param type  事件
     */
    public void postEventBusSticky(String topic, String type, Object o) {
        BaseEventBus baseEventBus = new BaseEventBus();
        baseEventBus.setTopic(topic);
        baseEventBus.setType(type);
        baseEventBus.setData(o);
        EventBus.getDefault().postSticky(baseEventBus);
    }
    /**
     * 发布EventBus事件
     *
     * @param topic 主题
     * @param type  事件
     */
    public void postEventBus(String topic, String type) {
        BaseEventBus baseEventBus = new BaseEventBus();
        baseEventBus.setTopic(topic);
        baseEventBus.setType(type);
        EventBus.getDefault().postSticky(baseEventBus);
    }
    /**
     * 发布EventBus事件
     *
     * @param topic 主题
     * @param type  事件
     */
    public void postEventBus(String topic, String type, Object o) {
        BaseEventBus baseEventBus = new BaseEventBus();
        baseEventBus.setTopic(topic);
        baseEventBus.setType(type);
        baseEventBus.setData(o);
        EventBus.getDefault().postSticky(baseEventBus);
    }
}
app/src/main/java/com/hdl/photovoltaic/ui/BPowerStationActivity.java
@@ -32,7 +32,9 @@
import com.hdl.photovoltaic.databinding.ActivityMyPowerStationBinding;
import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch;
import com.hdl.photovoltaic.enums.NetworkType;
import com.hdl.photovoltaic.enums.PowerStationStatusType;
import com.hdl.photovoltaic.listener.CloudCallBeak;
import com.hdl.photovoltaic.other.HdlCommonLogic;
import com.hdl.photovoltaic.other.HdlDeviceLogic;
import com.hdl.photovoltaic.other.HdlLogLogic;
import com.hdl.photovoltaic.other.HdlMessageLogic;
@@ -306,7 +308,7 @@
                currentFragmentIndex = 0;
                bottomViewChangeOfStyle();
                showFragment();
                postEventBus(HomepageTitleTabSwitch.homepage);
                HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.homepage_title_tab_switch, HomepageTitleTabSwitch.homepage.toString());
            }
        });
        viewBinding.myPowerStationBottomIl1.clickTv.setOnClickListener(new View.OnClickListener() {
@@ -318,7 +320,7 @@
                currentFragmentIndex = 1;
                bottomViewChangeOfStyle();
                showFragment();
                postEventBus(HomepageTitleTabSwitch.powerstation);
                HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.homepage_title_tab_switch, HomepageTitleTabSwitch.powerstation.toString());
            }
        });
        viewBinding.myMessageBottomIl2.clickTv.setOnClickListener(new View.OnClickListener() {
@@ -330,7 +332,7 @@
                currentFragmentIndex = 2;
                bottomViewChangeOfStyle();
                showFragment();
                postEventBus(HomepageTitleTabSwitch.message);
                HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.homepage_title_tab_switch, HomepageTitleTabSwitch.message.toString());
            }
        });
        viewBinding.myMeBottomIl3.clickTv.setOnClickListener(new View.OnClickListener() {
@@ -342,7 +344,7 @@
                currentFragmentIndex = 3;
                bottomViewChangeOfStyle();
                showFragment();
                postEventBus(HomepageTitleTabSwitch.me);
                HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.homepage_title_tab_switch, HomepageTitleTabSwitch.me.toString());
            }
        });
@@ -410,17 +412,6 @@
        }
    }
    /**
     * 发布点击事件
     *
     * @param tabSwitch -
     */
    private void postEventBus(HomepageTitleTabSwitch tabSwitch) {
        BaseEventBus baseEventBus = new BaseEventBus();
        baseEventBus.setTopic(ConstantManage.homepage_title_tab_switch);
        baseEventBus.setType(tabSwitch.toString());
        EventBus.getDefault().postSticky(baseEventBus);
    }
    public void requestPermissions() {
        //消息通知限权
@@ -636,6 +627,12 @@
                    }
                });
            }
        } else if (event.getTopic().contains(ConstantManage.station_status)) {
            currentFragmentIndex = 1;
            bottomViewChangeOfStyle();
            showFragment();
            HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.homepage_title_tab_switch, event.getType());
        }
    }
app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java
@@ -21,15 +21,14 @@
import com.hdl.photovoltaic.R;
import com.hdl.photovoltaic.base.CustomBaseFragment;
import com.hdl.photovoltaic.config.ConstantManage;
import com.hdl.photovoltaic.config.UserConfigManage;
import com.hdl.photovoltaic.databinding.FragmentHomePageBinding;
import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch;
import com.hdl.photovoltaic.enums.PowerStationStatus;
import com.hdl.photovoltaic.enums.PowerStationStatusType;
import com.hdl.photovoltaic.enums.TimeType;
import com.hdl.photovoltaic.enums.UnitType;
import com.hdl.photovoltaic.listener.CloudCallBeak;
import com.hdl.photovoltaic.other.HdlCommonLogic;
import com.hdl.photovoltaic.other.HdlDeviceLogic;
import com.hdl.photovoltaic.other.HdlLogLogic;
import com.hdl.photovoltaic.other.HdlPowerStationDataStatisticsLogic;
import com.hdl.photovoltaic.other.HdlResidenceLogic;
@@ -81,7 +80,6 @@
    @Override
    public void onBindView(Bundle savedInstanceState) {
        //初始化
        initView();
        //初始化界面监听器
@@ -120,7 +118,7 @@
        viewBinding.homeAllIl.parentLl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                HdlCommonLogic.getInstance().postEventBus(ConstantManage.station_status, PowerStationStatus.All);
            }
        });
@@ -128,18 +126,21 @@
        viewBinding.homeFaultsIl.parentLl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                HdlCommonLogic.getInstance().postEventBus(ConstantManage.station_status, PowerStationStatus.malfunction);
            }
        });
        //离线
        viewBinding.homeOfflineIl.parentLl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                HdlCommonLogic.getInstance().postEventBus(ConstantManage.station_status, PowerStationStatus.off);
            }
        });
        //待接入
        viewBinding.homeConnectedIl.parentLl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                HdlCommonLogic.getInstance().postEventBus(ConstantManage.station_status, PowerStationStatus.connecting);
            }
        });
        //时间选择器
@@ -388,9 +389,7 @@
        aaChartView.callBack = this;
        if (TimeType.day.equals(timeType)) {
            aaChartModel = BasicChartComposer.configureAreaChart(getString(R.string.pv_power), fieldNames, fieldValues);
        } else if (TimeType.month.equals(timeType)
                || TimeType.year.equals(timeType)
                || TimeType.all.equals(timeType)) {
        } else if (TimeType.month.equals(timeType) || TimeType.year.equals(timeType) || TimeType.all.equals(timeType)) {
            aaChartModel = configureColorfulColumnChart(getString(R.string.pv_power), fieldNames, fieldValues);
        }
        aaChartView.aa_drawChartWithChartModel(aaChartModel);
@@ -465,6 +464,7 @@
        }
    }
    /**
     * 电站状态概览
     */
app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java
@@ -219,8 +219,15 @@
            mMessageAdapter.setOnclickListener(new MessageAdapter.OnClickListener() {
                @Override
                public void onClick(int position, MessageBean messageBean) {
                    String messageStateType;
                    if (isAlarmDeviceClick) {
                        messageStateType = MessageStateType.untreated;
                    } else {
                        messageStateType = MessageStateType.processed;
                    }
                    Intent intent = new Intent();
                    intent.putExtra("msgId", messageBean.getMsgId().toString());
                    intent.putExtra("messageStateType", messageStateType);
                    intent.setClass(_mActivity, MessageInfoActivity.class);
                    startActivity(intent);
                }
@@ -298,7 +305,7 @@
                // 取消粘性事件
                EventBus.getDefault().removeStickyEvent(eventBus);
                //进来读取一次数据(为了更新currentPage,currentTotal这个值)
                initData();
//                initData();
                HdlLogLogic.print("正在点击【消息】");
            }
app/src/main/java/com/hdl/photovoltaic/ui/message/MessageInfoActivity.java
@@ -34,6 +34,7 @@
    private MessageBean mMessageBean;
    private String mMsgId;
    private String mMessageStateType;
    @Override
    public Object getContentView() {
@@ -47,6 +48,7 @@
        setStatusBarTextColor();
        try {
            mMsgId = getIntent().getStringExtra("msgId");
            mMessageStateType = getIntent().getStringExtra("messageStateType");
        } catch (Exception ignored) {
        }
@@ -240,5 +242,11 @@
        viewBinding.messageInfoAlarmRangeIn.rightContentTv.setText("");
        viewBinding.messageInfoPowerStationLocationIn.rightContentTv.setText("");
        viewBinding.messageInfoAlarmTimeIn.rightContentTv.setText("");
        if (mMessageStateType.equals(MessageStateType.processed)) {
            //已经解决掉的隐藏
            viewBinding.messageInfoBackTv.setVisibility(View.GONE);
            viewBinding.messageInfoSolveTv.setVisibility(View.GONE);
        }
    }
}
app/src/main/java/com/hdl/photovoltaic/ui/message/SearchMessageActivity.java
@@ -183,6 +183,7 @@
            public void onClick(int position, MessageBean messageBean) {
                Intent intent = new Intent();
                intent.putExtra("msgId", messageBean.getMsgId().toString());
                intent.putExtra("messageStateType", mMessageStateType);
                intent.setClass(_mActivity, MessageInfoActivity.class);
                startActivity(intent);
            }
app/src/main/java/com/hdl/photovoltaic/ui/newC/MessageCenterList.java
@@ -269,8 +269,17 @@
            messageCenterListAdapter.setNoOnclickListener(new MessageCenterListAdapter.OnclickListener() {
                @Override
                public void onClick(int position, MessageBean messageBean) {
                    String messageStateType;
                    if (isAlarmDeviceClick) {
                        messageStateType = MessageStateType.untreated;
                    } else {
                        messageStateType = MessageStateType.processed;
                    }
                    Intent intent = new Intent();
                    intent.putExtra("msgId", messageBean.getMsgId().toString());
                    intent.putExtra("messageStateType", messageStateType);
                    intent.setClass(_mActivity, MessageInfoActivity.class);
                    startActivity(intent);
                }
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java
@@ -59,6 +59,8 @@
 * 电站和设备-界面
 */
public class HouseAndDeviceFragment extends CustomBaseFragment {
    private boolean isReadData = false;
    private FragmentHouseListBinding viewBinding;
    private HouseInfoAdapter houseInfoAdapter;
@@ -66,8 +68,6 @@
    private List<HouseIdBean> houseListBeanIDList;
    private List<DeviceBean> deviceInfoList;
    private int currentHouseListPage = 0; // 当前电站列表页码
    private int currentHouseListTotal = 0; // 电站列表总页码
    private boolean isHouseLoadingMore = false; // 标记电站列表正在加载更多数据
@@ -96,9 +96,6 @@
    @Override
    public void onBindView(Bundle savedInstanceState) {
        //放在这里也对,这里只是被创建一次
//        loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
//        getStatusOverview();
        initData();
        //初始化
        initView();
@@ -126,6 +123,7 @@
                    viewBinding.deviceNullDataIc.getRoot().setVisibility(View.GONE);
                }
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
                getStatusOverview();
            }
        });
        //设备标签
@@ -229,6 +227,7 @@
            public void onRefresh() {
                viewBinding.fragmentHouseSrl.setRefreshing(false);
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
                getStatusOverview();
            }
        });
        //电站上拉读取
@@ -602,14 +601,20 @@
                // 取消粘性事件
                EventBus.getDefault().removeStickyEvent(eventBus);
                HdlLogLogic.print("正在点击【电站】");
//                HdlThreadLogic.runSubThread(new Runnable() {
//                    @Override
//                    public void run() {
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
                getStatusOverview();
//                    }
//                });
                if (!isReadData) {
                    //1,从首页-故障-进来-电站(不读取)
                    //1,从电站-进来-电站(读取一次,后面进来不在读取)
                    loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
                    getStatusOverview();
                }
            } else if (eventBus.getType().equals(PowerStationStatus.All)) {
                viewBinding.powerStationAllIl.parentLl.performClick();
            } else if (eventBus.getType().equals(PowerStationStatus.malfunction)) {
                viewBinding.powerStationFaultsIl.parentLl.performClick();
            } else if (eventBus.getType().equals(PowerStationStatus.off)) {
                viewBinding.powerStationOfflineIl.parentLl.performClick();
            } else if (eventBus.getType().equals(PowerStationStatus.connecting)) {
                viewBinding.powerStationConnectedIl.parentLl.performClick();
            }
        }
    }
@@ -656,6 +661,7 @@
     * @param isClear              是否清除数据
     */
    private void loadNextPageHouseList(boolean isRefreshing, String key, String keyValue, String installedCapacityMin, String installedCapacityMax, String gridType, String powerStationStatus, long pageNo, boolean isClear) {
        isReadData = true;
        if (isClear) {
            clearData();
        }