Browse Source

Merge remote-tracking branch 'origin/dev' into dev

dist.1.3.0
汤建军 11 months ago
parent
commit
6cf63c98bc
  1. 22
      blade-biz-common/src/main/java/org/springblade/common/annotations/LocalServerUser.java
  2. 5
      blade-biz-common/src/main/java/org/springblade/common/cache/CacheNames.java
  3. 25
      blade-biz-common/src/main/java/org/springblade/common/constant/LauncherConstant.java
  4. 8
      blade-biz-common/src/main/java/org/springblade/common/launch/LauncherServiceImpl.java
  5. 9
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java
  6. 2
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/BillladingDTO.java
  7. 12
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/LoadCarsDTO.java
  8. 6
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/OpenOrderDTO.java
  9. 9
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/TrunklineCarsLoadEntity.java
  10. 4
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/TrunklineCarsLoadScanEntity.java
  11. 15
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWaybillEntity.java
  12. 12
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseWaybillClient.java
  13. 31
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/aspect/AsyncAnnotationAspect.java
  14. 31
      blade-service/logpm-basic/src/main/java/com/logpm/basic/aspect/AsyncAnnotationAspect.java
  15. 31
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/aspect/AsyncAnnotationAspect.java
  16. 1
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataDriverArteryClient.java
  17. 1
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataClientMapper.xml
  18. 31
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/aspect/AsyncAnnotationAspect.java
  19. 67
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/config/CustomMessageConverter.java
  20. 1
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/config/RabbitMqConfiguration.java
  21. 15
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java
  22. 7
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java
  23. 32
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml
  24. 6
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java
  25. 15
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java
  26. 113
      blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/config/CustomMessageConverter.java
  27. 50
      blade-service/logpm-factory/src/main/java/com/logpm/factory/aspect/AsyncAnnotationAspect.java
  28. 59
      blade-service/logpm-factory/src/main/java/com/logpm/factory/aspect/LocalServerTenantIdAnnotationAspect.java
  29. 2
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryAuthController.java
  30. 7
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryCommonController.java
  31. 67
      blade-service/logpm-factory/src/main/java/com/logpm/factory/config/CustomMessageConverter.java
  32. 12
      blade-service/logpm-factory/src/main/java/com/logpm/factory/config/InterceptorAdapterConfig.java
  33. 3
      blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java
  34. 6
      blade-service/logpm-factory/src/main/java/com/logpm/factory/filer/HttpServletFilter.java
  35. 100
      blade-service/logpm-factory/src/main/java/com/logpm/factory/interceptor/LocalServerLoginAccountsInterceptor.java
  36. 1
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.java
  37. 36
      blade-service/logpm-factory/src/main/java/com/logpm/factory/wrapper/CustomHttpServletRequestWrapper.java
  38. 8
      blade-service/logpm-old-project/src/main/resources/application-dev.yml
  39. 31
      blade-service/logpm-supervise/src/main/java/com/logpm/supervise/aspect/AsyncAnnotationAspect.java
  40. 31
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/aspect/AsyncAnnotationAspect.java
  41. 67
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/CustomMessageConverter.java
  42. 1
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/RabbitMqConfiguration.java
  43. 23
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/BillladingController.java
  44. 120
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/OpenOrderController.java
  45. 1
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java
  46. 14
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml
  47. 3
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingMapper.java
  48. 11
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingMapper.xml
  49. 3
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.xml
  50. 7
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.java
  51. 71
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml
  52. 8
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.xml
  53. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineWaybillOrderMapper.java
  54. 11
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineWaybillOrderMapper.xml
  55. 3
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ICarsLoadAsyncService.java
  56. 5
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderService.java
  57. 1
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java
  58. 3
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineBillladingService.java
  59. 7
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadScanService.java
  60. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineWaybillOrderService.java
  61. 31
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java
  62. 16
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java
  63. 299
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java
  64. 5
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java
  65. 11
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java
  66. 84
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingServiceImpl.java
  67. 14
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadScanServiceImpl.java
  68. 53
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java
  69. 5
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillOrderServiceImpl.java
  70. 31
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/aspect/AsyncAnnotationAspect.java
  71. 67
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/config/CustomMessageConverter.java
  72. 1
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/config/RabbitMqConfiguration.java
  73. 12
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WarehouseWaybillDTO.java
  74. 31
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseWaybillClient.java
  75. 3
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWayBillDetailMapper.java
  76. 9
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillDetailMapper.xml
  77. 2
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.java
  78. 94
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml
  79. 1
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWayBillDetailService.java
  80. 2
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWaybillService.java
  81. 5
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWayBillDetailServiceImpl.java
  82. 36
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java

22
blade-biz-common/src/main/java/org/springblade/common/annotations/LocalServerUser.java

@ -0,0 +1,22 @@
package org.springblade.common.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 特俗标记
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD})
public @interface LocalServerUser {
/**
* 匹配值
* factory:工厂系统
* 6278683: 租户
* factory-data: 租户
* @return
*/
String ds() default "";
}

5
blade-biz-common/src/main/java/org/springblade/common/cache/CacheNames.java vendored

@ -78,4 +78,9 @@ public interface CacheNames {
* 用户能操作的仓库 * 用户能操作的仓库
*/ */
String USER_WAREHOUSE_OWN = "logpm:user:warehouse:own:"; String USER_WAREHOUSE_OWN = "logpm:user:warehouse:own:";
/**
* 模拟登录缓存对象
*/
String LOCAL_SERVER_USER = "logpm:user:local:user:";
} }

25
blade-biz-common/src/main/java/org/springblade/common/constant/LauncherConstant.java

@ -90,6 +90,20 @@ public interface LauncherConstant {
*/ */
String SEATA_TEST_ADDR = "192.168.2.110:8091"; String SEATA_TEST_ADDR = "192.168.2.110:8091";
/**
* 本地登录 dev地址
*/
String APPLICATION_DEV_LOGIN_ADDR = "192.168.3.2:13000";
/**
* 本地登录 test地址
*/
String APPLICATION_TEST_LOGIN_ADDR = "192.168.2.110:9999";
/**
* 本地登录 pord地址
*/
String APPLICATION_PROD_LOGIN_ADDR = "192.168.5.14:13000";
/** /**
* dbuuo提供者 * dbuuo提供者
@ -221,4 +235,15 @@ public interface LauncherConstant {
} }
} }
static String loginAddr(String profile) {
switch (profile) {
case (AppConstant.PROD_CODE):
return APPLICATION_DEV_LOGIN_ADDR;
case (AppConstant.TEST_CODE):
return APPLICATION_TEST_LOGIN_ADDR;
default:
return APPLICATION_PROD_LOGIN_ADDR;
}
}
} }

8
blade-biz-common/src/main/java/org/springblade/common/launch/LauncherServiceImpl.java

@ -44,10 +44,10 @@ public class LauncherServiceImpl implements LauncherService {
PropsUtil.setProperty(props, "spring.cloud.sentinel.transport.dashboard", LauncherConstant.sentinelAddr(profile)); PropsUtil.setProperty(props, "spring.cloud.sentinel.transport.dashboard", LauncherConstant.sentinelAddr(profile));
PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.username","nacos"); // PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.username","nacos");
PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.password","Nacos123123"); // PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.password","Nacos123123");
PropsUtil.setProperty(props, "spring.cloud.nacos.config.username","nacos"); // PropsUtil.setProperty(props, "spring.cloud.nacos.config.username","nacos");
PropsUtil.setProperty(props, "spring.cloud.nacos.config.password","Nacos123123"); // PropsUtil.setProperty(props, "spring.cloud.nacos.config.password","Nacos123123");
// dubbo注册 // dubbo注册
PropsUtil.setProperty(props, "dubbo.application.name", appName); PropsUtil.setProperty(props, "dubbo.application.name", appName);
PropsUtil.setProperty(props, "dubbo.application.qos.enable", "false"); PropsUtil.setProperty(props, "dubbo.application.qos.enable", "false");

9
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java

@ -155,4 +155,13 @@ public interface IDistributionParcelListClient {
@PostMapping(API_PREFIX+"/updateList") @PostMapping(API_PREFIX+"/updateList")
void updateList(@RequestBody List<DistributionParcelListEntity> updateParcelList); void updateList(@RequestBody List<DistributionParcelListEntity> updateParcelList);
@PostMapping(API_PREFIX+"/updateFreezeStatusByWaybillIds")
void updateFreezeStatusByWaybillIds(@RequestBody List<Long> waybillIds);
@PostMapping(API_PREFIX+"/updateUnFreezeStatusByWaybillIds")
void updateUnFreezeStatusByWaybillIds(@RequestBody List<Long> waybillIds);
@PostMapping(API_PREFIX+"/clearParceListWaybillByAdvanceIds")
void clearParceListWaybillByAdvanceIds(@RequestBody List<Long> advanceIds);
} }

2
blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/BillladingDTO.java

@ -53,4 +53,6 @@ public class BillladingDTO extends TrunklineBillladingEntity {
private String remark;//备注 private String remark;//备注
private String destinationWarehouseName;//目的仓 private String destinationWarehouseName;//目的仓
private Long billladingId;
} }

12
blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/LoadCarsDTO.java

@ -55,9 +55,11 @@ public class LoadCarsDTO implements Serializable {
private String orderCode; private String orderCode;
private String trayCode; private String trayCode;
private String trayName;
private String trayType; private String trayType;
private Integer isZero; private Integer isZero;
private String scanCode; private String scanCode;
private String scanStatus;
private List<LoadingPackageDTO> packageList = new ArrayList<>(); private List<LoadingPackageDTO> packageList = new ArrayList<>();
private List<LoadingZeroDTO> zeroList = new ArrayList<>(); private List<LoadingZeroDTO> zeroList = new ArrayList<>();
@ -123,4 +125,14 @@ public class LoadCarsDTO implements Serializable {
private Integer isTransfer = 0; private Integer isTransfer = 0;
private String loadingUserName;
private String finalNodeName;
private String unloadNodeName;
private String unloadUserName;
private Integer isData;
private Integer loadingAbnormal;
private Integer unloadAbnormal;
private Integer isSupple;
} }

6
blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/OpenOrderDTO.java

@ -149,4 +149,10 @@ public class OpenOrderDTO implements Serializable {
private List<Long> warehouseIds; private List<Long> warehouseIds;
private List<Long> waybillIds;
private Integer isEdit;
} }

9
blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/TrunklineCarsLoadEntity.java

@ -202,4 +202,13 @@ public class TrunklineCarsLoadEntity extends TenantEntity {
/** 直发商家个数 */ /** 直发商家个数 */
@ApiModelProperty(name = "直发商家个数",notes = "") @ApiModelProperty(name = "直发商家个数",notes = "")
private Integer customerNum; private Integer customerNum;
/** 司机类型 1-自有,2-加盟,3-外调,4-临调*/
@ApiModelProperty(name = "直发商家个数",notes = "")
private String driverType;
/** 外请人*/
@ApiModelProperty(name = "外请人",notes = "")
private String outDriverPerson;
} }

4
blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/TrunklineCarsLoadScanEntity.java

@ -127,4 +127,8 @@ public class TrunklineCarsLoadScanEntity extends TenantEntity {
@ApiModelProperty(name = "卸车人名称",notes = "") @ApiModelProperty(name = "卸车人名称",notes = "")
private String unloadUserName; private String unloadUserName;
/** 卸车时间 */
@ApiModelProperty(name = "卸车时间",notes = "")
private Date unloadTime;
} }

15
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWaybillEntity.java

@ -469,4 +469,19 @@ public class WarehouseWaybillEntity extends TenantEntity {
@ApiModelProperty(value = "提货车型 ") @ApiModelProperty(value = "提货车型 ")
private String pickupVehicleType; private String pickupVehicleType;
@ApiModelProperty(value = "作废状态 0否 1是 ")
private Integer abolishStatus;
@ApiModelProperty(value = "作废人名称 ")
private String abolishUserName;
@ApiModelProperty(value = "作废时间 ")
private Date abolishTime;
@ApiModelProperty(value = "冻结人名称 ")
private String freezeUserName;
@ApiModelProperty(value = "冻结时间 ")
private Date freezeTime;
} }

12
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseWaybillClient.java

@ -71,4 +71,16 @@ public interface IWarehouseWaybillClient {
@GetMapping(API_PREFIX + "/findLastData") @GetMapping(API_PREFIX + "/findLastData")
Long findLastData(@RequestParam String waybillNo); Long findLastData(@RequestParam String waybillNo);
@PostMapping(API_PREFIX + "/findListByWaybillIds")
List<WarehouseWaybillEntity> findListByWaybillIds(@RequestBody List<Long> waybillIds);
@PostMapping(API_PREFIX + "/updateList")
void updateList(@RequestBody List<WarehouseWaybillEntity> waybillEntities);
@PostMapping(API_PREFIX + "/findFreezeOrAbolishByWaybillNos")
List<WarehouseWaybillEntity> findFreezeOrAbolishByWaybillNos(@RequestBody List<String> waybillNos);
@PostMapping(API_PREFIX + "/updateWaybillFreezeStatusByWaybillIds")
void updateWaybillFreezeStatusByWaybillIds(@RequestBody List<Long> waybillIds);
} }

31
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/aspect/AsyncAnnotationAspect.java

@ -47,4 +47,35 @@ public class AsyncAnnotationAspect {
} }
/**
* 该方法为一个切面用于对标记了@RabbitListener注解的方法进行增强主要增加了日志记录和数据源上下文处理的功能
*
* @param joinPoint 切面的连接点表示当前被拦截的方法
* @return 返回被拦截方法的执行结果
* @throws Throwable 如果执行过程中发生异常则抛出
*/
@Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitListener)")
public Object rabbitMethods(ProceedingJoinPoint joinPoint) throws Throwable {
// 在方法执行前,获取当前租户ID并设置到数据源上下文中
String tenantId = AuthUtil.getTenantId();
DynamicDataSourceContextHolder.push(tenantId);
// 执行原方法
Object result = joinPoint.proceed();
// 在方法执行后,从数据源上下文中移除租户ID
DynamicDataSourceContextHolder.poll();
return result;
}
@Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitHandler)")
public Object rabbitHandlerMethods(ProceedingJoinPoint joinPoint) throws Throwable {
// 在方法执行前,获取当前租户ID并设置到数据源上下文中
String tenantId = AuthUtil.getTenantId();
DynamicDataSourceContextHolder.push(tenantId);
// 执行原方法
Object result = joinPoint.proceed();
// 在方法执行后,从数据源上下文中移除租户ID
DynamicDataSourceContextHolder.poll();
return result;
}
} }

31
blade-service/logpm-basic/src/main/java/com/logpm/basic/aspect/AsyncAnnotationAspect.java

@ -47,4 +47,35 @@ public class AsyncAnnotationAspect {
} }
/**
* 该方法为一个切面用于对标记了@RabbitListener注解的方法进行增强主要增加了日志记录和数据源上下文处理的功能
*
* @param joinPoint 切面的连接点表示当前被拦截的方法
* @return 返回被拦截方法的执行结果
* @throws Throwable 如果执行过程中发生异常则抛出
*/
// @Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitListener)")
// public Object rabbitMethods(ProceedingJoinPoint joinPoint) throws Throwable {
// // 在方法执行前,获取当前租户ID并设置到数据源上下文中
// String tenantId = AuthUtil.getTenantId();
// DynamicDataSourceContextHolder.push(tenantId);
// // 执行原方法
// Object result = joinPoint.proceed();
// // 在方法执行后,从数据源上下文中移除租户ID
// DynamicDataSourceContextHolder.poll();
// return result;
// }
// @Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitHandler)")
// public Object rabbitHandlerMethods(ProceedingJoinPoint joinPoint) throws Throwable {
// // 在方法执行前,获取当前租户ID并设置到数据源上下文中
// String tenantId = AuthUtil.getTenantId();
// DynamicDataSourceContextHolder.push(tenantId);
// // 执行原方法
// Object result = joinPoint.proceed();
// // 在方法执行后,从数据源上下文中移除租户ID
// DynamicDataSourceContextHolder.poll();
// return result;
// }
} }

31
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/aspect/AsyncAnnotationAspect.java

@ -47,4 +47,35 @@ public class AsyncAnnotationAspect {
} }
/**
* 该方法为一个切面用于对标记了@RabbitListener注解的方法进行增强主要增加了日志记录和数据源上下文处理的功能
*
* @param joinPoint 切面的连接点表示当前被拦截的方法
* @return 返回被拦截方法的执行结果
* @throws Throwable 如果执行过程中发生异常则抛出
*/
// @Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitListener)")
// public Object rabbitMethods(ProceedingJoinPoint joinPoint) throws Throwable {
// // 在方法执行前,获取当前租户ID并设置到数据源上下文中
// String tenantId = AuthUtil.getTenantId();
// DynamicDataSourceContextHolder.push(tenantId);
// // 执行原方法
// Object result = joinPoint.proceed();
// // 在方法执行后,从数据源上下文中移除租户ID
// DynamicDataSourceContextHolder.poll();
// return result;
// }
// @Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitHandler)")
// public Object rabbitHandlerMethods(ProceedingJoinPoint joinPoint) throws Throwable {
// // 在方法执行前,获取当前租户ID并设置到数据源上下文中
// String tenantId = AuthUtil.getTenantId();
// DynamicDataSourceContextHolder.push(tenantId);
// // 执行原方法
// Object result = joinPoint.proceed();
// // 在方法执行后,从数据源上下文中移除租户ID
// DynamicDataSourceContextHolder.poll();
// return result;
// }
} }

1
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataDriverArteryClient.java

@ -76,6 +76,7 @@ public class BasicdataDriverArteryClient implements IBasicdataDriverArteryClient
jsonObject.put("driverId",driverArteryEntity.getId()); jsonObject.put("driverId",driverArteryEntity.getId());
jsonObject.put("driverName",driverArteryEntity.getName()); jsonObject.put("driverName",driverArteryEntity.getName());
jsonObject.put("driverPhone",driverArteryEntity.getPhone()); jsonObject.put("driverPhone",driverArteryEntity.getPhone());
jsonObject.put("driverType",driverArteryEntity.getType());
list.add(jsonObject); list.add(jsonObject);
} }
return list; return list;

1
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataClientMapper.xml

@ -88,6 +88,7 @@
lbc.blade_region_province_id bladeRegionProvinceId, lbc.blade_region_province_id bladeRegionProvinceId,
lbc.blade_region_city_id bladeRegionCityId, lbc.blade_region_city_id bladeRegionCityId,
lbc.blade_region_area_id bladeRegionAreaId, lbc.blade_region_area_id bladeRegionAreaId,
lbc.default_payment_methods defaultPaymentMethods,
lbsc.linkman linkman, lbsc.linkman linkman,
lbsc.phone phone, lbsc.phone phone,
lbc.detailedly detailedly lbc.detailedly detailedly

31
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/aspect/AsyncAnnotationAspect.java

@ -47,4 +47,35 @@ public class AsyncAnnotationAspect {
} }
/**
* 该方法为一个切面用于对标记了@RabbitListener注解的方法进行增强主要增加了日志记录和数据源上下文处理的功能
*
* @param joinPoint 切面的连接点表示当前被拦截的方法
* @return 返回被拦截方法的执行结果
* @throws Throwable 如果执行过程中发生异常则抛出
*/
@Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitListener)")
public Object rabbitMethods(ProceedingJoinPoint joinPoint) throws Throwable {
// 在方法执行前,获取当前租户ID并设置到数据源上下文中
String tenantId = AuthUtil.getTenantId();
DynamicDataSourceContextHolder.push(tenantId);
// 执行原方法
Object result = joinPoint.proceed();
// 在方法执行后,从数据源上下文中移除租户ID
DynamicDataSourceContextHolder.poll();
return result;
}
@Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitHandler)")
public Object rabbitHandlerMethods(ProceedingJoinPoint joinPoint) throws Throwable {
// 在方法执行前,获取当前租户ID并设置到数据源上下文中
String tenantId = AuthUtil.getTenantId();
DynamicDataSourceContextHolder.push(tenantId);
// 执行原方法
Object result = joinPoint.proceed();
// 在方法执行后,从数据源上下文中移除租户ID
DynamicDataSourceContextHolder.poll();
return result;
}
} }

67
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/config/CustomMessageConverter.java

@ -0,0 +1,67 @@
package com.logpm.distribution.config;
import cn.hutool.json.JSONUtil;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.ThreadLocalUtil;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.support.converter.MessageConversionException;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.http.HttpHeaders;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import java.util.Map;
/**
* @author zhaoqiaobo
* @create 2024-05-08
*/
@Component
public class CustomMessageConverter implements MessageConverter {
private String name;
@Override
public Message toMessage(Object o, MessageProperties messageProperties) throws MessageConversionException {
HttpHeaders headers = (HttpHeaders) ThreadLocalUtil.get("bladeContext");
if (headers != null && !headers.isEmpty()) {
headers.forEach((key, values) -> {
values.forEach((value) -> {
messageProperties.setHeader(key, new String[]{value});
});
});
}
BladeUser user = AuthUtil.getUser();
BladeUser bladeUser = new BladeUser();
bladeUser.setTenantId(user.getTenantId());
bladeUser.setUserId(user.getUserId());
bladeUser.setAccount(user.getAccount());
bladeUser.setRoleId(user.getRoleId());
messageProperties.setHeader("bladeUser", JSONUtil.toJsonStr(bladeUser));
return new Message(o.toString().getBytes(), messageProperties);
}
@Override
public Object fromMessage(Message message) throws MessageConversionException {
MessageProperties messageProperties = message.getMessageProperties();
Map<String, Object> headers = messageProperties.getHeaders();
ThreadLocalUtil.put("bladeContext", headers);
Object bladeUser = headers.get("bladeUser");
MockHttpServletRequest request = new MockHttpServletRequest();
BladeUser bladeUser1 = JSONUtil.toBean(bladeUser.toString(), BladeUser.class);
request.setAttribute("_BLADE_USER_REQUEST_ATTR_", bladeUser1);
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
return new String(message.getBody());
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

1
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/config/RabbitMqConfiguration.java

@ -28,6 +28,7 @@ public class RabbitMqConfiguration {
RabbitTemplate template = new RabbitTemplate(); RabbitTemplate template = new RabbitTemplate();
template.setConnectionFactory(connectionFactory); template.setConnectionFactory(connectionFactory);
template.setMandatory(true); template.setMandatory(true);
template.setMessageConverter(new CustomMessageConverter());
template.setConfirmCallback(new RabbitTemplate.ConfirmCallback() { template.setConfirmCallback(new RabbitTemplate.ConfirmCallback() {
@Override @Override
public void confirm(CorrelationData correlationData, boolean b, String s) { public void confirm(CorrelationData correlationData, boolean b, String s) {

15
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java

@ -361,4 +361,19 @@ public class DistributionParcelListClient implements IDistributionParcelListClie
}); });
} }
@Override
public void updateFreezeStatusByWaybillIds(List<Long> waybillIds) {
distributionParcelListService.updateFreezeStatusByWaybillIds(waybillIds);
}
@Override
public void updateUnFreezeStatusByWaybillIds(List<Long> waybillIds) {
distributionParcelListService.updateUnFreezeStatusByWaybillIds(waybillIds);
}
@Override
public void clearParceListWaybillByAdvanceIds(List<Long> advanceIds) {
distributionParcelListService.clearParceListWaybillByAdvanceIds(advanceIds);
}
} }

7
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java

@ -263,4 +263,11 @@ public interface DistributionParcelListMapper extends BaseMapper<DistributionPar
void updatePackageStatus(@Param("orderPackageCodes") List<String> orderPackageCodes, @Param("warehouseId") Long warehouseId, @Param("packageStatus") String packageStatus); void updatePackageStatus(@Param("orderPackageCodes") List<String> orderPackageCodes, @Param("warehouseId") Long warehouseId, @Param("packageStatus") String packageStatus);
List<DistributionParcelListEntity> findListByOrderPackageCode(@Param("orderPackageCodes") List<String> orderPackageCodes, @Param("warehouseId") Long warehouseId); List<DistributionParcelListEntity> findListByOrderPackageCode(@Param("orderPackageCodes") List<String> orderPackageCodes, @Param("warehouseId") Long warehouseId);
void updateFreezeStatusByWaybillIds(@Param("waybillIds") List<Long> waybillIds);
void updateUnFreezeStatusByWaybillIds(@Param("waybillIds") List<Long> waybillIds);
void clearParceListWaybillByAdvanceIds(@Param("advanceIds") List<Long> advanceIds);
} }

