Beta功能实现删除缓存信息接口

BetaCache新增删除缓存方法
This commit is contained in:
qiaoqinzheng 2023-10-20 09:41:00 +08:00
parent b09bb44a0a
commit 5b1cf4567d
4 changed files with 19 additions and 13 deletions

View File

@ -33,4 +33,8 @@ public class BetaCache {
this.betaCache = betaCache;
}
public void deleteBetaCache(String key){
this.betaCache.invalidate(key);
}
}

View File

@ -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")

View File

@ -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);

View File

@ -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