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(); 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("改单成功");