From eb12daf15edd4e5b478672b37fe15b8735b66411 Mon Sep 17 00:00:00 2001 From: junjun Date: Mon, 18 Apr 2022 10:09:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?refactor:=20=E4=BB=AA=E8=A1=A8=E7=9B=98?= =?UTF-8?q?=E9=98=88=E5=80=BC=E6=94=AF=E6=8C=81=E5=B0=8F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/chart/gauge/gauge.js | 2 +- frontend/src/views/chart/chart/gauge/gauge_antv.js | 2 +- frontend/src/views/chart/components/senior/Threshold.vue | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/views/chart/chart/gauge/gauge.js b/frontend/src/views/chart/chart/gauge/gauge.js index c578949fa9..74922e41e5 100644 --- a/frontend/src/views/chart/chart/gauge/gauge.js +++ b/frontend/src/views/chart/chart/gauge/gauge.js @@ -62,7 +62,7 @@ export function baseGaugeOption(chart_option, chart) { const per = parseFloat(chart.data.series[0].data[0]) / parseFloat(chart_option.series[0].max) for (let i = 0; i < arr.length; i++) { const ele = arr[i] - const p = parseInt(ele) / 100 + const p = parseFloat(ele) / 100 range.push([p, hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)]) if (!flag && per <= p) { flag = true diff --git a/frontend/src/views/chart/chart/gauge/gauge_antv.js b/frontend/src/views/chart/chart/gauge/gauge_antv.js index 2aff090ed8..c492061a2a 100644 --- a/frontend/src/views/chart/chart/gauge/gauge_antv.js +++ b/frontend/src/views/chart/chart/gauge/gauge_antv.js @@ -48,7 +48,7 @@ export function baseGaugeOptionAntV(plot, container, chart, action) { const arr = threshold.gaugeThreshold.split(',') for (let i = 0; i < arr.length; i++) { const ele = arr[i] - const p = parseInt(ele) / 100 + const p = parseFloat(ele) / 100 range.push(p) if (!flag && per <= p) { flag = true diff --git a/frontend/src/views/chart/components/senior/Threshold.vue b/frontend/src/views/chart/components/senior/Threshold.vue index 69c9d7871e..e970c5349f 100644 --- a/frontend/src/views/chart/components/senior/Threshold.vue +++ b/frontend/src/views/chart/components/senior/Threshold.vue @@ -9,7 +9,7 @@ ,100
- 阈值设置,决定仪表盘区间颜色,为空则不开启阈值,范围(0-100),仅限整数,且逐级递增 + 阈值设置,决定仪表盘区间颜色,为空则不开启阈值,范围(0-100),逐级递增
例如:输入 30,70;表示:分为3段,分别为[0,30],(30,70],(70,100]
@@ -129,7 +129,7 @@ export default { const arr = this.thresholdForm.gaugeThreshold.split(',') for (let i = 0; i < arr.length; i++) { const ele = arr[i] - if (ele.indexOf('.') > -1 || parseInt(ele).toString() === 'NaN' || parseInt(ele) < 1 || parseInt(ele) > 99) { + if (parseFloat(ele).toString() === 'NaN' || parseFloat(ele) < 1 || parseFloat(ele) > 99) { this.$message({ message: this.$t('chart.gauge_threshold_format_error'), type: 'error', From 413481685a193a9719277a97146391e2ba9f639a Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 18 Apr 2022 10:48:20 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20redis=E7=BC=93=E5=AD=98=E5=AD=98?= =?UTF-8?q?=E5=8F=96=E6=96=B9=E6=A1=88=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/listener/util/CacheUtils.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/io/dataease/listener/util/CacheUtils.java b/backend/src/main/java/io/dataease/listener/util/CacheUtils.java index df13083c45..22ebed424a 100644 --- a/backend/src/main/java/io/dataease/listener/util/CacheUtils.java +++ b/backend/src/main/java/io/dataease/listener/util/CacheUtils.java @@ -26,8 +26,8 @@ public class CacheUtils { public static Object get(String cacheName, Object key) { if (getCacheManager() instanceof RedisCacheManager) { org.springframework.cache.Cache cache = getCacheManager().getCache(cacheName); - if (null == cache) return null; - return cache.get(key); + if (null == cache || null == cache.get(key)) return null; + return cache.get(key).get(); } Element element = cache(cacheName).get(key); if (null == element) return null; @@ -36,9 +36,12 @@ public class CacheUtils { public static void put(String cacheName, Object key, Object value, Integer ttl, Integer tti) { if (getCacheManager() instanceof RedisCacheManager) { - RedisTemplate redisTemplate = (RedisTemplate) CommonBeanFactory.getBean("redisTemplate"); + /*RedisTemplate redisTemplate = (RedisTemplate) CommonBeanFactory.getBean("redisTemplate"); ValueOperations valueOperations = redisTemplate.opsForValue(); - valueOperations.set(cacheName + "::" + key , value ); + valueOperations.set(cacheName + "::" + key , value );*/ + org.springframework.cache.Cache cache = getCacheManager().getCache(cacheName); + if (null == cache) return; + cache.put(key, value); return; } Element e = new Element(key, value);