2021与蓝度共同重构项目,服务端
liuhaonan
2022-09-08 521e71bc33f02ab9a1b79fb1df68c69bad4a75d2
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleLightemitService.java
@@ -1,5 +1,6 @@
package com.sandu.ximon.admin.service;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.gson.Gson;
import com.sandu.common.execption.BusinessException;
@@ -49,6 +50,9 @@
    @Autowired
    PoleLightemitEntityMapper poleLightemitDao;
    @Autowired
    LedSFileService xiXunFileService;
    @PostConstruct
    public void init() {
@@ -121,6 +125,23 @@
            }
        }
        return temp;
    }
    /**
     * 熙讯设备列表(用于首页数据统计)
     *
     * @return
     */
    public List<PoleLightemitEntity> listLedOnHome() {
        List<PoleLightemitEntity> poleLightemitEntityList;
        //超管
        if (SecurityUtils.getClientId() == null) {
            poleLightemitEntityList = poleLightemitDao.listLed(null, null, null);
        } else {
            poleLightemitEntityList = poleLightemitDao.listLed(null, SecurityUtils.getUserId(), null);
        }
        return poleLightemitEntityList;
    }
@@ -223,12 +244,13 @@
        }
        PoleLightemitEntity xiXun = getOne(Wrappers.lambdaQuery(PoleLightemitEntity.class).eq(PoleLightemitEntity::getLightemitControlCode, lightControlCode));
        boolean isScreenOpen = false;
        if (xiXun != null) {
            equipmentInfo.setEquipmentCreateTime(xiXun.getCreateTime());
            equipmentInfo.setEquipmentMac(xiXun.getLightemitControlCode());
            equipmentInfo.setEquipmentName(xiXun.getLightemitName());
            isScreenOpen = lightemitUtils.getLedOnLine(xiXun.getLightemitControlCode());
        }
        boolean isScreenOpen = lightemitUtils.getLedOnLine(xiXun.getLightemitControlCode());
        if (isScreenOpen) {
            equipmentInfo.setEquipmentState("在线");
        } else {
@@ -529,4 +551,15 @@
        lightemitUtils.setBrightness(lightemitControlCode, brightness);
    }
    public Object getProgram(Long lightemitId) {
        PoleLightemitEntity xiXun = getById(lightemitId);
        String requestBody = xiXun.getRequestBody();
        if (requestBody == null || requestBody.isEmpty()) {
            throw new BusinessException("未找到节目");
        }
        Map map = JSON.parseObject(requestBody, Map.class);
        return map;
    }
}