32
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml

@ -1689,5 +1689,37 @@
and warehouse_id = #{warehouseId} and warehouse_id = #{warehouseId}
</select> </select>
<update id="updateFreezeStatusByWaybillIds" >
update logpm_distribution_parcel_list
set order_package_freeze_status = '20'
where waybill_id in
<foreach collection="waybillIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<update id="updateUnFreezeStatusByWaybillIds" >
update logpm_distribution_parcel_list
set order_package_freeze_status = '10'
where waybill_id in
<foreach collection="waybillIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<update id="clearParceListWaybillByAdvanceIds" >
update logpm_distribution_parcel_list
set waybill_id = null,
waybill_number = null,
send_warehouse_id = null,
send_warehouse_name = null,
accept_warehouse_id = null,
accept_warehouse_name = null,
is_transfer = 1
where advance_id in
<foreach collection="advanceIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
</mapper> </mapper>

6
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java

@ -223,4 +223,10 @@ public interface IDistributionParcelListService extends BaseService<Distribution
void updatePackageStatus(List<String> orderPackageCodes, Long warehouseId, String packageStatus); void updatePackageStatus(List<String> orderPackageCodes, Long warehouseId, String packageStatus);
List<DistributionParcelListEntity> findListByOrderPackageCode(List<String> orderPackageCodes, Long warehouseId); List<DistributionParcelListEntity> findListByOrderPackageCode(List<String> orderPackageCodes, Long warehouseId);
void updateFreezeStatusByWaybillIds(List<Long> waybillIds);
void updateUnFreezeStatusByWaybillIds(List<Long> waybillIds);
void clearParceListWaybillByAdvanceIds(List<Long> advanceIds);
} }

15
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java

@ -1235,4 +1235,19 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl<Distribut
return baseMapper.findListByOrderPackageCode(orderPackageCodes,warehouseId); return baseMapper.findListByOrderPackageCode(orderPackageCodes,warehouseId);
} }
@Override
public void updateFreezeStatusByWaybillIds(List<Long> waybillIds) {
baseMapper.updateFreezeStatusByWaybillIds(waybillIds);
}
@Override
public void updateUnFreezeStatusByWaybillIds(List<Long> waybillIds) {
baseMapper.updateUnFreezeStatusByWaybillIds(waybillIds);
}
@Override
public void clearParceListWaybillByAdvanceIds(List<Long> advanceIds) {
baseMapper.clearParceListWaybillByAdvanceIds(advanceIds);
}
} }

113
blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/config/CustomMessageConverter.java

