From 0152c5791c36fc63dbedfb4b687af68fb5435cdb Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 31 Jan 2024 14:36:43 +0800 Subject: [PATCH] =?UTF-8?q?#=E5=A2=9E=E5=8A=A0Json=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/operation/monitor/impl/MonitorServiceImpl.java | 2 +- .../operational/station/service/impl/RealMonitorServiceImpl.java | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java index 8f41d10..831dade 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java @@ -344,7 +344,7 @@ public class MonitorServiceImpl implements MonitorService { Thread.currentThread().interrupt(); } pool.shutdown(); - redisTemplate.opsForValue().set(moniter_station_cache_final, JSONObject.toJSONString(stationList)); + redisTemplate.opsForValue().set(moniter_station_cache_final, stationList); } /** diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java index 352d070..1d7072e 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java @@ -467,7 +467,7 @@ public class RealMonitorServiceImpl implements IRealMonitorService { } pool.shutdown(); log.info(thread.getName() + "步骤12所有线程完成 耗时 : {}",System.currentTimeMillis() - beginTime); - redisTemplate.opsForValue().set(moniter_station_key, stationList); + redisTemplate.opsForValue().set(moniter_station_key, JSONObject.toJSONString(stationList)); } /** @@ -851,12 +851,10 @@ public class RealMonitorServiceImpl implements IRealMonitorService { if(ObjectUtil.isEmpty(message) || CollectionUtil.isEmpty(message.getDeptIds())){ return null; } - Object json = redisTemplate.opsForValue().get(moniter_station_key); - if(ObjectUtil.isEmpty(json)){ + List realStationVoList = (List) redisTemplate.opsForValue().get(moniter_station_key); + if(ObjectUtil.isEmpty(realStationVoList)){ return null; } - // 获取所有监控缓存数据 - List realStationVoList = JSONObject.parseObject(json.toString(),new TypeReference>() {}); if(CollectionUtil.isEmpty(realStationVoList)){ return null; }