2021与蓝度共同重构项目,服务端
liuhaonan
2022-04-27 f4914a5f40ffb7340d8f99b4f730b4b665901918
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
@@ -30,6 +30,7 @@
import com.sandu.ximon.admin.param.*;
import com.sandu.ximon.admin.redis.LightKey;
import com.sandu.ximon.admin.security.SecurityUtils;
import com.sandu.ximon.admin.utils.LightemitUtils;
import com.sandu.ximon.admin.utils.RedisUtils;
import com.sandu.ximon.admin.utils.response.VnnoxResult;
import com.sandu.ximon.admin.vo.PoleBindVO;
@@ -873,6 +874,12 @@
     */
    public boolean pushAirDataToXiXun(Long poleId) {
        Pole pole = getById(poleId);
        //判断归属权
        if (SecurityUtils.getClientId() != null) {
            if (!pole.getClientId().equals(SecurityUtils.getUserId()) && !pole.getUserId().equals(SecurityUtils.getUserId())) {
                throw new BusinessException("无权限操作");
            }
        }
        PoleBinding air = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, poleId).eq(PoleBinding::getDeviceType, 3));
        PoleBinding xixun = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, poleId).eq(PoleBinding::getDeviceType, 10));
        if (pole == null) {
@@ -890,6 +897,27 @@
        return SpringContextHolder.getBean(XiXunPlayerService.class).pushWeather(xixun.getDeviceCode(), data, pole);
    }
    /**
     * 关闭熙讯大气推送
     */
    public void closeXiXunAirPush(Long poleId) {
        Pole pole = getById(poleId);
        if (SecurityUtils.getClientId() != null) {
            if (!pole.getClientId().equals(SecurityUtils.getUserId()) && !pole.getUserId().equals(SecurityUtils.getUserId())) {
                throw new BusinessException("无权限操作");
            }
        }
        PoleBinding air = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, poleId).eq(PoleBinding::getDeviceType, 3));
        PoleBinding xixun = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, poleId).eq(PoleBinding::getDeviceType, 10));
        if (pole == null || air == null || xixun == null) {
            throw new BusinessException("设备不存在");
        }
        //关闭推送
        SpringContextHolder.getBean(LightemitUtils.class).clear(xixun.getDeviceCode());
    }
    /**
     * 推送大气监测数据到novaLED
     */