Merge branch 'master-jdk17' of https://gitee.com/zhijiantianya/yudao-cloud
commit
527a635155
|
@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
|
||||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
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.service.TenantFrameworkService;
|
||||||
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
|
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
|
||||||
|
import com.xxl.job.core.context.XxlJobContext;
|
||||||
import com.xxl.job.core.context.XxlJobHelper;
|
import com.xxl.job.core.context.XxlJobHelper;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
@ -45,10 +46,13 @@ public class TenantJobAspect {
|
||||||
// 逐个租户,执行 Job
|
// 逐个租户,执行 Job
|
||||||
Map<Long, String> results = new ConcurrentHashMap<>();
|
Map<Long, String> results = new ConcurrentHashMap<>();
|
||||||
AtomicBoolean success = new AtomicBoolean(true); // 标记,是否存在失败的情况
|
AtomicBoolean success = new AtomicBoolean(true); // 标记,是否存在失败的情况
|
||||||
|
XxlJobContext xxlJobContext = XxlJobContext.getXxlJobContext(); // XXL-Job 上下文
|
||||||
tenantIds.parallelStream().forEach(tenantId -> {
|
tenantIds.parallelStream().forEach(tenantId -> {
|
||||||
// TODO 芋艿:先通过 parallel 实现并行;1)多个租户,是一条执行日志;2)异常的情况
|
// TODO 芋艿:先通过 parallel 实现并行;1)多个租户,是一条执行日志;2)异常的情况
|
||||||
TenantUtils.execute(tenantId, () -> {
|
TenantUtils.execute(tenantId, () -> {
|
||||||
try {
|
try {
|
||||||
|
XxlJobContext.setXxlJobContext(xxlJobContext);
|
||||||
|
// 执行 Job
|
||||||
Object result = joinPoint.proceed();
|
Object result = joinPoint.proceed();
|
||||||
results.put(tenantId, StrUtil.toStringOrEmpty(result));
|
results.put(tenantId, StrUtil.toStringOrEmpty(result));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
|
|
@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.member.api.point.MemberPointApi;
|
||||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||||
import cn.iocoder.yudao.module.pay.api.order.PayOrderApi;
|
import cn.iocoder.yudao.module.pay.api.order.PayOrderApi;
|
||||||
import cn.iocoder.yudao.module.pay.api.refund.PayRefundApi;
|
import cn.iocoder.yudao.module.pay.api.refund.PayRefundApi;
|
||||||
|
import cn.iocoder.yudao.module.pay.api.transfer.PayTransferApi;
|
||||||
|
import cn.iocoder.yudao.module.pay.api.wallet.PayWalletApi;
|
||||||
import cn.iocoder.yudao.module.product.api.category.ProductCategoryApi;
|
import cn.iocoder.yudao.module.product.api.category.ProductCategoryApi;
|
||||||
import cn.iocoder.yudao.module.product.api.comment.ProductCommentApi;
|
import cn.iocoder.yudao.module.product.api.comment.ProductCommentApi;
|
||||||
import cn.iocoder.yudao.module.product.api.sku.ProductSkuApi;
|
import cn.iocoder.yudao.module.product.api.sku.ProductSkuApi;
|
||||||
|
@ -21,6 +23,8 @@ import cn.iocoder.yudao.module.promotion.api.reward.RewardActivityApi;
|
||||||
import cn.iocoder.yudao.module.promotion.api.seckill.SeckillActivityApi;
|
import cn.iocoder.yudao.module.promotion.api.seckill.SeckillActivityApi;
|
||||||
import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
|
import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
|
||||||
import cn.iocoder.yudao.module.system.api.social.SocialClientApi;
|
import cn.iocoder.yudao.module.system.api.social.SocialClientApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.social.SocialUserApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@ -30,8 +34,8 @@ import org.springframework.context.annotation.Configuration;
|
||||||
CouponApi.class, DiscountActivityApi.class, RewardActivityApi.class, SeckillActivityApi.class, PointActivityApi.class,
|
CouponApi.class, DiscountActivityApi.class, RewardActivityApi.class, SeckillActivityApi.class, PointActivityApi.class,
|
||||||
MemberUserApi.class, MemberPointApi.class, MemberLevelApi.class, MemberAddressApi.class, MemberConfigApi.class,
|
MemberUserApi.class, MemberPointApi.class, MemberLevelApi.class, MemberAddressApi.class, MemberConfigApi.class,
|
||||||
ProductSpuApi.class, ProductSkuApi.class, ProductCommentApi.class, ProductCategoryApi.class,
|
ProductSpuApi.class, ProductSkuApi.class, ProductCommentApi.class, ProductCategoryApi.class,
|
||||||
PayOrderApi.class, PayRefundApi.class,
|
PayOrderApi.class, PayRefundApi.class, PayTransferApi.class, PayWalletApi.class,
|
||||||
NotifyMessageSendApi.class, SocialClientApi.class
|
AdminUserApi.class, NotifyMessageSendApi.class, SocialClientApi.class, SocialUserApi.class
|
||||||
})
|
})
|
||||||
public class RpcConfiguration {
|
public class RpcConfiguration {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue