| | |
| | | import com.moral.api.service.DeviceService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | |
| | | import com.moral.api.util.CacheUtils; |
| | | import com.moral.api.util.LogUtils; |
| | | import com.moral.constant.Constants; |
| | | import com.moral.constant.RedisConstants; |
| | |
| | | @Autowired |
| | | private VersionSensorUnitMapper versionSensorUnitMapper; |
| | | |
| | | |
| | | |
| | | /* |
| | | * 从redis获取设备信息 |
| | | * */ |
| | |
| | | delDeviceInfoFromRedis(mac); |
| | | //设备信息存入redis |
| | | setDeviceInfoToRedis(mac, deviceInfo); |
| | | //刷新deviceInfo缓存 |
| | | CacheUtils.flushDeviceAlarmInfo(); |
| | | //操作日志记录 |
| | | HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); |
| | | StringBuilder content = new StringBuilder(); |
| | |
| | | Integer versionId = device.getDeviceVersionId(); |
| | | Integer orgId = device.getOrganizationId(); |
| | | deleteOrganizationUnitAlarm(orgId,versionId); |
| | | //刷新deviceInfo缓存 |
| | | CacheUtils.flushDeviceAlarmInfo(); |
| | | //操作日志记录 |
| | | HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); |
| | | StringBuilder content = new StringBuilder(); |
| | |
| | | public void update(Device device) { |
| | | Integer deviceId = device.getId(); |
| | | Device oldDevice = deviceMapper.selectById(deviceId); |
| | | //判断是否更新了站点,如果更新了站点则查询对应站点的组织id进行更新 |
| | | if(!ObjectUtils.isEmpty(device.getMonitorPointId())){ |
| | | MonitorPoint monitorPoint = monitorPointMapper.selectById(device.getMonitorPointId()); |
| | | device.setOrganizationId(monitorPoint.getOrganizationId()); |
| | | } |
| | | deviceMapper.updateById(device); |
| | | Device updateDevice = deviceMapper.selectById(deviceId); |
| | | String mac = updateDevice.getMac(); |
| | |
| | | Map<String, Object> deviceInfo = selectDeviceInfoById(deviceId); |
| | | //设备信息存入redis |
| | | setDeviceInfoToRedis(mac, deviceInfo); |
| | | //刷新deviceInfo缓存 |
| | | CacheUtils.flushDeviceAlarmInfo(); |
| | | //操作日志记录 |
| | | HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); |
| | | StringBuilder content = new StringBuilder(); |
| | |
| | | organizationUnitAlarm.setVersionId(versionId); |
| | | organizationUnitAlarm.setSensorCode(versionSensorUnit.getSensorCode()); |
| | | organizationUnitAlarm.setUnitKey(versionSensorUnit.getUnitKey()); |
| | | organizationUnitAlarm.setShowUnitKey(versionSensorUnit.getUnitKey()); |
| | | organizationUnitAlarmMapper.insert(organizationUnitAlarm); |
| | | } |
| | | } |