From 3439988ca26f2797ad3b2563c43af2dc86557507 Mon Sep 17 00:00:00 2001 From: junjie Date: Wed, 10 Nov 2021 15:30:21 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=A7=86=E5=9B=BE):=E8=A7=86=E5=9B=BE?= =?UTF-8?q?=E4=BF=9D=E7=95=99=E5=AE=9E=E6=97=B6=E8=AE=A1=E7=AE=97=E4=B8=8E?= =?UTF-8?q?=E6=B8=B2=E6=9F=93=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BD=86=E4=B8=8D?= =?UTF-8?q?=E5=AE=9E=E6=97=B6=E4=BF=9D=E5=AD=98=EF=BC=8C=E6=8F=90=E4=BE=9B?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E4=B8=8E=E9=87=8D=E7=BD=AE=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/chart/ChartViewController.java | 2 +- .../dataease/service/chart/ChartViewService.java | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java b/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java index 5bb7d3d54c..4e7924fc86 100644 --- a/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java +++ b/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java @@ -105,6 +105,6 @@ public class ChartViewController { @ApiOperation("计算结果") @PostMapping("/calcData") public ChartViewDTO calcData(@RequestBody ChartCalRequest request) throws Exception { - return chartViewService.calcData(request.getView(), request.getRequestList()); + return chartViewService.calcData(request.getView(), request.getRequestList(), true); } } diff --git a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java index beee14ae42..92b1cc3631 100644 --- a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -75,9 +75,9 @@ public class ChartViewService { chartView.setUpdateTime(timestamp); chartViewMapper.insertSelective(chartView); } - Optional.ofNullable(chartView.getId()).ifPresent(id -> { - CacheUtils.remove(JdbcConstants.VIEW_CACHE_KEY, id); - }); +// Optional.ofNullable(chartView.getId()).ifPresent(id -> { +// CacheUtils.remove(JdbcConstants.VIEW_CACHE_KEY, id); +// }); return getOneWithPermission(chartView.getId()); } @@ -179,10 +179,15 @@ public class ChartViewService { public ChartViewDTO getData(String id, ChartExtRequest requestList) throws Exception { ChartViewWithBLOBs view = chartViewMapper.selectByPrimaryKey(id); - return calcData(view, requestList); + return calcData(view, requestList, false); } - public ChartViewDTO calcData(ChartViewWithBLOBs view, ChartExtRequest requestList) throws Exception { + public ChartViewDTO calcData(ChartViewWithBLOBs view, ChartExtRequest requestList, boolean clearCache) throws Exception { + if (clearCache) { + Optional.ofNullable(view.getId()).ifPresent(id -> { + CacheUtils.remove(JdbcConstants.VIEW_CACHE_KEY, id); + }); + } if (ObjectUtils.isEmpty(view)) { throw new RuntimeException(Translator.get("i18n_chart_delete")); }