| | |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | |
| | | |
| | | public static void refreshDeviceAlarmInfo() { |
| | | //删除缓存 |
| | | redisTemplate.delete(RedisConstants.DEVICE_INFO); |
| | | |
| | | refreshDeviceAlarmInfo(null); |
| | | |
| | | |
| | | } |
| | | public static void refreshDeviceAlarmInfo(String mac){ |
| | | if(StringUtils.isEmpty(mac)){ |
| | | //删除缓存 |
| | | redisTemplate.delete(RedisConstants.DEVICE_INFO); |
| | | }else { |
| | | redisTemplate.opsForHash().delete(RedisConstants.DEVICE_INFO,mac); |
| | | } |
| | | //重新添加缓存 |
| | | List<Device> devices = deviceMapper.queryDeviceUnitAlarmInfo(); |
| | | List<Device> devices = deviceMapper.queryDeviceUnitAlarmInfo(mac); |
| | | |
| | | Map<String, SysDictData> unitMap = sysDictDataService.getDictDatasByType("unit"); |
| | | //查询对应的单位名称以及转换公式 |
| | | Map<String,Device> result = new HashMap<>(); |
| | |
| | | redisTemplate.opsForHash().putAll(RedisConstants.DEVICE_INFO,result); |
| | | } |
| | | |
| | | |
| | | |
| | | public static void refreshSpecialDeviceAlarmInfo() { |
| | | //删除缓存 |
| | | redisTemplate.delete(RedisConstants.SPECIAL_DEVICE_INFO); |