@ -6,14 +6,25 @@ import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.ThreadLocalUtil; import org.springblade.core.tool.utils.ThreadLocalUtil;
import org.springframework.amqp.core.Message; import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties; import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.support.converter.AllowedListDeserializingMessageConverter;
import org.springframework.amqp.support.converter.MessageConversionException; import org.springframework.amqp.support.converter.MessageConversionException;
import org.springframework.amqp.support.converter.MessageConverter; import org.springframework.amqp.utils.SerializationUtils;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.remoting.rmi.CodebaseAwareObjectInputStream;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ClassUtils;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Map; import java.util.Map;
/** /**
@ -21,9 +32,74 @@ import java.util.Map;
* @create 2024-05-08 * @create 2024-05-08
*/ */
@Component @Component
public class CustomMessageConverter implements MessageConverter { public class CustomMessageConverter extends AllowedListDeserializingMessageConverter implements BeanClassLoaderAware {
private volatile String defaultCharset = "UTF-8";
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
private String codebaseUrl;
@Override
public Object fromMessage(Message message) throws MessageConversionException {
Object content = null;
MessageProperties properties = message.getMessageProperties();
if (properties != null) {
String contentType = properties.getContentType();
if (contentType != null && contentType.startsWith("text")) {
String encoding = properties.getContentEncoding();
if (encoding == null) {
encoding = "UTF-8";
}
try {
content = new String(message.getBody(), encoding);
} catch (UnsupportedEncodingException var8) {
throw new MessageConversionException("failed to convert text-based Message content", var8);
}
} else if (contentType != null && contentType.equals("application/x-java-serialized-object")) {
try {
content = SerializationUtils.deserialize(this.createObjectInputStream(new ByteArrayInputStream(message.getBody()), this.codebaseUrl));
} catch (IllegalArgumentException | IllegalStateException | IOException var7) {
throw new MessageConversionException("failed to convert serialized Message content", var7);
}
}
}
Map<String, Object> headers = properties.getHeaders();
ThreadLocalUtil.put("bladeContext", headers);
Object bladeUser = headers.get("bladeUser");
MockHttpServletRequest request = new MockHttpServletRequest();
BladeUser bladeUser1 = JSONUtil.toBean(bladeUser.toString(), BladeUser.class);
request.setAttribute("_BLADE_USER_REQUEST_ATTR_", bladeUser1);
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
if (content == null) {
content = message.getBody();
}
return content;
}
@Override @Override
public Message toMessage(Object o, MessageProperties messageProperties) throws MessageConversionException { protected Message createMessage(Object object, MessageProperties messageProperties) throws MessageConversionException {
byte[] bytes = null;
if (object instanceof byte[]) {
bytes = (byte[]) object;
messageProperties.setContentType("application/octet-stream");
} else if (object instanceof String) {
try {
bytes = ((String) object).getBytes(this.defaultCharset);
} catch (UnsupportedEncodingException var6) {
throw new MessageConversionException("failed to convert to Message content", var6);
}
messageProperties.setContentType("text/plain");
messageProperties.setContentEncoding(this.defaultCharset);
} else if (object instanceof Serializable) {
try {
bytes = SerializationUtils.serialize(object);
} catch (IllegalArgumentException var5) {
throw new MessageConversionException("failed to convert to serialized Message content", var5);
}
messageProperties.setContentType("application/x-java-serialized-object");
}
HttpHeaders headers = (HttpHeaders) ThreadLocalUtil.get("bladeContext"); HttpHeaders headers = (HttpHeaders) ThreadLocalUtil.get("bladeContext");
if (headers != null && !headers.isEmpty()) { if (headers != null && !headers.isEmpty()) {
headers.forEach((key, values) -> { headers.forEach((key, values) -> {
@ -39,19 +115,28 @@ public class CustomMessageConverter implements MessageConverter {
bladeUser.setAccount(user.getAccount()); bladeUser.setAccount(user.getAccount());
bladeUser.setRoleId(user.getRoleId()); bladeUser.setRoleId(user.getRoleId());
messageProperties.setHeader("bladeUser", JSONUtil.toJsonStr(bladeUser)); messageProperties.setHeader("bladeUser", JSONUtil.toJsonStr(bladeUser));
return new Message(o.toString().getBytes(), messageProperties);
if (bytes != null) {
messageProperties.setContentLength((long) bytes.length);
return new Message(bytes, messageProperties);
} else {
throw new IllegalArgumentException(this.getClass().getSimpleName() + " only supports String, byte[] and Serializable payloads, received: " + object.getClass().getName());
}
} }
@Override @Override
public Object fromMessage(Message message) throws MessageConversionException { public void setBeanClassLoader(ClassLoader classLoader) {
MessageProperties messageProperties = message.getMessageProperties(); this.beanClassLoader = beanClassLoader;
Map<String, Object> headers = messageProperties.getHeaders(); }
ThreadLocalUtil.put("bladeContext", headers);
Object bladeUser = headers.get("bladeUser"); protected ObjectInputStream createObjectInputStream(InputStream is, String codebaseUrl) throws IOException {
MockHttpServletRequest request = new MockHttpServletRequest(); return new CodebaseAwareObjectInputStream(is, this.beanClassLoader, codebaseUrl) {
BladeUser bladeUser1 = JSONUtil.toBean(bladeUser.toString(), BladeUser.class); @Override
request.setAttribute("_BLADE_USER_REQUEST_ATTR_", bladeUser1); protected Class<?> resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException {
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request)); Class<?> clazz = super.resolveClass(classDesc);
return new String(message.getBody()); CustomMessageConverter.this.checkAllowedList(clazz);
return clazz;
}
};
} }
} }

50
blade-service/logpm-factory/src/main/java/com/logpm/factory/aspect/AsyncAnnotationAspect.java

@ -0,0 +1,50 @@
package com.logpm.factory.aspect;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
@Aspect
@Component
public class AsyncAnnotationAspect {
/**
* 该方法为一个切面用于对标记了@RabbitListener注解的方法进行增强主要增加了日志记录和数据源上下文处理的功能
*
* @param joinPoint 切面的连接点表示当前被拦截的方法
* @return 返回被拦截方法的执行结果
* @throws Throwable 如果执行过程中发生异常则抛出
*/
@Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitListener)")
public Object rabbitMethods(ProceedingJoinPoint joinPoint) throws Throwable {
// 在方法执行前,获取当前租户ID并设置到数据源上下文中
String tenantId = AuthUtil.getTenantId();
DynamicDataSourceContextHolder.push(tenantId);
// 执行原方法
Object result = joinPoint.proceed();
// 在方法执行后,从数据源上下文中移除租户ID
DynamicDataSourceContextHolder.poll();
return result;
}
@Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitHandler)")
public Object rabbitHandlerMethods(ProceedingJoinPoint joinPoint) throws Throwable {
// 在方法执行前,获取当前租户ID并设置到数据源上下文中
String tenantId = AuthUtil.getTenantId();
DynamicDataSourceContextHolder.push(tenantId);
// 执行原方法
Object result = joinPoint.proceed();
// 在方法执行后,从数据源上下文中移除租户ID
DynamicDataSourceContextHolder.poll();
return result;
}
}

59
blade-service/logpm-factory/src/main/java/com/logpm/factory/aspect/LocalServerTenantIdAnnotationAspect.java

@ -0,0 +1,59 @@
//package com.logpm.factory.aspect;
//
//import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
//import org.aspectj.lang.ProceedingJoinPoint;
//import org.aspectj.lang.annotation.Around;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.reflect.MethodSignature;
//import org.springblade.common.annotations.LocalServerUser;
//import org.springblade.core.secure.BladeUser;
//import org.springblade.core.secure.utils.AuthUtil;
//import org.springblade.core.tool.utils.StringUtil;
//import org.springblade.core.tool.utils.WebUtil;
//import org.springblade.system.cache.UserCache;
//import org.springblade.system.entity.User;
//import org.springframework.core.annotation.Order;
//import org.springframework.scheduling.annotation.Async;
//import org.springframework.stereotype.Component;
//
//import javax.servlet.http.HttpServletRequest;
//import java.lang.reflect.Method;
//
//@Aspect
//@Component
//public class LocalServerTenantIdAnnotationAspect {
//
//
// /**
// * 定义一个切点,匹配所有带有@Async("asyncExecutor")注解的方法。
// * 注意:实际上Spring Framework自带对@Async("asyncExecutor")的处理,直接这样配置可能会导致预期之外的行为。
// */
//
// // 定义一个
// @Around("@annotation(org.springblade.common.annotations.LocalServerUser)")
// public Object logAroundAsyncMethods(ProceedingJoinPoint joinPoint) throws Throwable {
//
// MethodSignature signature = (MethodSignature) joinPoint.getSignature();
// Method method = signature.getMethod();
//
// LocalServerUser myAsync = method.getAnnotation(LocalServerUser.class);
// String annotationValue = myAsync.ds();
//
// if(StringUtil.isNotBlank(annotationValue) ){
// // 在方法执行前的操作
// DynamicDataSourceContextHolder.push(annotationValue);
//
// // 执行原方法
// Object result = joinPoint.proceed();
//
// // 在方法执行后的操作
// DynamicDataSourceContextHolder.poll();
//
// return result;
// }else{
// return joinPoint.proceed();
// }
//
// }
//
//}

2
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryAuthController.java

@ -26,6 +26,7 @@ import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springblade.common.exception.CustomerException; import org.springblade.common.exception.CustomerException;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -39,6 +40,7 @@ import javax.servlet.http.HttpServletResponse;
* @since 2023-06-06 * @since 2023-06-06
*/ */
@Log4j2 @Log4j2
@NonDS
@RestController @RestController
@AllArgsConstructor @AllArgsConstructor
@RequestMapping("/factory/auth") @RequestMapping("/factory/auth")

7
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryCommonController.java

@ -10,17 +10,23 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springblade.common.annotations.LocalServerUser;
import org.springblade.common.constant.RabbitConstant; import org.springblade.common.constant.RabbitConstant;
import org.springblade.common.exception.CustomerException; import org.springblade.common.exception.CustomerException;
import org.springblade.common.utils.CommonUtil; import org.springblade.common.utils.CommonUtil;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springblade.core.tool.utils.WebUtil;
import org.springframework.amqp.rabbit.connection.CorrelationData; import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -177,6 +183,7 @@ public class FactoryCommonController {
map.put("messageData", receiveInfoDTO); map.put("messageData", receiveInfoDTO);
map.put("createTime", new Date().getTime()); map.put("createTime", new Date().getTime());
map.put("flagType", "OrderStatusLog"); map.put("flagType", "OrderStatusLog");
//将消息携带绑定键值 //将消息携带绑定键值
rabbitTemplate.convertAndSend(RabbitConstant.UNLOAD_CAR_COM_INFO_EXCHANGE, RabbitConstant.UNLOAD_CAR_COM_INFO_ROUTING, map); rabbitTemplate.convertAndSend(RabbitConstant.UNLOAD_CAR_COM_INFO_EXCHANGE, RabbitConstant.UNLOAD_CAR_COM_INFO_ROUTING, map);

67
blade-service/logpm-factory/src/main/java/com/logpm/factory/config/CustomMessageConverter.java

@ -0,0 +1,67 @@
package com.logpm.factory.config;
import cn.hutool.json.JSONUtil;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.ThreadLocalUtil;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.support.converter.MessageConversionException;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.http.HttpHeaders;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import java.util.Map;
/**
* @author zhaoqiaobo
* @create 2024-05-08
*/
@Component
public class CustomMessageConverter implements MessageConverter {
private String name;
@Override
public Message toMessage(Object o, MessageProperties messageProperties) throws MessageConversionException {
HttpHeaders headers = (HttpHeaders) ThreadLocalUtil.get("bladeContext");
if (headers != null && !headers.isEmpty()) {
headers.forEach((key, values) -> {
values.forEach((value) -> {
messageProperties.setHeader(key, new String[]{value});
});
});
}
BladeUser user = AuthUtil.getUser();
BladeUser bladeUser = new BladeUser();
bladeUser.setTenantId(user.getTenantId());
bladeUser.setUserId(user.getUserId());
bladeUser.setAccount(user.getAccount());
bladeUser.setRoleId(user.getRoleId());
messageProperties.setHeader("bladeUser", JSONUtil.toJsonStr(bladeUser));
return new Message(o.toString().getBytes(), messageProperties);
}
@Override
public Object fromMessage(Message message) throws MessageConversionException {
MessageProperties messageProperties = message.getMessageProperties();
Map<String, Object> headers = messageProperties.getHeaders();
ThreadLocalUtil.put("bladeContext", headers);
Object bladeUser = headers.get("bladeUser");
MockHttpServletRequest request = new MockHttpServletRequest();
BladeUser bladeUser1 = JSONUtil.toBean(bladeUser.toString(), BladeUser.class);
request.setAttribute("_BLADE_USER_REQUEST_ATTR_", bladeUser1);
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
return new String(message.getBody());
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

12
blade-service/logpm-factory/src/main/java/com/logpm/factory/config/InterceptorAdapterConfig.java

@ -2,8 +2,10 @@ package com.logpm.factory.config;
import com.logpm.factory.comfac.service.IFactoryTokenService; import com.logpm.factory.comfac.service.IFactoryTokenService;
import com.logpm.factory.interceptor.FactoryAccountsInterceptor; import com.logpm.factory.interceptor.FactoryAccountsInterceptor;
import com.logpm.factory.interceptor.LocalServerLoginAccountsInterceptor;
import com.logpm.factory.interceptor.ZbFactoryAccountsInterceptor; import com.logpm.factory.interceptor.ZbFactoryAccountsInterceptor;
import com.logpm.factory.props.ZbFactoryProperties; import com.logpm.factory.props.ZbFactoryProperties;
import org.springblade.core.redis.cache.BladeRedis;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration; import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
@ -15,8 +17,10 @@ public class InterceptorAdapterConfig implements WebMvcConfigurer {
@Autowired @Autowired
IFactoryTokenService factoryTokenService; IFactoryTokenService factoryTokenService;
@Autowired @Autowired
ZbFactoryProperties zbFactoryProperties; private BladeRedis redis;
@Override @Override
public void addInterceptors(InterceptorRegistry interceptorRegistry) { public void addInterceptors(InterceptorRegistry interceptorRegistry) {
@ -26,6 +30,12 @@ public class InterceptorAdapterConfig implements WebMvcConfigurer {
excludePathPatterns("/factory/oupai/**"). excludePathPatterns("/factory/oupai/**").
excludePathPatterns("/factory/zb/**") excludePathPatterns("/factory/zb/**")
.excludePathPatterns("/factory/common/**"); .excludePathPatterns("/factory/common/**");
registry=interceptorRegistry.addInterceptor(new LocalServerLoginAccountsInterceptor(redis));
// registry.addPathPatterns("/factory/**").
// excludePathPatterns("/factory/auth/token").
// excludePathPatterns("/factory/oupai/**").
// excludePathPatterns("/factory/zb/**")
// .excludePathPatterns("/factory/common/**");
// InterceptorRegistration registryZbFactory = interceptorRegistry.addInterceptor(new ZbFactoryAccountsInterceptor(zbFactoryProperties)); // InterceptorRegistration registryZbFactory = interceptorRegistry.addInterceptor(new ZbFactoryAccountsInterceptor(zbFactoryProperties));
// registryZbFactory.addPathPatterns("/factory/zb/**"); // registryZbFactory.addPathPatterns("/factory/zb/**");
} }

3
blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java

@ -27,10 +27,11 @@ import static io.protostuff.MapSchema.MessageFactories.HashMap;
public class RabbitMqConfiguration { public class RabbitMqConfiguration {
@Bean @Bean
public RabbitTemplate createRabbitTemplate(ConnectionFactory connectionFactory) { public RabbitTemplate createRabbitTemplate(ConnectionFactory connectionFactory,CustomMessageConverter converter) {
RabbitTemplate template = new RabbitTemplate(); RabbitTemplate template = new RabbitTemplate();
template.setConnectionFactory(connectionFactory); template.setConnectionFactory(connectionFactory);
template.setMandatory(true); template.setMandatory(true);
template.setMessageConverter(converter);
template.setConfirmCallback(new RabbitTemplate.ConfirmCallback() { template.setConfirmCallback(new RabbitTemplate.ConfirmCallback() {
@Override @Override
public void confirm(CorrelationData correlationData, boolean b, String s) { public void confirm(CorrelationData correlationData, boolean b, String s) {

6
blade-service/logpm-factory/src/main/java/com/logpm/factory/filer/HttpServletFilter.java

@ -11,8 +11,14 @@ import java.io.IOException;
public class HttpServletFilter implements Filter { public class HttpServletFilter implements Filter {
public void init(FilterConfig filterConfig) throws ServletException { public void init(FilterConfig filterConfig) throws ServletException {
System.out.println("****************************1");
} }
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 执行这里");
ServletRequest requestWrapper = null; ServletRequest requestWrapper = null;
if(request instanceof HttpServletRequest) { if(request instanceof HttpServletRequest) {
requestWrapper = new RequestWrapper((HttpServletRequest) request); requestWrapper = new RequestWrapper((HttpServletRequest) request);

100
blade-service/logpm-factory/src/main/java/com/logpm/factory/interceptor/LocalServerLoginAccountsInterceptor.java

@ -0,0 +1,100 @@
package com.logpm.factory.interceptor;
import cn.hutool.core.map.MapUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.logpm.factory.comfac.service.IFactoryTokenService;
import com.logpm.factory.config.RequestWrapper;
import com.logpm.factory.wrapper.CustomHttpServletRequestWrapper;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springblade.common.cache.CacheNames;
import org.springblade.common.constant.LauncherConstant;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@Log4j2
@AllArgsConstructor
public class LocalServerLoginAccountsInterceptor extends HandlerInterceptorAdapter {
private final BladeRedis bladeRedis;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws CustomerException {
try {
JSONObject data =bladeRedis.get(CacheNames.LOCAL_SERVER_USER+"admin");
CustomHttpServletRequestWrapper wrappedRequest = new CustomHttpServletRequestWrapper(request);
if(Objects.isNull(data)){
String url = "http://"+ LauncherConstant.loginAddr(AppConstant.DEV_CODE)+"/blade-auth/oauth/token";
cn.hutool.http.HttpRequest urlRequest = HttpRequest.post(url);
urlRequest.header("Authorization", "Basic c2FiZXI6c2FiZXJfc2VjcmV0");
urlRequest.header("Tenant-Id", "627683");
Map<String, Object> params = new HashMap<>();
params.put("grant_type", "local_server");
params.put("scope", "all");
params.put("username", "shujutongbu");
params.put("tenantId", "627683");
HttpResponse execute = urlRequest.form(params).execute();
String body = execute.body();
data = JSONObject.parseObject(body);
bladeRedis.setEx(CacheNames.LOCAL_SERVER_USER+"admin",data,3200L);
}
// 修改或添加header
// 发送登录请求
log.info("##########preHandle: request={}", request);
wrappedRequest.addHeader("Blade-Auth", "bearer "+data.getString("access_token"));
// 用包装后的request替换原始request
request = wrappedRequest;
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
return true;
} catch (Exception e) {
returnJson(response, JSONObject.toJSONString(R.fail(500, "服务异常,请联系管理员")));
return false;
}
}
private void returnJson(HttpServletResponse response, String json) {
PrintWriter writer = null;
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json");
try {
writer = response.getWriter();
writer.print(json);
} catch (IOException e) {
System.out.println(e.getMessage());
} finally {
if (writer != null) {
writer.close();
}
}
}
}

1
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.java

@ -1,5 +1,6 @@
package com.logpm.factory.mt.mapper; package com.logpm.factory.mt.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.factory.mt.entity.MtFactoryOrderMain; import com.logpm.factory.mt.entity.MtFactoryOrderMain;

36
blade-service/logpm-factory/src/main/java/com/logpm/factory/wrapper/CustomHttpServletRequestWrapper.java

@ -0,0 +1,36 @@
package com.logpm.factory.wrapper;
import org.springframework.http.HttpHeaders;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.util.*;
public class CustomHttpServletRequestWrapper extends HttpServletRequestWrapper {
private final HttpHeaders headers;
public CustomHttpServletRequestWrapper(HttpServletRequest request) {
super(request);
headers = new HttpHeaders();
}
@Override
public String getHeader(String name) {
String headerValue = headers.getFirst(name);
return headerValue != null ? headerValue : super.getHeader(name);
}
@Override
public Enumeration<String> getHeaderNames() {
List<String> names = Collections.list(super.getHeaderNames());
headers.forEach((key, value) -> names.add(key));
return Collections.enumeration(names);
}
// 其他需要覆盖的方法...
public void addHeader(String name, String value) {
headers.add(name, value);
}
}

8
blade-service/logpm-old-project/src/main/resources/application-dev.yml

@ -34,12 +34,12 @@ spring:
url: ${blade.datasource.oldproject.master.url} url: ${blade.datasource.oldproject.master.url}
username: ${blade.datasource.oldproject.master.username} username: ${blade.datasource.oldproject.master.username}
password: ${blade.datasource.oldproject.master.password} password: ${blade.datasource.oldproject.master.password}
slave: 627683:
druid: druid:
#独立校验配置 #独立校验配置
validation-query: select 1 validation-query: select 1
#oracle校验 #oracle校验
#validation-query: select 1 from dual #validation-query: select 1 from dual
url: ${blade.datasource.oldproject.slave.url} url: ${blade.datasource.oldproject.627683.url}
username: ${blade.datasource.oldproject.slave.username} username: ${blade.datasource.oldproject.627683.username}
password: ${blade.datasource.oldproject.slave.password} password: ${blade.datasource.oldproject.627683.password}

31
blade-service/logpm-supervise/src/main/java/com/logpm/supervise/aspect/AsyncAnnotationAspect.java

@ -47,4 +47,35 @@ public class AsyncAnnotationAspect {
} }
/**
* 该方法为一个切面用于对标记了@RabbitListener注解的方法进行增强主要增加了日志记录和数据源上下文处理的功能
*
* @param joinPoint 切面的连接点表示当前被拦截的方法
* @return 返回被拦截方法的执行结果
* @throws Throwable 如果执行过程中发生异常则抛出
*/
@Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitListener)")
public Object rabbitMethods(ProceedingJoinPoint joinPoint) throws Throwable {
// 在方法执行前,获取当前租户ID并设置到数据源上下文中
String tenantId = AuthUtil.getTenantId();
DynamicDataSourceContextHolder.push(tenantId);
// 执行原方法
Object result = joinPoint.proceed();
// 在方法执行后,从数据源上下文中移除租户ID
DynamicDataSourceContextHolder.poll();
return result;
}
@Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitHandler)")
public Object rabbitHandlerMethods(ProceedingJoinPoint joinPoint) throws Throwable {
// 在方法执行前,获取当前租户ID并设置到数据源上下文中
String tenantId = AuthUtil.getTenantId();
DynamicDataSourceContextHolder.push(tenantId);
// 执行原方法
Object result = joinPoint.proceed();
// 在方法执行后,从数据源上下文中移除租户ID
DynamicDataSourceContextHolder.poll();
return result;
}
} }

31
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/aspect/AsyncAnnotationAspect.java

@ -47,4 +47,35 @@ public class AsyncAnnotationAspect {
} }
/**
* 该方法为一个切面用于对标记了@RabbitListener注解的方法进行增强主要增加了日志记录和数据源上下文处理的功能
*
* @param joinPoint 切面的连接点表示当前被拦截的方法
* @return 返回被拦截方法的执行结果
* @throws Throwable 如果执行过程中发生异常则抛出
*/
@Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitListener)")
public Object rabbitMethods(ProceedingJoinPoint joinPoint) throws Throwable {
// 在方法执行前,获取当前租户ID并设置到数据源上下文中
String tenantId = AuthUtil.getTenantId();
DynamicDataSourceContextHolder.push(tenantId);
// 执行原方法
Object result = joinPoint.proceed();
// 在方法执行后,从数据源上下文中移除租户ID
DynamicDataSourceContextHolder.poll();
return result;
}
@Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitHandler)")
public Object rabbitHandlerMethods(ProceedingJoinPoint joinPoint) throws Throwable {
// 在方法执行前,获取当前租户ID并设置到数据源上下文中
String tenantId = AuthUtil.getTenantId();
DynamicDataSourceContextHolder.push(tenantId);
// 执行原方法
Object result = joinPoint.proceed();
// 在方法执行后,从数据源上下文中移除租户ID
DynamicDataSourceContextHolder.poll();
return result;
}
} }

67
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/CustomMessageConverter.java

@ -0,0 +1,67 @@
package com.logpm.trunkline.config;
import cn.hutool.json.JSONUtil;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.ThreadLocalUtil;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.support.converter.MessageConversionException;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.http.HttpHeaders;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import java.util.Map;
/**
* @author zhaoqiaobo
* @create 2024-05-08
*/
@Component
public class CustomMessageConverter implements MessageConverter {
private String name;
@Override
public Message toMessage(Object o, MessageProperties messageProperties) throws MessageConversionException {
HttpHeaders headers = (HttpHeaders) ThreadLocalUtil.get("bladeContext");
if (headers != null && !headers.isEmpty()) {
headers.forEach((key, values) -> {
values.forEach((value) -> {
messageProperties.setHeader(key, new String[]{value});
});
});
}
BladeUser user = AuthUtil.getUser();
BladeUser bladeUser = new BladeUser();
bladeUser.setTenantId(user.getTenantId());
bladeUser.setUserId(user.getUserId());
bladeUser.setAccount(user.getAccount());
bladeUser.setRoleId(user.getRoleId());
messageProperties.setHeader("bladeUser", JSONUtil.toJsonStr(bladeUser));
return new Message(o.toString().getBytes(), messageProperties);
}
@Override
public Object fromMessage(Message message) throws MessageConversionException {
MessageProperties messageProperties = message.getMessageProperties();
Map<String, Object> headers = messageProperties.getHeaders();
ThreadLocalUtil.put("bladeContext", headers);
Object bladeUser = headers.get("bladeUser");
MockHttpServletRequest request = new MockHttpServletRequest();
BladeUser bladeUser1 = JSONUtil.toBean(bladeUser.toString(), BladeUser.class);
request.setAttribute("_BLADE_USER_REQUEST_ATTR_", bladeUser1);
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
return new String(message.getBody());
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

1
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/RabbitMqConfiguration.java

@ -21,6 +21,7 @@ public class RabbitMqConfiguration {
RabbitTemplate template = new RabbitTemplate(); RabbitTemplate template = new RabbitTemplate();
template.setConnectionFactory(connectionFactory); template.setConnectionFactory(connectionFactory);
template.setMandatory(true); template.setMandatory(true);
template.setMessageConverter(new CustomMessageConverter());
template.setConfirmCallback(new RabbitTemplate.ConfirmCallback() { template.setConfirmCallback(new RabbitTemplate.ConfirmCallback() {
@Override @Override
public void confirm(CorrelationData correlationData, boolean b, String s) { public void confirm(CorrelationData correlationData, boolean b, String s) {

23
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/BillladingController.java

@ -492,7 +492,7 @@ public class BillladingController {
} }
@ResponseBody @ResponseBody
@PostMapping("/findDriverListByName") @PostMapping("/findDriverListByName")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "通过名称查司机", notes = "传入waybillDTO") @ApiOperation(value = "通过名称查司机", notes = "传入waybillDTO")
public R findDriverListByName(@RequestBody BillladingDTO billladingDTO) { public R findDriverListByName(@RequestBody BillladingDTO billladingDTO) {
@ -551,6 +551,27 @@ public class BillladingController {
} }
@ResponseBody
@PostMapping("/findBillladingLogList")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "查询提货单日志", notes = "传入waybillDTO")
public R findBillladingLogList(@RequestBody BillladingDTO billladingDTO) {
String method = "############findBillladingLogList: ";
log.info(method + "请求参数{}", billladingDTO);
Long billladingId = billladingDTO.getBillladingId();
try{
return trunklineBillladingService.findBillladingLogList(billladingId);
}catch (CustomerException e){
log.error(e.message,e);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error("############sendOrders: 系统异常",e);
return R.fail(500,"############sendOrders: 系统异常");
}
}
} }

120
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/OpenOrderController.java

@ -1,7 +1,6 @@
package com.logpm.trunkline.controller; package com.logpm.trunkline.controller;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
@ -11,6 +10,7 @@ import com.logpm.trunkline.dto.OpenLabelDTO;
import com.logpm.trunkline.dto.OpenOrderDTO; import com.logpm.trunkline.dto.OpenOrderDTO;
import com.logpm.trunkline.dto.WaybillDetailDTO; import com.logpm.trunkline.dto.WaybillDetailDTO;
import com.logpm.trunkline.entity.TrunklineAdvanceEntity; import com.logpm.trunkline.entity.TrunklineAdvanceEntity;
import com.logpm.trunkline.service.ICarsLoadAsyncService;
import com.logpm.trunkline.service.IOpenOrderService; import com.logpm.trunkline.service.IOpenOrderService;
import com.logpm.trunkline.service.ITrunklineCarsLoadService; import com.logpm.trunkline.service.ITrunklineCarsLoadService;
import com.logpm.trunkline.vo.TrunklineAdvanceDetailVO; import com.logpm.trunkline.vo.TrunklineAdvanceDetailVO;
@ -40,6 +40,7 @@ public class OpenOrderController {
private final IBasicdataWarehouseClient warehouseClient; private final IBasicdataWarehouseClient warehouseClient;
private final IOpenOrderService openOrderService; private final IOpenOrderService openOrderService;
private final ITrunklineCarsLoadService carsLoadService; private final ITrunklineCarsLoadService carsLoadService;
private final ICarsLoadAsyncService carsLoadAsyncService;
@ResponseBody @ResponseBody
@PostMapping("/advancePageList") @PostMapping("/advancePageList")
@ -1089,9 +1090,7 @@ public class OpenOrderController {
R<List<TrunklineAdvanceEntity>> listR = openOrderService.openLabelHasPacakage(myCurrentWarehouse.getId(),myCurrentWarehouse.getName(),file); R<List<TrunklineAdvanceEntity>> listR = openOrderService.openLabelHasPacakage(myCurrentWarehouse.getId(),myCurrentWarehouse.getName(),file);
List<TrunklineAdvanceEntity> data = listR.getData(); List<TrunklineAdvanceEntity> data = listR.getData();
if(!CollUtil.isEmpty(data)){ if(!CollUtil.isEmpty(data)){
for (TrunklineAdvanceEntity datum : data) { carsLoadAsyncService.sendRabbitMessageLoadScanData(data);
carsLoadService.sendRabbitMessageLoadScanData(JSONUtil.toJsonStr(datum));
}
} }
return listR; return listR;
@ -1160,9 +1159,7 @@ public class OpenOrderController {
R<List<TrunklineAdvanceEntity>> listR = openOrderService.importCustomizedOuPai(myCurrentWarehouse.getId(), myCurrentWarehouse.getName(), file); R<List<TrunklineAdvanceEntity>> listR = openOrderService.importCustomizedOuPai(myCurrentWarehouse.getId(), myCurrentWarehouse.getName(), file);
List<TrunklineAdvanceEntity> data = listR.getData(); List<TrunklineAdvanceEntity> data = listR.getData();
if(!CollUtil.isEmpty(data)){ if(!CollUtil.isEmpty(data)){
for (TrunklineAdvanceEntity datum : data) { carsLoadAsyncService.sendRabbitMessageLoadScanData(data);
carsLoadService.sendRabbitMessageLoadScanData(JSONUtil.toJsonStr(datum));
}
} }
return listR; return listR;
}catch (CustomerException e){ }catch (CustomerException e){
@ -1194,9 +1191,7 @@ public class OpenOrderController {
R<List<TrunklineAdvanceEntity>> listR = openOrderService.importStandardOuPai(myCurrentWarehouse.getId(),myCurrentWarehouse.getName(),file); R<List<TrunklineAdvanceEntity>> listR = openOrderService.importStandardOuPai(myCurrentWarehouse.getId(),myCurrentWarehouse.getName(),file);
List<TrunklineAdvanceEntity> data = listR.getData(); List<TrunklineAdvanceEntity> data = listR.getData();
if(!CollUtil.isEmpty(data)){ if(!CollUtil.isEmpty(data)){
for (TrunklineAdvanceEntity datum : data) { carsLoadAsyncService.sendRabbitMessageLoadScanData(data);
carsLoadService.sendRabbitMessageLoadScanData(JSONUtil.toJsonStr(datum));
}
} }
return listR; return listR;
}catch (CustomerException e){ }catch (CustomerException e){
@ -1217,7 +1212,7 @@ public class OpenOrderController {
String method = "############findWaybillDetail: "; String method = "############findWaybillDetail: ";
log.info(method + "请求参数{}", openOrderDTO); log.info(method + "请求参数{}", openOrderDTO);
Long waybillId = openOrderDTO.getWaybillId(); Long waybillId = openOrderDTO.getWaybillId();
Integer isEdit = openOrderDTO.getIsEdit();
try{ try{
//当前登录人选择的仓库 //当前登录人选择的仓库
@ -1234,6 +1229,11 @@ public class OpenOrderController {
return R.fail(403,"运单号id为空"); return R.fail(403,"运单号id为空");
} }
if (Objects.isNull(isEdit)){
log.warn(method+"查看类型为空 isEdit={}",isEdit);
return R.fail(403,"查看类型为空");
}
return openOrderService.findWaybillDetail(openOrderDTO); return openOrderService.findWaybillDetail(openOrderDTO);
}catch (CustomerException e){ }catch (CustomerException e){
log.error(e.message,e); log.error(e.message,e);
@ -1285,7 +1285,7 @@ public class OpenOrderController {
@PostMapping("/updateWaybill") @PostMapping("/updateWaybill")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "改单", notes = "传入openOrderDTO") @ApiOperation(value = "改单", notes = "传入openOrderDTO")
public R updateWaybill(@RequestBody OpenOrderDTO openOrderDTO) { public R updateWaybill(@RequestBody OpenOrderDTO openOrderDTO) {
String method = "############updateWaybill: "; String method = "############updateWaybill: ";
log.info(method + "请求参数{}", openOrderDTO); log.info(method + "请求参数{}", openOrderDTO);
Long waybillId = openOrderDTO.getWaybillId(); Long waybillId = openOrderDTO.getWaybillId();
@ -1613,4 +1613,100 @@ public class OpenOrderController {
} }
} }
@ResponseBody
@PostMapping("/freezeWaybill")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "冻结运单", notes = "传入openOrderDTO")
public R freezeWaybill(@RequestBody OpenOrderDTO openOrderDTO) {
String method = "############freezeWaybill: ";
log.info(method + "请求参数{}", openOrderDTO);
List<Long> waybillIds = openOrderDTO.getWaybillIds();
try{
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"请选择仓库 myCurrentWarehouse={}",myCurrentWarehouse);
return R.fail(405,"请选择仓库");
}
if(CollUtil.isEmpty(waybillIds)){
log.warn(method+"运单ids为空 waybillIds={}",waybillIds);
return R.fail(405,"运单ids为空");
}
return openOrderService.freezeWaybill(waybillIds,myCurrentWarehouse.getId(),myCurrentWarehouse.getName());
}catch (CustomerException e){
log.error(e.message,e);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常",e);
return R.fail(500,"系统异常");
}
}
@ResponseBody
@PostMapping("/unFreezeWaybill")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "解冻运单", notes = "传入openOrderDTO")
public R unFreezeWaybill(@RequestBody OpenOrderDTO openOrderDTO) {
String method = "############unFreezeWaybill: ";
log.info(method + "请求参数{}", openOrderDTO);
List<Long> waybillIds = openOrderDTO.getWaybillIds();
try{
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"请选择仓库 myCurrentWarehouse={}",myCurrentWarehouse);
return R.fail(405,"请选择仓库");
}
if(CollUtil.isEmpty(waybillIds)){
log.warn(method+"运单ids为空 waybillIds={}",waybillIds);
return R.fail(405,"运单ids为空");
}
return openOrderService.unFreezeWaybill(waybillIds,myCurrentWarehouse.getId(),myCurrentWarehouse.getName());
}catch (CustomerException e){
log.error(e.message,e);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常",e);
return R.fail(500,"系统异常");
}
}
@ResponseBody
@PostMapping("/abolishWaybill")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "作废运单", notes = "传入openOrderDTO")
public R abolishWaybill(@RequestBody OpenOrderDTO openOrderDTO) {
String method = "############abolishWaybill: ";
log.info(method + "请求参数{}", openOrderDTO);
List<Long> waybillIds = openOrderDTO.getWaybillIds();
try{
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"请选择仓库 myCurrentWarehouse={}",myCurrentWarehouse);
return R.fail(405,"请选择仓库");
}
if(CollUtil.isEmpty(waybillIds)){
log.warn(method+"运单ids为空 waybillIds={}",waybillIds);
return R.fail(405,"运单ids为空");
}
return openOrderService.abolishWaybill(waybillIds,myCurrentWarehouse.getId(),myCurrentWarehouse.getName());
}catch (CustomerException e){
log.error(e.message,e);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常",e);
return R.fail(500,"系统异常");
}
}
} }

1
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java

@ -59,4 +59,5 @@ public interface TrunklineAdvanceDetailMapper extends BaseMapper<TrunklineAdvanc
IPage<OrderDetailInfoVO> findOrderDetails(IPage<Object> page, @Param("param") OrderDetailsDTO orderDetailsDTO); IPage<OrderDetailInfoVO> findOrderDetails(IPage<Object> page, @Param("param") OrderDetailsDTO orderDetailsDTO);
void updateWaybillNoIsNullByAdvanceIds(@Param("advanceIds") List<Long> advanceIds);
} }

14
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml

@ -260,7 +260,7 @@
and LOCATE(#{param.orderCode}, pl.order_code) > 0 and LOCATE(#{param.orderCode}, pl.order_code) > 0
</if> </if>
<if test="param.waybillNo != null and param.waybillNo != '' "> <if test="param.waybillNo != null and param.waybillNo != '' ">
and ad.waybill_no = #{param.waybill} and ad.waybill_no = #{param.waybillNo}
</if> </if>
<if test="param.trainNumber != null and param.trainNumber != '' "> <if test="param.trainNumber != null and param.trainNumber != '' ">
and ad.train_number = #{param.trainNumber} and ad.train_number = #{param.trainNumber}
@ -289,7 +289,7 @@
and LOCATE(#{param.orderCode}, ltad.order_code) > 0 and LOCATE(#{param.orderCode}, ltad.order_code) > 0
</if> </if>
<if test="param.waybillNo != null and param.waybillNo != '' "> <if test="param.waybillNo != null and param.waybillNo != '' ">
and ltad.waybill_no = #{param.waybill} and ltad.waybill_no = #{param.waybillNo}
</if> </if>
<if test="param.trainNumber != null and param.trainNumber != '' "> <if test="param.trainNumber != null and param.trainNumber != '' ">
and ltad.train_number = #{param.trainNumber} and ltad.train_number = #{param.trainNumber}
@ -336,4 +336,14 @@
</select> </select>
<update id="updateWaybillNoIsNullByAdvanceIds" >
update logpm_trunkline_advance_detail
set waybill_no = null,
waybill_id = null
where advance_id in
<foreach collection="advanceIds" item="advanceId" open="(" separator="," close=")">
#{advanceId}
</foreach>
</update>
</mapper> </mapper>

3
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingMapper.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.trunkline.dto.BillladingDTO; import com.logpm.trunkline.dto.BillladingDTO;
import com.logpm.trunkline.entity.TrunklineBillladingEntity; import com.logpm.trunkline.entity.TrunklineBillladingEntity;
import com.logpm.trunkline.entity.TrunklineBillladingLogEntity;
import com.logpm.trunkline.vo.TrunklineBillladingDetailListVO; import com.logpm.trunkline.vo.TrunklineBillladingDetailListVO;
import com.logpm.trunkline.vo.TrunklineBillladingDetailVO; import com.logpm.trunkline.vo.TrunklineBillladingDetailVO;
import com.logpm.trunkline.vo.TrunklineBillladingVO; import com.logpm.trunkline.vo.TrunklineBillladingVO;
@ -29,4 +30,6 @@ public interface TrunklineBillladingMapper extends BaseMapper<TrunklineBillladin
List<TrunklineBillladingDetailListVO> findAdvanceDetailList(@Param("orderCode") String orderCode); List<TrunklineBillladingDetailListVO> findAdvanceDetailList(@Param("orderCode") String orderCode);
Map<String, Integer> billladingNum(@Param("warehouseId") Long warehouseId, @Param("startByDateStr") Date startByDateStr, @Param("endByDateStr") Date endByDateStr); Map<String, Integer> billladingNum(@Param("warehouseId") Long warehouseId, @Param("startByDateStr") Date startByDateStr, @Param("endByDateStr") Date endByDateStr);
List<TrunklineBillladingLogEntity> findBillladingLogList(@Param("billladingId") Long billladingId);
} }

11
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingMapper.xml

@ -177,4 +177,15 @@
</select> </select>
<select id="findBillladingLogList" resultType="com.logpm.trunkline.entity.TrunklineBillladingLogEntity">
select warehouse_id warehouseId,
warehouse_name warehouseName,
create_user_name createUserName,
content content,
create_time createTime
from logpm_trunkline_billlading_log
where billlading_id = #{billladingId}
order by create_time asc
</select>
</mapper> </mapper>

3
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.xml

@ -202,9 +202,12 @@
ltwo.order_code, ltwo.order_code,
sum(ltwo.total_number) total_number sum(ltwo.total_number) total_number
from logpm_trunkline_waybill_order ltwo from logpm_trunkline_waybill_order ltwo
where ltwo.is_deleted = 0
group by ltwo.waybill_no, group by ltwo.waybill_no,
ltwo.order_code) m on m.order_code = t.order_code and m.waybill_no = t.waybill_number ltwo.order_code) m on m.order_code = t.order_code and m.waybill_no = t.waybill_number
where IFNULL( t.stock_num, 0 )-IFNULL( l.planNum,0) > 0 where IFNULL( t.stock_num, 0 )-IFNULL( l.planNum,0) > 0
and lww.abolish_status = 0
and lww.freeze_status = 0
<if test="param.openTimeStart != null"> <if test="param.openTimeStart != null">
and lww.create_time &gt;= #{param.openTimeStart} and lww.create_time &gt;= #{param.openTimeStart}
</if> </if>

7
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.java

@ -12,6 +12,7 @@ import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -90,7 +91,7 @@ public interface TrunklineCarsLoadScanMapper extends BaseMapper<TrunklineCarsLoa
List<LoadingListGoodsVO> findUnloadGoods(@Param("loadId") Long loadId, @Param("warehouseId") Long warehouseId, @Param("orderCode") String orderCode, @Param("waybillNo") String waybillNo); List<LoadingListGoodsVO> findUnloadGoods(@Param("loadId") Long loadId, @Param("warehouseId") Long warehouseId, @Param("orderCode") String orderCode, @Param("waybillNo") String waybillNo);
void updateScanStatus(@Param("loadScanIds") List<Long> loadScanIds, @Param("scanStatus") String scanStatus); void updateScanStatusAndTime(@Param("loadScanIds") List<Long> loadScanIds, @Param("scanStatus") String scanStatus, @Param("unloadTime") Date unloadTime);
List<LoadScanWaybillVO> findLoadScanWaybillList(@Param("loadId") Long loadId, @Param("nodeId") Long nodeId); List<LoadScanWaybillVO> findLoadScanWaybillList(@Param("loadId") Long loadId, @Param("nodeId") Long nodeId);
@ -116,7 +117,7 @@ public interface TrunklineCarsLoadScanMapper extends BaseMapper<TrunklineCarsLoa
List<String> findUnloadByLoadIdAndWarehouseId(@Param("loadId") Long loadId, @Param("warehouseId") Long warehouseId); List<String> findUnloadByLoadIdAndWarehouseId(@Param("loadId") Long loadId, @Param("warehouseId") Long warehouseId);
void updateScanStatusByLoadId(@Param("loadId") Long loadId, @Param("scanStatus") String scanStatus); void updateScanStatusByLoadId(@Param("loadId") Long loadId, @Param("scanStatus") String scanStatus, @Param("unloadTime") Date unloadTime);
List<String> findSignListOrderPackageCodes(@Param("loadId") Long loadId); List<String> findSignListOrderPackageCodes(@Param("loadId") Long loadId);
@ -147,4 +148,6 @@ public interface TrunklineCarsLoadScanMapper extends BaseMapper<TrunklineCarsLoa
List<String> findIncomingOrdeCodesByCarsLoadScanIds(@Param("carsLoadScanIds") List<Long> carsLoadScanIds, @Param("warehouseId") Long warehouseId); List<String> findIncomingOrdeCodesByCarsLoadScanIds(@Param("carsLoadScanIds") List<Long> carsLoadScanIds, @Param("warehouseId") Long warehouseId);
List<TrunklineCarsLoadScanVO> findListHasSignOrderIdByIds(@Param("carsLoadScanIds") List<Long> loadScanIds); List<TrunklineCarsLoadScanVO> findListHasSignOrderIdByIds(@Param("carsLoadScanIds") List<Long> loadScanIds);
List<Long> findCarsLoadScanIdsByWaybillIds(@Param("waybillIds") List<Long> waybillIds);
} }

71
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml

@ -83,6 +83,58 @@
select * select *
from logpm_trunkline_cars_load_scan from logpm_trunkline_cars_load_scan
where load_id = #{param.loadId} where load_id = #{param.loadId}
<if test="param.waybillNo != null and param.waybillNo != ''">
and Locate(#{param.waybillNo},waybill_no) > 0
</if>
<if test="param.orderCode != null and param.orderCode != ''">
and Locate(#{param.orderCode},order_code) > 0
</if>
<if test="param.scanCode != null and param.scanCode != ''">
and Locate(#{param.scanCode},scan_code) > 0
</if>
<if test="param.loadingUserName != null and param.loadingUserName != ''">
and Locate(#{param.loadingUserName},loading_user_name) > 0
</if>
<if test="param.warehouseName != null and param.warehouseName != ''">
and Locate(#{param.warehouseName},warehouse_name) > 0
</if>
<if test="param.finalNodeName != null and param.finalNodeName != ''">
and Locate(#{param.finalNodeName},final_node_name) > 0
</if>
<if test="param.finalNodeName != null and param.finalNodeName != ''">
and Locate(#{param.finalNodeName},final_node_name) > 0
</if>
<if test="param.scanStatus != null">
and scan_status = #{param.scanStatus}
</if>
<if test="param.trayName != null and param.trayName != ''">
and Locate(#{param.trayName},tray_name) > 0
</if>
<if test="param.trayCode != null and param.trayCode != ''">
and Locate(#{param.trayCode},tray_code) > 0
</if>
<if test="param.unloadNodeName != null and param.unloadNodeName != ''">
and Locate(#{param.unloadNodeName},unload_node_name) > 0
</if>
<if test="param.unloadUserName != null and param.unloadUserName != ''">
and Locate(#{param.unloadUserName},unload_user_name) > 0
</if>
<if test="param.type != null">
and `type` = #{param.type}
</if>
<if test="param.isData != null">
and is_data = #{param.isData}
</if>
<if test="param.loadingAbnormal != null">
and loading_abnormal = #{param.loadingAbnormal}
</if>
<if test="param.unloadAbnormal != null">
and unload_abnormal = #{param.unloadAbnormal}
</if>
<if test="param.isSupple != null">
and is_supple = #{param.isSupple}
</if>
</select> </select>
@ -400,9 +452,10 @@
ltco.unload_num ltco.unload_num
</select> </select>
<update id="updateScanStatus"> <update id="updateScanStatusAndTime">
update logpm_trunkline_cars_load_scan update logpm_trunkline_cars_load_scan
set scan_status = #{scanStatus} set scan_status = #{scanStatus},
sign_time = #{unloadTime}
where 1=1 where 1=1
<if test="loadScanIds != null and loadScanIds.size() > 0"> <if test="loadScanIds != null and loadScanIds.size() > 0">
and id in and id in
@ -513,7 +566,8 @@
<update id="updateScanStatusByLoadId" > <update id="updateScanStatusByLoadId" >
update logpm_trunkline_cars_load_scan update logpm_trunkline_cars_load_scan
set scan_status = #{scanStatus} set scan_status = #{scanStatus},
sign_time = #{unloadTime}
where load_id = #{loadId} where load_id = #{loadId}
</update> </update>
@ -714,4 +768,15 @@
</foreach> </foreach>
</select> </select>
<select id="findCarsLoadScanIdsByWaybillIds" resultType="Long">
select ltcls.id
from logpm_trunkline_cars_load_scan ltcls
where ltcls.waybill_id in
<foreach collection="waybillIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
and ltcls.scan_status = '1'
group by ltcls.id
</select>
</mapper> </mapper>

8
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.xml

@ -135,9 +135,9 @@
select ltco.order_code orderCode, select ltco.order_code orderCode,
IFNULL(ltco.plan_num,0) planNum, IFNULL(ltco.plan_num,0) planNum,
t.loadingNum, t.loadingNum,
lww.total_freight orderFreight,
lww.check_user_name checkUserName, lww.check_user_name checkUserName,
IFNULL(ltco.unload_num,0) unloadNum, IFNULL(ltco.unload_num,0) unloadNum,
IFNULL(lww.total_freight/lww.total_count*ltwo.total_number,0) orderFreight,
IFNULL(lww.total_freight/lww.total_count*t.unloadNum,0) unloadIncome, IFNULL(lww.total_freight/lww.total_count*t.unloadNum,0) unloadIncome,
m.costPiece, m.costPiece,
m.costZhang, m.costZhang,
@ -159,7 +159,7 @@
group by ltcsr.waybill_no, group by ltcsr.waybill_no,
ltcsr.order_code) m on m.waybillNo = t.waybillNo and m.orderCode = t.orderCode ltcsr.order_code) m on m.waybillNo = t.waybillNo and m.orderCode = t.orderCode
left join logpm_trunkline_cars_order ltco on ltco.waybill_no = t.waybillNo and ltco.order_code = t.orderCode left join logpm_trunkline_cars_order ltco on ltco.waybill_no = t.waybillNo and ltco.order_code = t.orderCode
left join logpm_trunkline_waybill_order ltwo on ltwo.order_code = ltco.order_code and ltwo.waybill_no = ltco.waybill_no left join logpm_trunkline_waybill_order ltwo on ltwo.order_code = ltco.order_code and ltwo.waybill_no = ltco.waybill_no and ltwo.is_deleted = 0
left join logpm_warehouse_waybill lww on lww.waybill_no = ltwo.waybill_no left join logpm_warehouse_waybill lww on lww.waybill_no = ltwo.waybill_no
where ltco.load_id = #{loadId} where ltco.load_id = #{loadId}
and ltco.waybill_no = #{waybillNo} and ltco.waybill_no = #{waybillNo}
@ -171,14 +171,14 @@
select ltco.order_code orderCode, select ltco.order_code orderCode,
ltco.plan_num planNum, ltco.plan_num planNum,
ltco.real_num loadingNum, ltco.real_num loadingNum,
lww.total_freight orderFreight,
lww.check_user_name checkUserName, lww.check_user_name checkUserName,
IFNULL(ltco.unload_num,0) unloadNum, IFNULL(ltco.unload_num,0) unloadNum,
IFNULL(lww.total_freight/lww.total_count*ltwo.total_number,0) orderFreight,
IFNULL(lww.total_freight/lww.total_count*ltco.unload_num,0) unloadIncome, IFNULL(lww.total_freight/lww.total_count*ltco.unload_num,0) unloadIncome,
IFNULL(lww.total_freight/lww.total_count*ltco.plan_num,0) orderLineCost, IFNULL(lww.total_freight/lww.total_count*ltco.plan_num,0) orderLineCost,
sum(ltwo.total_number) orderNum sum(ltwo.total_number) orderNum
from logpm_trunkline_cars_order ltco from logpm_trunkline_cars_order ltco
left join logpm_trunkline_waybill_order ltwo on ltwo.order_code = ltco.order_code and ltwo.waybill_no = ltco.waybill_no left join logpm_trunkline_waybill_order ltwo on ltwo.order_code = ltco.order_code and ltwo.waybill_no = ltco.waybill_no and ltwo.is_deleted = 0
left join logpm_warehouse_waybill lww on lww.waybill_no = ltwo.waybill_no left join logpm_warehouse_waybill lww on lww.waybill_no = ltwo.waybill_no
where ltco.load_id = #{loadId} where ltco.load_id = #{loadId}
and ltco.waybill_no = #{waybillNo} and ltco.waybill_no = #{waybillNo}

2
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineWaybillOrderMapper.java

@ -20,4 +20,6 @@ public interface TrunklineWaybillOrderMapper extends BaseMapper<TrunklineWaybill
Long findWaybillIdByAdvanceId(@Param("advanceId") Long advanceId); Long findWaybillIdByAdvanceId(@Param("advanceId") Long advanceId);
Integer findTotalNumByWaybillNoAndOrderCode(@Param("waybillId") Long waybillId, @Param("orderCode") String orderCode); Integer findTotalNumByWaybillNoAndOrderCode(@Param("waybillId") Long waybillId, @Param("orderCode") String orderCode);
List<Long> findAdvanceIdsByWaybillIds(@Param("waybillIds") List<Long> waybillIds);
} }

11
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineWaybillOrderMapper.xml

@ -36,4 +36,15 @@
and ltwo.order_code = #{orderCode} and ltwo.order_code = #{orderCode}
</select> </select>
<select id="findAdvanceIdsByWaybillIds" resultType="Long">
select ltwo.advance_id
from logpm_trunkline_waybill_order ltwo
where ltwo.waybill_id in
<foreach collection="waybillIds" item="waybillId" open="(" separator="," close=")">
#{waybillId}
</foreach>
and ltwo.is_deleted = 0
group by ltwo.advance_id
</select>
</mapper> </mapper>

3
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ICarsLoadAsyncService.java

@ -1,5 +1,6 @@
package com.logpm.trunkline.service; package com.logpm.trunkline.service;
import com.logpm.trunkline.entity.TrunklineAdvanceEntity;
import com.logpm.trunkline.entity.TrunklineCarsLoadEntity; import com.logpm.trunkline.entity.TrunklineCarsLoadEntity;
import com.logpm.trunkline.entity.TrunklineCarsLoadLineEntity; import com.logpm.trunkline.entity.TrunklineCarsLoadLineEntity;
import com.logpm.trunkline.entity.TrunklineCarsUnloadLogEntity; import com.logpm.trunkline.entity.TrunklineCarsUnloadLogEntity;
@ -23,4 +24,6 @@ public interface ICarsLoadAsyncService {
void dealwithAfterAbnormalPackage(String orderPackageCode, Long warehouseId, String warehouseName, String carsNo, Long userId, Long aLong, String nickName); void dealwithAfterAbnormalPackage(String orderPackageCode, Long warehouseId, String warehouseName, String carsNo, Long userId, Long aLong, String nickName);
void savaUnloadLogBatch(List<TrunklineCarsUnloadLogEntity> unloadLogList); void savaUnloadLogBatch(List<TrunklineCarsUnloadLogEntity> unloadLogList);
void sendRabbitMessageLoadScanData(List<TrunklineAdvanceEntity> data);
} }

5
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderService.java

@ -82,6 +82,11 @@ public interface IOpenOrderService {
R findUpdateWaybillList(OpenOrderDTO openOrderDTO); R findUpdateWaybillList(OpenOrderDTO openOrderDTO);
R freezeWaybill(List<Long> waybillIds, Long warehouseId, String warehouseName);
R unFreezeWaybill(List<Long> waybillIds, Long warehouseId, String warehouseName);
R abolishWaybill(List<Long> waybillIds, Long warehouseId, String warehouseName);
// R findWaybillInfo(String waybillNo); // R findWaybillInfo(String waybillNo);

1
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java

@ -73,4 +73,5 @@ public interface ITrunklineAdvanceDetailService extends BaseService<TrunklineAdv
R findOrderDetails(OrderDetailsDTO orderDetailsDTO); R findOrderDetails(OrderDetailsDTO orderDetailsDTO);
void updateWaybillNoIsNullByAdvanceIds(List<Long> advanceIds);
} }

3
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineBillladingService.java

@ -44,4 +44,7 @@ public interface ITrunklineBillladingService extends BaseService<TrunklineBillla
R billladingList(BillladingDTO billladingDTO); R billladingList(BillladingDTO billladingDTO);
List<TrunklineBillladingDetailListVO> findAdvanceDetailList(BillladingDTO billladingDTO); List<TrunklineBillladingDetailListVO> findAdvanceDetailList(BillladingDTO billladingDTO);
R findBillladingLogList(Long billladingId);
} }

7
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadScanService.java

@ -10,6 +10,7 @@ import com.logpm.trunkline.vo.*;
import com.logpm.warehouse.entity.WarehouseWaybillEntity; import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -85,7 +86,7 @@ public interface ITrunklineCarsLoadScanService extends BaseService<TrunklineCars
List<LoadingListGoodsVO> findUnloadGoods(Long loadId, Long warehouseId, String orderCode, String waybillNo); List<LoadingListGoodsVO> findUnloadGoods(Long loadId, Long warehouseId, String orderCode, String waybillNo);
void updateScanStatus(List<Long> loadScanIds, String scanStatus); void updateScanStatusAndTime(List<Long> loadScanIds, String scanStatus,Date unloadTime);
List<LoadScanWaybillVO> findLoadScanWaybillList(Long loadId, Long nodeId); List<LoadScanWaybillVO> findLoadScanWaybillList(Long loadId, Long nodeId);
@ -111,7 +112,7 @@ public interface ITrunklineCarsLoadScanService extends BaseService<TrunklineCars
List<String> findUnloadByLoadIdAndWarehouseId(Long loadId, Long warehouseId); List<String> findUnloadByLoadIdAndWarehouseId(Long loadId, Long warehouseId);
void updateScanStatusByLoadId(Long loadId, String scanStatus); void updateScanStatusByLoadId(Long loadId, String scanStatus, Date unloadTime);
List<String> findSignListOrderPackageCodes(Long loadId); List<String> findSignListOrderPackageCodes(Long loadId);
@ -142,4 +143,6 @@ public interface ITrunklineCarsLoadScanService extends BaseService<TrunklineCars
List<String> findIncomingOrdeCodesByCarsLoadScanIds(List<Long> carsLoadScanIds, Long warehouseId); List<String> findIncomingOrdeCodesByCarsLoadScanIds(List<Long> carsLoadScanIds, Long warehouseId);
List<TrunklineCarsLoadScanVO> findListHasSignOrderIdByIds(List<Long> loadScanIds); List<TrunklineCarsLoadScanVO> findListHasSignOrderIdByIds(List<Long> loadScanIds);
List<Long> findCarsLoadScanIdsByWaybillIds(List<Long> waybillIds);
} }

2
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineWaybillOrderService.java

@ -19,4 +19,6 @@ public interface ITrunklineWaybillOrderService extends BaseService<TrunklineWayb
Integer findTotalNumByWaybillNoAndOrderCode(Long waybillId, String orderCode); Integer findTotalNumByWaybillNoAndOrderCode(Long waybillId, String orderCode);
List<Long> findAdvanceIdsByWaybillIds(List<Long> waybillIds);
} }

31
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java

@ -1,5 +1,7 @@
package com.logpm.trunkline.service.impl; package com.logpm.trunkline.service.impl;
import cn.hutool.core.util.IdUtil;
import cn.hutool.json.JSONUtil;
import com.logpm.aftersales.entity.AftersalesAbnormalRecordEntity; import com.logpm.aftersales.entity.AftersalesAbnormalRecordEntity;
import com.logpm.aftersales.feign.IAftersalesAbnormalRecordClient; import com.logpm.aftersales.feign.IAftersalesAbnormalRecordClient;
import com.logpm.aftersales.feign.IAftersalesWorkOrderClient; import com.logpm.aftersales.feign.IAftersalesWorkOrderClient;
@ -14,11 +16,14 @@ import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import com.logpm.warehouse.feign.IWarehouseWaybillClient; import com.logpm.warehouse.feign.IWarehouseWaybillClient;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.DictBizConstant; import org.springblade.common.constant.DictBizConstant;
import org.springblade.common.constant.RabbitConstant;
import org.springblade.common.constant.TenantNum; import org.springblade.common.constant.TenantNum;
import org.springblade.common.constant.carsload.CarsLoadLogTypeConstant; import org.springblade.common.constant.carsload.CarsLoadLogTypeConstant;
import org.springblade.common.exception.CustomerException; import org.springblade.common.exception.CustomerException;
import org.springblade.common.utils.CommonUtil; import org.springblade.common.utils.CommonUtil;
import org.springblade.system.cache.DictBizCache; import org.springblade.system.cache.DictBizCache;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
@ -26,9 +31,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.Date; import java.util.*;
import java.util.List;
import java.util.Objects;
@Slf4j @Slf4j
@Service @Service
@ -55,6 +58,8 @@ public class CarsLoadAsyncServiceImpl implements ICarsLoadAsyncService {
private IAftersalesWorkOrderClient aftersalesWorkOrderClient; private IAftersalesWorkOrderClient aftersalesWorkOrderClient;
@Autowired @Autowired
private ITrunklineCarsUnloadLogService trunklineCarsUnloadLogService; private ITrunklineCarsUnloadLogService trunklineCarsUnloadLogService;
@Autowired
private RabbitTemplate rabbitTemplate;
@Async("asyncExecutor") @Async("asyncExecutor")
@Override @Override
@ -518,4 +523,24 @@ public class CarsLoadAsyncServiceImpl implements ICarsLoadAsyncService {
trunklineCarsUnloadLogService.savaUnloadLogBatch(unloadLogList); trunklineCarsUnloadLogService.savaUnloadLogBatch(unloadLogList);
} }
@Async("asyncExecutor")
@Override
public void sendRabbitMessageLoadScanData(List<TrunklineAdvanceEntity> data) {
String queue = RabbitConstant.INCOMING_TO_LOAD_QUEUE;
String exchange = RabbitConstant.INCOMING_TO_LOAD_EXCHANGE;
String routing = RabbitConstant.INCOMING_TO_LOAD_ROUTING;
String msgId = IdUtil.simpleUUID();
for (TrunklineAdvanceEntity datum : data) {
Map<String, Object> map = new HashMap<>();
map.put("messageId", CommonUtil.getUUID());
map.put("logId", msgId);
map.put("messageData", JSONUtil.toJsonStr(datum));
map.put("createTime", new Date().getTime());
map.put("flagType", "OrderStatusLog");
//将消息携带绑定键值
rabbitTemplate.convertAndSend(exchange, routing, map, new CorrelationData(msgId));
}
}
} }

16
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java

@ -136,14 +136,16 @@ public class InComingServiceImpl implements IInComingService {
Integer incomingType = inComingDTO.getIncomingType(); Integer incomingType = inComingDTO.getIncomingType();
if(incomingType == 5){ if(incomingType == 5){
String incomingCode = inComingDTO.getIncomingCode(); String incomingCode = inComingDTO.getIncomingCode();
incomingCode = incomingCode.replaceAll(",",","); if(!StringUtil.isBlank(incomingCode)){
List<String> orderCodes = new ArrayList<>(); incomingCode = incomingCode.replaceAll(",",",");
if(incomingCode.contains(",")){ List<String> orderCodes = new ArrayList<>();
orderCodes.addAll(Arrays.asList(incomingCode.split(","))); if(incomingCode.contains(",")){
}else{ orderCodes.addAll(Arrays.asList(incomingCode.split(",")));
orderCodes.add(incomingCode); }else{
orderCodes.add(incomingCode);
}
inComingDTO.setOrderCodes(orderCodes);
} }
inComingDTO.setOrderCodes(orderCodes);
} }
List<TrunklineAdvanceVO> ls = advanceService.findIncomingOrderList(inComingDTO); List<TrunklineAdvanceVO> ls = advanceService.findIncomingOrderList(inComingDTO);

299
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java

@ -1,5 +1,6 @@
package com.logpm.trunkline.service.impl; package com.logpm.trunkline.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
@ -89,6 +90,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
private final ITrunklineWaybillReturnService trunklineWaybillReturnService; private final ITrunklineWaybillReturnService trunklineWaybillReturnService;
private final IBasicdataOpenIncomingClient basicdataOpenIncomingClient; private final IBasicdataOpenIncomingClient basicdataOpenIncomingClient;
private final ITrunklineCarsLoadService carsLoadService; private final ITrunklineCarsLoadService carsLoadService;
private final ITrunklineCarsLoadScanService trunklineCarsLoadScanService;
private final IBasicdataStoreContactClient basicdataStoreContactClient; private final IBasicdataStoreContactClient basicdataStoreContactClient;
private final IAsyncService asyncService; private final IAsyncService asyncService;
@ -383,6 +385,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
waybillEntity.setTotalWeight(openOrderDTO.getTotalWeghit()); waybillEntity.setTotalWeight(openOrderDTO.getTotalWeghit());
waybillEntity.setDealerCode(openOrderDTO.getDealerCode()); waybillEntity.setDealerCode(openOrderDTO.getDealerCode());
waybillEntity.setDealerName(openOrderDTO.getDealerName()); waybillEntity.setDealerName(openOrderDTO.getDealerName());
waybillEntity.setWaybillStatus("0");
//统计当前订单的在库数 //统计当前订单的在库数
List<Long> advanceIds = openOrderDTO.getAdvanceIds(); List<Long> advanceIds = openOrderDTO.getAdvanceIds();
AdvanceDetailStockNumVO advanceDetailStockNumVO = advanceDetailService.findStockNumByAdvanceIds(advanceIds); AdvanceDetailStockNumVO advanceDetailStockNumVO = advanceDetailService.findStockNumByAdvanceIds(advanceIds);
@ -420,13 +423,15 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
waybillEntity.setReceipt(openOrderDTO.getReceipt()); waybillEntity.setReceipt(openOrderDTO.getReceipt());
waybillEntity.setRemark(openOrderDTO.getRemark()); waybillEntity.setRemark(openOrderDTO.getRemark());
waybillEntity.setWaybillType(openOrderDTO.getWaybillType()); waybillEntity.setWaybillType(openOrderDTO.getWaybillType());
waybillEntity.setAgent(AuthUtil.getUserName()); waybillEntity.setAgent(AuthUtil.getNickName());
waybillEntity.setAgentId(AuthUtil.getUserId()); waybillEntity.setAgentId(AuthUtil.getUserId());
waybillEntity.setDocumentMakingTime(CommonUtil.StringToDate(openOrderDTO.getOpenOrderDate())); waybillEntity.setDocumentMakingTime(CommonUtil.StringToDate(openOrderDTO.getOpenOrderDate()));
waybillEntity.setPickupCompleteOrNot(openOrderDTO.getPickupCompleteOrNot()); waybillEntity.setPickupCompleteOrNot(openOrderDTO.getPickupCompleteOrNot());
waybillEntity.setTrunklineCompleteOrNot(openOrderDTO.getTrunklineCompleteOrNot()); waybillEntity.setTrunklineCompleteOrNot(openOrderDTO.getTrunklineCompleteOrNot());
waybillEntity.setTrunklineVehicleType(openOrderDTO.getTrunklineVehicleType()); waybillEntity.setTrunklineVehicleType(openOrderDTO.getTrunklineVehicleType());
waybillEntity.setPickupVehicleType(openOrderDTO.getPickupVehicleType()); waybillEntity.setPickupVehicleType(openOrderDTO.getPickupVehicleType());
waybillEntity.setAbolishStatus(0);
waybillEntity.setFreezeStatus(0);
Long waybillId = warehouseWaybillClient.addEnntity(waybillEntity); Long waybillId = warehouseWaybillClient.addEnntity(waybillEntity);
if (!Objects.isNull(waybillId)) { if (!Objects.isNull(waybillId)) {
@ -567,6 +572,9 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
Boolean aBoolean = basicdataOpenIncomingClient.checkOpenIncoming(warehouseId, brandId); Boolean aBoolean = basicdataOpenIncomingClient.checkOpenIncoming(warehouseId, brandId);
if (Boolean.TRUE.equals(aBoolean)) { if (Boolean.TRUE.equals(aBoolean)) {
openOrderAsyncService.incomingPackageBatch(advanceIds, AuthUtil.getUserId(), Func.firstLong(AuthUtil.getDeptId()), AuthUtil.getTenantId(), AuthUtil.getNickName(), IncomingTypeEnum.OPEN_TO_IN.getCode(),warehouseId,warehouseName); openOrderAsyncService.incomingPackageBatch(advanceIds, AuthUtil.getUserId(), Func.firstLong(AuthUtil.getDeptId()), AuthUtil.getTenantId(), AuthUtil.getNickName(), IncomingTypeEnum.OPEN_TO_IN.getCode(),warehouseId,warehouseName);
waybillEntity.setStockCount(waybillEntity.getTotalCount());
waybillEntity.setWaybillStatus("20");
warehouseWaybillClient.updateEntity(waybillEntity);
} }
//异步存入日志 //异步存入日志
@ -700,8 +708,10 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
waybillEntity.setRemark(openOrderDTO.getRemark()); waybillEntity.setRemark(openOrderDTO.getRemark());
waybillEntity.setWaybillType(openOrderDTO.getWaybillType()); waybillEntity.setWaybillType(openOrderDTO.getWaybillType());
waybillEntity.setWaybillStatus("20"); waybillEntity.setWaybillStatus("20");
waybillEntity.setAgent(AuthUtil.getUserName()); waybillEntity.setAgent(AuthUtil.getNickName());
waybillEntity.setAgentId(AuthUtil.getUserId()); waybillEntity.setAgentId(AuthUtil.getUserId());
waybillEntity.setAbolishStatus(0);
waybillEntity.setFreezeStatus(0);
Long waybillId = warehouseWaybillClient.addEnntity(waybillEntity); Long waybillId = warehouseWaybillClient.addEnntity(waybillEntity);
waybillEntity.setId(waybillId); waybillEntity.setId(waybillId);
@ -948,7 +958,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
advanceEntity.setOrderCode(openLabelDTO.getOrderCode()); advanceEntity.setOrderCode(openLabelDTO.getOrderCode());
advanceEntity.setSiteName(openLabelDTO.getSiteName()); advanceEntity.setSiteName(openLabelDTO.getSiteName());
advanceEntity.setArea(openLabelDTO.getArea()); advanceEntity.setArea(openLabelDTO.getArea());
advanceEntity.setOrderType("Label"); // advanceEntity.setOrderType("Label");
advanceEntity.setBrand(openLabelDTO.getBrand()); advanceEntity.setBrand(openLabelDTO.getBrand());
Integer totalNumber = openLabelDTO.getTotalNumber(); Integer totalNumber = openLabelDTO.getTotalNumber();
advanceEntity.setTotalNum(totalNumber); advanceEntity.setTotalNum(totalNumber);
@ -1043,7 +1053,15 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
List<Long> advanceIds = new ArrayList<>(); List<Long> advanceIds = new ArrayList<>();
List<TrunklineAdvanceEntity> detailEntities = advanceService.findListByExistsAndOrderCodeSet(orderCodeSet); List<TrunklineAdvanceEntity> detailEntities = new ArrayList<>();
//把orderCodeSet分成每2000个元素为一组
List<Set<String>> orderCodeSets = orderCodeSet.parallelStream().collect(Collectors.groupingBy(a -> a.hashCode() % 2000)).values().stream().map(a -> new HashSet<>(a)).collect(Collectors.toList());
for (int i = 0; i < orderCodeSets.size(); i++) {
Set<String> set1 = orderCodeSets.get(i);
List<TrunklineAdvanceEntity> entities = advanceService.findListByExistsAndOrderCodeSet(orderCodeSet);
detailEntities.addAll(entities);
}
//把detailEntities转化成以orderCode和trainNumber为key的map //把detailEntities转化成以orderCode和trainNumber为key的map
detailEntities.forEach(advanceEntity -> { detailEntities.forEach(advanceEntity -> {
String orderCode = advanceEntity.getOrderCode(); String orderCode = advanceEntity.getOrderCode();
@ -1053,7 +1071,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
}); });
Map<String, List<TrunklineAdvanceEntity>> advanceMap = detailEntities.parallelStream().collect(Collectors.groupingBy(a -> a.getOrderCode() + "&" + a.getTrainNumber())); // Map<String, List<TrunklineAdvanceEntity>> advanceMap = detailEntities.parallelStream().collect(Collectors.groupingBy(a -> a.getOrderCode() + "&" + a.getTrainNumber()));
listMap.keySet().forEach(str -> { listMap.keySet().forEach(str -> {
String[] split = str.split("&"); String[] split = str.split("&");
@ -1071,12 +1089,24 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
advanceEntity.setWarehouseName(warehouseName); advanceEntity.setWarehouseName(warehouseName);
advanceEntity.setOrderCode(orderCode); advanceEntity.setOrderCode(orderCode);
advanceEntity.setArea(pacakgeDetailExcelDTO.getArea()); advanceEntity.setArea(pacakgeDetailExcelDTO.getArea());
advanceEntity.setBrand(pacakgeDetailExcelDTO.getBrand()); String brand = pacakgeDetailExcelDTO.getBrand();
advanceEntity.setBrand(brand);
advanceEntity.setTotalNum(excelDTOS.size()); advanceEntity.setTotalNum(excelDTOS.size());
String firsts = pacakgeDetailExcelDTO.getFirsts(); String firsts = pacakgeDetailExcelDTO.getFirsts();
advanceEntity.setPackName(firsts); advanceEntity.setPackName(firsts);
advanceEntity.setDealerCode(pacakgeDetailExcelDTO.getDealerCode()); advanceEntity.setDealerCode(pacakgeDetailExcelDTO.getDealerCode());
advanceEntity.setDealerName(pacakgeDetailExcelDTO.getDealerName());
String dealerName = pacakgeDetailExcelDTO.getDealerName();
if(StringUtil.isBlank(dealerName)){
if(StringUtil.equals(brand,"欧派")){
//获取orderCode数字第一次出现的前面字符串截取
int firstDigitIndex = findFirstDigitIndex(orderCode);
if(firstDigitIndex != -1){
dealerName = orderCode.substring(0,firstDigitIndex);
}
}
}
advanceEntity.setDealerName(dealerName);
advanceEntity.setConsigneePerson(pacakgeDetailExcelDTO.getConsigneePerson()); advanceEntity.setConsigneePerson(pacakgeDetailExcelDTO.getConsigneePerson());
advanceEntity.setConsigneeMobile(pacakgeDetailExcelDTO.getConsigneeMobile()); advanceEntity.setConsigneeMobile(pacakgeDetailExcelDTO.getConsigneeMobile());
advanceEntity.setConsigneeAddress(pacakgeDetailExcelDTO.getConsigneeAddress()); advanceEntity.setConsigneeAddress(pacakgeDetailExcelDTO.getConsigneeAddress());
@ -1231,6 +1261,16 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
return R.data(advanceEntityList); return R.data(advanceEntityList);
} }
public int findFirstDigitIndex(String str) {
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (Character.isDigit(c)) {
return i;
}
}
return -1; // 如果没有找到数字,返回-1
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public R<List<TrunklineAdvanceEntity>> importCustomizedOuPai(Long warehouseId, String warehouseName, MultipartFile file) throws IOException { public R<List<TrunklineAdvanceEntity>> importCustomizedOuPai(Long warehouseId, String warehouseName, MultipartFile file) throws IOException {
@ -1513,8 +1553,21 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
@Override @Override
public R findWaybillDetail(OpenOrderDTO openOrderDTO) { public R findWaybillDetail(OpenOrderDTO openOrderDTO) {
Long waybillId = openOrderDTO.getWaybillId(); Long waybillId = openOrderDTO.getWaybillId();
Integer isEdit = openOrderDTO.getIsEdit();
WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillId(waybillId); WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillId(waybillId);
if(Objects.isNull(waybillEntity)){
log.warn("#############findWaybillDetail: 运单信息不存在 waybillId={}",waybillId);
return R.fail(405,"运单信息不存在");
}
if(isEdit.equals(1)){
Integer abolishStatus = waybillEntity.getAbolishStatus();
if(abolishStatus.equals(1)){
log.warn("#############findWaybillDetail: 运单已作废 waybillId={}",waybillId);
return R.fail(405,"运单已作废");
}
}
WarehouseWaybillVO warehouseWaybillVO = new WarehouseWaybillVO(); WarehouseWaybillVO warehouseWaybillVO = new WarehouseWaybillVO();
BeanUtil.copy(waybillEntity, warehouseWaybillVO); BeanUtil.copy(waybillEntity, warehouseWaybillVO);
@ -1550,6 +1603,13 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
log.warn("#############updateWaybill: 运单信息不存在 waybillId={}", waybillId); log.warn("#############updateWaybill: 运单信息不存在 waybillId={}", waybillId);
return R.fail(405, "运单信息不存在"); return R.fail(405, "运单信息不存在");
} }
Integer abolishStatus = waybillEntity.getAbolishStatus();
if(abolishStatus.equals(1)){
log.warn("#############updateWaybill: 运单已作废 waybillId={}", waybillId);
return R.fail(405, "运单已作废");
}
String updateMsg = verifyUpdateData(openOrderDTO, waybillEntity); String updateMsg = verifyUpdateData(openOrderDTO, waybillEntity);
warehouseWaybillClient.updateEntity(waybillEntity); warehouseWaybillClient.updateEntity(waybillEntity);
@ -1569,6 +1629,13 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
log.warn("#############updateWaybill: 运单信息不存在 waybillId={}", waybillId); log.warn("#############updateWaybill: 运单信息不存在 waybillId={}", waybillId);
return R.fail(405, "运单信息不存在"); return R.fail(405, "运单信息不存在");
} }
Integer abolishStatus = waybillEntity.getAbolishStatus();
if(abolishStatus.equals(1)){
log.warn("#############updateWaybill: 运单已作废 waybillId={}", waybillId);
return R.fail(405, "运单已作废");
}
// String updateMsg = verifyData(openOrderDTO,waybillEntity); // String updateMsg = verifyData(openOrderDTO,waybillEntity);
List<EditOrderMsgVO> list = verifyData(openOrderDTO,waybillEntity); List<EditOrderMsgVO> list = verifyData(openOrderDTO,waybillEntity);
@ -1750,6 +1817,17 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
log.warn("##############checkWaybill: 运单信息不存在"); log.warn("##############checkWaybill: 运单信息不存在");
return R.fail(405, "运单信息不存在"); return R.fail(405, "运单信息不存在");
} }
Integer abolishStatus = warehouseWaybillEntity.getAbolishStatus();
if(abolishStatus.equals(1)){
log.warn("#############checkWaybill: 运单已作废 waybillId={}",waybillId);
return R.fail(405,"运单已作废");
}
Long checkUserId = warehouseWaybillEntity.getCheckUserId();
if(!Objects.isNull(checkUserId)){
log.warn("##############checkWaybill: 运单已经审核 waybillId={}",waybillId);
return R.fail(405, "运单已经审核");
}
warehouseWaybillEntity.setCheckUserId(AuthUtil.getUserId()); warehouseWaybillEntity.setCheckUserId(AuthUtil.getUserId());
warehouseWaybillEntity.setCheckUserName(AuthUtil.getNickName()); warehouseWaybillEntity.setCheckUserName(AuthUtil.getNickName());
@ -2252,6 +2330,135 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
return R.data(pageList); return R.data(pageList);
} }
@Override
public R freezeWaybill(List<Long> waybillIds, Long warehouseId, String warehouseName) {
List<WarehouseWaybillEntity> waybillEntities = warehouseWaybillClient.findListByWaybillIds(waybillIds);
waybillEntities.forEach(waybillEntity -> {
String waybillNo = waybillEntity.getWaybillNo();
Integer abolishStatus = waybillEntity.getAbolishStatus();
Integer freezeStatus = waybillEntity.getFreezeStatus();
if(abolishStatus.equals(1)){
log.warn("##############freezeWaybill: {}运单已经作废",waybillNo);
throw new CustomerException(405,waybillNo+"运单已经作废,不能冻结");
}
if(freezeStatus.equals(1)){
log.warn("##############freezeWaybill: {}运单已冻结",waybillNo);
throw new CustomerException(405,waybillNo+"运单已冻结,不能冻结");
}
waybillEntity.setFreezeStatus(1);
waybillEntity.setFreezeTime(new Date());
waybillEntity.setFreezeUserName(AuthUtil.getNickName());
});
warehouseWaybillClient.updateList(waybillEntities);
//修改所有该运单的包件状态为已冻结
distributionParcelListClient.updateFreezeStatusByWaybillIds(waybillIds);
waybillEntities.forEach(waybillEntity -> {
String createOperationRemark = "冻结运单" + waybillEntity.getWaybillNo() + ",时间:" + CommonUtil.dateToString(new Date());
openOrderAsyncService.saveLog(waybillEntity.getId(), waybillEntity.getWaybillNo(), "990", "冻结运单", createOperationRemark, AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName);
});
return R.success("修改成功");
}
@Override
public R unFreezeWaybill(List<Long> waybillIds, Long warehouseId, String warehouseName) {
List<WarehouseWaybillEntity> waybillEntities = warehouseWaybillClient.findListByWaybillIds(waybillIds);
waybillEntities.forEach(waybillEntity -> {
String waybillNo = waybillEntity.getWaybillNo();
Integer abolishStatus = waybillEntity.getAbolishStatus();
Integer freezeStatus = waybillEntity.getFreezeStatus();
if(abolishStatus.equals(1)){
log.warn("##############unFreezeWaybill: {}运单已经作废",waybillNo);
throw new CustomerException(405,waybillNo+"运单已经作废,不能解冻");
}
if(freezeStatus.equals(0)){
log.warn("##############unFreezeWaybill: {}运单未冻结",waybillNo);
throw new CustomerException(405,waybillNo+"运单未冻结,不能解冻");
}
waybillEntity.setFreezeStatus(0);
waybillEntity.setFreezeTime(null);
waybillEntity.setFreezeUserName(null);
});
warehouseWaybillClient.updateWaybillFreezeStatusByWaybillIds(waybillIds);
//修改所有该运单的包件状态为已冻结
distributionParcelListClient.updateUnFreezeStatusByWaybillIds(waybillIds);
waybillEntities.forEach(waybillEntity -> {
String createOperationRemark = "解冻运单" + waybillEntity.getWaybillNo() + ",时间:" + CommonUtil.dateToString(new Date());
openOrderAsyncService.saveLog(waybillEntity.getId(), waybillEntity.getWaybillNo(), "991", "解冻运单", createOperationRemark, AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName);
});
return R.success("修改成功");
}
@Transactional(rollbackFor = Exception.class)
@Override
public R abolishWaybill(List<Long> waybillIds, Long warehouseId, String warehouseName) {
List<WarehouseWaybillEntity> waybillList = warehouseWaybillClient.findListByWaybillIds(waybillIds);
List<WarehouseWaybillEntity> waybillEntities = warehouseWaybillClient.findListByWaybillIds(waybillIds);
waybillList.forEach(waybillEntity -> {
String waybillNo = waybillEntity.getWaybillNo();
String waybillStatus = waybillEntity.getWaybillStatus();
if(StringUtil.isBlank(waybillStatus)){
log.warn("##############abolishWaybill: {}运单为旧数据不能作废",waybillNo);
throw new CustomerException(405,waybillNo+"运单为旧数据不能作废");
}
Integer waybillStatusNum = Integer.parseInt(waybillStatus);
if(waybillStatusNum >= 30){
log.warn("##############abolishWaybill: {}运单已经进入配载不能进行作废",waybillNo);
throw new CustomerException(405,waybillNo+"运单已经进入配载不能进行作废");
}
Integer abolishStatus = waybillEntity.getAbolishStatus();
if(abolishStatus.equals(1)){
log.warn("##############abolishWaybill: {}运单已经作废",waybillNo);
throw new CustomerException(405,waybillNo+"运单已经作废,不能重复作废");
}
waybillEntity.setAbolishStatus(1);
waybillEntity.setAbolishUserName(AuthUtil.getNickName());
waybillEntity.setAbolishTime(new Date());
});
warehouseWaybillClient.updateList(waybillEntities);
//把装了车的包件取消装车
List<Long> carsLoadScanIds = trunklineCarsLoadScanService.findCarsLoadScanIdsByWaybillIds(waybillIds);
if(!CollUtil.isEmpty(carsLoadScanIds)){
//把carsLoadScanIds中的元素用,拼接起来成为一个字符串
String carsLoadScanIdsStr = CollUtil.join(carsLoadScanIds, ",");
carsLoadService.removeCarsLoadScan(carsLoadScanIdsStr,warehouseId);
}
List<Long> advanceIds = trunklineWaybillOrderService.findAdvanceIdsByWaybillIds(waybillIds);
trunklineWaybillOrderService.remove(new QueryWrapper<TrunklineWaybillOrderEntity>().in("waybill_id",waybillIds));
if(!advanceIds.isEmpty()){
List<TrunklineAdvanceEntity> advanceEntities = advanceService.findListByIds(advanceIds);
advanceEntities.forEach(advanceEntity -> {
advanceEntity.setWaybillStatus("0");
advanceEntity.setWaybillNo(null);
});
advanceService.updateBatchById(advanceEntities);
advanceDetailService.updateWaybillNoIsNullByAdvanceIds(advanceIds);
distributionParcelListClient.clearParceListWaybillByAdvanceIds(advanceIds);
}
waybillEntities.forEach(waybillEntity -> {
String createOperationRemark = "作废运单" + waybillEntity.getWaybillNo() + ",时间:" + CommonUtil.dateToString(new Date());
openOrderAsyncService.saveLog(waybillEntity.getId(), waybillEntity.getWaybillNo(), "1000", "作废运单", createOperationRemark, AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName);
});
return R.success("作废成功");
}
private List<EditOrderMsgVO> verifyData(OpenOrderDTO openOrderDTO, WarehouseWaybillEntity waybillEntity) { private List<EditOrderMsgVO> verifyData(OpenOrderDTO openOrderDTO, WarehouseWaybillEntity waybillEntity) {
log.info("###################verifyData: 验证改单数据"); log.info("###################verifyData: 验证改单数据");
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
@ -2361,7 +2568,6 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
String newShipperName = openOrderDTO.getShipperName(); String newShipperName = openOrderDTO.getShipperName();
String shipperName = waybillEntity.getShipperName(); String shipperName = waybillEntity.getShipperName();
shipperName = StringUtil.isBlank(shipperName)?"":shipperName;
if(!ObjectUtil.equals(shipperName,newShipperName)){ if(!ObjectUtil.equals(shipperName,newShipperName)){
// stringBuilder.append("发货人:").append(shipperName).append("-->").append(newShipperName).append(";"); // stringBuilder.append("发货人:").append(shipperName).append("-->").append(newShipperName).append(";");
EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO();
@ -2373,7 +2579,6 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
String newShipperMobile = openOrderDTO.getShipperMobile(); String newShipperMobile = openOrderDTO.getShipperMobile();
String shipperMobile = waybillEntity.getShipperMobile(); String shipperMobile = waybillEntity.getShipperMobile();
shipperMobile = StringUtil.isBlank(shipperMobile)?"":shipperMobile;
if(!ObjectUtil.equals(shipperMobile,newShipperMobile)){ if(!ObjectUtil.equals(shipperMobile,newShipperMobile)){
// stringBuilder.append("发货人电话:").append(shipperMobile).append("-->").append(newShipperMobile).append(";"); // stringBuilder.append("发货人电话:").append(shipperMobile).append("-->").append(newShipperMobile).append(";");
EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO();
@ -2385,11 +2590,10 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
String newShipperAddress = openOrderDTO.getShipperAddress(); String newShipperAddress = openOrderDTO.getShipperAddress();
String shipperAddress = waybillEntity.getShipperAddress(); String shipperAddress = waybillEntity.getShipperAddress();
shipperAddress = StringUtil.isBlank(shipperAddress)?"":shipperAddress;
if(!ObjectUtil.equals(shipperAddress,newShipperAddress)){ if(!ObjectUtil.equals(shipperAddress,newShipperAddress)){
// stringBuilder.append("发货人地址:").append(shipperAddress).append("-->").append(newShipperAddress).append(";"); // stringBuilder.append("发货人地址:").append(shipperAddress).append("-->").append(newShipperAddress).append(";");
EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO();
editOrderMsgVO.setItemName("发货人电话"); editOrderMsgVO.setItemName("发货人地址");
editOrderMsgVO.setOldValue(shipperAddress); editOrderMsgVO.setOldValue(shipperAddress);
editOrderMsgVO.setNewValue(newShipperAddress); editOrderMsgVO.setNewValue(newShipperAddress);
msgList.add(editOrderMsgVO); msgList.add(editOrderMsgVO);
@ -2410,7 +2614,6 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
String newConsigneeName = openOrderDTO.getConsigneeName(); String newConsigneeName = openOrderDTO.getConsigneeName();
String consigneeName = waybillEntity.getConsigneeName(); String consigneeName = waybillEntity.getConsigneeName();
consigneeName = StringUtil.isBlank(consigneeName)?"":consigneeName;
if(!ObjectUtil.equals(consigneeName,newConsigneeName)){ if(!ObjectUtil.equals(consigneeName,newConsigneeName)){
// stringBuilder.append("收货人:").append(consigneeName).append("-->").append(newConsigneeName).append(";"); // stringBuilder.append("收货人:").append(consigneeName).append("-->").append(newConsigneeName).append(";");
EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO();
@ -2422,7 +2625,6 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
String newConsigneeMobile = openOrderDTO.getConsigneeMobile(); String newConsigneeMobile = openOrderDTO.getConsigneeMobile();
String consigneeMobile = waybillEntity.getConsigneeMobile(); String consigneeMobile = waybillEntity.getConsigneeMobile();
consigneeMobile = StringUtil.isBlank(consigneeMobile)?"":consigneeMobile;
if(!ObjectUtil.equals(consigneeMobile,newConsigneeMobile)){ if(!ObjectUtil.equals(consigneeMobile,newConsigneeMobile)){
// stringBuilder.append("收货人电话:").append(consigneeMobile).append("-->").append(newConsigneeMobile).append(";"); // stringBuilder.append("收货人电话:").append(consigneeMobile).append("-->").append(newConsigneeMobile).append(";");
EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO();
@ -2434,13 +2636,12 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
String newConsigneeAddress = openOrderDTO.getConsigneeAddress(); String newConsigneeAddress = openOrderDTO.getConsigneeAddress();
String consigneeAddress = waybillEntity.getConsigneeAddress(); String consigneeAddress = waybillEntity.getConsigneeAddress();
consigneeAddress = StringUtil.isBlank(consigneeAddress)?"":consigneeAddress; if(!ObjectUtil.equals(consigneeAddress,newConsigneeAddress)){
if(!ObjectUtil.equals(shipperAddress,newShipperAddress)){ // stringBuilder.append("收货人地址:").append(consigneeAddress).append("-->").append(newConsigneeAddress).append(";");
// stringBuilder.append("发货人地址:").append(consigneeAddress).append("-->").append(newConsigneeAddress).append(";");
EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO();
editOrderMsgVO.setItemName("货人地址"); editOrderMsgVO.setItemName("货人地址");
editOrderMsgVO.setOldValue(shipperAddress); editOrderMsgVO.setOldValue(consigneeAddress);
editOrderMsgVO.setNewValue(newShipperAddress); editOrderMsgVO.setNewValue(newConsigneeAddress);
msgList.add(editOrderMsgVO); msgList.add(editOrderMsgVO);
} }
@ -2525,6 +2726,18 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
editOrderMsgVO.setNewValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_CHARGE_TYPE,newChargeType+"")); editOrderMsgVO.setNewValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_CHARGE_TYPE,newChargeType+""));
msgList.add(editOrderMsgVO); msgList.add(editOrderMsgVO);
} }
BigDecimal newSubtotalFreight = waybillDetailDTO.getSubtotalFreight();
BigDecimal subtotalFreight = warehouseWayBillDetail.getSubtotalFreight();
if(subtotalFreight.compareTo(newSubtotalFreight) != 0){
// stringBuilder.append("明细更新:").append(warehouseWayBillDetail.getProductName()).append(" 单价修改").append(price).append("-->").append(newPrice).append(";");
EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO();
editOrderMsgVO.setItemName("明细更新 "+warehouseWayBillDetail.getProductName() +" 运费小计修改 ");
editOrderMsgVO.setOldValue(subtotalFreight.toPlainString());
editOrderMsgVO.setNewValue(newSubtotalFreight.toPlainString());
msgList.add(editOrderMsgVO);
}
} }
} }
@ -2863,7 +3076,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
String newDestination = openOrderDTO.getDestination(); String newDestination = openOrderDTO.getDestination();
String destination = waybillEntity.getDestination(); String destination = waybillEntity.getDestination();
if (!destination.equals(newDestination)) { if (!ObjectUtil.equals(destination,newDestination)) {
stringBuilder.append("到站:").append(destination).append("-->").append(newDestination).append(";"); stringBuilder.append("到站:").append(destination).append("-->").append(newDestination).append(";");
waybillEntity.setDestination(newDestination); waybillEntity.setDestination(newDestination);
waybillEntity.setDestinationCode(openOrderDTO.getDestinationCode()); waybillEntity.setDestinationCode(openOrderDTO.getDestinationCode());
@ -2872,7 +3085,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
String newDestinationWarehouseName = openOrderDTO.getDestinationWarehouseName(); String newDestinationWarehouseName = openOrderDTO.getDestinationWarehouseName();
Long destinationWarehouseId = waybillEntity.getDestinationWarehouseId(); Long destinationWarehouseId = waybillEntity.getDestinationWarehouseId();
String departureWarehouseName = waybillEntity.getDepartureWarehouseName(); String departureWarehouseName = waybillEntity.getDepartureWarehouseName();
if (!destinationWarehouseId.equals(newDestinationWarehouseId)) { if (!ObjectUtil.equals(destinationWarehouseId,newDestinationWarehouseId)) {
stringBuilder.append("目的仓:").append(departureWarehouseName).append("-->").append(newDestinationWarehouseName).append(";"); stringBuilder.append("目的仓:").append(departureWarehouseName).append("-->").append(newDestinationWarehouseName).append(";");
waybillEntity.setDestinationWarehouseId(newDestinationWarehouseId); waybillEntity.setDestinationWarehouseId(newDestinationWarehouseId);
waybillEntity.setDestinationWarehouseName(newDestinationWarehouseName); waybillEntity.setDestinationWarehouseName(newDestinationWarehouseName);
@ -2881,31 +3094,28 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
String newShipper = openOrderDTO.getShipper(); String newShipper = openOrderDTO.getShipper();
Long shipperId = waybillEntity.getShipperId(); Long shipperId = waybillEntity.getShipperId();
String shipper = waybillEntity.getShipper(); String shipper = waybillEntity.getShipper();
if (!shipperId.equals(newShipperId)) { if (!ObjectUtil.equals(shipperId,newShipperId)) {
stringBuilder.append("发货单位:").append(shipper).append("-->").append(newShipper).append(";"); stringBuilder.append("发货单位:").append(shipper).append("-->").append(newShipper).append(";");
waybillEntity.setShipper(newShipper); waybillEntity.setShipper(newShipper);
waybillEntity.setShipperId(newShipperId); waybillEntity.setShipperId(newShipperId);
} }
String newShipperName = openOrderDTO.getShipperName(); String newShipperName = openOrderDTO.getShipperName();
String shipperName = waybillEntity.getShipperName(); String shipperName = waybillEntity.getShipperName();
shipperName = StringUtil.isBlank(shipperName) ? "" : shipperName; if (!ObjectUtil.equals(shipperName,newShipperName)) {
if (!shipperName.equals(newShipperName)) {
stringBuilder.append("发货人:").append(shipperName).append("-->").append(newShipperName).append(";"); stringBuilder.append("发货人:").append(shipperName).append("-->").append(newShipperName).append(";");
waybillEntity.setShipperName(newShipperName); waybillEntity.setShipperName(newShipperName);
} }
String newShipperMobile = openOrderDTO.getShipperMobile(); String newShipperMobile = openOrderDTO.getShipperMobile();
String shipperMobile = waybillEntity.getShipperMobile(); String shipperMobile = waybillEntity.getShipperMobile();
shipperMobile = StringUtil.isBlank(shipperMobile) ? "" : shipperMobile; if (!ObjectUtil.equals(shipperMobile,newShipperMobile)) {
if (!shipperMobile.equals(newShipperMobile)) {
stringBuilder.append("发货人电话:").append(shipperMobile).append("-->").append(newShipperMobile).append(";"); stringBuilder.append("发货人电话:").append(shipperMobile).append("-->").append(newShipperMobile).append(";");
waybillEntity.setShipperMobile(newShipperMobile); waybillEntity.setShipperMobile(newShipperMobile);
} }
String newShipperAddress = openOrderDTO.getShipperAddress(); String newShipperAddress = openOrderDTO.getShipperAddress();
String shipperAddress = waybillEntity.getShipperAddress(); String shipperAddress = waybillEntity.getShipperAddress();
shipperAddress = StringUtil.isBlank(shipperAddress) ? "" : shipperAddress; if (!ObjectUtil.equals(shipperAddress,newShipperAddress)) {
if (!shipperAddress.equals(newShipperAddress)) {
stringBuilder.append("发货人地址:").append(shipperAddress).append("-->").append(newShipperAddress).append(";"); stringBuilder.append("发货人地址:").append(shipperAddress).append("-->").append(newShipperAddress).append(";");
waybillEntity.setShipperAddress(newShipperAddress); waybillEntity.setShipperAddress(newShipperAddress);
} }
@ -2914,7 +3124,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
String newConsignee = openOrderDTO.getConsignee(); String newConsignee = openOrderDTO.getConsignee();
Long consigneeId = waybillEntity.getConsigneeId(); Long consigneeId = waybillEntity.getConsigneeId();
String consignee = waybillEntity.getConsignee(); String consignee = waybillEntity.getConsignee();
if (!consigneeId.equals(newConsigneeId)) { if (!ObjectUtil.equals(consigneeId,newConsigneeId)) {
stringBuilder.append("收货单位:").append(consignee).append("-->").append(newConsignee).append(";"); stringBuilder.append("收货单位:").append(consignee).append("-->").append(newConsignee).append(";");
waybillEntity.setConsignee(newConsignee); waybillEntity.setConsignee(newConsignee);
waybillEntity.setConsigneeId(newConsigneeId); waybillEntity.setConsigneeId(newConsigneeId);
@ -2922,24 +3132,21 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
String newConsigneeName = openOrderDTO.getConsigneeName(); String newConsigneeName = openOrderDTO.getConsigneeName();
String consigneeName = waybillEntity.getConsigneeName(); String consigneeName = waybillEntity.getConsigneeName();
consigneeName = StringUtil.isBlank(consigneeName) ? "" : consigneeName; if (!ObjectUtil.equals(consigneeName,newConsigneeName)) {
if (!consigneeName.equals(newConsigneeName)) {
stringBuilder.append("收货人:").append(consigneeName).append("-->").append(newConsigneeName).append(";"); stringBuilder.append("收货人:").append(consigneeName).append("-->").append(newConsigneeName).append(";");
waybillEntity.setConsigneeName(newConsigneeName); waybillEntity.setConsigneeName(newConsigneeName);
} }
String newConsigneeMobile = openOrderDTO.getConsigneeMobile(); String newConsigneeMobile = openOrderDTO.getConsigneeMobile();
String consigneeMobile = waybillEntity.getConsigneeMobile(); String consigneeMobile = waybillEntity.getConsigneeMobile();
consigneeMobile = StringUtil.isBlank(consigneeMobile) ? "" : consigneeMobile; if (!ObjectUtil.equals(consigneeMobile,newConsigneeName)) {
if (!consigneeMobile.equals(newConsigneeMobile)) {
stringBuilder.append("收货人电话:").append(consigneeMobile).append("-->").append(newConsigneeMobile).append(";"); stringBuilder.append("收货人电话:").append(consigneeMobile).append("-->").append(newConsigneeMobile).append(";");
waybillEntity.setConsigneeMobile(newConsigneeMobile); waybillEntity.setConsigneeMobile(newConsigneeMobile);
} }
String newConsigneeAddress = openOrderDTO.getConsigneeAddress(); String newConsigneeAddress = openOrderDTO.getConsigneeAddress();
String consigneeAddress = waybillEntity.getConsigneeAddress(); String consigneeAddress = waybillEntity.getConsigneeAddress();
consigneeAddress = StringUtil.isBlank(consigneeAddress) ? "" : consigneeAddress; if (!ObjectUtil.equals(consigneeAddress,newConsigneeAddress)) {
if (!shipperAddress.equals(newShipperAddress)) {
stringBuilder.append("收货人地址:").append(consigneeAddress).append("-->").append(newConsigneeAddress).append(";"); stringBuilder.append("收货人地址:").append(consigneeAddress).append("-->").append(newConsigneeAddress).append(";");
waybillEntity.setConsigneeAddress(newConsigneeAddress); waybillEntity.setConsigneeAddress(newConsigneeAddress);
} }
@ -2999,7 +3206,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
} }
Integer newNum = waybillDetailDTO.getNum(); Integer newNum = waybillDetailDTO.getNum();
Integer num = warehouseWayBillDetail.getNum(); Integer num = warehouseWayBillDetail.getNum();
if (!num.equals(newNum)) { if (!ObjectUtil.equals(num,newNum)) {
stringBuilder.append("明细更新:").append(warehouseWayBillDetail.getProductName()).append(" 数量修改").append(num).append("-->").append(newNum).append(";"); stringBuilder.append("明细更新:").append(warehouseWayBillDetail.getProductName()).append(" 数量修改").append(num).append("-->").append(newNum).append(";");
warehouseWayBillDetail.setNum(newNum); warehouseWayBillDetail.setNum(newNum);
} }
@ -3013,17 +3220,25 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
Integer newChargeType = waybillDetailDTO.getChargeType(); Integer newChargeType = waybillDetailDTO.getChargeType();
Integer chargeType = warehouseWayBillDetail.getChargeType(); Integer chargeType = warehouseWayBillDetail.getChargeType();
if (!chargeType.equals(newChargeType)) { if (!ObjectUtil.equals(chargeType,newChargeType)) {
stringBuilder.append("明细更新:").append(warehouseWayBillDetail.getProductName()).append(" 计价方式修改").append(chargeType).append("-->").append(newChargeType).append(";"); stringBuilder.append("明细更新:").append(warehouseWayBillDetail.getProductName()).append(" 计价方式修改").append(chargeType).append("-->").append(newChargeType).append(";");
warehouseWayBillDetail.setChargeType(newChargeType); warehouseWayBillDetail.setChargeType(newChargeType);
} }
BigDecimal newSubtotalFreight = waybillDetailDTO.getSubtotalFreight();
BigDecimal subtotalFreight = warehouseWayBillDetail.getSubtotalFreight();
if(subtotalFreight.compareTo(newSubtotalFreight) != 0){
stringBuilder.append("明细更新:").append(warehouseWayBillDetail.getProductName()).append(" 运费小计修改").append(subtotalFreight).append("-->").append(newSubtotalFreight).append(";");
warehouseWayBillDetail.setSubtotalFreight(newSubtotalFreight);
}
warehouseWaybillDetailClient.updateEntityById(warehouseWayBillDetail); warehouseWaybillDetailClient.updateEntityById(warehouseWayBillDetail);
} }
} }
Integer newTotalCount = openOrderDTO.getTotalCount(); Integer newTotalCount = openOrderDTO.getTotalCount();
Integer totalCount = waybillEntity.getTotalCount(); Integer totalCount = waybillEntity.getTotalCount();
if (!totalCount.equals(newTotalCount)) { if (!ObjectUtil.equals(totalCount,newTotalCount)) {
stringBuilder.append("货物总数:").append(totalCount).append("-->").append(newTotalCount).append(";"); stringBuilder.append("货物总数:").append(totalCount).append("-->").append(newTotalCount).append(";");
waybillEntity.setTotalCount(newTotalCount); waybillEntity.setTotalCount(newTotalCount);
} }
@ -3100,14 +3315,14 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
String newPayType = openOrderDTO.getPayType(); String newPayType = openOrderDTO.getPayType();
String payType = waybillEntity.getPayType(); String payType = waybillEntity.getPayType();
if (!payType.equals(newPayType)) { if (!ObjectUtil.equals(payType,newPayType)) {
stringBuilder.append("支付方式:").append(payType).append("-->").append(newPayType).append(";"); stringBuilder.append("支付方式:").append(payType).append("-->").append(newPayType).append(";");
waybillEntity.setPayType(newPayType); waybillEntity.setPayType(newPayType);
} }
String newPayWay = openOrderDTO.getPayWay(); String newPayWay = openOrderDTO.getPayWay();
String payWay = waybillEntity.getPayWay(); String payWay = waybillEntity.getPayWay();
if (!payWay.equals(newPayWay)) { if (!ObjectUtil.equals(payType,newPayType)) {
stringBuilder.append("付款方式:").append(payWay).append("-->").append(newPayWay).append(";"); stringBuilder.append("付款方式:").append(payWay).append("-->").append(newPayWay).append(";");
waybillEntity.setPayWay(newPayWay); waybillEntity.setPayWay(newPayWay);
} }
@ -3149,14 +3364,14 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
String newdeliveryWay = openOrderDTO.getDeliveryWay(); String newdeliveryWay = openOrderDTO.getDeliveryWay();
String deliveryWay = waybillEntity.getDeliveryWay(); String deliveryWay = waybillEntity.getDeliveryWay();
if (!deliveryWay.equals(newdeliveryWay)) { if (!ObjectUtil.equals(deliveryWay,newdeliveryWay)) {
stringBuilder.append("送货方式:").append(deliveryWay).append("-->").append(newdeliveryWay).append(";"); stringBuilder.append("送货方式:").append(deliveryWay).append("-->").append(newdeliveryWay).append(";");
waybillEntity.setDeliveryWay(newdeliveryWay); waybillEntity.setDeliveryWay(newdeliveryWay);
} }
String newurgency = openOrderDTO.getUrgency(); String newurgency = openOrderDTO.getUrgency();
String urgency = waybillEntity.getUrgency(); String urgency = waybillEntity.getUrgency();
if (!urgency.equals(newurgency)) { if (!ObjectUtil.equals(urgency,newurgency)) {
stringBuilder.append("紧急度:").append(urgency).append("-->").append(newurgency).append(";"); stringBuilder.append("紧急度:").append(urgency).append("-->").append(newurgency).append(";");
waybillEntity.setUrgency(newurgency); waybillEntity.setUrgency(newurgency);
} }

5
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java

@ -266,4 +266,9 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
IPage<OrderDetailInfoVO> pageList = baseMapper.findOrderDetails(page,orderDetailsDTO); IPage<OrderDetailInfoVO> pageList = baseMapper.findOrderDetails(page,orderDetailsDTO);
return R.data(pageList); return R.data(pageList);
} }
@Override
public void updateWaybillNoIsNullByAdvanceIds(List<Long> advanceIds) {
baseMapper.updateWaybillNoIsNullByAdvanceIds(advanceIds);
}
} }

11
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java

@ -555,18 +555,24 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanc
parcelList.setTenantId(tenantId); parcelList.setTenantId(tenantId);
parcelList.setIsDeleted(0); parcelList.setIsDeleted(0);
parcelList.setStatus(1); parcelList.setStatus(1);
parcelList.setIsTransfer(1);
parcelList.setWarehouse(warehouseEntity.getName()); parcelList.setWarehouse(warehouseEntity.getName());
parcelList.setWarehouseId(warehouseId); parcelList.setWarehouseId(warehouseId);
String waybillNo = advanceEntity.getWaybillNo(); String waybillNo = advanceEntity.getWaybillNo();
if(StringUtil.isNotBlank(waybillNo)){ if(StringUtil.isNotBlank(waybillNo)){
WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNo); WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNo);
if(!Objects.isNull(waybillEntity)){ if(!Objects.isNull(waybillEntity)){
Long departureWarehouseId = waybillEntity.getDepartureWarehouseId();
Long destinationWarehouseId = waybillEntity.getDestinationWarehouseId();
parcelList.setWaybillId(waybillEntity.getId()); parcelList.setWaybillId(waybillEntity.getId());
parcelList.setWaybillNumber(waybillEntity.getWaybillNo()); parcelList.setWaybillNumber(waybillEntity.getWaybillNo());
parcelList.setSendWarehouseId(waybillEntity.getDepartureWarehouseId()); parcelList.setSendWarehouseId(departureWarehouseId);
parcelList.setSendWarehouseName(waybillEntity.getDepartureWarehouseName()); parcelList.setSendWarehouseName(waybillEntity.getDepartureWarehouseName());
parcelList.setAcceptWarehouseId(waybillEntity.getDestinationWarehouseId()); parcelList.setAcceptWarehouseId(destinationWarehouseId);
parcelList.setAcceptWarehouseName(waybillEntity.getDestinationWarehouseName()); parcelList.setAcceptWarehouseName(waybillEntity.getDestinationWarehouseName());
if(departureWarehouseId.equals(destinationWarehouseId)){
parcelList.setIsTransfer(0);
}
} }
} }
parcelList.setConditions(1); parcelList.setConditions(1);
@ -578,7 +584,6 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanc
parcelList.setStockArticleId(orderId); parcelList.setStockArticleId(orderId);
parcelList.setOrderCode(orderCode); parcelList.setOrderCode(orderCode);
parcelList.setServiceNumber(advanceDetailEntity.getServiceNum()); parcelList.setServiceNumber(advanceDetailEntity.getServiceNum());
parcelList.setIsTransfer(1);
parcelList.setAdvanceId(advanceId); parcelList.setAdvanceId(advanceId);
Long materialId = advanceDetailEntity.getMaterialId(); Long materialId = advanceDetailEntity.getMaterialId();

