新增删除自建台站缓存接口
This commit is contained in:
parent
941c6c0685
commit
ee3a04af2f
|
@ -257,10 +257,6 @@ public class SelfStationUtil extends AbstractLogOrReport {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (Objects.nonNull(file)) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
return struct;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,11 @@ public class SelfStationController {
|
|||
return selfStationService.loadSelfStationByFile(sampleFileName, detFileName, request);
|
||||
}
|
||||
|
||||
@DeleteMapping("deleteSelfStationCache")
|
||||
public void deleteSelfStationCache(String sampleFileName, HttpServletRequest request) {
|
||||
selfStationService.deleteSelfStationCache(sampleFileName, request);
|
||||
}
|
||||
|
||||
@PostMapping("updateROI")
|
||||
@ApiOperation(value = "更新ROI范围", notes = "更新ROI范围")
|
||||
public Result updateROI(Integer startChannel, Integer endChannel, Integer ROINum, String sampleFileName, HttpServletRequest request) {
|
||||
|
|
|
@ -12,6 +12,8 @@ public interface ISelfStationService {
|
|||
|
||||
Result loadSelfStationByFile(String sampleFileName, String detFileName, HttpServletRequest request);
|
||||
|
||||
void deleteSelfStationCache(String sampleFileName, HttpServletRequest request);
|
||||
|
||||
Result updateROI(Integer startChannel, Integer endChannel, Integer ROINum, String sampleFileName, HttpServletRequest request);
|
||||
|
||||
Result energyCalibration(String fileName, String currentText, Double width, HttpServletRequest request);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
|
@ -85,6 +86,28 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSelfStationCache(String sampleFileName, HttpServletRequest request) {
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
String key = sampleFileName + StrUtil.DASHED + userName;
|
||||
Cache<String, SelfStationData> selfCache = selfStationCache.getSelfCache();
|
||||
SelfStationData selfStationData = selfCache.getIfPresent(key);
|
||||
if (StringUtils.isNotBlank(selfStationData.getSampleTmpPath())) {
|
||||
File file = new File(selfStationData.getSampleTmpPath());
|
||||
if (Objects.nonNull(file)) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(selfStationData.getDetTmpPath())) {
|
||||
File file = new File(selfStationData.getDetTmpPath());
|
||||
if (Objects.nonNull(file)) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
// 删除指定key的Cache
|
||||
selfStationCache.deleteSelfCache(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result updateROI(Integer startChannel, Integer endChannel, Integer ROINum, String sampleFileName, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
|
|
Loading…
Reference in New Issue
Block a user