From 6a2980a8b45db3ad462f8dc76627cb9e6c5cf4d0 Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Fri, 9 Aug 2024 17:55:14 +0800 Subject: [PATCH 1/2] =?UTF-8?q?1.=E5=B9=B2=E7=BA=BFbug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/OpenOrderServiceImpl.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java index 23f4e84fa..91921cb14 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java @@ -2266,19 +2266,19 @@ public class OpenOrderServiceImpl implements IOpenOrderService { trunklineWaybillPackageService.updateBatchById(trunklineWaybillPackageEntities); } } - if(CollUtil.isNotEmpty(noArriveWarehousePackageCode)){ - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.in("order_package_code",noArriveWarehousePackageCode) - .eq("is_deleted",0); - List trunklineWaybillPackageEntities = trunklineWaybillPackageService.list(queryWrapper); - if(!trunklineWaybillPackageEntities.isEmpty()){ - for (TrunklineWaybillPackageEntity trunklineWaybillPackageEntity : trunklineWaybillPackageEntities) { - trunklineWaybillPackageEntity.setPackageStatus(WorkNodeEnums.INITIAL_WAREHOUSE_DEPART.getCode()); - } - trunklineWaybillPackageService.updateBatchById(trunklineWaybillPackageEntities); - } - } - trunklineWaybillPackageService.updateWaybillStatus(waybillEntity); +// if(CollUtil.isNotEmpty(noArriveWarehousePackageCode)){ +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// queryWrapper.in("order_package_code",noArriveWarehousePackageCode) +// .eq("is_deleted",0); +// List trunklineWaybillPackageEntities = trunklineWaybillPackageService.list(queryWrapper); +// if(!trunklineWaybillPackageEntities.isEmpty()){ +// for (TrunklineWaybillPackageEntity trunklineWaybillPackageEntity : trunklineWaybillPackageEntities) { +// trunklineWaybillPackageEntity.setPackageStatus(WorkNodeEnums.INITIAL_WAREHOUSE_DEPART.getCode()); +// } +// trunklineWaybillPackageService.updateBatchById(trunklineWaybillPackageEntities); +// } +// } +// trunklineWaybillPackageService.updateWaybillStatus(waybillEntity); } openOrderAsyncService.sendUpdateWaybillFanout(waybillEntity,wayBillDetailList,advanceIds,oldConsignee); return R.success("改单成功"); From 671fa2e7932d67dc127f7b73b1bce273175e5d11 Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" Date: Fri, 9 Aug 2024 18:05:56 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=E5=BD=93=E6=B2=A1=E6=9C=89=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=88=B0=E7=A7=9F=E6=88=B7=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E4=B8=80=E4=B8=AA=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logpm/trunkline/config/ExecutorConfig.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/ExecutorConfig.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/ExecutorConfig.java index 35931744d..89003ea0a 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/ExecutorConfig.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/ExecutorConfig.java @@ -1,6 +1,7 @@ package com.logpm.trunkline.config; import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; import lombok.extern.slf4j.Slf4j; import org.slf4j.MDC; import org.springblade.core.secure.utils.AuthUtil; @@ -55,6 +56,8 @@ public class ExecutorConfig { public Runnable decorate(@Nonnull Runnable runnable) { RequestAttributes context = RequestContextHolder.currentRequestAttributes(); String tenantId = AuthUtil.getTenantId(); + + Map all = ThreadLocalUtil.getAll(); Map mdcMap = MDC.getCopyOfContextMap(); return () -> { @@ -64,9 +67,19 @@ public class ExecutorConfig { MDC.setContextMap(mdcMap); } RequestContextHolder.setRequestAttributes(context); - // 未当前的异步线程绑定租户ID 和切换数据源 + log.info(">>>> 异步线程创建,绑定租户数据源 {}",tenantId); - DynamicDataSourceContextHolder.push(tenantId); + if(StringUtils.isBlank(tenantId)){ + //这里为null 存在问题 + log.info(">>>> 异步线程创建,没有用户信息 {}",AuthUtil.getUserId()); + log.info(">>>> 异步线程创建,没有用户信息 {}",AuthUtil.getUser()); + log.info(">>>> 异步线程创建,没有用户信息 {}",context); + DynamicDataSourceContextHolder.push("627683"); + }else{ + // 未当前的异步线程绑定租户ID 和切换数据源 + DynamicDataSourceContextHolder.push(tenantId); + } + runnable.run(); } finally { RequestContextHolder.resetRequestAttributes();