84
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingServiceImpl.java

@ -1,5 +1,6 @@
package com.logpm.trunkline.service.impl; package com.logpm.trunkline.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -16,6 +17,7 @@ import com.logpm.warehouse.feign.IWarehouseWaybillClient;
import com.logpm.warehouse.vo.WarehouseWaybillVO; import com.logpm.warehouse.vo.WarehouseWaybillVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.DictBizConstant;
import org.springblade.common.exception.CustomerException; import org.springblade.common.exception.CustomerException;
import org.springblade.common.utils.CommonUtil; import org.springblade.common.utils.CommonUtil;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
@ -23,6 +25,7 @@ import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.cache.DictBizCache;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -159,16 +162,18 @@ public class TrunklineBillladingServiceImpl extends BaseServiceImpl<TrunklineBil
} }
String billladingCode = billladingEntity.getBillladingCode(); String billladingCode = billladingEntity.getBillladingCode();
String updateMsg = verifyBilllading(billladingEntity,billladingDTO);
TrunklineBillladingLogEntity logEntity = new TrunklineBillladingLogEntity(); TrunklineBillladingLogEntity logEntity = new TrunklineBillladingLogEntity();
logEntity.setWarehouseId(warehouseId); logEntity.setWarehouseId(warehouseId);
logEntity.setWarehouseName(warehouseName); logEntity.setWarehouseName(warehouseName);
logEntity.setCreateUserName(AuthUtil.getUserName()); logEntity.setCreateUserName(AuthUtil.getUserName());
logEntity.setContent("修改提货单 billladingCode="+billladingCode); logEntity.setContent("修改提货单 billladingCode="+billladingCode+" "+updateMsg);
logEntity.setBillladingId(billladingId); logEntity.setBillladingId(billladingId);
logEntity.setBeforeOpreation(JSON.toJSONString(billladingEntity)); logEntity.setBeforeOpreation(JSON.toJSONString(billladingEntity));
BeanUtil.copy(billladingDTO,billladingEntity); BeanUtil.copy(billladingDTO,billladingEntity);
updateById(billladingEntity); // updateById(billladingEntity);
//先删除路线节点 //先删除路线节点
billladingLineService.deleteByBillladingId(billladingId); billladingLineService.deleteByBillladingId(billladingId);
@ -195,6 +200,7 @@ public class TrunklineBillladingServiceImpl extends BaseServiceImpl<TrunklineBil
billladingEntity.setLineNameTitle(lineTitle); billladingEntity.setLineNameTitle(lineTitle);
updateById(billladingEntity); updateById(billladingEntity);
//先删除所有对应的运单 //先删除所有对应的运单
billladingWaybillService.deletedByBillladingId(billladingId); billladingWaybillService.deletedByBillladingId(billladingId);
@ -224,6 +230,71 @@ public class TrunklineBillladingServiceImpl extends BaseServiceImpl<TrunklineBil
} }
private String verifyBilllading(TrunklineBillladingEntity billladingEntity, BillladingDTO billladingDTO) {
StringBuilder stringBuilder = new StringBuilder();
String carNumber = billladingEntity.getCarNumber();
String newCarNumber = billladingDTO.getCarNumber();
if(!StringUtil.equals(carNumber,newCarNumber)){
stringBuilder.append("车牌号:").append(carNumber).append("-->").append(newCarNumber).append(";");
}
String driverName = billladingEntity.getDriverName();
String newDriverName = billladingDTO.getDriverName();
if(!StringUtil.equals(driverName,newDriverName)){
stringBuilder.append("司机:").append(driverName).append("-->").append(newDriverName).append(";");
}
String driverPhone = billladingEntity.getDriverPhone();
String newDriverPhone = billladingDTO.getDriverPhone();
if(!StringUtil.equals(driverPhone,newDriverPhone)){
stringBuilder.append("司机电话:").append(driverPhone).append("-->").append(newDriverPhone).append(";");
}
String carrierName = billladingEntity.getCarrierName();
String newCarrierName = billladingDTO.getCarrierName();
if(!StringUtil.equals(carrierName,newCarrierName)){
stringBuilder.append("承运商:").append(carrierName).append("-->").append(newCarrierName).append(";");
}
Integer planNum = billladingEntity.getPlanNum();
Integer newPlanNum = billladingDTO.getPlanNum();
if(!ObjectUtil.equals(planNum,newPlanNum)){
stringBuilder.append("预计件数:").append(planNum).append("-->").append(newPlanNum).append(";");
}
BigDecimal planWeight = billladingEntity.getPlanWeight();
BigDecimal newPlanWeight = billladingDTO.getPlanWeight();
if(!ObjectUtil.equals(planWeight,newPlanWeight)){
stringBuilder.append("预计重量:").append(planWeight).append("-->").append(newPlanWeight).append(";");
}
BigDecimal planVolume = billladingEntity.getPlanVolume();
BigDecimal newPlanVolume = billladingDTO.getPlanVolume();
if(!ObjectUtil.equals(planVolume,newPlanVolume)){
stringBuilder.append("预计重量:").append(planWeight).append("-->").append(newPlanWeight).append(";");
}
String chargeType = billladingEntity.getChargeType();
String newChargeType = billladingDTO.getChargeType();
if(!StringUtil.equals(chargeType,newChargeType)){
stringBuilder.append("计费模式:").append(DictBizCache.getValue(DictBizConstant.BILLLADING_CHARGE_TYPE,chargeType)).append("-->").append(DictBizCache.getValue(DictBizConstant.BILLLADING_CHARGE_TYPE,newChargeType)).append(";");
}
BigDecimal totalFee = billladingEntity.getTotalFee();
BigDecimal newTotalFee = billladingDTO.getTotalFee();
if(!ObjectUtil.equals(totalFee,newTotalFee)){
stringBuilder.append("提货费用:").append(totalFee.toPlainString()).append("-->").append(newTotalFee.toPlainString()).append(";");
}
String remark = billladingEntity.getRemark();
String newRemark = billladingDTO.getRemark();
if(!StringUtil.equals(remark,newRemark)){
stringBuilder.append("备注:").append(remark).append("-->").append(newRemark).append(";");
}
return stringBuilder.toString();
}
@Override @Override
public void updateBillladingStatus(Long billladingId, Integer type,Long warehouseId,String warehouseName) { public void updateBillladingStatus(Long billladingId, Integer type,Long warehouseId,String warehouseName) {
log.info("#############updateBillladingStatus: 更新提货单状态 type={}",type); log.info("#############updateBillladingStatus: 更新提货单状态 type={}",type);
@ -558,4 +629,13 @@ public class TrunklineBillladingServiceImpl extends BaseServiceImpl<TrunklineBil
return baseMapper.findAdvanceDetailList(orderCode); return baseMapper.findAdvanceDetailList(orderCode);
} }
@Override
public R findBillladingLogList(Long billladingId) {
List<TrunklineBillladingLogEntity> list = baseMapper.findBillladingLogList(billladingId);
return R.data(list);
}
} }

