2021与蓝度共同重构项目,服务端
liuhaonan
2022-05-17 fb842a99734726e628bd0981ccdf80a253534eaa
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedPlayerEntityService.java
@@ -1,5 +1,6 @@
package com.sandu.ximon.admin.service;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.sandu.common.execption.BusinessException;
@@ -66,7 +67,6 @@
    /**
     * 首页灯杆绑定信息
     */
    //TODO
    public EquipmentInfomation getBySnAndPlayerSnInfo(String sn) {
        EquipmentInfomation equipmentInfo = new EquipmentInfomation();
        equipmentInfo.setEquipmentType("诺瓦LED");
@@ -75,6 +75,9 @@
        }
        LedPlayerEntity one = getOne(Wrappers.lambdaQuery(LedPlayerEntity.class).eq(LedPlayerEntity::getSn, sn));
        if (one == null) {
            return equipmentInfo;
        }
        List<LedPlayerEntity> list = new ArrayList<>();
        list.add(one);
        List<LedPlayerEntity> ledPlayerEntities = vnnoxAPIUtil.syncCurrentInfo(list);
@@ -82,11 +85,11 @@
        if (one != null) {
            equipmentInfo.setEquipmentMac(one.getSn());
            equipmentInfo.setEquipmentName(one.getName());
           if (onlineStatus == 0) {
            if (onlineStatus == 0) {
                equipmentInfo.setEquipmentState("在线");
           }else {
               equipmentInfo.setEquipmentName("离线");
           }
            } else {
                equipmentInfo.setEquipmentState("离线");
            }
        }
        return equipmentInfo;
@@ -104,17 +107,16 @@
        } else {
            list = ledPlayerEntityMapper.ledPlayerEntityList(keyword, SecurityUtils.getUserId());
        }
        return SpringContextHolder.getBean(VnnoxService.class).setCacheInfo(vnnoxAPIUtil.syncCurrentInfo(list));
        List<List<LedPlayerEntity>> split = CollectionUtil.split(list, 100);
        List<LedPlayerEntity> ledPlayerEntities=null;
        for (List<LedPlayerEntity> splist : split) {
            List<LedPlayerEntity> ledPlayerEntitie = SpringContextHolder.getBean(VnnoxService.class).setCacheInfo(vnnoxAPIUtil.syncCurrentInfo(splist));
            if (ledPlayerEntitie != null) {
                ledPlayerEntities.addAll(ledPlayerEntitie);
            }
        }
        return ledPlayerEntities;
    }
//    public List<LedPlayerEntity> ledPlayerEntityList() {
//        List<LedPlayerEntity> list;
//        //超管
//        if (SecurityUtils.getClientId() == null) {
//            list = ledPlayerEntityMapper.ledPlayerEntityList(null, null);
//        } else {
//            list = ledPlayerEntityMapper.ledPlayerEntityList(null, SecurityUtils.getUserId());
//        }
//        return SpringContextHolder.getBean(VnnoxService.class).setCacheInfo(vnnoxAPIUtil.syncCurrentInfo(list));
//    }
}