系统操作日志使用异步插入,解决平台所有日志阻塞问题!! 屮

This commit is contained in:
wangliwen 2022-06-20 14:25:07 +08:00
parent e1edb302f5
commit b165e91663
2 changed files with 8 additions and 5 deletions

View File

@ -16,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.CompletableFuture;
/** /**
* 操作日志 * 操作日志
@ -54,7 +55,9 @@ public class SysLogOperationServiceImpl extends BaseServiceImpl<SysLogOperationD
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(SysLogOperationEntity entity) { public void save(SysLogOperationEntity entity) {
CompletableFuture.runAsync(() -> {
insert(entity); insert(entity);
});
} }
} }

View File

@ -210,7 +210,7 @@ public class ResourceController {
@ApiOperation("导入") @ApiOperation("导入")
@LogOperation("导入") @LogOperation("导入")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "source", value = "请求来源", paramType = "string", dataType = "string") @ApiImplicitParam(name = "file", value = "数据文件文件", paramType = "file", dataType = "file")
}) })
public Result importResource(@RequestParam("file") MultipartFile uploadFile, HttpServletRequest request) { public Result importResource(@RequestParam("file") MultipartFile uploadFile, HttpServletRequest request) {
List<Map<String, Object>> dept = List<Map<String, Object>> dept =