14
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadScanServiceImpl.java

@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -202,8 +203,8 @@ public class TrunklineCarsLoadScanServiceImpl extends BaseServiceImpl<TrunklineC
} }
@Override @Override
public void updateScanStatus(List<Long> loadScanIds, String scanStatus) { public void updateScanStatusAndTime(List<Long> loadScanIds, String scanStatus,Date unloadTime) {
baseMapper.updateScanStatus(loadScanIds,scanStatus); baseMapper.updateScanStatusAndTime(loadScanIds,scanStatus,unloadTime);
} }
@Override @Override
@ -267,8 +268,8 @@ public class TrunklineCarsLoadScanServiceImpl extends BaseServiceImpl<TrunklineC
} }
@Override @Override
public void updateScanStatusByLoadId(Long loadId, String scanStatus) { public void updateScanStatusByLoadId(Long loadId, String scanStatus, Date unloadTime) {
baseMapper.updateScanStatusByLoadId(loadId,scanStatus); baseMapper.updateScanStatusByLoadId(loadId,scanStatus,unloadTime);
} }
@Override @Override
@ -346,4 +347,9 @@ public class TrunklineCarsLoadScanServiceImpl extends BaseServiceImpl<TrunklineC
return baseMapper.findListHasSignOrderIdByIds(loadScanIds); return baseMapper.findListHasSignOrderIdByIds(loadScanIds);
} }
@Override
public List<Long> findCarsLoadScanIdsByWaybillIds(List<Long> waybillIds) {
return baseMapper.findCarsLoadScanIdsByWaybillIds(waybillIds);
}
} }

