From 5b1cf4567d1fa672c824b7308cce60e3a2e7d9a0 Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Fri, 20 Oct 2023 09:41:00 +0800 Subject: [PATCH] =?UTF-8?q?Beta=E5=8A=9F=E8=83=BD=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=BC=93=E5=AD=98=E4=BF=A1=E6=81=AF=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20BetaCache=E6=96=B0=E5=A2=9E=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/jeecg/common/cache/BetaCache.java | 4 ++++ .../controller/SpectrumAnalysesController.java | 8 ++++---- .../service/ISpectrumAnalysisService.java | 2 +- .../impl/SpectrumAnalysisServiceImpl.java | 18 ++++++++++-------- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/cache/BetaCache.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/cache/BetaCache.java index be2ac261..842eca57 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/cache/BetaCache.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/cache/BetaCache.java @@ -33,4 +33,8 @@ public class BetaCache { this.betaCache = betaCache; } + public void deleteBetaCache(String key){ + this.betaCache.invalidate(key); + } + } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SpectrumAnalysesController.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SpectrumAnalysesController.java index d6b8bee7..c19ba1bb 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SpectrumAnalysesController.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SpectrumAnalysesController.java @@ -64,10 +64,10 @@ public class SpectrumAnalysesController { return spectrumAnalysisService.getFileSpectrumChart(sampleFileName, gasFileName, detFileName, qcFileName, request); } - @DeleteMapping("deleteDBSpectrumChartData") - @ApiOperation(value = "删除折线图缓存数据",notes = "删除折线图缓存数据") - public Result deleteDBSpectrumChartData(Integer[] sampleIds) { - return spectrumAnalysisService.deleteDBSpectrumChartData(sampleIds); + @DeleteMapping("deleteSpectrumCacheData") + @ApiOperation(value = "删除缓存数据",notes = "删除缓存数据") + public void deleteSpectrumCacheData(String sampleFileName, String qcFileName, HttpServletRequest request) { + spectrumAnalysisService.deleteSpectrumCacheData(sampleFileName, qcFileName, request); } @GetMapping("viewComment") diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/ISpectrumAnalysisService.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/ISpectrumAnalysisService.java index 76deb763..fe7b45ec 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/ISpectrumAnalysisService.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/ISpectrumAnalysisService.java @@ -24,7 +24,7 @@ public interface ISpectrumAnalysisService { Result getFileSpectrumChart(String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request); - Result deleteDBSpectrumChartData(Integer[] sampleIds); + void deleteSpectrumCacheData(String sampleFileName, String qcFileName, HttpServletRequest request); Result viewComment(Integer sampleId, String sampleFileName, HttpServletRequest request); diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java index 7eab662d..109c1d72 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java @@ -575,14 +575,16 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService { } @Override - public Result deleteDBSpectrumChartData(Integer[] sampleIds) { - Result result = new Result(); - if (Objects.isNull(sampleIds)){ - result.error500("删除失败!"); - return result; - } - result.success("删除成功"); - return result; + public void deleteSpectrumCacheData(String sampleFileName, String qcFileName, HttpServletRequest request) { + String userName = JwtUtil.getUserNameByToken(request); + String betaKey = qcFileName + "-" + userName + "-beta"; + betaCache.deleteBetaCache(betaKey); + String gammaKey = qcFileName + "-" + userName + "-gamma"; + betaCache.deleteBetaCache(gammaKey); + String analyseKey = sampleFileName + "-" + userName + "-reAnalyseParam"; + betaCache.deleteBetaCache(analyseKey); + String xeKey = sampleFileName + "-" + userName + "-xeData"; + betaCache.deleteBetaCache(xeKey); } @Override