提交 3439988c authored 作者: junjie's avatar junjie

feat(视图):视图保留实时计算与渲染功能,但不实时保存,提供保存与重置按钮

上级 46884dbd
...@@ -105,6 +105,6 @@ public class ChartViewController { ...@@ -105,6 +105,6 @@ public class ChartViewController {
@ApiOperation("计算结果") @ApiOperation("计算结果")
@PostMapping("/calcData") @PostMapping("/calcData")
public ChartViewDTO calcData(@RequestBody ChartCalRequest request) throws Exception { public ChartViewDTO calcData(@RequestBody ChartCalRequest request) throws Exception {
return chartViewService.calcData(request.getView(), request.getRequestList()); return chartViewService.calcData(request.getView(), request.getRequestList(), true);
} }
} }
...@@ -75,9 +75,9 @@ public class ChartViewService { ...@@ -75,9 +75,9 @@ public class ChartViewService {
chartView.setUpdateTime(timestamp); chartView.setUpdateTime(timestamp);
chartViewMapper.insertSelective(chartView); chartViewMapper.insertSelective(chartView);
} }
Optional.ofNullable(chartView.getId()).ifPresent(id -> { // Optional.ofNullable(chartView.getId()).ifPresent(id -> {
CacheUtils.remove(JdbcConstants.VIEW_CACHE_KEY, id); // CacheUtils.remove(JdbcConstants.VIEW_CACHE_KEY, id);
}); // });
return getOneWithPermission(chartView.getId()); return getOneWithPermission(chartView.getId());
} }
...@@ -179,10 +179,15 @@ public class ChartViewService { ...@@ -179,10 +179,15 @@ public class ChartViewService {
public ChartViewDTO getData(String id, ChartExtRequest requestList) throws Exception { public ChartViewDTO getData(String id, ChartExtRequest requestList) throws Exception {
ChartViewWithBLOBs view = chartViewMapper.selectByPrimaryKey(id); 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)) { if (ObjectUtils.isEmpty(view)) {
throw new RuntimeException(Translator.get("i18n_chart_delete")); throw new RuntimeException(Translator.get("i18n_chart_delete"));
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论