diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java index 580bd6db..1380766c 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java @@ -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 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 creator = Optional.ofNullable(sysUserService.selectById(Long.parseLong(processVariable.get("creator").toString()))); + dto.setUserName(creator.get().getRealName()); listDto.add(dto); continue; } diff --git a/renren-admin/src/main/java/io/renren/modules/log/dao/SysLogErrorDao.java b/renren-admin/src/main/java/io/renren/modules/log/dao/SysLogErrorDao.java index bb7d21c3..c01e30eb 100644 --- a/renren-admin/src/main/java/io/renren/modules/log/dao/SysLogErrorDao.java +++ b/renren-admin/src/main/java/io/renren/modules/log/dao/SysLogErrorDao.java @@ -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 { - + + Integer clearLog(@Param("offsetDay") DateTime offsetDay); } diff --git a/renren-admin/src/main/java/io/renren/modules/log/dao/SysLogOperationDao.java b/renren-admin/src/main/java/io/renren/modules/log/dao/SysLogOperationDao.java index 742ef251..d2332174 100644 --- a/renren-admin/src/main/java/io/renren/modules/log/dao/SysLogOperationDao.java +++ b/renren-admin/src/main/java/io/renren/modules/log/dao/SysLogOperationDao.java @@ -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 { - + + Integer clearLog(@Param("offsetDay") DateTime offsetDay); } diff --git a/renren-admin/src/main/java/io/renren/modules/log/task/clearLogTask.java b/renren-admin/src/main/java/io/renren/modules/log/task/clearLogTask.java new file mode 100644 index 00000000..45300d47 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/log/task/clearLogTask.java @@ -0,0 +1,46 @@ +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); + logger.info("日志保留开始日期-------->" + offsetDay); + sysLogOperationDao.clearLog(offsetDay); + sysLogErrorDao.clearLog(offsetDay); + logger.info("---------------------结束清理日志表数据---------------------"); + } +} diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 9f5967c1..7284feb3 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -624,7 +624,6 @@ public class ResourceServiceImpl extends CrudServiceImpl() { { QueryWrapper queryWrapper = new QueryWrapper<>(); diff --git a/renren-admin/src/main/java/io/renren/modules/taskList/task/InsertTaskListJob.java b/renren-admin/src/main/java/io/renren/modules/taskList/task/InsertTaskListJob.java index b9b14735..0e8a41a3 100644 --- a/renren-admin/src/main/java/io/renren/modules/taskList/task/InsertTaskListJob.java +++ b/renren-admin/src/main/java/io/renren/modules/taskList/task/InsertTaskListJob.java @@ -14,7 +14,6 @@ import org.springframework.stereotype.Component; import java.util.Map; import java.util.Optional; - /** * 商汤 场景任务列表插入 */ diff --git a/renren-admin/src/main/resources/application.yml b/renren-admin/src/main/resources/application.yml index 6f073a2c..a84bd4ef 100644 --- a/renren-admin/src/main/resources/application.yml +++ b/renren-admin/src/main/resources/application.yml @@ -7,7 +7,7 @@ project: big_date: name: 青岛市大数据发展管理局 assignee_role_name: 部门审批人 -# 需要进行统计数目的资源 type +# 需要进行统计数目的资源 type/需要进行统计申请的资源类型 applyType census: type: 组件服务,应用资源,基础设施,数据资源,知识库 applyType: 应用资源,业务组件,图层服务,开发组件,智能算法 diff --git a/renren-admin/src/main/resources/mapper/log/SysLogErrorDao.xml b/renren-admin/src/main/resources/mapper/log/SysLogErrorDao.xml index 0babe80a..c0df9526 100644 --- a/renren-admin/src/main/resources/mapper/log/SysLogErrorDao.xml +++ b/renren-admin/src/main/resources/mapper/log/SysLogErrorDao.xml @@ -3,4 +3,7 @@ + + DELETE FROM sys_log_error WHERE 1 = 1 AND #{offsetDay} > create_date + \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/log/SysLogOperationDao.xml b/renren-admin/src/main/resources/mapper/log/SysLogOperationDao.xml index 35881acf..d50185fb 100644 --- a/renren-admin/src/main/resources/mapper/log/SysLogOperationDao.xml +++ b/renren-admin/src/main/resources/mapper/log/SysLogOperationDao.xml @@ -3,4 +3,7 @@ + + DELETE FROM sys_log_operation WHERE 1 = 1 AND #{offsetDay} > create_date + \ No newline at end of file