Commit d8d385e489f3ee87a76fd5ace123fc7bad4a56ed
1 parent
dfb1b6b8
【功能修复】定时任务在多租户下,没有记录执行的日志结果
Showing
1 changed file
with
3 additions
and
1 deletions
yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/job/TenantJobAspect.java
| ... | ... | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.framework.tenant.core.job; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.exceptions.ExceptionUtil; |
| 5 | +import cn.hutool.core.util.StrUtil; | |
| 5 | 6 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 6 | 7 | import cn.iocoder.yudao.framework.tenant.core.service.TenantFrameworkService; |
| 7 | 8 | import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; |
| ... | ... | @@ -44,7 +45,8 @@ public class TenantJobAspect { |
| 44 | 45 | // TODO 芋艿:先通过 parallel 实现并行;1)多个租户,是一条执行日志;2)异常的情况 |
| 45 | 46 | TenantUtils.execute(tenantId, () -> { |
| 46 | 47 | try { |
| 47 | - joinPoint.proceed(); | |
| 48 | + Object result = joinPoint.proceed(); | |
| 49 | + results.put(tenantId, StrUtil.toStringOrNull(result)); | |
| 48 | 50 | } catch (Throwable e) { |
| 49 | 51 | log.error("[execute][租户({}) 执行 Job 发生异常", tenantId, e); |
| 50 | 52 | results.put(tenantId, ExceptionUtil.getRootCauseMessage(e)); | ... | ... |