Browse Source

Merge branch 'refs/heads/dev' into chenglong

dist.1.3.0
chenlong 5 months ago
parent
commit
04f09f637f
  1. 17
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/ExecutorConfig.java
  2. 26
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java

17
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<String, Object> all = ThreadLocalUtil.getAll();
Map<String, String> 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();

26
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<TrunklineWaybillPackageEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("order_package_code",noArriveWarehousePackageCode)
.eq("is_deleted",0);
List<TrunklineWaybillPackageEntity> 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<TrunklineWaybillPackageEntity> queryWrapper = new QueryWrapper<>();
// queryWrapper.in("order_package_code",noArriveWarehousePackageCode)
// .eq("is_deleted",0);
// List<TrunklineWaybillPackageEntity> 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("改单成功");

Loading…
Cancel
Save