53
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java

@ -1094,6 +1094,13 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
Long nodeId = carsLoadLineEntity.getNodeId(); Long nodeId = carsLoadLineEntity.getNodeId();
String nodeName = carsLoadLineEntity.getNodeName(); String nodeName = carsLoadLineEntity.getNodeName();
List<TrunklineCarsOrderDTO> lineCarsOrderList = carsLoadLineDTO.getAddList(); List<TrunklineCarsOrderDTO> lineCarsOrderList = carsLoadLineDTO.getAddList();
//把lineCarsOrderList中的所有运单号合并成一个集合
List<String> waybillNos = lineCarsOrderList.stream().map(TrunklineCarsOrderDTO::getWaybillNo).collect(Collectors.toList());
List<WarehouseWaybillEntity> freezeOrAbolishWaybillList = warehouseWaybillClient.findFreezeOrAbolishByWaybillNos(waybillNos);
if(!CollUtil.isEmpty(freezeOrAbolishWaybillList)){
log.warn("##########saveNew: 运单有变动,请重新做计划");
throw new CustomerException(400, "运单有变动,请重新做计划");
}
for (TrunklineCarsOrderDTO carsOrderDTO : lineCarsOrderList) { for (TrunklineCarsOrderDTO carsOrderDTO : lineCarsOrderList) {
Integer planNum = carsOrderDTO.getPlanNum(); Integer planNum = carsOrderDTO.getPlanNum();
String orderCode = carsOrderDTO.getOrderCode(); String orderCode = carsOrderDTO.getOrderCode();
@ -1286,6 +1293,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
String receivingTimeStr = carsLoadDTO.getReceivingTimeStr(); String receivingTimeStr = carsLoadDTO.getReceivingTimeStr();
BigDecimal countTransportCost = carsLoadDTO.getCountTransportCost(); BigDecimal countTransportCost = carsLoadDTO.getCountTransportCost();
BigDecimal settlementValue = carsLoadDTO.getSettlementValue(); BigDecimal settlementValue = carsLoadDTO.getSettlementValue();
String driverType = carsLoadDTO.getDriverType();
String outDriverPerson = carsLoadDTO.getOutDriverPerson();
List<TrunklineCarsLoadLineDTO> addCarsLoadLineList = carsLoadDTO.getAddCarsLoadLineList(); List<TrunklineCarsLoadLineDTO> addCarsLoadLineList = carsLoadDTO.getAddCarsLoadLineList();
List<TrunklineCarsLoadLineDTO> removeCarsLoadLineList = carsLoadDTO.getRemoveCarsLoadLineList(); List<TrunklineCarsLoadLineDTO> removeCarsLoadLineList = carsLoadDTO.getRemoveCarsLoadLineList();
@ -1325,6 +1334,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadEntity.setReceivingTime(CommonUtil.StringToDate(receivingTimeStr)); carsLoadEntity.setReceivingTime(CommonUtil.StringToDate(receivingTimeStr));
carsLoadEntity.setCountTransportCost(countTransportCost); carsLoadEntity.setCountTransportCost(countTransportCost);
carsLoadEntity.setSettlementValue(settlementValue); carsLoadEntity.setSettlementValue(settlementValue);
carsLoadEntity.setDriverType(driverType);
carsLoadEntity.setOutDriverPerson(outDriverPerson);
updateById(carsLoadEntity); updateById(carsLoadEntity);
for (TrunklineCarsLoadLineDTO carsLoadLineDTO : removeCarsLoadLineList) { for (TrunklineCarsLoadLineDTO carsLoadLineDTO : removeCarsLoadLineList) {
@ -1417,6 +1428,14 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
trunklineCarsOrderService.deleteByCarsOrderId(carsOrderId); trunklineCarsOrderService.deleteByCarsOrderId(carsOrderId);
} }
//把lineCarsOrderList中的所有运单号合并成一个集合
List<String> waybillNos = addList.stream().map(TrunklineCarsOrderDTO::getWaybillNo).collect(Collectors.toList());
List<WarehouseWaybillEntity> freezeOrAbolishWaybillList = warehouseWaybillClient.findFreezeOrAbolishByWaybillNos(waybillNos);
if(!CollUtil.isEmpty(freezeOrAbolishWaybillList)){
log.warn("##########saveNew: 运单有变动,请重新做计划");
throw new CustomerException(400, "运单有变动,请重新做计划");
}
for (TrunklineCarsOrderDTO trunklineCarsOrderDTO : addList) { for (TrunklineCarsOrderDTO trunklineCarsOrderDTO : addList) {
TrunklineCarsOrderEntity trunklineCarsOrderEntity = new TrunklineCarsOrderEntity(); TrunklineCarsOrderEntity trunklineCarsOrderEntity = new TrunklineCarsOrderEntity();
BeanUtil.copy(trunklineCarsOrderDTO, trunklineCarsOrderEntity); BeanUtil.copy(trunklineCarsOrderDTO, trunklineCarsOrderEntity);
@ -1985,7 +2004,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadEntity.setLoadStatus("90"); carsLoadEntity.setLoadStatus("90");
updateById(carsLoadEntity); updateById(carsLoadEntity);
trunklineCarsLoadScanService.updateScanStatusByLoadId(loadId, "3"); trunklineCarsLoadScanService.updateScanStatusByLoadId(loadId, "3",new Date());
try { try {
List<String> orderPackageCodes = trunklineCarsLoadScanService.findSignListOrderPackageCodes(loadId); List<String> orderPackageCodes = trunklineCarsLoadScanService.findSignListOrderPackageCodes(loadId);
@ -2284,7 +2303,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
List<String> orderPackageCodes = new ArrayList<>(); List<String> orderPackageCodes = new ArrayList<>();
orderPackageCodes.add(orderPackageCode); orderPackageCodes.add(orderPackageCode);
String content = "包件在 " + warehouseName + "装车,配载计划目的仓 " + carsLoadScanEntity.getFinalNodeName() + ",数据来源仓库 " + fromWarehouseName; String content = "包件在 " + warehouseName + " "+(StringUtil.isBlank(trayName)?"扫码": "托盘("+trayName+")")+" 装车,配载计划目的仓 " + carsLoadScanEntity.getFinalNodeName() + ",数据来源仓库 " + fromWarehouseName;
packageTrackLogAsyncService.addPackageTrackLog(AuthUtil.getTenantId(), AuthUtil.getUserId(), Func.firstLong(AuthUtil.getDeptId()), AuthUtil.getNickName(), orderPackageCodes, warehouseId, warehouseName, WorkNodeEnums.INITIAL_WAREHOUSE_LOADING.getCode(), content); packageTrackLogAsyncService.addPackageTrackLog(AuthUtil.getTenantId(), AuthUtil.getUserId(), Func.firstLong(AuthUtil.getDeptId()), AuthUtil.getNickName(), orderPackageCodes, warehouseId, warehouseName, WorkNodeEnums.INITIAL_WAREHOUSE_LOADING.getCode(), content);
trunklineCarsLoadingLogService.savaLoadingLog(warehouseId, warehouseName, loadId, loadCode, waybillId, waybillNo, orderCode, orderPackageCode, 1, trunklineCarsLoadingLogService.savaLoadingLog(warehouseId, warehouseName, loadId, loadCode, waybillId, waybillNo, orderCode, orderPackageCode, 1,
@ -3174,6 +3193,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
trunklineCarsLoadScanEntity.setUnloadAbnormal(1); trunklineCarsLoadScanEntity.setUnloadAbnormal(1);
trunklineCarsLoadScanEntity.setUnloadNodeId(warehouseId); trunklineCarsLoadScanEntity.setUnloadNodeId(warehouseId);
trunklineCarsLoadScanEntity.setUnloadNum(1); trunklineCarsLoadScanEntity.setUnloadNum(1);
trunklineCarsLoadScanEntity.setUnloadTime(new Date());
trunklineCarsLoadScanEntity.setIsSupple(0); trunklineCarsLoadScanEntity.setIsSupple(0);
trunklineCarsLoadScanService.save(trunklineCarsLoadScanEntity); trunklineCarsLoadScanService.save(trunklineCarsLoadScanEntity);
Long loadScanId = trunklineCarsLoadScanEntity.getId(); Long loadScanId = trunklineCarsLoadScanEntity.getId();
@ -3223,6 +3243,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
trunklineCarsLoadScanEntity.setUnloadNodeId(warehouseId); trunklineCarsLoadScanEntity.setUnloadNodeId(warehouseId);
trunklineCarsLoadScanEntity.setUnloadNodeName(warehouseName); trunklineCarsLoadScanEntity.setUnloadNodeName(warehouseName);
trunklineCarsLoadScanEntity.setUnloadNum(1); trunklineCarsLoadScanEntity.setUnloadNum(1);
trunklineCarsLoadScanEntity.setUnloadTime(new Date());
trunklineCarsLoadScanService.save(trunklineCarsLoadScanEntity); trunklineCarsLoadScanService.save(trunklineCarsLoadScanEntity);
Long loadScanId = trunklineCarsLoadScanEntity.getId(); Long loadScanId = trunklineCarsLoadScanEntity.getId();
@ -3267,6 +3288,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadScanEntity.setUnloadNodeId(warehouseId); carsLoadScanEntity.setUnloadNodeId(warehouseId);
carsLoadScanEntity.setUnloadNodeName(warehouseName); carsLoadScanEntity.setUnloadNodeName(warehouseName);
carsLoadScanEntity.setUnloadNum(carsLoadScanEntity.getNum()); carsLoadScanEntity.setUnloadNum(carsLoadScanEntity.getNum());
carsLoadScanEntity.setUnloadTime(new Date());
carsLoadScanEntity.setScanStatus("2"); carsLoadScanEntity.setScanStatus("2");
trayCode = carsLoadScanEntity.getTrayCode(); trayCode = carsLoadScanEntity.getTrayCode();
if (!StringUtil.isBlank(trayCode)) { if (!StringUtil.isBlank(trayCode)) {
@ -3349,6 +3371,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadScanEntity.setUnloadNodeId(warehouseId); carsLoadScanEntity.setUnloadNodeId(warehouseId);
carsLoadScanEntity.setUnloadNodeName(warehouseName); carsLoadScanEntity.setUnloadNodeName(warehouseName);
carsLoadScanEntity.setUnloadAbnormal(0); carsLoadScanEntity.setUnloadAbnormal(0);
carsLoadScanEntity.setUnloadTime(new Date());
carsLoadScanEntity.setScanStatus("2"); carsLoadScanEntity.setScanStatus("2");
trunklineCarsLoadScanService.updateById(carsLoadScanEntity); trunklineCarsLoadScanService.updateById(carsLoadScanEntity);
@ -3490,6 +3513,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
e.setScanStatus("2"); e.setScanStatus("2");
e.setUnloadNodeId(warehouseId); e.setUnloadNodeId(warehouseId);
e.setUnloadNodeName(warehouseName); e.setUnloadNodeName(warehouseName);
e.setUnloadTime(date);
Long finalNodeId = e.getFinalNodeId(); Long finalNodeId = e.getFinalNodeId();
if(!finalNodeId.equals(warehouseId)){ if(!finalNodeId.equals(warehouseId)){
isAbnormal = 1; isAbnormal = 1;
@ -3963,6 +3987,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
String carsNo = carsLoadEntity.getCarsNo(); String carsNo = carsLoadEntity.getCarsNo();
Date date = new Date();
TrunklineCarsLoadScanEntity carsLoadScanEntity = trunklineCarsLoadScanService.findEntityByLoadIdAndOrderPackageCode(loadId, orderPackageCode); TrunklineCarsLoadScanEntity carsLoadScanEntity = trunklineCarsLoadScanService.findEntityByLoadIdAndOrderPackageCode(loadId, orderPackageCode);
if (Objects.isNull(carsLoadScanEntity)) { if (Objects.isNull(carsLoadScanEntity)) {
//因为没有装车记录,补装车记录 //因为没有装车记录,补装车记录
@ -3980,9 +4005,10 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadScanEntity.setLoadingAbnormal(1); carsLoadScanEntity.setLoadingAbnormal(1);
carsLoadScanEntity.setUnloadAbnormal(1); carsLoadScanEntity.setUnloadAbnormal(1);
carsLoadScanEntity.setUnloadNum(1); carsLoadScanEntity.setUnloadNum(1);
carsLoadScanEntity.setSignTime(new Date()); carsLoadScanEntity.setSignTime(date);
carsLoadScanEntity.setSignAbnormal(1); carsLoadScanEntity.setSignAbnormal(1);
carsLoadScanEntity.setSignOrderId(signOrderId); carsLoadScanEntity.setSignOrderId(signOrderId);
carsLoadScanEntity.setUnloadTime(date);
carsLoadScanEntity.setRemark("无数据签收"); carsLoadScanEntity.setRemark("无数据签收");
trunklineCarsLoadScanService.save(carsLoadScanEntity); trunklineCarsLoadScanService.save(carsLoadScanEntity);
@ -4021,9 +4047,10 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadScanEntity.setLoadingAbnormal(1); carsLoadScanEntity.setLoadingAbnormal(1);
carsLoadScanEntity.setUnloadAbnormal(1); carsLoadScanEntity.setUnloadAbnormal(1);
carsLoadScanEntity.setUnloadNum(1); carsLoadScanEntity.setUnloadNum(1);
carsLoadScanEntity.setSignTime(new Date()); carsLoadScanEntity.setSignTime(date);
carsLoadScanEntity.setSignAbnormal(1); carsLoadScanEntity.setSignAbnormal(1);
carsLoadScanEntity.setSignOrderId(signOrderId); carsLoadScanEntity.setSignOrderId(signOrderId);
carsLoadScanEntity.setUnloadTime(date);
carsLoadScanEntity.setRemark("有数据异常签收"); carsLoadScanEntity.setRemark("有数据异常签收");
trunklineCarsLoadScanService.save(carsLoadScanEntity); trunklineCarsLoadScanService.save(carsLoadScanEntity);
@ -4082,8 +4109,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
} }
carsLoadScanEntity.setScanStatus("3"); carsLoadScanEntity.setScanStatus("3");
carsLoadScanEntity.setUnloadNum(1); carsLoadScanEntity.setUnloadNum(1);
carsLoadScanEntity.setSignTime(new Date()); carsLoadScanEntity.setSignTime(date);
carsLoadScanEntity.setSignOrderId(signOrderId); carsLoadScanEntity.setSignOrderId(signOrderId);
carsLoadScanEntity.setUnloadTime(date);
trunklineCarsLoadScanService.updateById(carsLoadScanEntity); trunklineCarsLoadScanService.updateById(carsLoadScanEntity);
//生成签收记录 //生成签收记录
@ -4149,7 +4177,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
@Override @Override
public R signZeroOrder(Long signOrderId, Long carsLoadScanId, Integer enterNum, String remark) { public R signZeroOrder(Long signOrderId, Long carsLoadScanId, Integer enterNum, String remark) {
Date date = new Date();
TrunklineLoadSignOrderEntity signOrderEntity = trunklineLoadSignOrderService.getById(signOrderId); TrunklineLoadSignOrderEntity signOrderEntity = trunklineLoadSignOrderService.getById(signOrderId);
if (Objects.isNull(signOrderEntity)) { if (Objects.isNull(signOrderEntity)) {
log.warn("##############signZeroOrder: 签收单信息不存在 signOrderId={}", signOrderId); log.warn("##############signZeroOrder: 签收单信息不存在 signOrderId={}", signOrderId);
@ -4178,7 +4206,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadScanEntity.setScanStatus("3"); carsLoadScanEntity.setScanStatus("3");
carsLoadScanEntity.setUnloadNum(enterNum); carsLoadScanEntity.setUnloadNum(enterNum);
carsLoadScanEntity.setSignTime(new Date()); carsLoadScanEntity.setSignTime(date);
carsLoadScanEntity.setUnloadTime(date);
trunklineCarsLoadScanService.updateById(carsLoadScanEntity); trunklineCarsLoadScanService.updateById(carsLoadScanEntity);
//生成签收记录 //生成签收记录
@ -4253,6 +4282,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
entity.setScanStatus("3"); entity.setScanStatus("3");
entity.setUnloadNum(t.getNum()); entity.setUnloadNum(t.getNum());
entity.setSignTime(date); entity.setSignTime(date);
entity.setUnloadTime(date);
if(entity.getType().equals(1)){ if(entity.getType().equals(1)){
String scanCode = entity.getScanCode(); String scanCode = entity.getScanCode();
List<DistributionParcelListEntity> parcelList = parcelListMap.get(scanCode); List<DistributionParcelListEntity> parcelList = parcelListMap.get(scanCode);
@ -4589,7 +4619,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
} }
Date date = new Date(); Date date = new Date();
trunklineCarsLoadScanService.updateScanStatus(loadScanIds, "3"); trunklineCarsLoadScanService.updateScanStatusAndTime(loadScanIds, "3",new Date());
List<String> orderPackageCodes = trunklineCarsLoadScanService.findSignListOrderPackageCodesByIds(loadScanIds); List<String> orderPackageCodes = trunklineCarsLoadScanService.findSignListOrderPackageCodesByIds(loadScanIds);
@ -5436,6 +5466,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
trunklineCarsLoadScanEntity.setIsSupple(0); trunklineCarsLoadScanEntity.setIsSupple(0);
trunklineCarsLoadScanEntity.setLoadingUserName(AuthUtil.getNickName()); trunklineCarsLoadScanEntity.setLoadingUserName(AuthUtil.getNickName());
trunklineCarsLoadScanEntity.setUnloadUserName(AuthUtil.getNickName()); trunklineCarsLoadScanEntity.setUnloadUserName(AuthUtil.getNickName());
trunklineCarsLoadScanEntity.setUnloadTime(new Date());
trunklineCarsLoadScanService.save(trunklineCarsLoadScanEntity); trunklineCarsLoadScanService.save(trunklineCarsLoadScanEntity);
loadScanId = trunklineCarsLoadScanEntity.getId(); loadScanId = trunklineCarsLoadScanEntity.getId();
@ -5486,6 +5517,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
trunklineCarsLoadScanEntity.setUnloadNum(1); trunklineCarsLoadScanEntity.setUnloadNum(1);
trunklineCarsLoadScanEntity.setLoadingUserName(AuthUtil.getNickName()); trunklineCarsLoadScanEntity.setLoadingUserName(AuthUtil.getNickName());
trunklineCarsLoadScanEntity.setUnloadUserName(AuthUtil.getNickName()); trunklineCarsLoadScanEntity.setUnloadUserName(AuthUtil.getNickName());
trunklineCarsLoadScanEntity.setUnloadTime(new Date());
trunklineCarsLoadScanService.save(trunklineCarsLoadScanEntity); trunklineCarsLoadScanService.save(trunklineCarsLoadScanEntity);
loadScanId = trunklineCarsLoadScanEntity.getId(); loadScanId = trunklineCarsLoadScanEntity.getId();
@ -5606,6 +5638,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadScanEntity.setUnloadNodeName(warehouseName); carsLoadScanEntity.setUnloadNodeName(warehouseName);
carsLoadScanEntity.setUnloadNum(carsLoadScanEntity.getNum()); carsLoadScanEntity.setUnloadNum(carsLoadScanEntity.getNum());
carsLoadScanEntity.setScanStatus("2"); carsLoadScanEntity.setScanStatus("2");
carsLoadScanEntity.setUnloadUserName(AuthUtil.getNickName());
carsLoadScanEntity.setUnloadTime(new Date());
trayCode = carsLoadScanEntity.getTrayCode(); trayCode = carsLoadScanEntity.getTrayCode();
if (!StringUtil.isBlank(trayCode)) { if (!StringUtil.isBlank(trayCode)) {
BasicdataTrayEntity trayEntity = basicdataTrayClient.getTrayByTrayCode(trayCode); BasicdataTrayEntity trayEntity = basicdataTrayClient.getTrayByTrayCode(trayCode);
@ -5714,6 +5748,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadScanEntity.setOrderCode(orderCode1); carsLoadScanEntity.setOrderCode(orderCode1);
carsLoadScanEntity.setWaybillNo(waybillNo1); carsLoadScanEntity.setWaybillNo(waybillNo1);
carsLoadScanEntity.setUnloadUserName(AuthUtil.getNickName());
carsLoadScanEntity.setUnloadTime(new Date());
carsLoadScanEntity.setIsData(1); carsLoadScanEntity.setIsData(1);
trunklineCarsLoadScanService.updateById(carsLoadScanEntity); trunklineCarsLoadScanService.updateById(carsLoadScanEntity);
} else { } else {
@ -5846,6 +5882,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadScanEntity.setScanStatus("2"); carsLoadScanEntity.setScanStatus("2");
carsLoadScanEntity.setLoadingUserName(AuthUtil.getNickName()); carsLoadScanEntity.setLoadingUserName(AuthUtil.getNickName());
carsLoadScanEntity.setUnloadUserName(AuthUtil.getNickName()); carsLoadScanEntity.setUnloadUserName(AuthUtil.getNickName());
carsLoadScanEntity.setUnloadTime(new Date());
trunklineCarsLoadScanService.updateById(carsLoadScanEntity); trunklineCarsLoadScanService.updateById(carsLoadScanEntity);
trunklineCarsUnloadLogService.savaUnloadLog(warehouseId, warehouseName, loadId, loadCode, waybillId, waybillNo, orderCode, trunklineCarsUnloadLogService.savaUnloadLog(warehouseId, warehouseName, loadId, loadCode, waybillId, waybillNo, orderCode,

5
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillOrderServiceImpl.java

@ -39,4 +39,9 @@ public class TrunklineWaybillOrderServiceImpl extends BaseServiceImpl<TrunklineW
public Integer findTotalNumByWaybillNoAndOrderCode(Long waybillId, String orderCode) { public Integer findTotalNumByWaybillNoAndOrderCode(Long waybillId, String orderCode) {
return baseMapper.findTotalNumByWaybillNoAndOrderCode(waybillId,orderCode); return baseMapper.findTotalNumByWaybillNoAndOrderCode(waybillId,orderCode);
} }
@Override
public List<Long> findAdvanceIdsByWaybillIds(List<Long> waybillIds) {
return baseMapper.findAdvanceIdsByWaybillIds(waybillIds);
}
} }

31
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/aspect/AsyncAnnotationAspect.java

@ -47,4 +47,35 @@ public class AsyncAnnotationAspect {
} }
/**
* 该方法为一个切面用于对标记了@RabbitListener注解的方法进行增强主要增加了日志记录和数据源上下文处理的功能
*
* @param joinPoint 切面的连接点表示当前被拦截的方法
* @return 返回被拦截方法的执行结果
* @throws Throwable 如果执行过程中发生异常则抛出
*/
@Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitListener)")
public Object rabbitMethods(ProceedingJoinPoint joinPoint) throws Throwable {
// 在方法执行前,获取当前租户ID并设置到数据源上下文中
String tenantId = AuthUtil.getTenantId();
DynamicDataSourceContextHolder.push(tenantId);
// 执行原方法
Object result = joinPoint.proceed();
// 在方法执行后,从数据源上下文中移除租户ID
DynamicDataSourceContextHolder.poll();
return result;
}
@Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitHandler)")
public Object rabbitHandlerMethods(ProceedingJoinPoint joinPoint) throws Throwable {
// 在方法执行前,获取当前租户ID并设置到数据源上下文中
String tenantId = AuthUtil.getTenantId();
DynamicDataSourceContextHolder.push(tenantId);
// 执行原方法
Object result = joinPoint.proceed();
// 在方法执行后,从数据源上下文中移除租户ID
DynamicDataSourceContextHolder.poll();
return result;
}
} }

67
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/config/CustomMessageConverter.java

@ -0,0 +1,67 @@
package com.logpm.warehouse.config;
import cn.hutool.json.JSONUtil;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.ThreadLocalUtil;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.support.converter.MessageConversionException;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.http.HttpHeaders;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import java.util.Map;
/**
* @author zhaoqiaobo
* @create 2024-05-08
*/
@Component
public class CustomMessageConverter implements MessageConverter {
private String name;
@Override
public Message toMessage(Object o, MessageProperties messageProperties) throws MessageConversionException {
HttpHeaders headers = (HttpHeaders) ThreadLocalUtil.get("bladeContext");
if (headers != null && !headers.isEmpty()) {
headers.forEach((key, values) -> {
values.forEach((value) -> {
messageProperties.setHeader(key, new String[]{value});
});
});
}
BladeUser user = AuthUtil.getUser();
BladeUser bladeUser = new BladeUser();
bladeUser.setTenantId(user.getTenantId());
bladeUser.setUserId(user.getUserId());
bladeUser.setAccount(user.getAccount());
bladeUser.setRoleId(user.getRoleId());
messageProperties.setHeader("bladeUser", JSONUtil.toJsonStr(bladeUser));
return new Message(o.toString().getBytes(), messageProperties);
}
@Override
public Object fromMessage(Message message) throws MessageConversionException {
MessageProperties messageProperties = message.getMessageProperties();
Map<String, Object> headers = messageProperties.getHeaders();
ThreadLocalUtil.put("bladeContext", headers);
Object bladeUser = headers.get("bladeUser");
MockHttpServletRequest request = new MockHttpServletRequest();
BladeUser bladeUser1 = JSONUtil.toBean(bladeUser.toString(), BladeUser.class);
request.setAttribute("_BLADE_USER_REQUEST_ATTR_", bladeUser1);
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
return new String(message.getBody());
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

1
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/config/RabbitMqConfiguration.java

@ -27,6 +27,7 @@ public class RabbitMqConfiguration {
public RabbitTemplate createRabbitTemplate(ConnectionFactory connectionFactory){ public RabbitTemplate createRabbitTemplate(ConnectionFactory connectionFactory){
RabbitTemplate template = new RabbitTemplate(); RabbitTemplate template = new RabbitTemplate();
template.setConnectionFactory(connectionFactory); template.setConnectionFactory(connectionFactory);
template.setMessageConverter(new CustomMessageConverter());
template.setMandatory(true); template.setMandatory(true);
template.setConfirmCallback(new RabbitTemplate.ConfirmCallback() { template.setConfirmCallback(new RabbitTemplate.ConfirmCallback() {
@Override @Override

12
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WarehouseWaybillDTO.java

@ -20,6 +20,7 @@ import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -44,5 +45,16 @@ public class WarehouseWaybillDTO extends WarehouseWaybillEntity {
private List<String> waybillNoList; private List<String> waybillNoList;
private String documentMakingTimeStartStr;
private String documentMakingTimeEndStr;
private Date documentMakingTimeStartDate;
private Date documentMakingTimeEndDate;
private String createTimeStartStr;
private String createTimeEndStr;
private Date createTimeStartDate;
private Date createTimeEndDate;
} }

31
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseWaybillClient.java

@ -1,5 +1,7 @@
package com.logpm.warehouse.feign; package com.logpm.warehouse.feign;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.warehouse.entity.WarehouseWaybillEntity; import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import com.logpm.warehouse.service.IWarehouseWaybillService; import com.logpm.warehouse.service.IWarehouseWaybillService;
@ -73,4 +75,33 @@ public class WarehouseWaybillClient implements IWarehouseWaybillClient {
public Long findLastData(String waybillNo) { public Long findLastData(String waybillNo) {
return warehouseWaybillService.findLastData(waybillNo); return warehouseWaybillService.findLastData(waybillNo);
} }
@Override
public List<WarehouseWaybillEntity> findListByWaybillIds(List<Long> waybillIds) {
//通过waybillIds查询List<WarehouseWaybillEntity>
QueryWrapper<WarehouseWaybillEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("id", waybillIds);
return warehouseWaybillService.list(queryWrapper);
}
@Override
public void updateList(List<WarehouseWaybillEntity> waybillEntities) {
warehouseWaybillService.updateBatchById(waybillEntities);
}
@Override
public List<WarehouseWaybillEntity> findFreezeOrAbolishByWaybillNos(List<String> waybillNos) {
return warehouseWaybillService.findFreezeOrAbolishByWaybillNos(waybillNos);
}
@Override
public void updateWaybillFreezeStatusByWaybillIds(List<Long> waybillIds) {
UpdateWrapper<WarehouseWaybillEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("freeze_user_name",null)
.set("freeze_time",null)
.set("freeze_status",0)
.in("id",waybillIds);
warehouseWaybillService.update(updateWrapper);
}
} }

3
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWayBillDetailMapper.java

@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.warehouse.entity.WarehouseWayBillDetail; import com.logpm.warehouse.entity.WarehouseWayBillDetail;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper @Mapper
public interface WarehouseWayBillDetailMapper extends BaseMapper<WarehouseWayBillDetail> { public interface WarehouseWayBillDetailMapper extends BaseMapper<WarehouseWayBillDetail> {
List<WarehouseWayBillDetail> findByWaybillIds(List<Long> ids);
} }

9
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillDetailMapper.xml

@ -2,5 +2,14 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.logpm.warehouse.mapper.WarehouseWayBillDetailMapper"> <mapper namespace="com.logpm.warehouse.mapper.WarehouseWayBillDetailMapper">
<select id="findByWaybillIds" resultType="com.logpm.warehouse.entity.WarehouseWayBillDetail">
select *
from logpm_warehouse_waybill_detail
where waybill_id in
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
and is_deleted = 0
</select>
</mapper> </mapper>

2
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.java

@ -56,4 +56,6 @@ public interface WarehouseWaybillMapper extends BaseMapper<WarehouseWaybillEntit
Long findLastData(@Param("waybillNo") String waybillNo); Long findLastData(@Param("waybillNo") String waybillNo);
List<WarehouseWaybillEntity> findWaybillBillladingList(@Param("waybillNo") String waybillNo,@Param("warehouseId") Long warehouseId); List<WarehouseWaybillEntity> findWaybillBillladingList(@Param("waybillNo") String waybillNo,@Param("warehouseId") Long warehouseId);
List<WarehouseWaybillEntity> findFreezeOrAbolishByWaybillNos(@Param("waybillNos") List<String> waybillNos);
} }

94
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml

@ -155,9 +155,88 @@
<if test="param.warehouseId != null"> <if test="param.warehouseId != null">
and (departure_warehouse_id = #{param.warehouseId} or destination_warehouse_id = #{param.warehouseId}) and (departure_warehouse_id = #{param.warehouseId} or destination_warehouse_id = #{param.warehouseId})
</if> </if>
<if test="param.waybillNo != null"> <if test="param.waybillNo != null and param.waybillNo != ''">
and waybill_no = #{param.waybillNo} and Locate(#{param.waybillNo},waybill_no) > 0
</if> </if>
<if test="param.orderNo != null and param.orderNo != ''">
and Locate(#{param.orderNo},order_no) > 0
</if>
<if test="param.destinationWarehouseName != null and param.destinationWarehouseName != ''">
and Locate(#{param.destinationWarehouseName},destination_warehouse_name) > 0
</if>
<if test="param.departureWarehouseName != null and param.departureWarehouseName != ''">
and Locate(#{param.departureWarehouseName},departure_warehouse_name) > 0
</if>
<if test="param.customerTrain != null and param.customerTrain != ''">
and Locate(#{param.customerTrain},customer_train) > 0
</if>
<if test="param.brand != null and param.brand != ''">
and Locate(#{param.brand},brand) > 0
</if>
<if test="param.shipper != null and param.shipper != ''">
and Locate(#{param.shipper},shipper) > 0
</if>
<if test="param.shipperName != null and param.shipperName != ''">
and Locate(#{param.shipperName},shipper_name) > 0
</if>
<if test="param.shipperMobile != null and param.shipperMobile != ''">
and Locate(#{param.shipperMobile},shipper_mobile) > 0
</if>
<if test="param.consignee != null and param.consignee != ''">
and Locate(#{param.consignee},consignee) > 0
</if>
<if test="param.consigneeName != null and param.consigneeName != ''">
and Locate(#{param.consigneeName},consignee_name) > 0
</if>
<if test="param.consigneeMobile != null and param.consigneeMobile != ''">
and Locate(#{param.consigneeMobile},consignee_mobile) > 0
</if>
<if test="param.destination != null and param.destination != ''">
and Locate(#{param.destination},destination) > 0
</if>
<if test="param.departure != null and param.departure != ''">
and Locate(#{param.departure},departure) > 0
</if>
<if test="param.payType != null">
and pay_type = #{param.payType}
</if>
<if test="param.payWay != null">
and pay_way = #{param.payWay}
</if>
<if test="param.deliveryWay != null">
and delivery_way = #{param.deliveryWay}
</if>
<if test="param.urgency != null">
and urgency = #{param.urgency}
</if>
<if test="param.transportType != null">
and transport_type = #{param.transportType}
</if>
<if test="param.transportType != null">
and transport_type = #{param.transportType}
</if>
<if test="param.waybillStatus != null">
and waybill_status = #{param.waybillStatus}
</if>
<if test="param.pickupCompleteOrNot != null">
and pickup_complete_or_not = #{param.pickupCompleteOrNot}
</if>
<if test="param.trunklineCompleteOrNot != null">
and trunkline_complete_or_not = #{param.trunklineCompleteOrNot}
</if>
<if test="param.documentMakingTimeStartDate != null">
and document_making_time &gt;= #{param.documentMakingTimeStartDate}
</if>
<if test="param.documentMakingTimeEndDate != null">
and document_making_time &lt;= #{param.documentMakingTimeEndDate}
</if>
<if test="param.createTimeStartDate != null">
and create_time &gt;= #{param.createTimeStartDate}
</if>
<if test="param.createTimeEndDate != null">
and create_time &lt;= #{param.createTimeEndDate}
</if>
order by create_time desc order by create_time desc
</select> </select>
@ -183,4 +262,15 @@
limit 10 limit 10
</select> </select>
<select id="findFreezeOrAbolishByWaybillNos" resultType="com.logpm.warehouse.entity.WarehouseWaybillEntity">
select *
from logpm_warehouse_waybill
where 1=1
and (abolish_status = 1 or freeze_status = 1)
and waybill_no in
<foreach collection="waybillNos" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper> </mapper>

1
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWayBillDetailService.java

@ -23,4 +23,5 @@ public interface IWarehouseWayBillDetailService {
void deleteByWaybillDetailId(Long waybillDetailId); void deleteByWaybillDetailId(Long waybillDetailId);
List<WarehouseWayBillDetail> findByWaybillIds(List<Long> ids);
} }

2
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWaybillService.java

@ -67,4 +67,6 @@ public interface IWarehouseWaybillService extends BaseService<WarehouseWaybillEn
* @return * @return
*/ */
List<PrintPreviewVO> printBatch(String ids, String tempId) throws Exception; List<PrintPreviewVO> printBatch(String ids, String tempId) throws Exception;
List<WarehouseWaybillEntity> findFreezeOrAbolishByWaybillNos(List<String> waybillNos);
} }

5
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWayBillDetailServiceImpl.java

@ -69,4 +69,9 @@ public class WarehouseWayBillDetailServiceImpl implements IWarehouseWayBillDetai
public void deleteByWaybillDetailId(Long waybillDetailId) { public void deleteByWaybillDetailId(Long waybillDetailId) {
warehouseWayBillDetailMapper.deleteById(waybillDetailId); warehouseWayBillDetailMapper.deleteById(waybillDetailId);
} }
@Override
public List<WarehouseWayBillDetail> findByWaybillIds(List<Long> ids) {
return warehouseWayBillDetailMapper.findByWaybillIds(ids);
}
} }

36
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java

@ -45,6 +45,7 @@ import org.springblade.common.constant.OldSystemDataPushConfig;
import org.springblade.common.constant.TenantNum; import org.springblade.common.constant.TenantNum;
import org.springblade.common.constant.order.*; import org.springblade.common.constant.order.*;
import org.springblade.common.exception.CustomerException; import org.springblade.common.exception.CustomerException;
import org.springblade.common.utils.CommonUtil;
import org.springblade.common.utils.TemplateUtil; import org.springblade.common.utils.TemplateUtil;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
@ -669,22 +670,28 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
page.setCurrent(waybillDTO.getPageNum()); page.setCurrent(waybillDTO.getPageNum());
page.setSize(waybillDTO.getPageSize()); page.setSize(waybillDTO.getPageSize());
Long warehouseId = waybillDTO.getWarehouseId(); waybillDTO.setDocumentMakingTimeStartDate(CommonUtil.getStartByDateStr(waybillDTO.getDocumentMakingTimeStartStr()));
waybillDTO.setDocumentMakingTimeEndDate(CommonUtil.getEndByDateStr(waybillDTO.getDocumentMakingTimeEndStr()));
waybillDTO.setCreateTimeStartDate(CommonUtil.getStartByDateStr(waybillDTO.getCreateTimeStartStr()));
waybillDTO.setCreateTimeEndDate(CommonUtil.getEndByDateStr(waybillDTO.getCreateTimeEndStr()));
IPage<WarehouseWaybillVO> pageList = baseMapper.pageList(page, waybillDTO); IPage<WarehouseWaybillVO> pageList = baseMapper.pageList(page, waybillDTO);
List<WarehouseWaybillVO> records = pageList.getRecords(); List<WarehouseWaybillVO> records = pageList.getRecords();
for (WarehouseWaybillVO record : records) {
// Integer waybillType = record.getWaybillType(); if(!records.isEmpty()){
// if(waybillType.equals(2)){ //把records中的id取出作为一个集合
// String orderCode = record.getWaybillNo(); List<Long> ids = records.stream().map(WarehouseWaybillVO::getId).collect(Collectors.toList());
// DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCodeAndWarehouseId(orderCode, warehouseId); List<WarehouseWayBillDetail> wayBillDetailList = warehouseWayBillDetailService.findByWaybillIds(ids);
// record.setHandleNum(stockArticleEntity.getHandQuantity()); //把wayBillDetailList通过waibillId分组
// } Map<Long, List<WarehouseWayBillDetail>> map = wayBillDetailList.stream().collect(Collectors.groupingBy(WarehouseWayBillDetail::getWaybillId));
Long waybillId = record.getId();
List<WarehouseWayBillDetail> wayBillDetailList = warehouseWayBillDetailService.findByWaybillId(waybillId); for (WarehouseWaybillVO record : records) {
record.setDetailList(wayBillDetailList); Long waybillId = record.getId();
record.setDetailList(map.get(waybillId));
}
pageList.setRecords(records);
} }
pageList.setRecords(records);
return pageList; return pageList;
} }
@ -786,6 +793,11 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
return list; return list;
} }
@Override
public List<WarehouseWaybillEntity> findFreezeOrAbolishByWaybillNos(List<String> waybillNos) {
return baseMapper.findFreezeOrAbolishByWaybillNos(waybillNos);
}
private PrintPreviewVO buildPrintWallet(WarehouseWaybillEntity warehouseWaybillEntity, List<WarehouseWayBillDetail> warehouseWayBillDetails, BasicPrintTemplateEntity template) throws Exception { private PrintPreviewVO buildPrintWallet(WarehouseWaybillEntity warehouseWaybillEntity, List<WarehouseWayBillDetail> warehouseWayBillDetails, BasicPrintTemplateEntity template) throws Exception {
PrintPreviewVO printPreviewVO = new PrintPreviewVO(); PrintPreviewVO printPreviewVO = new PrintPreviewVO();
String html = TemplateUtil.getTemplateByUrl(template.getTemplateUrl()); String html = TemplateUtil.getTemplateByUrl(template.getTemplateUrl());

Loading…
Cancel
Save