diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/IotMachineServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/IotMachineServiceImpl.java index d901570..c387427 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/IotMachineServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/IotMachineServiceImpl.java @@ -6,6 +6,7 @@ import com.alibaba.fastjson2.JSONObject; import com.bonus.sgzb.base.domain.MaTypeKeeper; import com.bonus.sgzb.base.mapper.MaTypeMapper; import com.bonus.sgzb.common.core.constant.HttpStatus; +import com.bonus.sgzb.common.core.constant.RoleConstans; import com.bonus.sgzb.common.core.constant.TokenConstants; import com.bonus.sgzb.common.core.exception.ServiceException; import com.bonus.sgzb.common.core.utils.DateUtils; @@ -500,10 +501,16 @@ public class IotMachineServiceImpl implements IotMachineService { @Scheduled(fixedRate = 10800000) public int alarmPush() { log.info("开始获取报警信息===="); + List maTypeKeeperList = new ArrayList<>(); //获取当前登录用户的所有信息 - Long userId = SecurityUtils.getLoginUser().getUserid(); - //查看当前用户名下有哪些类型的设备 - List maTypeKeeperList = maTypeMapper.selectMaTypeByUserId(userId); + try { + Long userId = SecurityUtils.getLoginUser().getUserid(); + //查看当前用户名下有哪些类型的设备 + maTypeKeeperList = maTypeMapper.selectMaTypeByUserId(userId); + } catch (Exception e) { + log.error("获取用户信息有误!!"); + return 0; + } List iotLocationVoAll = new ArrayList<>(); for (int i = 0; i < maTypeKeeperList.size(); i++) { //查询该类机具有哪些设备绑定的iot设备