系统操作日志使用异步插入,解决平台所有日志阻塞问题!! 屮
This commit is contained in:
parent
e1edb302f5
commit
b165e91663
|
@ -16,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* 操作日志
|
||||
|
@ -28,8 +29,8 @@ public class SysLogOperationServiceImpl extends BaseServiceImpl<SysLogOperationD
|
|||
@Override
|
||||
public PageData<SysLogOperationDTO> page(Map<String, Object> params) {
|
||||
IPage<SysLogOperationEntity> page = baseDao.selectPage(
|
||||
getPage(params, Constant.CREATE_DATE, false),
|
||||
getWrapper(params)
|
||||
getPage(params, Constant.CREATE_DATE, false),
|
||||
getWrapper(params)
|
||||
);
|
||||
|
||||
return getPageData(page, SysLogOperationDTO.class);
|
||||
|
@ -42,7 +43,7 @@ public class SysLogOperationServiceImpl extends BaseServiceImpl<SysLogOperationD
|
|||
return ConvertUtils.sourceToTarget(entityList, SysLogOperationDTO.class);
|
||||
}
|
||||
|
||||
private QueryWrapper<SysLogOperationEntity> getWrapper(Map<String, Object> params){
|
||||
private QueryWrapper<SysLogOperationEntity> getWrapper(Map<String, Object> params) {
|
||||
String status = (String) params.get("status");
|
||||
|
||||
QueryWrapper<SysLogOperationEntity> wrapper = new QueryWrapper<>();
|
||||
|
@ -54,7 +55,9 @@ public class SysLogOperationServiceImpl extends BaseServiceImpl<SysLogOperationD
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void save(SysLogOperationEntity entity) {
|
||||
insert(entity);
|
||||
CompletableFuture.runAsync(() -> {
|
||||
insert(entity);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -210,7 +210,7 @@ public class ResourceController {
|
|||
@ApiOperation("导入")
|
||||
@LogOperation("导入")
|
||||
@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) {
|
||||
List<Map<String, Object>> dept =
|
||||
|
|
Loading…
Reference in New Issue