新增日志清除任务
This commit is contained in:
parent
20007761eb
commit
5536f25c8f
|
@ -21,6 +21,7 @@ import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO;
|
|||
import io.renren.modules.resourceMountApply.service.TResourceMountApplyService;
|
||||
import io.renren.modules.security.user.SecurityUser;
|
||||
import io.renren.modules.sys.dto.SysUserDTO;
|
||||
import io.renren.modules.sys.entity.SysUserEntity;
|
||||
import io.renren.modules.sys.service.SysRoleUserService;
|
||||
import io.renren.modules.sys.service.SysUserService;
|
||||
import org.activiti.engine.HistoryService;
|
||||
|
@ -186,7 +187,6 @@ public class ActTaskService extends BaseServiceImpl {
|
|||
}).collect(Collectors.toList());
|
||||
CompletableFuture.allOf(completableFutureList.toArray(new CompletableFuture[completableFutureList.size()])).join();
|
||||
Page<TaskDTO> page = new Page(curPage, limit);
|
||||
int j = Math.min(curPage * limit, taskDtoList.size());
|
||||
if (taskDtoList.isEmpty()) {
|
||||
page.setRecords(null);
|
||||
page.setTotal(0);
|
||||
|
@ -216,6 +216,8 @@ public class ActTaskService extends BaseServiceImpl {
|
|||
if (dto.getBusinessKey().startsWith("{") || dto.getBusinessKey().startsWith("[")) { // 为json内容 (特殊处理批量)
|
||||
processVariable.putAll(task.getProcessVariables());
|
||||
dto.setParams(processVariable);
|
||||
Optional<SysUserEntity> creator = Optional.ofNullable(sysUserService.selectById(Long.parseLong(processVariable.get("creator").toString())));
|
||||
dto.setUserName(creator.get().getRealName());
|
||||
listDto.add(dto);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package io.renren.modules.log.dao;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import io.renren.common.dao.BaseDao;
|
||||
import io.renren.modules.log.entity.SysLogErrorEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 异常日志
|
||||
|
@ -11,5 +13,6 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
*/
|
||||
@Mapper
|
||||
public interface SysLogErrorDao extends BaseDao<SysLogErrorEntity> {
|
||||
|
||||
|
||||
Integer clearLog(@Param("offsetDay") DateTime offsetDay);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package io.renren.modules.log.dao;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import io.renren.common.dao.BaseDao;
|
||||
import io.renren.modules.log.entity.SysLogOperationEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 操作日志
|
||||
|
@ -11,5 +13,6 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
*/
|
||||
@Mapper
|
||||
public interface SysLogOperationDao extends BaseDao<SysLogOperationEntity> {
|
||||
|
||||
|
||||
Integer clearLog(@Param("offsetDay") DateTime offsetDay);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package io.renren.modules.log.task;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import io.renren.modules.job.task.ITask;
|
||||
import io.renren.modules.log.dao.SysLogErrorDao;
|
||||
import io.renren.modules.log.dao.SysLogOperationDao;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 清理操作日志表任务
|
||||
*/
|
||||
@Component("clearLogTask")
|
||||
public class clearLogTask implements ITask {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(clearLogTask.class);
|
||||
|
||||
@Autowired
|
||||
private SysLogOperationDao sysLogOperationDao;
|
||||
|
||||
@Autowired
|
||||
private SysLogErrorDao sysLogErrorDao;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param params 日志保留天数
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void run(String params) {
|
||||
logger.info("---------------------开始清理日志表数据---------------------");
|
||||
int offset = -Integer.parseInt(params);
|
||||
DateTime offsetDay = DateUtil.offsetDay(new Date(), offset);
|
||||
sysLogOperationDao.clearLog(offsetDay);
|
||||
sysLogErrorDao.clearLog(offsetDay);
|
||||
logger.info("---------------------结束清理日志表数据---------------------");
|
||||
}
|
||||
}
|
|
@ -624,7 +624,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
put("type", "数据资源");
|
||||
}
|
||||
});
|
||||
|
||||
re.add(new HashMap<String, Object>() {
|
||||
{
|
||||
QueryWrapper<CameraChannel> queryWrapper = new QueryWrapper<>();
|
||||
|
|
|
@ -14,7 +14,6 @@ import org.springframework.stereotype.Component;
|
|||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
/**
|
||||
* 商汤 场景任务列表插入
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@ project:
|
|||
big_date:
|
||||
name: 青岛市大数据发展管理局
|
||||
assignee_role_name: 部门审批人
|
||||
# 需要进行统计数目的资源 type
|
||||
# 需要进行统计数目的资源 type/需要进行统计申请的资源类型 applyType
|
||||
census:
|
||||
type: 组件服务,应用资源,基础设施,数据资源,知识库
|
||||
applyType: 应用资源,业务组件,图层服务,开发组件,智能算法
|
||||
|
|
|
@ -3,4 +3,7 @@
|
|||
|
||||
<mapper namespace="io.renren.modules.log.dao.SysLogErrorDao">
|
||||
|
||||
<delete id="clearLog">
|
||||
DELETE FROM sys_log_error WHERE 1 = 1 AND #{offsetDay} > create_date
|
||||
</delete>
|
||||
</mapper>
|
|
@ -3,4 +3,7 @@
|
|||
|
||||
<mapper namespace="io.renren.modules.log.dao.SysLogOperationDao">
|
||||
|
||||
<delete id="clearLog">
|
||||
DELETE FROM sys_log_operation WHERE 1 = 1 AND #{offsetDay} > create_date
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue