【功能修复】定时任务在多租户下,没有记录执行的日志结果

This commit is contained in:
YunaiV 2024-09-12 13:39:19 +08:00
parent dfb1b6b823
commit d8d385e489

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.framework.tenant.core.job;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.exceptions.ExceptionUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.framework.tenant.core.service.TenantFrameworkService;
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
@ -44,7 +45,8 @@ public class TenantJobAspect {
// TODO 芋艿先通过 parallel 实现并行1多个租户是一条执行日志2异常的情况
TenantUtils.execute(tenantId, () -> {
try {
joinPoint.proceed();
Object result = joinPoint.proceed();
results.put(tenantId, StrUtil.toStringOrNull(result));
} catch (Throwable e) {
log.error("[execute][租户({}) 执行 Job 发生异常", tenantId, e);
results.put(tenantId, ExceptionUtil.getRootCauseMessage(e));