Browse Source

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

dev
汤建军 3 days ago
parent
commit
6e4a7fe7f1
  1. 4
      blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java
  2. 15
      blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java
  3. 8
      blade-biz-common/src/main/java/org/springblade/common/constant/factorydata/FactoryDataConstants.java
  4. 24
      blade-biz-common/src/main/java/org/springblade/common/constant/order/OrderSplitStatusConstant.java
  5. 50
      blade-biz-common/src/main/java/org/springblade/common/model/TripartiteVO.java
  6. 3
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockArticleEntity.java
  7. 10
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/queryOrderVO.java
  8. 9
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/vo/OpFactoryPackageDataVO.java
  9. 1
      blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/enums/BrandEnums.java
  10. 4
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineAdvanceDetailClient.java
  11. 10
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalRecordServiceImpl.java
  12. 4
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataTrayServiceImpl.java
  13. 16
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java
  14. 42
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java
  15. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java
  16. 343
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java
  17. 23
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java
  18. 16
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/vo/DistributionSplitOrderAllTaskVO.java
  19. 11
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/vo/DistributionSplitOrderTaskVO.java
  20. 88
      blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/job/AdvanceJob.java
  21. 2
      blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/service/impl/MqWorkerServiceImpl.java
  22. 14
      blade-service/logpm-factory-data/logpm-factory-data-paterson/Dockerfile
  23. 96
      blade-service/logpm-factory-data/logpm-factory-data-paterson/pom.xml
  24. 20
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/FactoryDataPatersonApplication.java
  25. 50
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/aspect/AsyncAnnotationAspect.java
  26. 82
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/aspect/JobAnnotationAspect.java
  27. 48
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/aspect/RabbitAnnotationAspect.java
  28. 161
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/config/CustomMessageConverter.java
  29. 85
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/config/ExecutorConfig.java
  30. 40
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/config/FactoryDataPatersonConfiguration.java
  31. 39
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/config/InterceptorAdapterConfig.java
  32. 17
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/config/RabbitConfig.java
  33. 74
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/config/XxlJobConfig.java
  34. 64
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/controller/OrderController.java
  35. 88
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/entity/FactoryOrderEntity.java
  36. 63
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/entity/FactoryOrderLogEntity.java
  37. 72
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/entity/FactoryPackageEntity.java
  38. 64
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/entity/FactoryShipmentEntity.java
  39. 192
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/interceptor/FactoryAccountsInterceptor.java
  40. 60
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/launcher/FactoryDataBaseLauncherServiceImpl.java
  41. 16
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/mapper/FactoryOrderLogMapper.java
  42. 5
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/mapper/FactoryOrderLogMapper.xml
  43. 16
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/mapper/FactoryOrderMapper.java
  44. 5
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/mapper/FactoryOrderMapper.xml
  45. 16
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/mapper/FactoryPackageMapper.java
  46. 5
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/mapper/FactoryPackageMapper.xml
  47. 21
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/mapper/FactoryShipmentMapper.java
  48. 17
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/mapper/FactoryShipmentMapper.xml
  49. 52
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/mq/FactoryOrderListener.java
  50. 20
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/pros/FactoryDataPatersonProperties.java
  51. 78
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/pros/PatersonProperties.java
  52. 14
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/DeliveryNoteService.java
  53. 14
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/FactoryOrderLogService.java
  54. 14
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/FactoryOrderService.java
  55. 14
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/FactoryPackageService.java
  56. 19
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/FactoryShipmentService.java
  57. 13
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/MqWorkerService.java
  58. 181
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/impl/DeliveryNoteServiceImpl.java
  59. 22
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/impl/FactoryOrderLogServiceImpl.java
  60. 22
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/impl/FactoryOrderServiceImpl.java
  61. 22
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/impl/FactoryPackageServiceImpl.java
  62. 137
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/impl/FactoryShipmentServiceImpl.java
  63. 139
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/impl/MqWorkerServiceImpl.java
  64. 30
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/vo/FactoryAuthVO.java
  65. 27
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/vo/FactoryOrderDataVO.java
  66. 25
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/vo/FactoryOrderVO.java
  67. 21
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/vo/FactoryPackageVO.java
  68. 25
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/vo/FactoryShipmentVO.java
  69. 26
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/vo/PackageCategoryVO.java
  70. 32
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/vo/ThirdPlWarehouseMappingVO.java
  71. 38
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/wrapper/CustomHttpServletRequestWrapper.java
  72. 75
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/wrapper/RequestWrapper.java
  73. 73
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/resources/application-dev.yml
  74. 47
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/resources/application-prod.yml
  75. 73
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/resources/application-test.yml
  76. 31
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/resources/application.yml
  77. 40
      blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/resources/logback.xml
  78. 49
      blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/job/SpiderDataJob.java
  79. 1
      blade-service/logpm-factory-data/pom.xml
  80. 3
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryPackageMapper.xml
  81. 2
      blade-service/logpm-report/src/main/java/com/logpm/report/config/MybatisPlusConfig.java
  82. 12
      blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportIncomingMapper.xml
  83. 26
      blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportTimeMapper.xml
  84. 5
      blade-service/logpm-report/src/main/java/com/logpm/report/mapper/TrunklinePickupMapper.xml
  85. 2
      blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportDeliverServiceImpl.java
  86. 7
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/CarsLoadController.java
  87. 7
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/feign/TrunklineAdvanceDetailClient.java
  88. 1
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java
  89. 11
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml
  90. 1
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.xml
  91. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.java
  92. 1
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml
  93. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java
  94. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadScanService.java
  95. 19
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java
  96. 52
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java
  97. 5
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java
  98. 48
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java
  99. 4
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadScanServiceImpl.java
  100. 283
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java
  101. Some files were not shown because too many files have changed in this diff Show More

4
blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java

@ -106,6 +106,10 @@ public interface ModuleNameConstant {
* 索菲亚工厂数据模块
*/
String LOGPM_FACTORY_DATA_SUOFEIYA_NAME = "logpm-factory-data-suofeiya" + DEVAUTH;
/**
* 百得胜工厂数据模块
*/
String LOGPM_FACTORY_DATA_PATERSON_NAME = "logpm-factory-data-paterson" + DEVAUTH;
/**
* 我乐工厂数据模块
*/

15
blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java

@ -142,6 +142,21 @@ public abstract class FanoutConstants {
}
/**
* 备货节点
*
* @see org.springblade.common.model.StockUpVO
**/
interface tripartite {
String EXCHANGE = "fanout.trunkline.tripartite" + ModuleNameConstant.DEVAUTH;
interface QUEUE {
String SIGN = "fanout.trunkline.tripartite.sign" + ModuleNameConstant.DEVAUTH;
}
}
}

8
blade-biz-common/src/main/java/org/springblade/common/constant/factorydata/FactoryDataConstants.java

@ -95,6 +95,10 @@ public abstract class FactoryDataConstants {
String JP_NODE_DATA_PUSH = "factory.data.queue.jp.nodeDataPush" + DEVAUTH;
String JP_FACTORY_ORDER = "factory.data.queue.jp.factoryOrder" + DEVAUTH;
String JP_FACTORY_SHIPMENT = "factory.data.queue.jp.factoryShipment" + DEVAUTH;
/**
* 百得胜工厂订单
*/
String BDS_FACTORY_SHIPMENT = "factory.data.queue.bds.factoryShipment" + DEVAUTH;
/**
* 皮阿诺作业节点数据推送
*/
@ -149,6 +153,10 @@ public abstract class FactoryDataConstants {
String JP_NODE_DATA_PUSH = "jp.nodeDataPush" + DEVAUTH;
String JP_FACTORY_ORDER = "jp.factoryOrder" + DEVAUTH;
String JP_FACTORY_SHIPMENT = "jp.factoryShipment" + DEVAUTH;
/**
* 百得胜工厂订单
*/
String BDS_FACTORY_SHIPMENT = "bds.factoryShipment" + DEVAUTH;
/**
* 皮阿诺作业节点数据推送
*/

24
blade-biz-common/src/main/java/org/springblade/common/constant/order/OrderSplitStatusConstant.java

@ -0,0 +1,24 @@
package org.springblade.common.constant.order;
import lombok.Getter;
/**
* 订单拆单状态
* 状态0=1=进行中
*/
@Getter
public enum OrderSplitStatusConstant {
No("无",0),
InProgress("进行中",1);
private final String name;
private final Integer value;
OrderSplitStatusConstant(String name, Integer value) {
this.name = name;
this.value = value;
}
}

50
blade-biz-common/src/main/java/org/springblade/common/model/TripartiteVO.java

@ -0,0 +1,50 @@
package org.springblade.common.model;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@Data
public class TripartiteVO implements Serializable {
/** 发车批次号 */
private String carsNo ;
/** 司机id */
private Long driverId ;
/** 司机名称 */
private String driverName ;
/** 司机电话 */
private String driverMobile ;
/** 副驾id */
private Long assistantId ;
/** 副驾i名称 */
private String assistantName ;
/** 副驾i电话 */
private String assistantMobile ;
/** 车辆id */
private Long carId ;
/** 送货方式:1=自提,2=送货 */
private String deliveryType ;
/** 客户类型:1=商场,2=C端客户[多选] */
private String customerType ;
/** 承运商id */
private Long carrierId ;
/** 承运商名称 */
private String carrierName ;
/** 承运单号 */
private String carrierOrderCode ;
/** 承运时间 */
private Date carrierTime ;
/** 车牌号 */
private String carNumber ;
private List<PackageData> packageDataList;
}

3
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockArticleEntity.java

@ -454,6 +454,9 @@ public class DistributionStockArticleEntity extends TenantEntity {
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "拆单状态")
private Integer splitStatus;
/**
/* * 未入库数量
*//*

10
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/queryOrderVO.java

@ -1,9 +1,8 @@
package com.logpm.distribution.vo.app;
import com.alibaba.fastjson.JSONObject;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.vo.DistributionParcelListVO;
import com.logpm.distribution.vo.DistributionStockListInfoVO;
import com.logpm.distribution.vo.DistributionStockListVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -42,4 +41,11 @@ public class queryOrderVO extends DistributionStockArticleEntity {
private Integer inventoryNum;
/**
* 未入库包件列表
*/
@ApiModelProperty(value = "未入库包件列表")
private List<JSONObject> noIncomingList;
}

9
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/vo/OpFactoryPackageDataVO.java

@ -41,6 +41,15 @@ public class OpFactoryPackageDataVO implements Serializable {
*/
private String pushStatus;
/**
* 业务员模式
*
* 经销商
*
* 干仓配 不进行数据回传
*/
private String businessModel;

1
blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/enums/BrandEnums.java

@ -24,6 +24,7 @@ public enum BrandEnums implements Serializable {
OLO(8, "我乐"),
MHJ(9, "曼好家"),
LINSY(10, "林氏家居"),
BDS(11, "百得胜"),
;
private final Integer code;

4
blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineAdvanceDetailClient.java

@ -1,7 +1,6 @@
package com.logpm.trunkline.feign;
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity;
import com.logpm.trunkline.vo.TrunklineAdvanceDetailVO;
import org.springblade.common.constant.ModuleNameConstant;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
@ -48,4 +47,7 @@ public interface ITrunklineAdvanceDetailClient {
@PostMapping(API_PREFIX + "/maintainMaterial")
R maintainMaterial(@RequestBody Map<String,Object> map);
@GetMapping(API_PREFIX+"/findListByStockArticleId")
List<TrunklineAdvanceDetailEntity> findListByStockArticleId(@RequestParam Long stockArticleId, @RequestParam Long warehouseId);
}

10
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalRecordServiceImpl.java

@ -339,6 +339,16 @@ public class AftersalesAbnormalRecordServiceImpl extends BaseServiceImpl<Aftersa
currentStockArticleEntity.setIncomingNum(enterNum);
Long orderId = stockArticleClient.addData(currentStockArticleEntity);
if(!Objects.isNull(orderId)){
if(orderId.equals(0L)){
log.warn("################dealAbnormal: 订单信息保存失败 orderCode={} warehouseId={}",orderCode,warehouseId);
throw new CustomerException(405,"订单信息保存失败");
}
if(orderId.equals(1L)){
log.warn("################dealAbnormal: 订单信息正在更新 orderCode={} warehouseId={}",orderCode,warehouseId);
throw new CustomerException(405,"订单信息正在更新,请稍后重试");
}
List<TrunklineScanZeroDetailEntity> updateScanZeroDetailEntityList = new ArrayList<>();
List<DistributionParcelNumberEntity> addParcelNumberEntityList = new ArrayList<>();
List<AftersalesAbnormalRecordZeroDetailEntity> updateRecordZeroDetailList = new ArrayList<>();

4
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataTrayServiceImpl.java

@ -173,7 +173,7 @@ public class BasicdataTrayServiceImpl extends BaseServiceImpl<BasicdataTrayMappe
//获取所有的操作人ID
List<Long> operateUserIds = records.stream().map(BasicdataStockArticleVO::getOperateUser).collect(Collectors.toList());
List<User> listR = new ArrayList<>();
if (CollUtil.isEmpty(operateUserIds)) {
if (CollUtil.isNotEmpty(operateUserIds)) {
R<List<User>> temp = userClient.userInfoByIds(AuthUtil.getTenantId(), CollUtil.join(operateUserIds, StrUtil.COMMA));
if (temp.isSuccess() && temp.getData() != null) {
listR.addAll(temp.getData());
@ -185,9 +185,7 @@ public class BasicdataTrayServiceImpl extends BaseServiceImpl<BasicdataTrayMappe
record.setOperateUserName(datum.getRealName());
}
}
}
return data;
}

16
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java

@ -6,6 +6,8 @@ import com.logpm.distribution.dto.splitOrder.*;
import com.logpm.distribution.entity.DistributionSplitOrderAllTaskEntity;
import com.logpm.distribution.entity.DistributionSplitOrderTaskEntity;
import com.logpm.distribution.service.IDistributionSplitOrderTaskService;
import com.logpm.distribution.vo.DistributionSplitOrderAllTaskVO;
import com.logpm.distribution.vo.DistributionSplitOrderTaskVO;
import com.logpm.distribution.vo.SplitPackageOrderVO;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
@ -30,7 +32,7 @@ public class DistributionSplitOrderTaskController {
}
@GetMapping("/all-task-list")
public R<IPage<DistributionSplitOrderAllTaskEntity>> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO) {
public R<IPage<DistributionSplitOrderAllTaskVO>> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO) {
return distributionSplitOrderTaskService.allTaskList(query, distributionSplitAllTaskSearchDTO);
}
@ -96,7 +98,7 @@ public class DistributionSplitOrderTaskController {
}
@GetMapping("/task-list")
public R<IPage<DistributionSplitOrderTaskEntity>> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO) {
public R<IPage<DistributionSplitOrderTaskVO>> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO) {
return distributionSplitOrderTaskService.taskList(query, distributionSplitTaskSearchDTO);
}
@ -115,6 +117,11 @@ public class DistributionSplitOrderTaskController {
return distributionSplitOrderTaskService.checkOrderCode(orderCode);
}
@GetMapping("/check-order-code-by-stock-article-id")
public R<String> checkOrderCode(Long stockArticleId) {
return distributionSplitOrderTaskService.checkOrderCode(stockArticleId);
}
@GetMapping("/get-package-code-by-order-code")
public R<IPage<SplitPackageOrderVO>> getPackageCodeByOrderCode(Query query, String orderCode) {
return distributionSplitOrderTaskService.getPackageCodeByOrderCode(query, orderCode);
@ -124,4 +131,9 @@ public class DistributionSplitOrderTaskController {
public R<List<SplitPackageOrderVO>> getPackageCodeByTaskId(Long taskId) {
return distributionSplitOrderTaskService.getPackageCodeByTaskId( taskId);
}
@GetMapping("/get-allow-split-order-number")
public R<Long> getAllowSplitOrderNumber(Long stockArticleId){
return R.data(distributionSplitOrderTaskService.getSplitOrderAllowCount(stockArticleId));
}
}

42
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java

@ -38,6 +38,7 @@ import org.springblade.common.exception.CustomerException;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.redis.cache.BladeRedis;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
@ -59,8 +60,9 @@ public class DistributionStockArticleClient implements IDistributionStockArticle
private final IDistributionStockArticleService distributionStockArticleService;
private final IDistributionParcelListService distributionParcelListService;
private final BladeRedis bladeRedis;
@Override
@Override
@GetMapping(TOP)
public BladePage<DistributionStockArticleEntity> top(Integer current, Integer size) {
Query query = new Query();
@ -73,12 +75,42 @@ public class DistributionStockArticleClient implements IDistributionStockArticle
@Override
@PostMapping(API_PREFIX + "/addData")
public Long addData(DistributionStockArticleEntity distributionStockArticleEntity) {
boolean saveFlag = distributionStockArticleService.save(distributionStockArticleEntity);
if(saveFlag){
return distributionStockArticleEntity.getId();
}else{
String orderCode = distributionStockArticleEntity.getOrderCode();
Long warehouseId = distributionStockArticleEntity.getWarehouseId();
String key = orderCode + warehouseId;
try{
Boolean exists = bladeRedis.exists(key);
if(exists){
String idStr = bladeRedis.get(key);
if("1".equals(idStr)){
return 1L;
}else{
return Long.valueOf(idStr);
}
}else{
bladeRedis.setEx(key,"1",30L);
DistributionStockArticleEntity distributionStockArticle = distributionStockArticleService.findStockArticleByOrderCodeAndWarehouseId(orderCode, warehouseId);
if(ObjectUtils.isNotEmpty(distributionStockArticle)){
bladeRedis.setEx(key,distributionStockArticle.getId().toString(),30L);
return distributionStockArticle.getId();
}else{
boolean saveFlag = distributionStockArticleService.save(distributionStockArticleEntity);
if(saveFlag){
bladeRedis.setEx(key,distributionStockArticleEntity.getId().toString(),30L);
return distributionStockArticleEntity.getId();
}else{
return 0L;
}
}
}
}catch (Exception e){
log.error("#######addData: 保存订单失败",e);
return 0L;
}
}
@Override

10
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java

@ -6,6 +6,8 @@ import com.logpm.distribution.dto.splitOrder.DistributionSplitAllTaskSearchDTO;
import com.logpm.distribution.dto.splitOrder.DistributionSplitTaskSearchDTO;
import com.logpm.distribution.entity.DistributionSplitOrderAllTaskEntity;
import com.logpm.distribution.entity.DistributionSplitOrderTaskEntity;
import com.logpm.distribution.vo.DistributionSplitOrderAllTaskVO;
import com.logpm.distribution.vo.DistributionSplitOrderTaskVO;
import com.logpm.distribution.vo.SplitPackageOrderVO;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
@ -24,7 +26,7 @@ public interface IDistributionSplitOrderTaskService extends BaseService<Distribu
* @param distributionSplitTaskSearchDTO
* @return
*/
R<IPage<DistributionSplitOrderTaskEntity>> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO);
R<IPage<DistributionSplitOrderTaskVO>> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO);
/**
* 拆单总任务
@ -32,7 +34,7 @@ public interface IDistributionSplitOrderTaskService extends BaseService<Distribu
* @param distributionSplitAllTaskSearchDTO
* @return
*/
R<IPage<DistributionSplitOrderAllTaskEntity>> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO);
R<IPage<DistributionSplitOrderAllTaskVO>> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO);
/**
* 创建任务
@ -115,6 +117,10 @@ public interface IDistributionSplitOrderTaskService extends BaseService<Distribu
R<String> checkOrderCode(String orderCode);
R<String> checkOrderCode(Long stockArticleId);
long getSplitOrderAllowCount(Long stockArticleId);
R<List<SplitPackageOrderVO>> getPackageCodeByTaskId(Long taskId);
R<IPage<SplitPackageOrderVO>> getPackageCodeByOrderCode(Query query, String orderCode);

343
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java

@ -1,11 +1,13 @@
package com.logpm.distribution.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.SerializationUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.logpm.distribution.bean.Resp;
import com.logpm.distribution.dto.splitOrder.DistributionSplitAllTaskSearchDTO;
import com.logpm.distribution.dto.splitOrder.DistributionSplitTaskSearchDTO;
import com.logpm.distribution.entity.DistributionParcelListEntity;
@ -21,13 +23,12 @@ import com.logpm.distribution.service.IDistributionSplitOrderDetailService;
import com.logpm.distribution.service.IDistributionSplitOrderLogService;
import com.logpm.distribution.service.IDistributionSplitOrderTaskService;
import com.logpm.distribution.service.IDistributionStockArticleService;
import com.logpm.distribution.vo.DistributionSplitOrderAllTaskVO;
import com.logpm.distribution.vo.DistributionSplitOrderTaskVO;
import com.logpm.distribution.vo.SplitPackageOrderVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.order.OrderReservationStatusConstant;
import org.springblade.common.constant.order.OrderSplitAllTaskStateConstant;
import org.springblade.common.constant.order.OrderSplitStateConstant;
import org.springblade.common.constant.order.OrderStatusConstant;
import org.springblade.common.constant.order.*;
import org.springblade.common.constant.orderpackage.*;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.mp.base.BaseServiceImpl;
@ -37,15 +38,15 @@ import org.springblade.core.redis.lock.LockType;
import org.springblade.core.redis.lock.RedisLockClient;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.system.entity.User;
import org.springblade.system.feign.IUserClient;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Service
@AllArgsConstructor
@ -58,10 +59,11 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
private final IDistributionSplitOrderDetailService distributionSplitOrderDetailService;
private final IDistributionSplitOrderLogService distributionSplitOrderLogService;
private final RedisLockClient redisLockClient;
private final IUserClient iUserClient;
@Override
public R<IPage<DistributionSplitOrderTaskEntity>> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO) {
public R<IPage<DistributionSplitOrderTaskVO>> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO) {
LambdaQueryWrapper<DistributionSplitOrderTaskEntity> queryWrapper = Wrappers.lambdaQuery();
if (distributionSplitTaskSearchDTO.getSplitOrderAllTaskId() != null) {
queryWrapper.eq(DistributionSplitOrderTaskEntity::getSplitOrderAllTaskId, distributionSplitTaskSearchDTO.getSplitOrderAllTaskId());
@ -83,10 +85,31 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
}
IPage<DistributionSplitOrderTaskEntity> page = Condition.getPage(query);
List<DistributionSplitOrderTaskEntity> list = list(page, queryWrapper);
page.setRecords(list);
IPage<DistributionSplitOrderTaskVO> pageRes = Condition.getPage(query);
List<DistributionSplitOrderTaskEntity> list = list(page, queryWrapper);
List<DistributionSplitOrderTaskVO> listVo = new ArrayList<>();
if (list != null && !list.isEmpty()) {
Map<Long, String> userIdNameMap = getUserIdNameMap(list.stream().map(DistributionSplitOrderTaskEntity::getCreateUser).collect(Collectors.toList()));
listVo = list.stream().map(item -> {
DistributionSplitOrderTaskVO distributionSplitOrderTaskVO = new DistributionSplitOrderTaskVO();
BeanUtil.copyProperties(item, distributionSplitOrderTaskVO);
distributionSplitOrderTaskVO.setCreateUserName(userIdNameMap.get(item.getCreateUser()));
return distributionSplitOrderTaskVO;
}).collect(Collectors.toList());
}
return R.data(page);
pageRes.setRecords(listVo);
pageRes.setPages(page.getPages());
pageRes.setTotal(page.getTotal());
return R.data(pageRes);
}
private Map<Long, String> getUserIdNameMap(List<Long> list) {
String createUserIds = list.stream().map((d) -> d + "").collect(Collectors.joining(","));
List<User> users = iUserClient.userInfoByIds(AuthUtil.getTenantId(), createUserIds).getData();
return users.stream().collect(Collectors.toMap(User::getId, User::getName));
}
@Transactional
@ -107,28 +130,41 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
if (distributionStockArticle == null) {
return R.fail("原订单信息错误");
}
if (!Objects.equals(distributionStockArticle.getOrderStatus(), OrderStatusConstant.ruku.getValue())
if (distributionStockArticle.getOrderStatus().equals(OrderStatusConstant.chuku.getValue())
|| distributionStockArticle.getOrderStatus().equals(OrderStatusConstant.qianshou.getValue())
|| Objects.equals(distributionStockArticle.getReservationStatus(), OrderReservationStatusConstant.yiyueyue.getValue())) {
return R.fail("订单"+ distributionStockArticle.getOrderCode() +"不允许拆单");
}
long packageAllowCount = distributionParcelListService.count(
Wrappers.<DistributionParcelListEntity>lambdaQuery()
.in(DistributionParcelListEntity::getStockArticleId, stockArticleId)
.ne(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiqianshou.getValue())
.eq(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue())
.eq(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.weizhuancghe.getValue())
.eq(DistributionParcelListEntity::getOrderPackageFreezeStatus, OrderPackageFreezeStatusConstant.weidongjie.getValue())
.eq(DistributionParcelListEntity::getIsTransfer, 0)
);
long packageAllCount = distributionParcelListService.count(
Wrappers.<DistributionParcelListEntity>lambdaQuery()
.in(DistributionParcelListEntity::getStockArticleId, stockArticleId)
);
long packageAllowCount = getSplitOrderAllowCount(stockArticleId);
long packageAllCount = getSplitOrderAllCount(stockArticleId);
if (packageAllowCount == 0 || packageAllCount == 1) {
return R.fail("订单"+ distributionStockArticle.getOrderCode() +"包件数量不足,不允许拆单");
}
boolean exists = exists(
Wrappers.<DistributionSplitOrderTaskEntity>lambdaQuery()
.eq(DistributionSplitOrderTaskEntity::getStockArticleId, stockArticleId)
.eq(DistributionSplitOrderTaskEntity::getState, OrderSplitStateConstant.InProgress.getValue())
);
if (exists) {
return R.fail("订单"+ distributionStockArticle.getOrderCode() +"正在拆单中,不允许重复拆单");
}
int taskNumber = distributionSplitOrderTaskList
.stream()
.map(DistributionSplitOrderTaskEntity::getTaskNumber)
.mapToInt(Integer::intValue)
.sum();
long tipNumber = packageAllCount > packageAllowCount ? packageAllowCount : packageAllowCount - 1;
if (packageAllowCount < taskNumber) {
return R.fail("拆单包件数量不足,请重新填写,目前可拆单数量:" + tipNumber);
}
if (packageAllCount <= taskNumber) {
return R.fail("拆单数需要小于订单总数量,请重新填写,目前可拆单数量:" + tipNumber);
}
taskLock(stockArticleId, () -> {
String allTaskNo = getAllTaskNo();
DistributionSplitOrderAllTaskEntity allTask = new DistributionSplitOrderAllTaskEntity();
@ -138,10 +174,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
allTask.setNumber(distributionSplitOrderTaskList.size());
allTask.setState(OrderSplitStateConstant.InProgress.getValue());
allTask.setMallName(distributionStockArticle.getMallName());
int taskNumber = distributionSplitOrderTaskList.stream()
.map(DistributionSplitOrderTaskEntity::getTaskNumber)
.mapToInt(Integer::intValue)
.sum();
allTask.setOrderPackageNumber(taskNumber);
distributionSplitOrderAllTaskService.save(allTask);
@ -156,6 +189,9 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
save(distributionSplitOrderTaskEntity);
distributionSplitOrderLogService.record(distributionSplitOrderTaskEntity, "创建拆单任务", AuthUtil.getUser().getUserName());
}
distributionStockArticle.setSplitStatus(OrderSplitStatusConstant.InProgress.getValue());
distributionStockArticleService.save(distributionStockArticle);
});
} catch (Exception e) {
@ -254,12 +290,12 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
return R.fail("提交包件包含不属于当前拆单订单的包件");
}
int addNumber = packageCodes.size();
try {
List<DistributionSplitOrderDetailEntity> existsList = distributionSplitOrderDetailService.list(Wrappers.<DistributionSplitOrderDetailEntity>lambdaQuery()
.in(DistributionSplitOrderDetailEntity::getOrderPackageCode, packageCodes)
);
int addNumber = packageCodes.size();
if (!existsList.isEmpty()) {
if (existsList.stream().anyMatch(detail -> !detail.getSplitOrderTaskId().equals(taskId) && detail.getState().equals(OrderPackageSplitStateConstant.finish.getValue()))) {
return R.fail("提交包件包含其他拆单任务的包件");
@ -318,7 +354,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
log.error("添加包件系统错误", e);
throw new CustomerException("系统错误");
}
return R.success("success");
return Resp.scanSuccess("操作成功", addNumber == 0 ? "重复扫描" : task.getNumber() + "件");
}
@Deprecated
@ -530,66 +566,25 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
if (task == null) {
return R.fail("任务不存在");
}
if (!task.getState().equals(OrderSplitStateConstant.InProgress.getValue())) {
return R.fail("拆单任务不在进行中,无法撤销");
}
DistributionSplitOrderAllTaskEntity allTask = distributionSplitOrderAllTaskService.getById(task.getSplitOrderAllTaskId());
if (allTask == null) {
return R.fail("总任务不存在");
}
DistributionStockArticleEntity oldStockArticle = distributionStockArticleService.getById(task.getStockArticleId());
DistributionStockArticleEntity newStockArticle = distributionStockArticleService.getById(task.getNewStockArticleId());
if (oldStockArticle == null) {
oldStockArticle = distributionStockArticleService.getOne(Wrappers.<DistributionStockArticleEntity>lambdaQuery()
.eq(DistributionStockArticleEntity::getId, task.getStockArticleId())
.eq(DistributionStockArticleEntity::getIsDeleted, 1)
);
if (oldStockArticle == null) {
return R.fail("订单错误,无法删除");
}
oldStockArticle.setIsDeleted(0);
}
List<DistributionParcelListEntity> packageList = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>lambdaQuery()
.eq(DistributionParcelListEntity::getStockArticleId, task.getNewStockArticleId()));
if (packageList.stream().anyMatch(distributionParcelListEntity -> OrderPackageReservationStatusConstant.yiyueyue.getValue().equals(distributionParcelListEntity.getOrderPackageReservationStatus()))) {
return R.fail("新的订单包件已预约,无法删除");
long count = count(
Wrappers.<DistributionSplitOrderTaskEntity>lambdaQuery()
.eq(DistributionSplitOrderTaskEntity::getSplitOrderAllTaskId, task.getSplitOrderAllTaskId())
.in(DistributionSplitOrderTaskEntity::getState, Arrays.asList(OrderSplitStateConstant.InProgress.getValue(), OrderSplitStateConstant.finish.getValue()))
);
if (count == 1) {
return R.fail("总任务下只有一条任务,无法撤销");
}
try {
distributionParcelListService.update(Wrappers.<DistributionParcelListEntity>lambdaUpdate()
.eq(DistributionParcelListEntity::getStockArticleId, task.getNewStockArticleId())
.set(DistributionParcelListEntity::getStockArticleId, task.getStockArticleId())
.set(DistributionParcelListEntity::getOrderCode, task.getOrderCode())
);
if (newStockArticle != null) {
newStockArticle.setTotalNumber(0);
newStockArticle.setHandQuantity(0);
distributionStockArticleService.updateById(newStockArticle);
oldStockArticle.setTotalNumber(oldStockArticle.getTotalNumber() + newStockArticle.getTotalNumber());
oldStockArticle.setHandQuantity(oldStockArticle.getHandQuantity() + newStockArticle.getHandQuantity());
}
distributionStockArticleService.updateById(oldStockArticle);
distributionSplitOrderDetailService.update(Wrappers.<DistributionSplitOrderDetailEntity>lambdaUpdate()
.eq(DistributionSplitOrderDetailEntity::getSplitOrderTaskId, taskId)
.set(DistributionSplitOrderDetailEntity::getState, OrderPackageSplitStateConstant.cancel.getValue())
.set(DistributionSplitOrderDetailEntity::getCancelUser, AuthUtil.getUser().getUserId())
.set(DistributionSplitOrderDetailEntity::getCancelUsername, AuthUtil.getUser().getUserName())
);
distributionSplitOrderLogService.record(task, "取消拆单任务", AuthUtil.getUser().getUserName());
allTask.setNumber(allTask.getNumber() - 1);
allTask.setOrderPackageNumber(allTask.getOrderPackageNumber() - task.getTaskNumber());
distributionSplitOrderAllTaskService.updateById(allTask);
task.setIsDeleted(1);
task.setNumber(0);
updateById(task);
cancelTask(task);
return R.success("success");
} catch (Exception e) {
log.error("取消拆单任务系统错误", e);
@ -604,6 +599,9 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
if (task == null) {
return R.fail("拆单任务不存在");
}
if (!task.getState().equals(OrderSplitStateConstant.InProgress.getValue())) {
return R.fail("拆单任务不在进行中,无法取消");
}
long count = distributionSplitOrderDetailService.count(Wrappers.<DistributionSplitOrderDetailEntity>lambdaQuery()
.in(DistributionSplitOrderDetailEntity::getOrderPackageCode, packageCodes)
@ -618,11 +616,6 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
msg += "等" + packageCodes.size() + "个包件";
}
if (task.getNumber() == packageCodes.size()) {
distributionSplitOrderLogService.record(task, String.format("取消包件:%s", msg), AuthUtil.getUser().getUserName());
return deleteTask(taskId);
}
try{
distributionSplitOrderDetailService.update(Wrappers.<DistributionSplitOrderDetailEntity>lambdaUpdate()
@ -699,6 +692,10 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
newOrder.setTotalNumber(packageList.size());
newOrder.setHandQuantity(packageList.size());
newOrder.setIncomingNum(packageList.size());
newOrder.setCustomerAddress(task.getCustomerAddress());
newOrder.setCustomerName(task.getCustomerName());
newOrder.setCustomerTelephone(task.getCustomerTelephone());
if (newOrder.getId() != null) {
distributionStockArticleService.updateById(newOrder);
}else{
@ -723,10 +720,11 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
* @param taskId
* @return
*/
@Transactional
@Override
public R<String> cancelTask(Long taskId) {
DistributionSplitOrderTaskEntity task = getById(taskId);
if (!task.getState().equals(OrderSplitStateConstant.InProgress.getValue())) {
if (!task.getState().equals(OrderSplitStateConstant.finish.getValue())) {
return R.fail("任务未已完成,无法操作");
}
DistributionSplitOrderAllTaskEntity allTask = distributionSplitOrderAllTaskService.getById(task.getSplitOrderAllTaskId());
@ -735,28 +733,44 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
}
try {
task.setState(OrderSplitStateConstant.cancel.getValue());
task.setState(OrderSplitStateConstant.InProgress.getValue());
updateById(task);
distributionSplitOrderLogService.record(task, "撤消拆单任务", AuthUtil.getUser().getUserName());
} catch (Exception e) {
if (e instanceof CustomerException) {
throw new CustomerException(e.getMessage());
}
log.error("撤消拆单任务系统错误", e);
log.error("拆单任务取消完成系统错误", e);
throw new CustomerException("系统错误");
}
return R.success("操作成功");
}
/**
* 撤销任务
*/
public void cancelTask(DistributionSplitOrderTaskEntity task){
task.setState(OrderSplitStateConstant.cancel.getValue());
updateById(task);
distributionSplitOrderDetailService.update(
Wrappers.<DistributionSplitOrderDetailEntity>lambdaUpdate()
.eq(DistributionSplitOrderDetailEntity::getSplitOrderTaskId, task.getId())
.set(DistributionSplitOrderDetailEntity::getState, OrderPackageSplitStateConstant.cancel.getValue())
.set(DistributionSplitOrderDetailEntity::getCancelUser, AuthUtil.getUser().getUserId())
.set(DistributionSplitOrderDetailEntity::getCancelUsername, AuthUtil.getUser().getUserName())
);
distributionSplitOrderLogService.record(task, "撤消拆单任务", AuthUtil.getUser().getUserName());
}
@Transactional
@Override
public R<String> cancelAllTask(Long allTaskId) {
DistributionSplitOrderAllTaskEntity allTask = distributionSplitOrderAllTaskService.getById(allTaskId);
if (!allTask.getState().equals(OrderSplitAllTaskStateConstant.finish.getValue())) {
return R.fail("拆单总任务已完成,无法操作");
return R.fail("拆单总任务完成,无法操作");
}
if (!list(Wrappers.<DistributionSplitOrderTaskEntity>lambdaQuery()
@ -766,8 +780,25 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
return R.fail("拆单总任务中存在已完成拆单任务,无法操作");
}
List<DistributionSplitOrderTaskEntity> list = list(
Wrappers.<DistributionSplitOrderTaskEntity>lambdaQuery()
.eq(DistributionSplitOrderTaskEntity::getSplitOrderAllTaskId, allTaskId)
);
long finishCount = list.stream().filter(task -> task.getState().equals(OrderSplitStateConstant.finish.getValue())).count();
if (finishCount > 0) {
return R.fail("拆单任务中存在已完成拆单任务,无法操作");
}
allTask.setState(OrderSplitAllTaskStateConstant.cancel.getValue());
distributionSplitOrderAllTaskService.updateById(allTask);
list.forEach(this::cancelTask);
distributionStockArticleService.update(
Wrappers.<DistributionStockArticleEntity>lambdaUpdate()
.eq(DistributionStockArticleEntity::getId, allTask.getStockArticleId())
.set(DistributionStockArticleEntity::getSplitStatus, OrderSplitStatusConstant.No.getValue())
);
return R.success("success");
}
@ -780,11 +811,11 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
return R.fail("拆单总任务已完成或已取消,无法操作");
}
DistributionSplitOrderTaskEntity existsInProgress = getOne(Wrappers.<DistributionSplitOrderTaskEntity>lambdaQuery()
boolean existsInProgress = exists(Wrappers.<DistributionSplitOrderTaskEntity>lambdaQuery()
.eq(DistributionSplitOrderTaskEntity::getSplitOrderAllTaskId, allTaskId)
.eq(DistributionSplitOrderTaskEntity::getState, OrderSplitStateConstant.InProgress.getValue())
);
if (existsInProgress != null) {
if (existsInProgress) {
return R.fail("拆单总任务中存在未完成拆单任务,无法操作");
}
@ -799,6 +830,12 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
.eq(DistributionSplitOrderTaskEntity::getState, OrderSplitStateConstant.finish.getValue())
).forEach(this::packageTransfer);
distributionStockArticleService.update(
Wrappers.<DistributionStockArticleEntity>lambdaUpdate()
.eq(DistributionStockArticleEntity::getId, allTask.getStockArticleId())
.set(DistributionStockArticleEntity::getSplitStatus, OrderSplitStatusConstant.No.getValue())
);
return R.success("success");
}
@ -836,8 +873,9 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
}
@Override
public R<IPage<DistributionSplitOrderAllTaskEntity>> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO) {
public R<IPage<DistributionSplitOrderAllTaskVO>> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO) {
IPage<DistributionSplitOrderAllTaskEntity> page = Condition.getPage(query);
IPage<DistributionSplitOrderAllTaskVO> pageResult = Condition.getPage(query);
LambdaQueryWrapper<DistributionSplitOrderAllTaskEntity> queryWrapper = Wrappers.lambdaQuery();
@ -878,18 +916,49 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
}
if (splitOrderAllTaskId == 0) {
return R.data(page);
return R.data(pageResult);
}
queryWrapper.eq(DistributionSplitOrderAllTaskEntity::getId, splitOrderAllTaskId);
}
List<DistributionSplitOrderAllTaskEntity> list = distributionSplitOrderAllTaskService.list(page, queryWrapper);
page.setRecords(list);
List<DistributionSplitOrderAllTaskVO> listVo = new ArrayList<>();
if (list != null && !list.isEmpty()) {
Map<Long, String> userMap = getUserIdNameMap(list.stream().map(DistributionSplitOrderAllTaskEntity::getCreateUser).collect(Collectors.toList()));
Map<Long, Long> allTaskIdPackageNumber = getAllTaskIdPackageNumber(list.stream().map(DistributionSplitOrderAllTaskEntity::getId).collect(Collectors.toList()));
listVo = list.stream().map(d -> {
DistributionSplitOrderAllTaskVO vo = new DistributionSplitOrderAllTaskVO();
BeanUtil.copyProperties(d, vo);
vo.setCreateUserName(userMap.get(d.getCreateUser()));
vo.setSplitPackageNumber(allTaskIdPackageNumber.get(d.getId()));
return vo;
}).collect(Collectors.toList());
}
pageResult.setRecords(listVo);
pageResult.setPages(page.getPages());
pageResult.setTotal(page.getTotal());
return R.data(page);
return R.data(pageResult);
}
private Map<Long, Long> getAllTaskIdPackageNumber(List<Long> taskIds){
List<Map<String, Object>> maps = baseMapper.selectMaps(
Wrappers.<DistributionSplitOrderTaskEntity>query()
.select("split_order_all_task_id", "SUM(number) as number")
.in("split_order_all_task_id", taskIds)
.in("state", OrderSplitStateConstant.InProgress.getValue(), OrderSplitStateConstant.finish.getValue())
.groupBy("split_order_all_task_id")
);
return maps.stream().collect(Collectors.toMap(
m -> Long.valueOf(m.get("split_order_all_task_id").toString()),
m -> Long.valueOf(m.get("number").toString())
));
}
@Override
public R<Object> getTaskDetail(Long taskId) {
R<List<SplitPackageOrderVO>> PackageOrderList = getPackageCodeByTaskId(taskId);
@ -902,20 +971,80 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
res.put("packageList", PackageOrderList.getData());
res.put("logList", logList);
res.put("info", getById(taskId));
return R.data(res);
}
public long getSplitOrderAllowCount(Long stockArticleId) {
return distributionParcelListService.count(
Wrappers.<DistributionParcelListEntity>lambdaQuery()
.in(DistributionParcelListEntity::getStockArticleId, stockArticleId)
.ne(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiqianshou.getValue())
.eq(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue())
.eq(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.weizhuancghe.getValue())
.eq(DistributionParcelListEntity::getOrderPackageFreezeStatus, OrderPackageFreezeStatusConstant.weidongjie.getValue())
.eq(DistributionParcelListEntity::getIsTransfer, 0)
);
}
public long getSplitOrderAllCount(Long stockArticleId) {
return distributionParcelListService.count(
Wrappers.<DistributionParcelListEntity>lambdaQuery()
.in(DistributionParcelListEntity::getStockArticleId, stockArticleId)
);
}
@Override
public R<String> checkOrderCode(String orderCode) {
DistributionStockArticleEntity distributionStockArticle = distributionStockArticleService.getOne(Wrappers.<DistributionStockArticleEntity>lambdaQuery()
.eq(DistributionStockArticleEntity::getOrderCode, orderCode));
long splitOrderAllCount = getSplitOrderAllCount(distributionStockArticle.getId());
long splitOrderAllowCount = getSplitOrderAllowCount(distributionStockArticle.getId());
if (splitOrderAllowCount == 0 || splitOrderAllCount == 1) {
return R.success("该订单无法拆单");
}
return R.success("");
}
DistributionSplitOrderAllTaskEntity exists = distributionSplitOrderAllTaskService.getOne(
Wrappers.<DistributionSplitOrderAllTaskEntity>lambdaQuery()
.eq(DistributionSplitOrderAllTaskEntity::getOrderCode, orderCode)
@Override
public R<String> checkOrderCode(Long stockArticleId){
DistributionStockArticleEntity distributionStockArticle = distributionStockArticleService.getById(stockArticleId);
if (distributionStockArticle == null) {
return R.fail("原订单信息错误");
}
if (distributionStockArticle.getOrderStatus().equals(OrderStatusConstant.chuku.getValue())
|| distributionStockArticle.getOrderStatus().equals(OrderStatusConstant.qianshou.getValue())
|| Objects.equals(distributionStockArticle.getReservationStatus(), OrderReservationStatusConstant.yiyueyue.getValue())) {
return R.fail("订单"+ distributionStockArticle.getOrderCode() +"不允许拆单");
}
long packageAllowCount = getSplitOrderAllowCount(stockArticleId);
long packageAllCount = getSplitOrderAllCount(stockArticleId);
if (packageAllowCount == 0 || packageAllCount == 1) {
return R.fail("订单"+ distributionStockArticle.getOrderCode() +"包件数量不足,不允许拆单");
}
boolean exists = exists(
Wrappers.<DistributionSplitOrderTaskEntity>lambdaQuery()
.eq(DistributionSplitOrderTaskEntity::getStockArticleId, stockArticleId)
.eq(DistributionSplitOrderTaskEntity::getState, OrderSplitStateConstant.InProgress.getValue())
);
if (exists) {
return R.fail("订单"+ distributionStockArticle.getOrderCode() +"正在拆单中,不允许重复拆单");
}
boolean hasSplit = exists(
Wrappers.<DistributionSplitOrderTaskEntity>lambdaQuery()
.eq(DistributionSplitOrderTaskEntity::getNewStockArticleId, stockArticleId)
);
return R.success(exists == null ? "" : exists.getNo());
if (hasSplit){
return R.fail("订单"+ distributionStockArticle.getOrderCode() +"已是拆单订单,不允许再次拆单");
}
return R.success("");
}
@Override

23
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java

@ -1189,10 +1189,16 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
@Override
public queryOrderVO queryOrderVOCont(String condition, Integer i) {
//获取当前登录人仓库
List<BasicdataWarehouseEntity> myWarehouseList = warehouseClient.getMyWatchWarehouse();
List<Long> collect = myWarehouseList.stream()
.map(BasicdataWarehouseEntity::getId)
.collect(Collectors.toList());
// List<BasicdataWarehouseEntity> myWarehouseList = warehouseClient.getMyWatchWarehouse();
// List<Long> collect = myWarehouseList.stream()
// .map(BasicdataWarehouseEntity::getId)
// .collect(Collectors.toList());
List<Long> collect = new ArrayList<>();
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
Long warehouseId = myCurrentWarehouse.getId();
collect.add(warehouseId);
//查询包条(库存品)所在订单
queryOrderVO queryOrderVO;
if (i == 1) {
@ -1207,12 +1213,21 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
Long id = queryOrderVO.getId();
//查询订单下的所有包条
List<DistributionParcelListEntity> distributionParcelListEntitys = distributionParcelListMapper.selectListByOderId(id, collect);
//查询订单下的所有库存品
List<DistributionStockListVO> distributionStockListVOS = distributionParcelListMapper.selectStockListByOderId(id, collect);
//查询订单下所有未入库的包件
List<TrunklineAdvanceDetailEntity> advanceDetailEntities = trunklineAdvanceDetailClient.findListByStockArticleId(id,warehouseId);
List<JSONObject> noIncomingPackage = new ArrayList<>();
advanceDetailEntities.forEach(advanceDetailEntity -> {
noIncomingPackage.add(JSONObject.parseObject(JSONObject.toJSONString(advanceDetailEntity)));
});
queryOrderVO.setWrapNum(distributionParcelListEntitys.size());
queryOrderVO.setInventoryNum(distributionStockListVOS.size());
queryOrderVO.setList(distributionParcelListEntitys);
queryOrderVO.setStockList(distributionStockListVOS);
queryOrderVO.setNoIncomingList(noIncomingPackage);
return queryOrderVO;
}

16
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/vo/DistributionSplitOrderAllTaskVO.java

@ -0,0 +1,16 @@
package com.logpm.distribution.vo;
import com.logpm.distribution.entity.DistributionSplitOrderAllTaskEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class DistributionSplitOrderAllTaskVO extends DistributionSplitOrderAllTaskEntity {
private String createUserName;
/**
* 已拆单包件数量
*/
private Long splitPackageNumber;
}

11
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/vo/DistributionSplitOrderTaskVO.java

@ -0,0 +1,11 @@
package com.logpm.distribution.vo;
import com.logpm.distribution.entity.DistributionSplitOrderTaskEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class DistributionSplitOrderTaskVO extends DistributionSplitOrderTaskEntity {
private String createUserName;
}

88
blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/job/AdvanceJob.java

@ -1,9 +1,10 @@
package com.logpm.factorydata.jinpai.job;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.factorydata.base.feign.IFactoryDataBaseClient;
import com.logpm.factorydata.feign.IFactoryDataClient;
import com.logpm.factorydata.jinpai.entity.DeliveryNoteEntity;
import com.logpm.factorydata.jinpai.entity.OrderInfoEntity;
import com.logpm.factorydata.jinpai.entity.PackageInfoEntity;
@ -14,9 +15,9 @@ import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.annotations.LogpmAsync;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@ -62,21 +63,78 @@ public class AdvanceJob {
// 将数据封装到packageInfoEntityMap中 其中omsExtOrderNo为key
packageInfoEntityMap.computeIfAbsent(entity.getOmsExtOrderNo(), k -> new ArrayList<>()).add(entity);
}
// 根据订单数据查询出所有订单明细和包件信息
List<DeliveryNoteEntity> deliveryNoteEntities = deliveryNoteService.list(Wrappers.<DeliveryNoteEntity>lambdaQuery().in(DeliveryNoteEntity::getOrderId, deliveryNoteSet));
if (CollUtil.isNotEmpty(deliveryNoteEntities)) {
for (DeliveryNoteEntity entity : deliveryNoteEntities) {
deliveryNoteEntityMap.put(entity.getOrderId(), entity);
}
}
List<OrderInfoEntity> orders = orderInfoService.list(Wrappers.<OrderInfoEntity>lambdaQuery().eq(OrderInfoEntity::getReserve1, "0"));
if (CollUtil.isNotEmpty(orders)) {
for (OrderInfoEntity order : orders) {
orderInfoSet.add(order.getOmsExtOrderNo());
}
}
List<OrderInfoEntity> orderInfoEntities = orderInfoService.list(Wrappers.<OrderInfoEntity>lambdaQuery().in(OrderInfoEntity::getOmsExtOrderNo, orderInfoSet));
if (CollUtil.isNotEmpty(orderInfoEntities)) {
for (OrderInfoEntity entity : orderInfoEntities) {
String omsExtOrderNo = entity.getOmsExtOrderNo();
orderInfoEntityMap.put(omsExtOrderNo, entity);
deliveryNoteSet.add(entity.getOrderId());
}
List<OrderInfoEntity> orderInfoEntities = orderInfoService.list(Wrappers.<OrderInfoEntity>lambdaQuery().in(OrderInfoEntity::getOmsExtOrderNo, orderInfoSet));
if (CollUtil.isNotEmpty(orderInfoEntities)) {
for (OrderInfoEntity entity : orderInfoEntities) {
orderInfoEntityMap.put(entity.getOmsExtOrderNo(), entity);
}
// 根据订单数据查询出所有订单明细和包件信息
List<DeliveryNoteEntity> deliveryNoteEntities = deliveryNoteService.list(Wrappers.<DeliveryNoteEntity>lambdaQuery().in(DeliveryNoteEntity::getOrderId, deliveryNoteSet));
if (CollUtil.isNotEmpty(deliveryNoteEntities)) {
for (DeliveryNoteEntity entity : deliveryNoteEntities) {
deliveryNoteEntityMap.put(entity.getOrderId(), entity);
}
}
// 处理无包条的情况
if (CollUtil.isNotEmpty(orderInfoEntities)) {
for (OrderInfoEntity entity : orderInfoEntities) {
String omsExtOrderNo = entity.getOmsExtOrderNo();
String goodsNumber = entity.getGoodsNumber();
if (!packageInfoEntityMap.containsKey(omsExtOrderNo)) {
// 订单没有包件,生成包件
if (StrUtil.isNotEmpty(goodsNumber)) {
Integer anInt = Convert.toInt(goodsNumber);
if (anInt > 0) {
// 创建包件
List<PackageInfoEntity> packageInfoEntities = new ArrayList<>();
for (int i = 0; i < anInt; i++) {
PackageInfoEntity packageInfoEntity = new PackageInfoEntity();
packageInfoEntity.setOrderId(entity.getOrderId());
packageInfoEntity.setOmsExtOrderNo(omsExtOrderNo);
packageInfoEntity.setGoodsNum(entity.getGoodsNumber());
packageInfoEntity.setBoxType1(entity.getGoodsType());
packageInfoEntity.setBoxType2(entity.getGoodsType());
packageInfoEntity.setBoxType3(entity.getGoodsType());
packageInfoEntity.setExtBoxCode(deliveryNoteEntityMap.get(entity.getOrderId()).getOmsExtYsId() + omsExtOrderNo + "-" + i);
String goodsVolume = entity.getGoodsVolume();
if (StrUtil.isNotEmpty(goodsVolume)) {
BigDecimal div = NumberUtil.div(Convert.toBigDecimal(goodsVolume), Convert.toBigDecimal(anInt), 4);
packageInfoEntity.setGoodsVolume(Convert.toStr(div));
}
packageInfoEntities.add(packageInfoEntity);
}
packageInfoEntityMap.put(omsExtOrderNo, packageInfoEntities);
}
}
}
}
// 组装数据,然后生成暂存单
deliveryNoteService.buildAdvancePull(packageInfoEntityMap, deliveryNoteEntityMap, orderInfoEntityMap);
}
// 组装数据,然后生成暂存单
deliveryNoteService.buildAdvancePull(packageInfoEntityMap, deliveryNoteEntityMap, orderInfoEntityMap);
if (CollUtil.isNotEmpty(orderInfoEntities)) {
// 修改包件的发送状态 TODO 后面修改为暂存单消费完成之后回调更新状态
List<OrderInfoEntity> updatePackageList = new ArrayList<>();
for (OrderInfoEntity entity : orderInfoEntities) {
OrderInfoEntity updateEntity = new OrderInfoEntity();
updateEntity.setReserve1("1");
updateEntity.setId(entity.getId());
updatePackageList.add(updateEntity);
}
if (CollUtil.isNotEmpty(updatePackageList)) {
orderInfoService.updateBatchById(updatePackageList);
}
}
if (CollUtil.isNotEmpty(list)) {
// 修改包件的发送状态 TODO 后面修改为暂存单消费完成之后回调更新状态
List<PackageInfoEntity> updatePackageList = new ArrayList<>();
for (PackageInfoEntity entity : list) {

2
blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/service/impl/MqWorkerServiceImpl.java

@ -307,6 +307,8 @@ public class MqWorkerServiceImpl implements MqWorkerService {
OrderInfoEntity deliveryNoteEntity = new OrderInfoEntity();
BeanUtil.copyProperties(vo, deliveryNoteEntity);
deliveryNoteEntity.setLogId(ObjectUtil.isNotEmpty(logEntity.getId()) ? logEntity.getId().toString() : null);
// 是否推送
deliveryNoteEntity.setReserve1("0");
entities.add(deliveryNoteEntity);
}
if (CollUtil.isNotEmpty(entities)) {

14
blade-service/logpm-factory-data/logpm-factory-data-paterson/Dockerfile

@ -0,0 +1,14 @@
FROM 192.168.2.110:7777/hwy/hwy_base:v1.0
MAINTAINER h5u@163.com
RUN mkdir -p /logpm/logpm-factory-data-paterson
WORKDIR /logpm/logpm-factory-data-paterson
EXPOSE 19010
ADD ./target/logpm-factory-data-paterson.jar ./app.jar
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar","-Xms128m","-Xmx512m", "app.jar"]
CMD ["--spring.profiles.active=test"]

96
blade-service/logpm-factory-data/logpm-factory-data-paterson/pom.xml

@ -0,0 +1,96 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springblade</groupId>
<artifactId>logpm-factory-data</artifactId>
<version>3.2.0.RELEASE</version>
</parent>
<artifactId>logpm-factory-data-paterson</artifactId>
<version>${bladex.project.version}</version>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-boot</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-auto</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>logpm-factory-data-api</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-swagger</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>logpm-trunkline-api</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>logpm-factory-data-base-api</artifactId>
<version>${bladex.project.version}</version>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-oss</artifactId>
</dependency>
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-resource-api</artifactId>
<version>3.2.0.RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<configuration>
<username>${docker.username}</username>
<password>${docker.password}</password>
<repository>${docker.registry.url}/${docker.namespace}/${project.artifactId}</repository>
<tag>${project.version}</tag>
<useMavenSettingsForAuth>true</useMavenSettingsForAuth>
<buildArgs>
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

20
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/FactoryDataPatersonApplication.java

@ -0,0 +1,20 @@
package com.logpm.factorydata;
import org.springblade.common.constant.ModuleNameConstant;
import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication;
/**
* 索菲亚工厂数据启动类
*
* @author zhaoqiaobo
* @create 2024-4-26
*/
@BladeCloudApplication
public class FactoryDataPatersonApplication {
public static void main(String[] args) {
BladeApplication.run(ModuleNameConstant.LOGPM_FACTORY_DATA_PATERSON_NAME, FactoryDataPatersonApplication.class, args);
}
}

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

@ -0,0 +1,50 @@
package com.logpm.factorydata.paterson.aspect;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springblade.common.annotations.LogpmAsync;
import org.springblade.core.secure.utils.AuthUtil;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
@Aspect
@Component
@Slf4j
@Order(-1)
public class AsyncAnnotationAspect {
/**
* 定义一个切点匹配所有带有@LogpmAsync("asyncExecutor")注解的方法
* 注意实际上Spring Framework自带对@LogpmAsync("asyncExecutor")的处理直接这样配置可能会导致预期之外的行为
*/
//@Around("@annotation(org.springblade.common.annotations.LogpmAsync)")
public Object logAroundAsyncMethods(ProceedingJoinPoint joinPoint) throws Throwable {
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = signature.getMethod();
LogpmAsync myAsync = method.getAnnotation(LogpmAsync.class);
String annotationValue = myAsync.value();
log.info(">>>>>>>>>>>>>>>>>> annotationValue={}",annotationValue);
log.info("@LogpmAsync注解的值为asyncExecutor,进行数据源切换 ");
// 在方法执行前的操作
String tenantId = AuthUtil.getTenantId();
log.info(">> tenandId {} ",tenantId);
DynamicDataSourceContextHolder.push(tenantId);
// 执行原方法
Object result = joinPoint.proceed();
// 在方法执行后的操作
DynamicDataSourceContextHolder.poll();
return result;
}
}

82
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/aspect/JobAnnotationAspect.java

@ -0,0 +1,82 @@
package com.logpm.factorydata.paterson.aspect;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import lombok.AllArgsConstructor;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springblade.common.cache.CacheNames;
import org.springblade.common.component.MockLoginService;
import org.springblade.common.utils.DefaultUserTokenConfig;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.redis.lock.LockType;
import org.springblade.core.redis.lock.RedisLockClient;
import org.springblade.core.tool.utils.ThreadLocalUtil;
import org.springframework.core.env.Environment;
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.Objects;
import java.util.concurrent.TimeUnit;
@Aspect
@Component
@AllArgsConstructor
public class JobAnnotationAspect {
private final BladeRedis bladeRedis;
private final Environment environment;
private final RedisLockClient redisLockClient;
private final MockLoginService mockLoginService;
@Around("@annotation(com.xxl.job.core.handler.annotation.XxlJob)")
public Object xxlJobAnnotationMethods(ProceedingJoinPoint joinPoint) throws Throwable {
JSONObject jsonObject = mockLogin();
MockHttpServletRequest mockRequest = new MockHttpServletRequest();
mockRequest.addHeader("Blade-Auth", "bearer "+jsonObject.get("access_token"));
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(mockRequest));
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.add("Blade-Auth","bearer "+jsonObject.get("access_token") );
httpHeaders.add( "Authorization", "Basic bG9jYWw6bG9jYWxfc2VjcmV0");
ThreadLocalUtil.put("bladeContext", httpHeaders);
DynamicDataSourceContextHolder.push(jsonObject.getString("tenant_id"));
// 执行原方法
Object result = joinPoint.proceed();
// 在方法执行后,从数据源上下文中移除租户ID
DynamicDataSourceContextHolder.poll();
return result;
}
private JSONObject mockLogin() throws InterruptedException {
String account ="shujutongbu";
String tenantId ="627683";
String key =CacheNames.LOCAL_SERVER_USER+tenantId+":"+account;
String lockKey =key+":lock";
JSONObject data =bladeRedis.get(key);
if(Objects.isNull(data)){
boolean flag = redisLockClient.tryLock(lockKey, LockType.FAIR, 5000, 10000, TimeUnit.MILLISECONDS);
if(flag){
data =bladeRedis.get(key);
if(Objects.isNull(data)){
data = mockLoginService.mockToken(tenantId,account);
bladeRedis.setEx(key,data, DefaultUserTokenConfig.EXPIRE_TIME);
redisLockClient.unLock(lockKey, LockType.FAIR);
}
}
}
return data;
}
}

48
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/aspect/RabbitAnnotationAspect.java

@ -0,0 +1,48 @@
package com.logpm.factorydata.paterson.aspect;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springblade.core.secure.utils.AuthUtil;
import org.springframework.stereotype.Component;
@Aspect
@Component
@Slf4j
public class RabbitAnnotationAspect {
/**
* 该方法为一个切面用于对标记了@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;
}
}

161
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/config/CustomMessageConverter.java

@ -0,0 +1,161 @@
package com.logpm.factorydata.paterson.config;
import cn.hutool.core.util.StrUtil;
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.AllowedListDeserializingMessageConverter;
import org.springframework.amqp.support.converter.MessageConversionException;
import org.springframework.amqp.utils.SerializationUtils;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.http.HttpHeaders;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.remoting.rmi.CodebaseAwareObjectInputStream;
import org.springframework.stereotype.Component;
import org.springframework.util.ClassUtils;
import org.springframework.web.context.request.RequestContextHolder;
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.List;
import java.util.Map;
/**
* @author zhaoqiaobo
* @create 2024-05-08
*/
@Component
public class CustomMessageConverter extends AllowedListDeserializingMessageConverter implements BeanClassLoaderAware {
private volatile String defaultCharset = "UTF-8";
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
private String codebaseUrl;
@Deprecated
public void setCodebaseUrl(String codebaseUrl) {
this.codebaseUrl = 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();
HttpHeaders httpHeaders = new HttpHeaders();
for (Map.Entry<String, Object> entry : headers.entrySet()) {
if (StrUtil.equals("Blade-Auth", entry.getKey())
|| StrUtil.equals("Authorization", entry.getKey())
|| StrUtil.equals("blade-auth", entry.getKey())
|| StrUtil.equals("authorization", entry.getKey())) {
List value = (List) entry.getValue();
for (Object o : value) {
httpHeaders.add(entry.getKey(), String.valueOf(o));
}
}
}
ThreadLocalUtil.put("bladeContext", httpHeaders);
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
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");
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));
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
public void setBeanClassLoader(ClassLoader classLoader) {
this.beanClassLoader = beanClassLoader;
}
protected ObjectInputStream createObjectInputStream(InputStream is, String codebaseUrl) throws IOException {
return new CodebaseAwareObjectInputStream(is, this.beanClassLoader, codebaseUrl) {
@Override
protected Class<?> resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException {
Class<?> clazz = super.resolveClass(classDesc);
CustomMessageConverter.this.checkAllowedList(clazz);
return clazz;
}
};
}
}

85
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/config/ExecutorConfig.java

@ -0,0 +1,85 @@
package com.logpm.factorydata.paterson.config;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.ThreadLocalUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.TaskDecorator;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import javax.annotation.Nonnull;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
@Configuration
@Slf4j
@EnableAsync
public class ExecutorConfig {
@Bean
public Executor asyncExecutor() {
log.info("start async executor");
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
// 配置核心线程数
threadPoolTaskExecutor.setCorePoolSize(10);
// 配置最大线程数
threadPoolTaskExecutor.setMaxPoolSize(20);
// 配置队列大小
threadPoolTaskExecutor.setQueueCapacity(50);
// 配置线程池中线程的名称前缀
threadPoolTaskExecutor.setThreadNamePrefix("ASYNC_THREAD_");
// HelloWorldServiceImpl rejection-policy: 当pool已经达到max size时,如何处理新任务:
// CallerRunsPolicy: 不在新线程中执行任务,而是由调用者所在的线程来执行;
// AbortPolicy: 拒绝执行新任务,并抛出RejectedExecutionException异常;
// DiscardPolicy:丢弃当前将要加入队列的任务;
// DiscardOldestPolicy:丢弃任务队列中最旧的任务;
threadPoolTaskExecutor.setRejectedExecutionHandler(
new ThreadPoolExecutor.CallerRunsPolicy()
);
threadPoolTaskExecutor.setTaskDecorator(new ContextCopyingDecorator());
threadPoolTaskExecutor.initialize();
return threadPoolTaskExecutor;
}
static class ContextCopyingDecorator implements TaskDecorator {
@Nonnull
@Override
public Runnable decorate(@Nonnull Runnable runnable) {
RequestAttributes context = RequestContextHolder.currentRequestAttributes();
String tenantId = AuthUtil.getTenantId();
Map<String, Object> all = ThreadLocalUtil.getAll();
Map<String, String> mdcMap = MDC.getCopyOfContextMap();
return () -> {
try {
all.keySet().forEach(key -> ThreadLocalUtil.put(key, all.get(key)));
if (mdcMap != null && !mdcMap.isEmpty()) {
MDC.setContextMap(mdcMap);
}
RequestContextHolder.setRequestAttributes(context);
// 未当前的异步线程绑定租户ID 和切换数据源
log.info(">>>> 异步线程创建,绑定租户数据源 {}",tenantId);
DynamicDataSourceContextHolder.push(tenantId);
runnable.run();
} finally {
RequestContextHolder.resetRequestAttributes();
all.clear();
if (mdcMap != null) {
mdcMap.clear();
}
ThreadLocalUtil.clear();
MDC.clear();
DynamicDataSourceContextHolder.poll();
}
};
}
}
}

40
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/config/FactoryDataPatersonConfiguration.java

@ -0,0 +1,40 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.logpm.factorydata.paterson.config;
import com.logpm.factorydata.paterson.pros.FactoryDataPatersonProperties;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
/**
* 配置feignmybatis包名properties
*
* @author chaos
*/
@Configuration(proxyBeanMethods = false)
@ComponentScan({"org.springblade", "com.logpm"})
@EnableFeignClients({"org.springblade", "com.logpm"})
@MapperScan({"org.springblade.**.mapper.**", "com.logpm.**.mapper.**"})
@EnableConfigurationProperties(FactoryDataPatersonProperties.class)
public class FactoryDataPatersonConfiguration {
}

39
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/config/InterceptorAdapterConfig.java

@ -0,0 +1,39 @@
package com.logpm.factorydata.paterson.config;
import com.logpm.factorydata.paterson.interceptor.FactoryAccountsInterceptor;
import com.logpm.factorydata.paterson.pros.PatersonProperties;
import com.logpm.factorydata.paterson.service.FactoryShipmentService;
import org.springblade.common.component.MockLoginService;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.redis.lock.RedisLockClient;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.env.Environment;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import javax.annotation.Resource;
@Configuration
public class InterceptorAdapterConfig implements WebMvcConfigurer {
@Resource
private BladeRedis redis;
@Resource
private Environment environment;
@Resource
private RedisLockClient redisLockClient;
@Resource
private MockLoginService mockLoginService;
@Lazy
@Resource
private FactoryShipmentService jpFactoryShipmentService;
@Resource
private PatersonProperties jinPaiProperties;
@Override
public void addInterceptors(InterceptorRegistry interceptorRegistry) {
interceptorRegistry.addInterceptor(new FactoryAccountsInterceptor(redis, environment, redisLockClient, mockLoginService, jinPaiProperties, jpFactoryShipmentService))
.addPathPatterns("/order/v1").order(3);
}
}

17
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/config/RabbitConfig.java

@ -0,0 +1,17 @@
package com.logpm.factorydata.paterson.config;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class RabbitConfig {
@Bean
public RabbitTemplate rabbitTemplate(ConnectionFactory factory) {
RabbitTemplate template = new RabbitTemplate(factory);
template.setMessageConverter(new CustomMessageConverter());
return template;
}
}

74
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/config/XxlJobConfig.java

@ -0,0 +1,74 @@
package com.logpm.factorydata.paterson.config;
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* xxl-job config
*
* @author xuxueli 2017-04-28
*/
@Configuration(proxyBeanMethods = false)
public class XxlJobConfig {
private final Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
@Value("${xxl.job.admin.addresses}")
private String adminAddresses;
@Value("${xxl.job.executor.appname}")
private String appName;
@Value("${xxl.job.executor.ip}")
private String ip;
@Value("${xxl.job.executor.port}")
private int port;
@Value("${xxl.job.accessToken}")
private String accessToken;
@Value("${xxl.job.executor.logpath}")
private String logPath;
@Value("${xxl.job.executor.logretentiondays}")
private int logRetentionDays;
@Bean
public XxlJobSpringExecutor xxlJobExecutor() {
logger.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
xxlJobSpringExecutor.setAppName(appName);
xxlJobSpringExecutor.setIp(ip);
xxlJobSpringExecutor.setPort(port);
xxlJobSpringExecutor.setAccessToken(accessToken);
xxlJobSpringExecutor.setLogPath(logPath);
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
return xxlJobSpringExecutor;
}
/**
* 针对多网卡容器内部署等情况可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP
*
* 1引入依赖
* <dependency>
* <groupId>org.springframework.cloud</groupId>
* <artifactId>spring-cloud-commons</artifactId>
* <version>${version}</version>
* </dependency>
*
* 2配置文件或者容器启动变量
* spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
*
* 3获取IP
* String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
*/
}

64
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/controller/OrderController.java

@ -0,0 +1,64 @@
package com.logpm.factorydata.paterson.controller;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.factorydata.paterson.service.FactoryShipmentService;
import com.logpm.factorydata.paterson.vo.FactoryOrderDataVO;
import com.logpm.factorydata.paterson.vo.FactoryShipmentVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* 工厂订单 前端控制器
*
* @author zhaoqiaobo
* @create 2024-03-21 19:27
*/
@Slf4j
@RestController
@RequestMapping("/order")
@AllArgsConstructor
@Api(value = "工厂订单", tags = "工厂订单")
public class OrderController {
@Lazy
@Resource
private FactoryShipmentService shipmentService;
@ResponseBody
@PostMapping("/v1")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "百得胜-工厂订单", notes = "百得胜-工厂订单")
public R orderV1(@RequestBody FactoryOrderDataVO vo) {
String jsonStr = JSONUtil.toJsonStr(vo);
log.info("接收百得胜工厂订单:{} ", jsonStr);
String res = "";
try {
String params = vo.getParams();
if(StrUtil.isNotEmpty(params)){
FactoryShipmentVO bean = JSONUtil.toBean(params, FactoryShipmentVO.class);
if (ObjectUtil.isNotEmpty(bean)) {
res = shipmentService.shipment(bean);
}
}
} catch (Exception e) {
log.error("百得胜工厂订单异常:{} ", e);
return R.fail("服务器异常");
}
return R.success(res);
}
}

88
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/entity/FactoryOrderEntity.java

@ -0,0 +1,88 @@
package com.logpm.factorydata.paterson.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
/**
* 百得胜工厂订单 实体类
*
* @author zhaoqiaobo
* @create 2024-04-26
*/
@Data
@TableName("bds_factory_order")
@ApiModel(value = "百得胜工厂订单", description = "百得胜工厂订单")
@EqualsAndHashCode(callSuper = true)
public class FactoryOrderEntity extends BaseEntity {
@ApiModelProperty(name = "日志id")
private String logId;
@ApiModelProperty(name = "发货单id")
private Long shipmentId;
@ApiModelProperty(name = "订单号")
private String orderCode;
@ApiModelProperty(name = "交割单号/服务号")
private String serviceNum;
@ApiModelProperty(name = "服务类型")
private String serverType;
@ApiModelProperty(name = "结算方式")
private String settlementType;
@ApiModelProperty(name = "是否补件")
private String supplement;
@ApiModelProperty(name = "发运方式")
private String shipVia;
@ApiModelProperty(name = "订单总件数")
private Integer totalQuantity;
@ApiModelProperty(name = "商场名称")
private String mallName;
@ApiModelProperty(name = "商场编码")
private String mallCode;
@ApiModelProperty(name = "商场电话")
private String mallMobile;
@ApiModelProperty(name = "商场地址")
private String mallAddress;
@ApiModelProperty(name = "商场收货人")
private String mallConsignee;
@ApiModelProperty(name = "商场收货人电话")
private String mallConsigneeMobile;
@ApiModelProperty(name = "门店名称")
private String storeName;
@ApiModelProperty(name = "门店编码")
private String storeCode;
@ApiModelProperty(name = "门店电话")
private String storeMobile;
@ApiModelProperty(name = "门店地址")
private String storeAddress;
@ApiModelProperty(name = "门店收货人")
private String storeConsignee;
@ApiModelProperty(name = "门店收货人电话")
private String storeConsigneeMobile;
@ApiModelProperty(name = "终端收货人")
private String receiverName;
@ApiModelProperty(name = "终端收货人电话")
private String receiverMobile;
@ApiModelProperty(name = "终端收货人地址")
private String receiverAddress;
@ApiModelProperty(name = "备注")
private String remark;
@ApiModelProperty(name = "是否确认")
private Boolean checked;
@ApiModelProperty(name = "租户")
private String tenantCode;
@ApiModelProperty(name = "预留1", notes = "")
private String reserve1;
@ApiModelProperty(name = "预留2", notes = "")
private String reserve2;
@ApiModelProperty(name = "预留3", notes = "")
private String reserve3;
@ApiModelProperty(name = "预留4", notes = "")
private String reserve4;
@ApiModelProperty(name = "预留5", notes = "")
private String reserve5;
}

63
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/entity/FactoryOrderLogEntity.java

@ -0,0 +1,63 @@
package com.logpm.factorydata.paterson.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
@Data
@TableName("bds_factory_log")
@ApiModel(value = "接收工厂订单日志", description = "接收工厂订单日志")
@EqualsAndHashCode(callSuper = true)
public class FactoryOrderLogEntity extends BaseEntity {
/**
* 预留1
*/
@ApiModelProperty(name = "预留1", notes = "")
private String reserve1;
/**
* 预留2
*/
@ApiModelProperty(name = "预留2", notes = "")
private String reserve2;
/**
* 预留3
*/
@ApiModelProperty(name = "预留3", notes = "")
private String reserve3;
/**
* 预留4
*/
@ApiModelProperty(name = "预留4", notes = "")
private String reserve4;
/**
* 预留5
*/
@ApiModelProperty(name = "预留5", notes = "")
private String reserve5;
/**
* 日志文件存放地址
*/
@ApiModelProperty(name = "日志文件存放地址", notes = "")
private String logUrl;
/**
* 数据类型 1.拉取数据 2推送数据
*/
@ApiModelProperty(name = "数据类型 1.拉取数据 2。推送数据", notes = "")
private Integer type;
/**
* 数据维度1 订单 2 订单明细 3 包件
*/
@ApiModelProperty(name = "维度:1 订单 2 订单明细 3 包件", notes = "")
private Integer dimension;
/**
* 解析状态 0 未解析 1 解析失败 2 已解析
*/
@ApiModelProperty(name = "解析状态 0 未解析 1 解析失败 2 已解析", notes = "")
private Integer saxStatus;
}

72
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/entity/FactoryPackageEntity.java

@ -0,0 +1,72 @@
package com.logpm.factorydata.paterson.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
/**
* 百得胜工厂包件 实体类
*
* @author zhaoqiaobo
* @create 2024-04-26
*/
@Data
@TableName("bds_factory_package")
@ApiModel(value = "百得胜工厂包件", description = "百得胜工厂包件")
@EqualsAndHashCode(callSuper = true)
public class FactoryPackageEntity extends BaseEntity {
@ApiModelProperty(name = "日志id")
private String logId;
@ApiModelProperty(name = "订单id")
private Long orderId;
@ApiModelProperty(name = "是否合包")
@JsonProperty("isConsolidation")
private String consolidation;
@ApiModelProperty(name = "合包码")
private String consolidationCode;
@ApiModelProperty(name = "包件码")
private String unitNo;
@ApiModelProperty(name = "产品编号")
private String productCode;
@ApiModelProperty(name = "产品名称")
private String productName;
@ApiModelProperty(name = "件数")
private Integer quantity;
@ApiModelProperty(name = "体积")
private Double volume;
@ApiModelProperty(name = "重量")
private Double weight;
@ApiModelProperty(name = "一级品类名称")
private String firstPackName;
@ApiModelProperty(name = "一级品类编码")
private String firstPackCode;
@ApiModelProperty(name = "二级品类名称")
private String secondPackName;
@ApiModelProperty(name = "二级品类编码")
private String secondPackCode;
@ApiModelProperty(name = "三级品类名称")
private String thirdPackName;
@ApiModelProperty(name = "三级品类编码")
private String thirdPackCode;
@ApiModelProperty(name = "是否确认")
private Boolean checked;
@ApiModelProperty(name = "租户")
private String tenantCode;
@ApiModelProperty(name = "预留1", notes = "")
private String reserve1;
@ApiModelProperty(name = "预留2", notes = "")
private String reserve2;
@ApiModelProperty(name = "预留3", notes = "")
private String reserve3;
@ApiModelProperty(name = "预留4", notes = "")
private String reserve4;
@ApiModelProperty(name = "预留5", notes = "")
private String reserve5;
}

64
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/entity/FactoryShipmentEntity.java

@ -0,0 +1,64 @@
package com.logpm.factorydata.paterson.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
/**
* 百得胜工厂发货单 实体类
*
* @author zhaoqiaobo
* @create 2024-04-26
*/
@Data
@TableName("bds_factory_shipment")
@ApiModel(value = "百得胜工厂发货单", description = "百得胜工厂发货单")
@EqualsAndHashCode(callSuper = true)
public class FactoryShipmentEntity extends BaseEntity {
@ApiModelProperty(name = "日志id")
private String logId;
@ApiModelProperty(name = "发货单号")
private String shipmentId;
@ApiModelProperty(name = "物流公司编码")
private String carrierCode;
@ApiModelProperty(name = "物流公司名称")
private String carrierName;
@ApiModelProperty(name = "发货基地")
private String shipmentHub;
@ApiModelProperty(name = "计划发车时间")
private String planStartTime;
@ApiModelProperty(name = "计划到达时间")
private String planEndTime;
@ApiModelProperty(name = "司机")
private String driverName;
@ApiModelProperty(name = "司机电话")
private String driverMobile;
@ApiModelProperty(name = "车牌")
private String carNumber;
@ApiModelProperty(name = "发货人名称")
private String senderName;
@ApiModelProperty(name = "发货人电话")
private String senderMobile;
@ApiModelProperty(name = "发货人地址")
private String senderAddress;
@ApiModelProperty(name = "是否确认")
private Boolean checked;
@ApiModelProperty(name = "租户")
private String tenantCode;
@ApiModelProperty(name = "预留1", notes = "")
private String reserve1;
@ApiModelProperty(name = "预留2", notes = "")
private String reserve2;
@ApiModelProperty(name = "预留3", notes = "")
private String reserve3;
@ApiModelProperty(name = "预留4", notes = "")
private String reserve4;
@ApiModelProperty(name = "预留5", notes = "")
private String reserve5;
}

192
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/interceptor/FactoryAccountsInterceptor.java

@ -0,0 +1,192 @@
package com.logpm.factorydata.paterson.interceptor;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.digest.MD5;
import com.alibaba.fastjson.JSONObject;
import com.logpm.factorydata.paterson.pros.PatersonProperties;
import com.logpm.factorydata.paterson.service.FactoryShipmentService;
import com.logpm.factorydata.paterson.vo.FactoryAuthVO;
import com.logpm.factorydata.paterson.wrapper.RequestWrapper;
import lombok.NoArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springblade.common.cache.CacheNames;
import org.springblade.common.component.MockLoginService;
import org.springblade.common.exception.CustomerException;
import org.springblade.common.utils.DefaultUserTokenConfig;
import org.springblade.common.wrapper.CustomHttpServletRequestWrapper;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.redis.lock.LockType;
import org.springblade.core.redis.lock.RedisLockClient;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.core.tool.utils.ThreadLocalUtil;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpHeaders;
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 javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
@Log4j2
@NoArgsConstructor
public class FactoryAccountsInterceptor implements HandlerInterceptor {
@Resource
private BladeRedis bladeRedis;
@Resource
private Environment environment;
@Resource
private RedisLockClient redisLockClient;
@Resource
private MockLoginService mockLoginService;
@Resource
private PatersonProperties jinPaiProperties;
@Resource
@Lazy
private FactoryShipmentService jpFactoryShipmentService;
public FactoryAccountsInterceptor(BladeRedis redis, Environment environment, RedisLockClient redisLockClient, MockLoginService mockLoginService, PatersonProperties suoFeiYaProperties, FactoryShipmentService deliveryNoteService) {
this.bladeRedis = redis;
this.environment = environment;
this.redisLockClient = redisLockClient;
this.mockLoginService = mockLoginService;
this.jinPaiProperties = suoFeiYaProperties;
this.jpFactoryShipmentService = deliveryNoteService;
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws CustomerException {
try {
log.info("##########preHandle: 认证开始--------------");
RequestWrapper myRequestWrapper = new RequestWrapper(request);
String body = myRequestWrapper.getBody();
log.info("##########preHandle: body={}", body);
JSONObject jsonObject = JSONObject.parseObject(body);
// 获取头中参数
String companyCode = jsonObject.getString("companyCode");
String params = jsonObject.getString("params");
String sign = jsonObject.getString("digest");
Long authTime = jsonObject.getLong("timestamp");
if (ObjectUtil.isEmpty(authTime)) {
log.info("##########preHandle: 时间戳不能为空");
returnJson(response, JSONObject.toJSONString(R.fail("时间戳不能为空")));
return false;
}
log.info("##########preHandle: authTime={},sign={},companyCodeH={}", authTime, sign, companyCode);
String account = "shujutongbu";
String tenantId = "627683";
String authorizationHeader = "bG9jYWw6bG9jYWxfc2VjcmV0";
if (StringUtil.isNotBlank(companyCode)) {
FactoryAuthVO authVO = jpFactoryShipmentService.findFactoryAuth(companyCode);
if (ObjectUtil.isNotEmpty(authVO)) {
Long authTime1 = authVO.getAuthTime();
long secondTimestamp = DateUtil.current();
DateTime currentDate = DateUtil.date();
// 验证时间
if (secondTimestamp - authTime > authTime1) {
log.info("##########preHandle: 时间戳过期");
returnJson(response, JSONObject.toJSONString(R.fail("认证不通过,时间戳过期")));
return false;
}
// 将 authTime 转换为时间并与当前时间比较
DateTime authDateTime = DateUtil.date(authTime); // 将时间戳转换为 DateTime
// 将 authTime 转换为时间并与当前时间比较
long timeDifferenceInSeconds = DateUtil.between(authDateTime, currentDate, DateUnit.MS);
if (timeDifferenceInSeconds > authTime1) {
log.info("##########preHandle: 认证时间过期");
returnJson(response, JSONObject.toJSONString(R.fail("认证不通过,认证时间过期")));
return false;
}
// 验证签名
String auth = authVO.getAppKey();
String md5Hex = Base64.encode(MD5.create().digestHex(params + auth + authTime)).toUpperCase();
log.info("##########preHandle: md5Hex={}", md5Hex);
if (!StrUtil.equals(md5Hex, sign)) {
log.info("##########preHandle: 签名不正确");
returnJson(response, JSONObject.toJSONString(R.fail("认证不通过,签名不正确")));
return false;
}
account = authVO.getLoginAccount();
tenantId = authVO.getTenantCode();
authorizationHeader = authVO.getAuthorizationHeader();
CustomHttpServletRequestWrapper wrappedRequest = new CustomHttpServletRequestWrapper(request);
String key = CacheNames.LOCAL_SERVER_USER + tenantId + ":" + account;
String lockKey = key + ":lock";
JSONObject data = bladeRedis.get(key);
if (Objects.isNull(data)) {
boolean flag = redisLockClient.tryLock(lockKey, LockType.FAIR, 5000, 10000, TimeUnit.MILLISECONDS);
if (flag) {
data = bladeRedis.get(key);
if (Objects.isNull(data)) {
data = mockLoginService.mockToken(tenantId, account);
bladeRedis.setEx(key, data, DefaultUserTokenConfig.EXPIRE_TIME);
redisLockClient.unLock(lockKey, LockType.FAIR);
}
}
}
// 发送登录请求
log.info("##########preHandle: request={}", request);
wrappedRequest.addHeader("Blade-Auth", "bearer " + data.getString("access_token"));
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.add("Blade-Auth", "bearer " + data.get("access_token"));
httpHeaders.add("Authorization", "Basic " + authorizationHeader);
ThreadLocalUtil.put("bladeContext", httpHeaders);
// 用包装后的request替换原始request
request = wrappedRequest;
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
return true;
}
} else {
returnJson(response, JSONObject.toJSONString(R.fail("缺少参数 companyCode")));
return false;
}
return false;
} catch (Exception e) {
e.printStackTrace();
returnJson(response, JSONObject.toJSONString(R.fail("服务异常,请联系管理员")));
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();
}
}
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
HandlerInterceptor.super.postHandle(request, response, handler, modelAndView);
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
HandlerInterceptor.super.afterCompletion(request, response, handler, ex);
}
}

60
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/launcher/FactoryDataBaseLauncherServiceImpl.java

@ -0,0 +1,60 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.logpm.factorydata.paterson.launcher;
import org.springblade.core.auto.service.AutoService;
import org.springblade.core.launch.constant.NacosConstant;
import org.springblade.core.launch.service.LauncherService;
import org.springblade.core.launch.utils.PropsUtil;
import org.springframework.boot.builder.SpringApplicationBuilder;
import java.util.Properties;
/**
* 启动参数拓展
*
* @author Chill
*/
@AutoService(LauncherService.class)
public class FactoryDataBaseLauncherServiceImpl implements LauncherService {
@Override
public void launcher(SpringApplicationBuilder builder, String appName, String profile, boolean isLocalDev) {
Properties props = System.getProperties();
// 开启多数据源
PropsUtil.setProperty(props, "spring.datasource.dynamic.enabled", "true");
// 指定注册配置信息
PropsUtil.setProperty(props, "spring.cloud.nacos.config.extension-configs[0].data-id", NacosConstant.dataId(appName, profile));
PropsUtil.setProperty(props, "spring.cloud.nacos.config.extension-configs[0].group", NacosConstant.NACOS_CONFIG_GROUP);
PropsUtil.setProperty(props, "spring.cloud.nacos.config.extension-configs[0].refresh", NacosConstant.NACOS_CONFIG_REFRESH);
// 指定注册IP
// PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.ip", "127.0.0.1");
// 指定注册端口
// PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.port", "8200");
// 自定义命名空间
// PropsUtil.setProperty(props, "spring.cloud.nacos.config.namespace", LauncherConstant.NACOS_NAMESPACE);
// PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.namespace", LauncherConstant.NACOS_NAMESPACE);
// 自定义分组
// PropsUtil.setProperty(props, "spring.cloud.nacos.config.group", NacosConstant.NACOS_CONFIG_GROUP);
// PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.group", NacosConstant.NACOS_CONFIG_GROUP);
}
@Override
public int getOrder() {
return 20;
}
}

16
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/mapper/FactoryOrderLogMapper.java

@ -0,0 +1,16 @@
package com.logpm.factorydata.paterson.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.factorydata.paterson.entity.FactoryOrderLogEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 工厂订单日志 mapper
*
* @author zqb
* @since 2024-03-26
*/
@Mapper
public interface FactoryOrderLogMapper extends BaseMapper<FactoryOrderLogEntity> {
}

5
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/mapper/FactoryOrderLogMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.logpm.factorydata.paterson.mapper.FactoryOrderLogMapper">
</mapper>

16
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/mapper/FactoryOrderMapper.java

@ -0,0 +1,16 @@
package com.logpm.factorydata.paterson.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.factorydata.paterson.entity.FactoryOrderEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 百得胜工厂订单 mapper
*
* @author zqb
* @since 2024-03-26
*/
@Mapper
public interface FactoryOrderMapper extends BaseMapper<FactoryOrderEntity> {
}

5
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/mapper/FactoryOrderMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.logpm.factorydata.paterson.mapper.FactoryOrderMapper">
</mapper>

16
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/mapper/FactoryPackageMapper.java

@ -0,0 +1,16 @@
package com.logpm.factorydata.paterson.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.factorydata.paterson.entity.FactoryPackageEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 百得胜工厂包件 mapper
*
* @author zqb
* @since 2024-03-26
*/
@Mapper
public interface FactoryPackageMapper extends BaseMapper<FactoryPackageEntity> {
}

5
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/mapper/FactoryPackageMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.logpm.factorydata.paterson.mapper.FactoryPackageMapper">
</mapper>

21
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/mapper/FactoryShipmentMapper.java

@ -0,0 +1,21 @@
package com.logpm.factorydata.paterson.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.factorydata.paterson.entity.FactoryShipmentEntity;
import com.logpm.factorydata.paterson.vo.FactoryAuthVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 百得胜工厂发货单 mapper
*
* @author zqb
* @since 2024-03-26
*/
@Mapper
public interface FactoryShipmentMapper extends BaseMapper<FactoryShipmentEntity> {
List<FactoryAuthVO> findFactoryAuth(@Param("companyCode") String companyCode);
}

17
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/mapper/FactoryShipmentMapper.xml

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.logpm.factorydata.paterson.mapper.FactoryShipmentMapper">
<select id="findFactoryAuth" resultType="com.logpm.factorydata.paterson.vo.FactoryAuthVO">
select
logistics_code,
app_key,
auth_time,
tenant_code,
login_account,
authorization_header
from bds_factory_auth
where
company_code = #{companyCode}
</select>
</mapper>

52
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/mq/FactoryOrderListener.java

@ -0,0 +1,52 @@
package com.logpm.factorydata.paterson.mq;
import com.logpm.factorydata.paterson.service.MqWorkerService;
import com.rabbitmq.client.Channel;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.factorydata.FactoryDataConstants;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Component;
import java.io.IOException;
/**
* 监听百得胜订单数据
*
* @author zhaoqiaobo
* @create 2024-03-18
*/
@Slf4j
@Component
@AllArgsConstructor
public class FactoryOrderListener {
private final MqWorkerService mqWorkerService;
@RabbitListener(bindings = @QueueBinding(
value = @Queue(name = FactoryDataConstants.Mq.Queues.BDS_FACTORY_SHIPMENT),
exchange = @Exchange(name = FactoryDataConstants.Mq.Exchanges.FACTORY_ORDER, type = ExchangeTypes.TOPIC),
key = FactoryDataConstants.Mq.RoutingKeys.BDS_FACTORY_SHIPMENT
), ackMode = "MANUAL")
public void factoryShipment(String msg, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag) {
log.info("处理百得胜工厂订单:{}", msg);
try {
mqWorkerService.factoryShipment(msg);
} catch (Exception e) {
e.printStackTrace();
log.error("处理百得胜工厂订单失败: {}", e.getMessage());
}
try {
channel.basicAck(tag, false);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}

20
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/pros/FactoryDataPatersonProperties.java

@ -0,0 +1,20 @@
package com.logpm.factorydata.paterson.pros;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* FactoryProperties
*
* @author pref
*/
@Data
@ConfigurationProperties(prefix = "logpm")
public class FactoryDataPatersonProperties {
/**
* 名称
*/
private String name;
}

78
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/pros/PatersonProperties.java

@ -0,0 +1,78 @@
package com.logpm.factorydata.paterson.pros;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* FactoryProperties
*
* @author pref
*/
@Data
@ConfigurationProperties(prefix = "paterson")
@Component
public class PatersonProperties {
/**
* 百得胜工厂推送节点数据url
*/
private String pushNodeUrl;
/**
* 百得胜查询老数据查询老系统数据URL
*/
private String findOldDataUrl = "/openApi/jinpai/code-query";
/**
* 是否推送工厂
*/
private Boolean enable = true;
/**
* 百得胜工厂主机地址
*/
private String host;
/**
* 承运商编码
*/
private String carrierCode;
/**
* 补节点数据时的延时时间分钟
*/
private Integer delayedTime = 30;
/**
* 生成老系统暂存单
*/
private Boolean oldAdvance = false;
/**
* 生成新系统暂存单
*/
private Boolean newAdvance = false;
/**
* 老系统host
*/
private String oldSystemHost;
/**
* 老系统回传到达url
*/
private String oldSystemArrivedUrl;
/**
* 老系统回传入库url
*/
private String oldSystemAlreadyStockedUrl;
private Map<String,String> warehouse;
/** auth过期时间 */
private Long authTime = 30000L;
/** key */
private String auth;
}

14
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/DeliveryNoteService.java

@ -0,0 +1,14 @@
package com.logpm.factorydata.paterson.service;
import com.logpm.factorydata.paterson.vo.FactoryShipmentVO;
/**
* 索菲亚发货单 服务类
*
* @Author zqb
* @Date 2024/4/26
**/
public interface DeliveryNoteService {
void buildFactoryAdvance(FactoryShipmentVO vo);
}

14
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/FactoryOrderLogService.java

@ -0,0 +1,14 @@
package com.logpm.factorydata.paterson.service;
import com.logpm.factorydata.paterson.entity.FactoryOrderLogEntity;
import org.springblade.core.mp.base.BaseService;
/**
* 工厂订单日志 服务类
*
* @Author zqb
* @Date 2024/4/26
**/
public interface FactoryOrderLogService extends BaseService<FactoryOrderLogEntity> {
}

14
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/FactoryOrderService.java

@ -0,0 +1,14 @@
package com.logpm.factorydata.paterson.service;
import com.logpm.factorydata.paterson.entity.FactoryOrderEntity;
import org.springblade.core.mp.base.BaseService;
/**
* 百得胜工厂订单 服务类
*
* @Author zqb
* @Date 2024/4/26
**/
public interface FactoryOrderService extends BaseService<FactoryOrderEntity> {
}

14
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/FactoryPackageService.java

@ -0,0 +1,14 @@
package com.logpm.factorydata.paterson.service;
import com.logpm.factorydata.paterson.entity.FactoryPackageEntity;
import org.springblade.core.mp.base.BaseService;
/**
* 百得胜工厂包件 服务类
*
* @Author zqb
* @Date 2024/4/26
**/
public interface FactoryPackageService extends BaseService<FactoryPackageEntity> {
}

19
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/FactoryShipmentService.java

@ -0,0 +1,19 @@
package com.logpm.factorydata.paterson.service;
import com.logpm.factorydata.paterson.entity.FactoryShipmentEntity;
import com.logpm.factorydata.paterson.vo.FactoryAuthVO;
import com.logpm.factorydata.paterson.vo.FactoryShipmentVO;
import org.springblade.core.mp.base.BaseService;
/**
* 百得胜工厂发货单 服务类
*
* @Author zqb
* @Date 2024/4/26
**/
public interface FactoryShipmentService extends BaseService<FactoryShipmentEntity> {
FactoryAuthVO findFactoryAuth(String companyCode);
String shipment(FactoryShipmentVO bean);
}

13
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/MqWorkerService.java

@ -0,0 +1,13 @@
package com.logpm.factorydata.paterson.service;
/**
* 消息队列工作类 服务类
*
* @Author zqb
* @Date 2024/4/26
**/
public interface MqWorkerService {
void factoryShipment(String msg);
}

181
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/impl/DeliveryNoteServiceImpl.java

@ -0,0 +1,181 @@
package com.logpm.factorydata.paterson.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.logpm.factorydata.base.feign.IFactoryDataBaseClient;
import com.logpm.factorydata.base.vo.FactoryWarehouseBindVO;
import com.logpm.factorydata.enums.BrandEnums;
import com.logpm.factorydata.feign.IFactoryDataClient;
import com.logpm.factorydata.paterson.service.DeliveryNoteService;
import com.logpm.factorydata.paterson.vo.FactoryOrderVO;
import com.logpm.factorydata.paterson.vo.FactoryPackageVO;
import com.logpm.factorydata.paterson.vo.FactoryShipmentVO;
import com.logpm.factorydata.vo.SendMsg;
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity;
import com.logpm.trunkline.entity.TrunklineAdvanceEntity;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.annotations.LogpmAsync;
import org.springblade.common.constant.HttpConstants;
import org.springblade.common.constant.factorydata.FactoryDataConstants;
import org.springblade.core.tool.api.R;
import org.springblade.resource.feign.IOssClient;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/**
* 发货单 业务实现类
*
* @Author zqb
* @Date 2024/4/26
**/
@Slf4j
@Service
public class DeliveryNoteServiceImpl implements DeliveryNoteService {
@Resource
private IFactoryDataClient factoryDataClient;
@Resource
private IOssClient ossClient;
@Resource
private IFactoryDataBaseClient baseClient;
@Override
@LogpmAsync("asyncExecutor")
public void buildFactoryAdvance(FactoryShipmentVO vo) {
// 新起线程构建暂存单发送mq
Long startWarehouseId = null;
String startWarehouseName = null;
String tenantId = null;
// 获取工厂基地绑定的始发仓信息
List<FactoryOrderVO> details = vo.getOrderList();
if (CollUtil.isEmpty(details)) {
return;
}
R<FactoryWarehouseBindVO> warehouseByBrandAndSiteName = baseClient.getWarehouseByBrandAndSiteName(BrandEnums.BDS.getValue(), vo.getShipmentHub());
if (ObjectUtil.equal(HttpConstants.HTTP.HTTP_RESOURCE_CODE.SUCCESS_CODE, warehouseByBrandAndSiteName.getCode())) {
FactoryWarehouseBindVO data = warehouseByBrandAndSiteName.getData();
if (ObjectUtil.isNotNull(data)) {
startWarehouseId = data.getWarehouseId();
startWarehouseName = data.getWarehouseName();
tenantId = data.getTenantId();
}
}
// 一个dd单号 一个暂存单
// 组装暂存单数据
List<JSONObject> advances = new ArrayList<>();
for (FactoryOrderVO orderInfoVO : details) {
List<JSONObject> packageList = new ArrayList<>();
TrunklineAdvanceEntity advanceEntity = new TrunklineAdvanceEntity();
Boolean checked = vo.getChecked();
if (checked) {
advanceEntity.setReserve2("1");
} else {
advanceEntity.setReserve2("0");
}
advanceEntity.setTenantId(tenantId);
advanceEntity.setStatus(0);
advanceEntity.setIsDeleted(0);
advanceEntity.setHasPackage(1);
advanceEntity.setOrderType("");
advanceEntity.setBrand(BrandEnums.BDS.getValue());
advanceEntity.setSiteName(vo.getShipmentHub());
advanceEntity.setArea("");
advanceEntity.setTotalNum(CollUtil.isNotEmpty(orderInfoVO.getPackageList()) ? orderInfoVO.getPackageList().size() : 0);
advanceEntity.setPackName("");
advanceEntity.setPackCode("");
advanceEntity.setWarehouseId(startWarehouseId);
advanceEntity.setWarehouseName(startWarehouseName);
advanceEntity.setIsGcp(0);
advanceEntity.setCarrierName("");
advanceEntity.setSystemType("线上");
advanceEntity.setMatingType("1");
advanceEntity.setSenderName("");
advanceEntity.setSenderPhone("");
advanceEntity.setSenderAddress("");
advanceEntity.setWaybillStatus("0");
advanceEntity.setWaybillNo("");
advanceEntity.setTrainNumber(vo.getShipmentId());
advanceEntity.setFreezeStatus("0");
advanceEntity.setOrderCode(orderInfoVO.getOrderCode());
advanceEntity.setServiceNum(orderInfoVO.getServiceNum());
advanceEntity.setSenderFactory("百得胜");
// 门店是商场
// advanceEntity.setDealerCode(orderInfoVO.getShopCode());
advanceEntity.setDealerName(orderInfoVO.getMallName());
// advanceEntity.setStoreCode(orderInfoVO.getShopCode());
advanceEntity.setStoreName(orderInfoVO.getStoreName());
// 安装是客户
advanceEntity.setCustomerName(orderInfoVO.getReceiverName());
advanceEntity.setCustomerPhone(orderInfoVO.getReceiverMobile());
advanceEntity.setCustomerAddress(orderInfoVO.getReceiverAddress());
// 收货人就是商场收货人
advanceEntity.setConsigneePerson(orderInfoVO.getMallConsignee());
advanceEntity.setConsigneeMobile(orderInfoVO.getMallConsigneeMobile());
advanceEntity.setConsigneeAddress(orderInfoVO.getMallAddress());
// 封装包件品类信息
for (FactoryPackageVO packageInfoVO : orderInfoVO.getPackageList()) {
// 封装包件
TrunklineAdvanceDetailEntity advanceDetailEntity = new TrunklineAdvanceDetailEntity();
advanceDetailEntity.setWarehouseId(startWarehouseId);
advanceDetailEntity.setWarehouseName(startWarehouseName);
advanceDetailEntity.setOrderCode(orderInfoVO.getOrderCode());
advanceDetailEntity.setBrand(BrandEnums.BDS.getValue());
advanceDetailEntity.setSystemType("线上");
// 获取映射品类信息
advanceDetailEntity.setFirstPackName(packageInfoVO.getFirstPackName());
advanceDetailEntity.setFirstPackCode(packageInfoVO.getFirstPackCode());
advanceDetailEntity.setSecondPackName(packageInfoVO.getSecondPackName());
advanceDetailEntity.setSecondPackCode(packageInfoVO.getSecondPackCode());
advanceDetailEntity.setThirdPackName(packageInfoVO.getThirdPackName());
advanceDetailEntity.setThirdPackCode(packageInfoVO.getThirdPackCode());
advanceDetailEntity.setSiteName(vo.getShipmentHub());
advanceDetailEntity.setSiteCode("");
advanceDetailEntity.setQuantity(1);
advanceDetailEntity.setOrderPackageCode(packageInfoVO.getUnitNo());
advanceDetailEntity.setTrainNumber(vo.getShipmentId());
advanceDetailEntity.setServiceNum(orderInfoVO.getServiceNum());
advanceDetailEntity.setWaybillNo("");
advanceDetailEntity.setPackageStatus("0");
advanceDetailEntity.setWeight(NumberUtil.toBigDecimal(packageInfoVO.getWeight()));
advanceDetailEntity.setVolume(NumberUtil.toBigDecimal(packageInfoVO.getVolume()));
// advanceDetailEntity.setChargeType(0);
advanceDetailEntity.setSupple("");
advanceDetailEntity.setManifest("");
advanceDetailEntity.setReturnNum("");
advanceDetailEntity.setSendDateStr(DateUtil.formatLocalDateTime(LocalDateTime.now()));
advanceDetailEntity.setCarNumber("");
advanceDetailEntity.setGoodsMan("");
advanceDetailEntity.setTenantId(tenantId);
advanceDetailEntity.setStatus(0);
advanceDetailEntity.setIsDeleted(0);
JSONObject entries = JSONUtil.parseObj(advanceDetailEntity);
packageList.add(entries);
}
// 转成json对象,然后将包件明细放到detail中
JSONObject entries = JSONUtil.parseObj(advanceEntity);
entries.set("details", JSONUtil.toJsonStr(packageList));
advances.add(entries);
}
// 将组装好的暂存单发送到 MQ ,由暂存单服务统一消费SendMsg.
if (CollUtil.isNotEmpty(advances)) {
for (JSONObject advance : advances) {
SendMsg sendMsg = SendMsg.builder().exchange(FactoryDataConstants.Mq.Exchanges.ADVANCE_ORDER)
.routingKey(FactoryDataConstants.Mq.RoutingKeys.ADVANCE_ORDER).message(JSONUtil.toJsonStr(advance)).build();
factoryDataClient.sendMessage(sendMsg);
}
}
}
}

22
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/impl/FactoryOrderLogServiceImpl.java

@ -0,0 +1,22 @@
package com.logpm.factorydata.paterson.service.impl;
import com.logpm.factorydata.paterson.entity.FactoryOrderLogEntity;
import com.logpm.factorydata.paterson.mapper.FactoryOrderLogMapper;
import com.logpm.factorydata.paterson.service.FactoryOrderLogService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* 工厂订单日志 业务实现类
*
* @Author zqb
* @Date 2024/4/26
**/
@Slf4j
@Service
@AllArgsConstructor
public class FactoryOrderLogServiceImpl extends BaseServiceImpl<FactoryOrderLogMapper, FactoryOrderLogEntity> implements FactoryOrderLogService {
}

22
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/impl/FactoryOrderServiceImpl.java

@ -0,0 +1,22 @@
package com.logpm.factorydata.paterson.service.impl;
import com.logpm.factorydata.paterson.entity.FactoryOrderEntity;
import com.logpm.factorydata.paterson.mapper.FactoryOrderMapper;
import com.logpm.factorydata.paterson.service.FactoryOrderService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* 百得胜工厂订单 业务实现类
*
* @Author zqb
* @Date 2024/4/26
**/
@Slf4j
@Service
@AllArgsConstructor
public class FactoryOrderServiceImpl extends BaseServiceImpl<FactoryOrderMapper, FactoryOrderEntity> implements FactoryOrderService {
}

22
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/impl/FactoryPackageServiceImpl.java

@ -0,0 +1,22 @@
package com.logpm.factorydata.paterson.service.impl;
import com.logpm.factorydata.paterson.entity.FactoryPackageEntity;
import com.logpm.factorydata.paterson.mapper.FactoryPackageMapper;
import com.logpm.factorydata.paterson.service.FactoryPackageService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* 百得胜工厂包件 业务实现类
*
* @Author zqb
* @Date 2024/4/26
**/
@Slf4j
@Service
@AllArgsConstructor
public class FactoryPackageServiceImpl extends BaseServiceImpl<FactoryPackageMapper, FactoryPackageEntity> implements FactoryPackageService {
}

137
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/impl/FactoryShipmentServiceImpl.java

@ -0,0 +1,137 @@
package com.logpm.factorydata.paterson.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.logpm.factorydata.enums.SaxStatusEnums;
import com.logpm.factorydata.feign.IFactoryDataClient;
import com.logpm.factorydata.paterson.entity.FactoryOrderLogEntity;
import com.logpm.factorydata.paterson.entity.FactoryShipmentEntity;
import com.logpm.factorydata.paterson.mapper.FactoryShipmentMapper;
import com.logpm.factorydata.paterson.service.FactoryOrderLogService;
import com.logpm.factorydata.paterson.service.FactoryShipmentService;
import com.logpm.factorydata.paterson.vo.FactoryAuthVO;
import com.logpm.factorydata.paterson.vo.FactoryShipmentVO;
import com.logpm.factorydata.vo.SendMsg;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.io.IOUtils;
import org.jetbrains.annotations.NotNull;
import org.springblade.common.constant.factorydata.FactoryDataConstants;
import org.springblade.common.utils.FileLogsUtil;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.api.R;
import org.springblade.resource.feign.IOssClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.time.Duration;
import java.util.List;
/**
* 百得胜工厂发货单 业务实现类
*
* @Author zqb
* @Date 2024/4/26
**/
@Slf4j
@Service
public class FactoryShipmentServiceImpl extends BaseServiceImpl<FactoryShipmentMapper, FactoryShipmentEntity> implements FactoryShipmentService {
@Resource
private BladeRedis bladeRedis;
@Resource
private IOssClient ossClient;
@Resource
private IFactoryDataClient factoryDataClient;
@Resource
private FactoryOrderLogService factoryOrderLogService;
@Override
public FactoryAuthVO findFactoryAuth(String companyCode) {
// redis 缓存数据 缓存时间 1天
if (StrUtil.isNotBlank(companyCode)) {
String key = "factory-data:bds:" + companyCode;
String json = bladeRedis.get(key);
if (StrUtil.isNotBlank(json)) {
return JSONUtil.toBean(json, FactoryAuthVO.class);
} else {
List<FactoryAuthVO> factoryAuth = baseMapper.findFactoryAuth(companyCode);
if(CollUtil.isNotEmpty(factoryAuth)){
FactoryAuthVO authVO = factoryAuth.get(0);
bladeRedis.setEx(key, JSONUtil.toJsonStr(authVO), Duration.ofDays(1));
return authVO;
}
}
}
return null;
}
@Override
public String shipment(FactoryShipmentVO vo) {
// 1 上传数据到 minio 获取到地址
String url = uploadFile(JSONUtil.toJsonStr(vo));
// 2 保存地址到数据库
FactoryOrderLogEntity logEntity = new FactoryOrderLogEntity();
logEntity.setType(2);
logEntity.setSaxStatus(SaxStatusEnums.NOMAL.getCode());
logEntity.setLogUrl(url);
factoryOrderLogService.save(logEntity);
// 3 将消息发送给 mq,解析保存
SendMsg build = SendMsg.builder().exchange(FactoryDataConstants.Mq.Exchanges.FACTORY_ORDER)
.routingKey(FactoryDataConstants.Mq.RoutingKeys.BDS_FACTORY_SHIPMENT).message(JSONUtil.toJsonStr(logEntity)).build();
factoryDataClient.sendMessage(build);
return "成功";
}
private String uploadFile(String body) {
// 文本内容和保存为本地文件 并上传
String logPath = FileLogsUtil.saveFileLogs(body);
log.info(">>> 文件路径 {}", logPath);
MultipartFile multi = getMultipartFile(logPath);
// 上传到服务器
R r = ossClient.fileUpload(multi, "bds-order-logs");
if (r.isSuccess()) {
BladeFile data = (BladeFile) r.getData();
// 删除本地文件
FileUtil.del(logPath);
return data.getLink();
}
return null;
}
@NotNull
private MultipartFile getMultipartFile(String logPath) {
File file = new File(logPath);
// File 转 MultipartFile
FileItem item = new DiskFileItemFactory().createItem("file"
, MediaType.MULTIPART_FORM_DATA_VALUE
, true
, file.getName());
try (
InputStream input = Files.newInputStream(file.toPath());
OutputStream os = item.getOutputStream()) {
// 流转移
IOUtils.copy(input, os);
} catch (Exception e) {
throw new IllegalArgumentException("Invalid file: " + e, e);
}
return new CommonsMultipartFile(item);
}
}

139
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/service/impl/MqWorkerServiceImpl.java

@ -0,0 +1,139 @@
package com.logpm.factorydata.paterson.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.factorydata.enums.SaxStatusEnums;
import com.logpm.factorydata.paterson.entity.FactoryOrderLogEntity;
import com.logpm.factorydata.paterson.entity.FactoryOrderEntity;
import com.logpm.factorydata.paterson.entity.FactoryPackageEntity;
import com.logpm.factorydata.paterson.entity.FactoryShipmentEntity;
import com.logpm.factorydata.paterson.service.DeliveryNoteService;
import com.logpm.factorydata.paterson.service.FactoryOrderLogService;
import com.logpm.factorydata.paterson.service.FactoryOrderService;
import com.logpm.factorydata.paterson.service.FactoryPackageService;
import com.logpm.factorydata.paterson.service.FactoryShipmentService;
import com.logpm.factorydata.paterson.service.MqWorkerService;
import com.logpm.factorydata.paterson.vo.FactoryOrderVO;
import com.logpm.factorydata.paterson.vo.FactoryPackageVO;
import com.logpm.factorydata.paterson.vo.FactoryShipmentVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.secure.utils.AuthUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
* 消息队列工作类 业务实现类
*
* @Author zqb
* @Date 2024/4/26
**/
@Slf4j
@Service
@AllArgsConstructor
public class MqWorkerServiceImpl implements MqWorkerService {
private final DeliveryNoteService deliveryNoteService;
private final FactoryOrderLogService logService;
private final FactoryShipmentService jpFactoryShipmentService;
private final FactoryOrderService jpFactoryOrderService;
private final FactoryPackageService jpFactoryPackageService;
@Override
@Transactional(rollbackFor = Exception.class)
public void factoryShipment(String msg) {
if (StrUtil.isEmpty(msg)) {
log.error("消息内容为空");
return;
}
FactoryOrderLogEntity logEntity = JSONUtil.toBean(msg, FactoryOrderLogEntity.class);
if (ObjectUtil.isEmpty(logEntity)) {
log.error("消息内容为空");
return;
}
// 去 minio 下载文件到本地,然后解析文件内容为实体对象
FactoryShipmentVO pushOrderVO = null;
String logUrl = logEntity.getLogUrl();
if (StrUtil.isNotEmpty(logUrl)) {
List<String> res = new ArrayList<>();
FileUtil.readLines(URLUtil.url(logUrl), CharsetUtil.CHARSET_UTF_8, res);
if (CollUtil.isNotEmpty(res)) {
String content = res.get(0);
if (StrUtil.isNotEmpty(content)) {
pushOrderVO = JSONUtil.toBean(content, FactoryShipmentVO.class);
}
}
}
shipmentData(pushOrderVO, logEntity);
}
private void shipmentData(FactoryShipmentVO vo, FactoryOrderLogEntity logEntity) {
if (ObjectUtil.isNotEmpty(vo)) {
// 1 解析数据保存入库
// 装车单号唯一
Long logId = logEntity.getId();
String truckNo = vo.getShipmentId();
if (StrUtil.isEmpty(truckNo)) {
return;
}
List<FactoryShipmentEntity> list = jpFactoryShipmentService.list(Wrappers.<FactoryShipmentEntity>lambdaQuery().eq(FactoryShipmentEntity::getShipmentId, truckNo));
Boolean checked = Boolean.FALSE;
if (CollUtil.isNotEmpty(list)) {
if (list.size() > 1) {
return;
}
checked = Boolean.TRUE;
}
vo.setChecked(checked);
vo.setLogId(ObjectUtil.isNotEmpty(logId) ? logId.toString() : null);
vo.setTenantCode(AuthUtil.getTenantId());
jpFactoryShipmentService.save(vo);
List<FactoryOrderVO> orderVOS = vo.getOrderList();
if (CollUtil.isNotEmpty(orderVOS)) {
List<FactoryPackageEntity> packageEntities = new ArrayList<>();
for (FactoryOrderVO orderVO : orderVOS) {
FactoryOrderEntity orderEntity = new FactoryOrderEntity();
BeanUtil.copyProperties(orderVO, orderEntity);
orderEntity.setLogId(ObjectUtil.isNotEmpty(logId) ? logId.toString() : null);
orderEntity.setShipmentId(vo.getId());
orderEntity.setChecked(checked);
orderEntity.setTenantCode(AuthUtil.getTenantId());
jpFactoryOrderService.save(orderEntity);
List<FactoryPackageVO> packageList = orderVO.getPackageList();
if (CollUtil.isNotEmpty(packageList)) {
for (FactoryPackageVO jpFactoryPackageVO : packageList) {
FactoryPackageEntity packageEntity = new FactoryPackageEntity();
BeanUtil.copyProperties(jpFactoryPackageVO, packageEntity);
packageEntity.setLogId(ObjectUtil.isNotEmpty(logId) ? logId.toString() : null);
packageEntity.setOrderId(orderEntity.getId());
packageEntity.setChecked(checked);
packageEntity.setTenantCode(AuthUtil.getTenantId());
packageEntities.add(packageEntity);
}
}
}
if (CollUtil.isNotEmpty(packageEntities)) {
jpFactoryPackageService.saveBatch(packageEntities);
}
}
// 2 构建暂存单,发送 mq 消息
FactoryOrderLogEntity logEntity1 = new FactoryOrderLogEntity();
logEntity1.setSaxStatus(SaxStatusEnums.SUCCESS.getCode());
logEntity1.setId(logId);
logService.saveOrUpdate(logEntity1);
// 处理暂存单
deliveryNoteService.buildFactoryAdvance(vo);
}
}
}

30
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/vo/FactoryAuthVO.java

@ -0,0 +1,30 @@
package com.logpm.factorydata.paterson.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 物流商认证
*
* @author zhaoqiaobo
* @create 2024-04-26
*/
@Data
public class FactoryAuthVO {
@ApiModelProperty(name = "物流编码")
private String logisticsCode;
@ApiModelProperty(name = "秘钥")
private String appKey;
@ApiModelProperty(name = "auth过期时间")
private Long authTime;
@ApiModelProperty(name = "物流公司")
private String companyCode;
@ApiModelProperty(name = "租户")
private String tenantCode;
@ApiModelProperty(name = "登录账号")
private String loginAccount;
@ApiModelProperty(name = "Authorization头")
private String authorizationHeader;
}

27
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/vo/FactoryOrderDataVO.java

@ -0,0 +1,27 @@
package com.logpm.factorydata.paterson.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 送货单 实体类
*
* @author zhaoqiaobo
* @create 2024-04-26
*/
@Data
@ApiModel(value = "发货单", description = "发货单")
public class FactoryOrderDataVO {
@ApiModelProperty("加密后的密文")
private String digest;
@ApiModelProperty("时间戳 毫秒")
private Long timestamp;
@ApiModelProperty("公司编码")
private String companyCode;
@ApiModelProperty("订单信息")
private String params;
}

25
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/vo/FactoryOrderVO.java

@ -0,0 +1,25 @@
package com.logpm.factorydata.paterson.vo;
import com.logpm.factorydata.paterson.entity.FactoryOrderEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* 送货单 实体类
*
* @author zhaoqiaobo
* @create 2024-04-26
*/
@Data
@ApiModel(value = "发货单", description = "发货单")
@EqualsAndHashCode(callSuper = true)
public class FactoryOrderVO extends FactoryOrderEntity {
@ApiModelProperty(name = "包件明细")
private List<FactoryPackageVO> packageList;
}

21
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/vo/FactoryPackageVO.java

@ -0,0 +1,21 @@
package com.logpm.factorydata.paterson.vo;
import com.logpm.factorydata.paterson.entity.FactoryPackageEntity;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 送货单 实体类
*
* @author zhaoqiaobo
* @create 2024-04-26
*/
@Data
@ApiModel(value = "发货单", description = "发货单")
@EqualsAndHashCode(callSuper = true)
public class FactoryPackageVO extends FactoryPackageEntity {
}

25
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/vo/FactoryShipmentVO.java

@ -0,0 +1,25 @@
package com.logpm.factorydata.paterson.vo;
import com.logpm.factorydata.paterson.entity.FactoryShipmentEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* 送货单 实体类
*
* @author zhaoqiaobo
* @create 2024-04-26
*/
@Data
@ApiModel(value = "发货单", description = "发货单")
@EqualsAndHashCode(callSuper = true)
public class FactoryShipmentVO extends FactoryShipmentEntity {
@ApiModelProperty(name = "订单明细")
private List<FactoryOrderVO> orderList;
}

26
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/vo/PackageCategoryVO.java

@ -0,0 +1,26 @@
package com.logpm.factorydata.paterson.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqiaobo
* @create 2024-04-30
*/
@Data
public class PackageCategoryVO implements Serializable {
@ApiModelProperty(name = "一级品类")
private String typea;
@ApiModelProperty(name = "二级品类")
private String typeb;
@ApiModelProperty(name = "三级品类")
private String typec;
@ApiModelProperty(name = "包件码")
private String extBoxCode;
@ApiModelProperty(name = "包件类型")
private String extBoxType;
}

32
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/vo/ThirdPlWarehouseMappingVO.java

@ -0,0 +1,32 @@
package com.logpm.factorydata.paterson.vo;
import lombok.Data;
import java.io.Serializable;
/**
* 百得胜三方物流仓库映射表
* @author zhaoqiaobo
* @create 2024-04-30
*/
@Data
public class ThirdPlWarehouseMappingVO implements Serializable {
/**
* 到站网点
*/
private String arriveOrgName;
/**
* 仓库id
*/
private String warehouseId;
/**
* 仓库名称
*/
private String warehouseName;
/**
* 租户id
*/
private String tenantId;
}

38
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/wrapper/CustomHttpServletRequestWrapper.java

@ -0,0 +1,38 @@
package com.logpm.factorydata.paterson.wrapper;
import org.springframework.http.HttpHeaders;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
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);
}
}

75
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/java/com/logpm/factorydata/paterson/wrapper/RequestWrapper.java

@ -0,0 +1,75 @@
package com.logpm.factorydata.paterson.wrapper;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class RequestWrapper extends HttpServletRequestWrapper {
private final String body;
public RequestWrapper(HttpServletRequest request) throws IOException {
super(request);
StringBuilder stringBuilder = new StringBuilder();
BufferedReader bufferedReader = null;
try {
InputStream inputStream = request.getInputStream();
if (inputStream != null) {
bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
char[] charBuffer = new char[128];
int bytesRead = -1;
while ((bytesRead = bufferedReader.read(charBuffer)) > 0) {
stringBuilder.append(charBuffer, 0, bytesRead);
}
} else {
stringBuilder.append("");
}
} catch (IOException ex) {
throw ex;
} finally {
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (IOException ex) {
throw ex;
}
}
}
body = stringBuilder.toString();
}
@Override
public ServletInputStream getInputStream() throws IOException {
final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(body.getBytes());
ServletInputStream servletInputStream = new ServletInputStream() {
@Override
public boolean isFinished() {
return false;
}
@Override
public boolean isReady() {
return false;
}
@Override
public void setReadListener(ReadListener readListener) {}
@Override
public int read() throws IOException {
return byteArrayInputStream.read();
}
};
return servletInputStream;
}
@Override
public BufferedReader getReader() throws IOException {
return new BufferedReader(new InputStreamReader(this.getInputStream()));
}
public String getBody() {
return this.body;
}
}

73
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/resources/application-dev.yml

@ -0,0 +1,73 @@
#服务器端口
server:
port: 19010
#数据源配置
#spring:
# datasource:
# url: ${blade.datasource.dev.url}
# username: ${blade.datasource.dev.username}
# password: ${blade.datasource.dev.password}
spring:
#rabbitmq配置
rabbitmq:
host: 192.168.2.46
port: 5672
username: admin
password: admin
#虚拟host 可以不设置,使用server默认host
virtual-host: /
#确认消息已发送到队列(Queue)
publisher-returns: true
publisher-confirm-type: correlated
# 手动提交消息
listener:
simple:
acknowledge-mode: auto
default-requeue-rejected: false
retry:
enabled: true # 开启消费者失败重试
initial-interval: 1000 # 初识的失败等待时长为1秒
multiplier: 1 # 失败的等待时长倍数,下次等待时长 = multiplier * last-interval
max-attempts: 3 # 最大重试次数
stateless: true # true无状态;false有状态。如果业务中包含事务,这里改为false
direct:
acknowledge-mode: manual
template:
mandatory: true
#排除DruidDataSourceAutoConfigure
autoconfigure:
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
dynamic:
druid:
#通用校验配置
validation-query: select 1
#启用sql日志拦截器
proxy-filters:
- sqlLogInterceptor
#设置默认的数据源或者数据源组,默认值即为master
primary: master
datasource:
master:
druid:
#独立校验配置
validation-query: select 1
#oracle校验
#validation-query: select 1 from dual
url: ${blade.datasource.factorydata-bds.master.url}
username: ${blade.datasource.factorydata-bds.master.username}
password: ${blade.datasource.factorydata-bds.master.password}
627683:
druid:
#独立校验配置
validation-query: select 1
#oracle校验
#validation-query: select 1 from dual
url: ${blade.datasource.factorydata-bds.627683.url}
username: ${blade.datasource.factorydata-bds.627683.username}
password: ${blade.datasource.factorydata-bds.627683.password}
blade:
data-scope:
enabled: false

47
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/resources/application-prod.yml

@ -0,0 +1,47 @@
#服务器端口
server:
port: 19010
#数据源配置
#spring:
# datasource:
# url: ${blade.datasource.dev.url}
# username: ${blade.datasource.dev.username}
# password: ${blade.datasource.dev.password}
spring:
#排除DruidDataSourceAutoConfigure
autoconfigure:
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
dynamic:
druid:
#通用校验配置
validation-query: select 1
#启用sql日志拦截器
proxy-filters:
- sqlLogInterceptor
#设置默认的数据源或者数据源组,默认值即为master
primary: master
datasource:
master:
druid:
#独立校验配置
validation-query: select 1
#oracle校验
#validation-query: select 1 from dual
url: ${blade.datasource.factorydata-bds.master.url}
username: ${blade.datasource.factorydata-bds.master.username}
password: ${blade.datasource.factorydata-bds.master.password}
627683:
druid:
#独立校验配置
validation-query: select 1
#oracle校验
#validation-query: select 1 from dual
url: ${blade.datasource.factorydata-bds.627683.url}
username: ${blade.datasource.factorydata-bds.627683.username}
password: ${blade.datasource.factorydata-bds.627683.password}
blade:
data-scope:
enabled: false

73
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/resources/application-test.yml

@ -0,0 +1,73 @@
#服务器端口
server:
port: 19010
#数据源配置
#spring:
# datasource:
# url: ${blade.datasource.dev.url}
# username: ${blade.datasource.dev.username}
# password: ${blade.datasource.dev.password}
spring:
#rabbitmq配置
rabbitmq:
host: 192.168.2.110
port: 5672
username: admin
password: Slwk@123654
#虚拟host 可以不设置,使用server默认host
virtual-host: /
#确认消息已发送到队列(Queue)
publisher-returns: true
publisher-confirm-type: correlated
# 手动提交消息
listener:
simple:
acknowledge-mode: auto
default-requeue-rejected: false
retry:
enabled: true # 开启消费者失败重试
initial-interval: 1000 # 初识的失败等待时长为1秒
multiplier: 1 # 失败的等待时长倍数,下次等待时长 = multiplier * last-interval
max-attempts: 3 # 最大重试次数
stateless: true # true无状态;false有状态。如果业务中包含事务,这里改为false
direct:
acknowledge-mode: manual
template:
mandatory: true
#排除DruidDataSourceAutoConfigure
autoconfigure:
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
dynamic:
druid:
#通用校验配置
validation-query: select 1
#启用sql日志拦截器
proxy-filters:
- sqlLogInterceptor
#设置默认的数据源或者数据源组,默认值即为master
primary: master
datasource:
master:
druid:
#独立校验配置
validation-query: select 1
#oracle校验
#validation-query: select 1 from dual
url: ${blade.datasource.factorydata-bds.master.url}
username: ${blade.datasource.factorydata-bds.master.username}
password: ${blade.datasource.factorydata-bds.master.password}
627683:
druid:
#独立校验配置
validation-query: select 1
#oracle校验
#validation-query: select 1 from dual
url: ${blade.datasource.factorydata-bds.627683.url}
username: ${blade.datasource.factorydata-bds.627683.username}
password: ${blade.datasource.factorydata-bds.627683.password}
blade:
data-scope:
enabled: false

31
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/resources/application.yml

@ -0,0 +1,31 @@
#mybatis-plus配置
mybatis-plus:
mapper-locations: classpath:com/logpm/**/mapper/*Mapper.xml
#实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: com.logpm.**.entity
#swagger扫描路径配置
swagger:
base-packages:
- org.springblade
- com.logpm
#oss配置
oss:
enabled: true
name: minio
tenant-mode: false
endpoint: http://8.137.14.82:9000
access-key: minio
secret-key: 123123123
bucket-name: bladex
logging:
config: classpath:logback.xml
spring:
main:
allow-circular-references: true

40
blade-service/logpm-factory-data/logpm-factory-data-paterson/src/main/resources/logback.xml

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="false" debug="false">
<contextName>logback</contextName>
<property name="log.path" value="./data/logpm-factory-data-suofeiya/logs/logs.log"/>
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
<conversionRule conversionWord="wex"
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
<conversionRule conversionWord="wEx"
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}.%d{yyyy-MM-dd}.zip</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n
</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="console"/>
<appender-ref ref="file"/>
</root>
</configuration>

49
blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/job/SpiderDataJob.java

@ -25,6 +25,7 @@ import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
@ -62,6 +63,11 @@ public class SpiderDataJob {
@Autowired
private Executor asyncChangeDbExecutor;
@Autowired
private BladeRedis bladeRedis;
private LocalDate firstDayOfMonth;
private LocalDate lastDayOfMonth;
@ -79,6 +85,8 @@ public class SpiderDataJob {
startData =LocalDate.now().toString();
endData = LocalDate.now().minusDays(1).toString();
if(StringUtil.isNotBlank(param)){
if(param.contains(",")){
String[] split = param.split(",");
@ -91,6 +99,14 @@ public class SpiderDataJob {
}
// 获取当前日期的第一天 的日期 和最后一天的日期
LocalDate now = LocalDate.parse(startData);
firstDayOfMonth = now.withDayOfMonth(1);
lastDayOfMonth = now.withDayOfMonth(now.lengthOfMonth());
//
// startData ="2025-02-25";
@ -178,6 +194,7 @@ public class SpiderDataJob {
packageInfoEntity.setUpdateTime(new Date());
packageInfoEntity.setIsDeleted(0);
packageInfoEntity.setStatus(1);
packageInfoEntity.setDealerName(spiderInforEntity.getBindBussiness());
// 判断这个包条是否存在鱼数据库 如果不存在 则执行
@ -195,6 +212,7 @@ public class SpiderDataJob {
vo.setOrderInfo(orderInfo);
vo.setPackageInfo(packageInfoVOs);
}
log.debug(">>>>> vo {}",vo);
asyncChangeDbExecutor.execute(new ChdbTask(spiderInforEntity.getBindTenantCode(), vo,deliveryNoteService));
}
@ -308,14 +326,25 @@ public class SpiderDataJob {
JSONObject jsonObject = getData(url, buildCookies(username, password));
JSONArray temList = jsonObject.getJSONArray("result");
log.debug("getCarOrders 执行时间:{}",temList.size());
for (Object o : temList) {
JSONObject jsonObject1 = (JSONObject) o;
JSONObject list2 = getOrderInfor(jsonObject1.getStr("orderNumber"), username, password);
JSONArray list_2 = list2.getJSONArray("result");
for (Object o1 : list_2) {
JSONObject t = (JSONObject) o1;
result.add(t);
String orderNumber = jsonObject1.getStr("orderNumber");
String key = "sfy:factory:"+orderNumber+".lock";
Object o2 = bladeRedis.get(key);
if(o2 == null){
JSONObject list2 = getOrderInfor(orderNumber, username, password);
JSONArray list_2 = list2.getJSONArray("result");
for (Object o1 : list_2) {
JSONObject t = (JSONObject) o1;
result.add(t);
}
// 单号存储3个小时
bladeRedis.setEx(key,"1",60L);
}
}
@ -339,8 +368,14 @@ public class SpiderDataJob {
*/
private JSONObject getOrderInfor(String orderCode, String username, String password) {
Long _dc_ = System.currentTimeMillis();
String url ="https://portal.sfygroup.com/reporthome/rest/delivedryNotice/all?_dc="+_dc_+"&page=1&start=0&limit=20&filtersRaw=[{\"id\":null,\"property\":\"A.SCHEDULE_DELIVERY_DATE\",\"value\":\""+startData+"\",\"operator\":\">=\",\"sql\":null},{\"id\":null,\"property\":\"A.SCHEDULE_DELIVERY_DATE\",\"value\":\""+endData+"\",\"operator\":\"<\",\"sql\":null},{\"id\":null,\"property\":\"A.ORDER_NUMBER\",\"value\":\""+orderCode+"\",\"operator\":\"like\",\"sql\":null}]";
String url ="https://portal.sfygroup.com/reporthome/rest/delivedryNotice/all?_dc="+_dc_
+"&page=1&start=0&limit=20&filtersRaw=[{\"id\":null,\"property\":\"A.SCHEDULE_DELIVERY_DATE\",\"value\":\""+
firstDayOfMonth+"\",\"operator\":\">=\",\"sql\":null},{\"id\":null,\"property\":\"A.SCHEDULE_DELIVERY_DATE\",\"value\":\""+
lastDayOfMonth+"\",\"operator\":\"<\",\"sql\":null},{\"id\":null,\"property\":\"A.ORDER_NUMBER\",\"value\":\""+orderCode+"\",\"operator\":\"like\",\"sql\":null}]";
JSONObject jsonObject = getData(url, buildCookiesByDD(username, password));
return jsonObject;
@ -385,7 +420,7 @@ public class SpiderDataJob {
JSONArray response = new JSONArray();
//获取订单对应的装箱单
Long _dc_ = System.currentTimeMillis();
String url = "https://portal.sfygroup.com/reporthome/rest/orderPackHead/all?_dc=" + _dc_ + "&page=1&start=0&limit=1000&filtersRaw=[{\"id\":null,\"property\":\"A.ORDER_NUMBER\",\"value\":\"" + orderCode + "\",\"operator\":\"=\",\"sql\":null},{\"id\":null,\"property\":\"A.SCHEDULE_DELIVERY_DATE\",\"value\":\"" + startData + "\",\"operator\":\">=\",\"sql\":null},{\"id\":null,\"property\":\"A.SCHEDULE_DELIVERY_DATE\",\"value\":\"" + endData + "\",\"operator\":\"<\",\"sql\":null}]";
String url = "https://portal.sfygroup.com/reporthome/rest/orderPackHead/all?_dc=" + _dc_ + "&page=1&start=0&limit=1000&filtersRaw=[{\"id\":null,\"property\":\"A.ORDER_NUMBER\",\"value\":\"" + orderCode + "\",\"operator\":\"=\",\"sql\":null},{\"id\":null,\"property\":\"A.SCHEDULE_DELIVERY_DATE\",\"value\":\"" + firstDayOfMonth + "\",\"operator\":\">=\",\"sql\":null},{\"id\":null,\"property\":\"A.SCHEDULE_DELIVERY_DATE\",\"value\":\"" + lastDayOfMonth + "\",\"operator\":\"<\",\"sql\":null}]";
JSONObject data = getData(url, buildCookiesByZx(username, password));
JSONArray tempList = data.getJSONArray("result");
for (Object o : tempList) {

1
blade-service/logpm-factory-data/pom.xml

@ -22,6 +22,7 @@
<module>logpm-factory-data-mwh</module>
<module>logpm-factory-data-mengtian</module>
<module>logpm-factory-data-pan</module>
<module>logpm-factory-data-paterson</module>
</modules>
<properties>

3
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryPackageMapper.xml

@ -22,7 +22,8 @@
ofp.first_class_name,
ofp.second_class_name,
ofp.third_class_name,
ofp.push_status
ofp.push_status,
ofo.business_model
FROM
op_factory_package ofp
LEFT JOIN op_factory_order ofo ON ofo.id = ofp.order_id

2
blade-service/logpm-report/src/main/java/com/logpm/report/config/MybatisPlusConfig.java

@ -63,7 +63,7 @@ public class MybatisPlusConfig implements WebMvcConfigurer {
AnnotationAwareOrderComparator.sort(queryInterceptorArray);
paginationInterceptor.setQueryInterceptors(queryInterceptorArray);
}
paginationInterceptor.setMaxLimit(mybatisPlusProperties.getPageLimit());
paginationInterceptor.setMaxLimit(-1L);
paginationInterceptor.setOverflow(mybatisPlusProperties.getOverflow());
paginationInterceptor.setOptimizeJoin(mybatisPlusProperties.getOptimizeJoin());
paginationInterceptor.setDbType(DbType.MYSQL);

12
blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportIncomingMapper.xml

@ -958,6 +958,12 @@
<if test="param.settlementStatus != null">
and lww.settlement_status = #{param.settlementStatus}
</if>
<if test="param.startTime != null ">
and lww.document_making_time &gt;= #{param.startTime}
</if>
<if test="param.endTime != null ">
and lww.document_making_time &lt;= #{param.endTime}
</if>
GROUP BY lww.id
order by lww.create_time desc
</select>
@ -1251,6 +1257,12 @@
<if test="param.settlementStatus != null">
and lww.settlement_status = #{param.settlementStatus}
</if>
<if test="param.startTime != null ">
and lww.document_making_time &gt;= #{param.startTime}
</if>
<if test="param.endTime != null ">
and lww.document_making_time &lt;= #{param.endTime}
</if>
GROUP BY lww.id
order by lww.create_time desc
</select>

26
blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportTimeMapper.xml

@ -238,14 +238,20 @@
count(lta.waybill_id) openNum,
sum( IF(ltcls.id IS NOT NULL AND ltcll.start_date is not null,1,0) ) startNum,
count(lta.id)-sum( IF(ltcls.id IS NOT NULL AND ltcll.start_date is not null,1,0) ) noOutNum,
sum(if( ltcls.id is null and now() > DATE_ADD( lta.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0)) noOutOverNum,
sum(if( (ltcls.id IS NULL OR ltcll.start_date IS NULL) and now() > DATE_ADD( lta.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0)) noOutOverNum,
sum(if(ltcll.start_date &lt;= DATE_ADD( lta.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0)) onTimeNum,
IFNULL(round(sum(if(ltcll.start_date &lt;= DATE_ADD( lta.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0))/count(lta.id)*100,2),'0.00') onTimeRate,
round(sum(TIMESTAMPDIFF(SECOND, lta.create_time, ltcll.start_date))/count(ltcls.id)/3600,1) avgTime
from logpm_trunkline_advance_detail lta
left join logpm_warehouse_waybill lww on lww.id = lta.waybill_id
left join logpm_warehouse_warehouse waw on waw.id = lta.warehouse_id
left join logpm_trunkline_cars_load_scan ltcls on ltcls.scan_code = lta.order_package_code and ltcls.warehouse_id = lta.warehouse_id and ltcls.type = 1 and ltcls.scan_status != 4
left join (
SELECT
t1.*
FROM logpm_trunkline_cars_load_scan t1
LEFT JOIN logpm_trunkline_cars_load_scan t2 ON t1.scan_code = t2.scan_code AND t1.create_time &lt; t2.create_time
WHERE t2.scan_code IS NULL
) ltcls on ltcls.scan_code = lta.order_package_code and ltcls.warehouse_id = lta.warehouse_id and ltcls.type = 1 and ltcls.scan_status != 4
left join logpm_trunkline_cars_load_line ltcll on ltcll.load_id = ltcls.load_id and ltcll.node_id = ltcls.warehouse_id
where lta.create_time &gt; '2024-10-22 00:00:00'
and lww.document_making_time &gt; '2024-10-22 00:00:00'
@ -299,14 +305,20 @@
count(lta.waybill_id) openNum,
sum( IF(ltcls.id IS NOT NULL AND ltcll.start_date is not null,1,0) ) startNum,
count(lta.id)-sum( IF(ltcls.id IS NOT NULL AND ltcll.start_date is not null,1,0) ) noOutNum,
sum(if( ltcls.id is null and now() > DATE_ADD( lta.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0)) noOutOverNum,
sum(if( (ltcls.id IS NULL OR ltcll.start_date IS NULL) and now() > DATE_ADD( lta.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0)) noOutOverNum,
sum(if(ltcll.start_date &lt;= DATE_ADD( lta.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0)) onTimeNum,
IFNULL(concat(round(sum(if(ltcll.start_date &lt;= DATE_ADD( lta.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0))/count(ltcls.id)*100,2),'%'),'0.00%') onTimeRate,
IFNULL(concat(round(sum(if(ltcll.start_date &lt;= DATE_ADD( lta.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0))/count(lta.id)*100,2),'%'),'0.00%') onTimeRate,
round(sum(TIMESTAMPDIFF(SECOND, lta.create_time, ltcll.start_date))/count(ltcls.id)/3600,1) avgTime
from logpm_trunkline_advance_detail lta
left join logpm_warehouse_waybill lww on lww.id = lta.waybill_id
left join logpm_warehouse_warehouse waw on waw.id = lta.warehouse_id
left join logpm_trunkline_cars_load_scan ltcls on ltcls.scan_code = lta.order_package_code and ltcls.warehouse_id = lta.warehouse_id and ltcls.type = 1 and ltcls.scan_status != 4
left join (
SELECT
t1.*
FROM logpm_trunkline_cars_load_scan t1
LEFT JOIN logpm_trunkline_cars_load_scan t2 ON t1.scan_code = t2.scan_code AND t1.create_time &lt; t2.create_time
WHERE t2.scan_code IS NULL
) ltcls on ltcls.scan_code = lta.order_package_code and ltcls.warehouse_id = lta.warehouse_id and ltcls.type = 1 and ltcls.scan_status != 4
left join logpm_trunkline_cars_load_line ltcll on ltcll.load_id = ltcls.load_id and ltcll.node_id = ltcls.warehouse_id
where lta.create_time &gt; '2024-10-22 00:00:00'
and lww.document_making_time &gt; '2024-10-22 00:00:00'
@ -2826,7 +2838,7 @@
</if>
<if test="param.startDetailType != null and param.startDetailType ==4">
and ltcls.id is null
and now() &lt;= DATE_ADD( ltad.create_time, INTERVAL #{param.hoursTime} HOUR )
and now() > DATE_ADD( ltad.create_time, INTERVAL #{param.hoursTime} HOUR )
</if>
group by ltad.id
</select>
@ -2928,7 +2940,7 @@
</if>
<if test="param.startDetailType != null and param.startDetailType ==4">
and ltcls.id is null
and now() &lt;= DATE_ADD( ltad.create_time, INTERVAL #{param.hoursTime} HOUR )
and now() > DATE_ADD( ltad.create_time, INTERVAL #{param.hoursTime} HOUR )
</if>
group by ltad.id
</select>

5
blade-service/logpm-report/src/main/java/com/logpm/report/mapper/TrunklinePickupMapper.xml

@ -248,7 +248,7 @@
</sql>
<select id="b2BDeliveryTimelinessPage" resultType="com.logpm.report.vo.trunklinebillloading.B2BDeliverTimelinessVO">
select
select * from (select
<if test="query.businessLineRange == null or query.businessLineRange == ''">
'全部' businessLine,
</if>
@ -295,7 +295,7 @@
when ifnull(ldsa.type_service, '1') = '4' then '三方中转' end as type_service,
count(distinct t.order_code) orderNum, sum(t.quantity) num
from logpm_distribution_parcel_list t
join logpm_distribution_stock_article ldsa on ldsa.order_code = t.order_code and ldsa.is_deleted = 0
join logpm_distribution_stock_article ldsa on ldsa.id = t.stock_article_id and ldsa.is_deleted = 0
left join logpm_warehouse_warehouse lww on lww.id = t.warehouse_id
where t.warehouse_entry_time_end >= #{query.startCreateTime} and t.warehouse_entry_time_end &lt;= #{query.endCreateTime}
and t.is_transfer = 0 and ldsa.type_service != '2'
@ -407,6 +407,7 @@
</if>
</trim>
</if>
) t
</select>
<select id="efficiencyCostPage"

2
blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportDeliverServiceImpl.java

@ -457,7 +457,7 @@ public class ReportDeliverServiceImpl implements ReportDeliverService {
@Override
public void exportDetailsV3(HttpServletResponse response, DevilerDetailsQuery query) {
IPage<ReportDetailVO> page = Condition.getPage(query);
page.setPages(1);
page.setPages(-1);
page.setSize(-1);
Integer more = 1;
if (StrUtil.isEmpty(query.getWarehouseNameRange())) {

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

@ -1093,9 +1093,14 @@ public class CarsLoadController {
// return R.fail(405,"未知的发车类型");
// }
carsLoadService.unloadByLoadId(loadCarsDTO);
try{
//同步一次系统无编码数据
carsLoadService.syncNoSystemData(loadId, myCurrentWarehouse.getId(), myCurrentWarehouse.getName());
carsLoadService.unloadByLoadId(loadCarsDTO);
carsLoadService.sendStationArrivedEnter(loadCarsDTO);
}catch (Exception e){

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

@ -5,13 +5,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity;
import com.logpm.trunkline.service.ITrunklineAdvanceDetailService;
import com.logpm.trunkline.vo.TrunklineAdvanceDetailVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -72,4 +72,9 @@ public class TrunklineAdvanceDetailClient implements ITrunklineAdvanceDetailClie
return advanceDetailService.maintainMaterial(map);
}
@Override
public List<TrunklineAdvanceDetailEntity> findListByStockArticleId(Long stockArticleId, Long warehouseId) {
return advanceDetailService.findListByStockArticleId(stockArticleId,warehouseId);
}
}

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

@ -107,4 +107,5 @@ public interface TrunklineAdvanceDetailMapper extends BaseMapper<TrunklineAdvanc
void deleteListByIds(@Param("advanceDetailIdList") List<Long> advanceDetailIdList);
List<TrunklineAdvanceDetailEntity> findListByStockArticleId(@Param("stockArticleId") Long stockArticleId, @Param("warehouseId") Long warehouseId);
}

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

@ -748,4 +748,15 @@
</foreach>
</delete>
<select id="findListByStockArticleId" resultType="com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity">
select ltad.*
from logpm_trunkline_advance_detail ltad
left join logpm_distribution_parcel_list ldpl on ldpl.order_package_code = ltad.order_package_code
where ldpl.stock_article_id = #{stockArticleId}
and ldpl.warehouse_id = #{warehouseId}
and ltad.is_deleted = 0
and ldpl.is_deleted = 0
and ldpl.id is null
</select>
</mapper>

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

@ -93,7 +93,6 @@
<select id="selectInfoByIds" resultType="com.logpm.trunkline.vo.OpenOrderVO">
select GROUP_CONCAT(DISTINCT brand) brand,
GROUP_CONCAT(DISTINCT train_number) trainNumber,
GROUP_CONCAT(DISTINCT order_code) orderCode,
GROUP_CONCAT(DISTINCT dealer_code) dealerCode,
GROUP_CONCAT(DISTINCT dealer_name) dealerName
from logpm_trunkline_advance

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

@ -206,5 +206,5 @@ public interface TrunklineCarsLoadScanMapper extends BaseMapper<TrunklineCarsLoa
String findBrandNameByCarLoadCode(@Param("loadCode") String loadCode);
int findEntityByOrderPackageCodeAndUnloadTime(@Param("orderPackageCode") String orderPackageCode, @Param("unloadTime") Date unloadTime);
int findEntityByOrderPackageCodeAndUnloadTime(@Param("orderPackageCode") String orderPackageCode, @Param("unloadTime") Date unloadTime, @Param("warehouseId") Long warehouseId);
}

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

@ -1233,6 +1233,7 @@
from logpm_trunkline_cars_load_scan ltcls
where ltcls.scan_code = #{orderPackageCode}
and ltcls.unload_time > #{unloadTime}
and ltcls.unload_node_id != #{warehouseId}
</select>

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

@ -129,4 +129,6 @@ public interface ITrunklineAdvanceDetailService extends BaseService<TrunklineAdv
* @return
*/
R maintainMaterial(Map<String, Object> map);
List<TrunklineAdvanceDetailEntity> findListByStockArticleId(Long stockArticleId, Long warehouseId);
}

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

@ -213,5 +213,5 @@ public interface ITrunklineCarsLoadScanService extends BaseService<TrunklineCars
*/
String findBrandNameByCarLoadCode(String loadCode);
int findEntityByOrderPackageCodeAndUnloadTime(String orderPackageCode, Date unloadTime);
int findEntityByOrderPackageCodeAndUnloadTime(String orderPackageCode, Date unloadTime, Long warehouseId);
}

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

@ -18,6 +18,7 @@ import com.logpm.basic.entity.BasicCarModelEntity;
import com.logpm.basic.feign.IBasicCarModelClient;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.distribution.dto.FindParamterDTO;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.feign.IDistributionParcelListClient;
@ -548,6 +549,16 @@ public class CarsLoadAsyncServiceImpl implements ICarsLoadAsyncService {
List<AftersalesAbnormalRecordEntity> addList = new ArrayList<>();
List<TrunklineCarsLoadScanEntity> noUnloadList = trunklineCarsLoadScanService.findUnloadCheckAbnormalNoUnloadList(loadId, warehouseId);
//把noUnloadList中所有元素的scanCode放入一个List
List<String> scanCodeList = noUnloadList.stream().map(TrunklineCarsLoadScanEntity::getScanCode).collect(Collectors.toList());
FindParamterDTO findParamterDTO = new FindParamterDTO();
findParamterDTO.setOrderPackageCodeList(scanCodeList);
findParamterDTO.setWarehouseId(warehouseId);
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(findParamterDTO);
//把parcelListEntityList转化成以orderPackageCode作为key的Map
Map<String, DistributionParcelListEntity> parcelMap = parcelListEntityList.stream()
.collect(Collectors.toMap(DistributionParcelListEntity::getOrderPackageCode, Function.identity()));
for (TrunklineCarsLoadScanEntity trunklineCarsLoadScanEntity : noUnloadList) {
String loadCode = trunklineCarsLoadScanEntity.getLoadCode();
String waybillNo = trunklineCarsLoadScanEntity.getWaybillNo();
@ -579,6 +590,14 @@ public class CarsLoadAsyncServiceImpl implements ICarsLoadAsyncService {
abnormalRecordEntity.setRemark("无卸车记录");
abnormalRecordEntity.setIsZero(0);
abnormalRecordEntity.setNum(1);
DistributionParcelListEntity distributionParcel = parcelMap.get(scanCode);
if(!Objects.isNull(distributionParcel)){
abnormalRecordEntity.setAbnormalStatus(1);
abnormalRecordEntity.setDealTime(new Date());
abnormalRecordEntity.setDealUserId(userId);
abnormalRecordEntity.setDealUserName(nickName);
abnormalRecordEntity.setRemark("无卸车记录,已在其他车次入库,系统判定自动完结");
}
addList.add(abnormalRecordEntity);
// abnormalRecordClient.addAbnormalRecord(abnormalRecordEntity);
}

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

@ -320,6 +320,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
String dealerName = null;
String dealerCode = null;
String brand = null;
Set<String> orderCodeSet = new HashSet<>();
for (TrunklineAdvanceEntity advanceEntity : list) {
if (StringUtil.isBlank(dealerName)) {
dealerName = advanceEntity.getDealerName();
@ -328,11 +329,13 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
if (StringUtil.isBlank(brand)) {
brand = advanceEntity.getBrand();
}
orderCodeSet.add(advanceEntity.getOrderCode());
}
OpenOrderVO openOrderVO = new OpenOrderVO();
//查询品牌 客户车次号 订单自编码
OpenOrderVO infoByIds = advanceService.selectInfoByIds(advanceIds);
BeanUtil.copy(infoByIds, openOrderVO);
openOrderVO.setOrderCode(String.join(",", orderCodeSet));
openOrderVO.setAdvanceIds(advanceIds);
BasicdataBrandEntity basicdataBrandEntity = basicdataBrandClient.findEntityByName(brand);
if (!Objects.isNull(basicdataBrandEntity)) {
@ -1818,6 +1821,12 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
dto.setOrderCode(dto.getOrderCode().trim());
dto.setOrderPackageCode(dto.getOrderPackageCode().trim());
});
List<BasicMaterialEntity> materialEntities = basicMaterialClient.findAllList();
//把materialEntities转化成以productCode和productName拼接为key的Map
Map<String, BasicMaterialEntity> materialEntityMap = materialEntities.stream().collect(Collectors.toMap(item -> item.getProductCode() + "&&" + item.getName(), item -> item));
//排除pacakgeDetailExcelDTOS中的orderPackageCode为空的元素
pacakgeDetailExcelDTOS = pacakgeDetailExcelDTOS.stream().filter(item -> StringUtil.isNotBlank(item.getOrderPackageCode())).collect(Collectors.toList());
//把importStandardOuPaiDTOS中orderPackageCode相同的元素去重
@ -2074,16 +2083,37 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
advanceDetailModel.setQuantity(1);
advanceDetailModel.setServiceNum(pacakgeDetailExcelDTO.getServiceNum());
advanceDetailModel.setPackageStatus("0");
String materialName = pacakgeDetailExcelDTO.getMaterialName();
String materialCode = pacakgeDetailExcelDTO.getMaterialCode();
advanceDetailModel.setMaterialName(materialName);
advanceDetailModel.setMaterialCode(materialCode);
if (!Objects.isNull(pacakgeDetailExcelDTO.getVolume())) {
advanceDetailModel.setVolume(new BigDecimal(pacakgeDetailExcelDTO.getVolume()));
} else {
advanceDetailModel.setVolume(BigDecimal.ZERO);
BasicMaterialEntity basicMaterialEntity = materialEntityMap.get(materialCode + "&&" + materialName);
if (!Objects.isNull(basicMaterialEntity)) {
advanceDetailModel.setMaterialId(basicMaterialEntity.getId());
String weight = basicMaterialEntity.getWeight();
if (StringUtil.isBlank(weight)) {
weight = "0";
}
String volume2 = basicMaterialEntity.getVolume();
if (StringUtil.isBlank(volume2)) {
volume2 = "0";
}
advanceDetailModel.setWeight(new BigDecimal(weight));
advanceDetailModel.setVolume(new BigDecimal(volume2));
}
}
String materialName = pacakgeDetailExcelDTO.getMaterialName();
String materialCode = pacakgeDetailExcelDTO.getMaterialCode();
advanceDetailModel.setMaterialName(materialName);
advanceDetailModel.setMaterialCode(materialCode);
// if (StringUtil.isNotBlank(materialCode) && StringUtil.isNotBlank(materialName)) {
@ -4051,6 +4081,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
String dealerName = null;
String brand = null;
Integer totalNum = 0;
Set<String> orderCodeSet = new HashSet<>();
for (TrunklineAdvanceEntity advanceEntity : list) {
if (StringUtil.isBlank(dealerName)) {
dealerName = advanceEntity.getDealerName();
@ -4060,11 +4091,15 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
}
totalNum = totalNum + advanceEntity.getTotalNum();
orderCodeSet.add(advanceEntity.getOrderCode());
}
OpenOrderVO openOrderVO = new OpenOrderVO();
//查询品牌 客户车次号 订单自编码
OpenOrderVO infoByIds = advanceService.selectInfoByIds(advanceIds);
BeanUtil.copy(infoByIds, openOrderVO);
openOrderVO.setOrderCode(String.join(",", orderCodeSet));
openOrderVO.setAdvanceIds(advanceIds);
//发站仓-----目前登录人的仓库
openOrderVO.setDepartureWarehouseName(basicdataWarehouseEntity.getName());
@ -6193,6 +6228,15 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
if (Objects.isNull(orderId)) {
log.warn("#################createStockArticle: 保存订单信息失败 orderCode={}", distributionStockArticleEntity.getOrderCode());
throw new CustomerException(405, "保存订单信息失败");
}else{
if(orderId.equals(0L)){
log.warn("################createStockArticle: 订单信息保存失败 orderCode={} warehouseId={}",distributionStockArticleEntity.getOrderCode(),distributionStockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息保存失败");
}
if(orderId.equals(1L)){
log.warn("################dealAbnocreateStockArticlermal: 订单信息正在更新 orderCode={} warehouseId={}",distributionStockArticleEntity.getOrderCode(),distributionStockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息正在更新,请稍后重试");
}
}
List<WarehouseWayBillDetail> wayBillDetailList = warehouseWaybillDetailClient.findByWaybillId(warehouseWaybill.getId());

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

@ -974,4 +974,9 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
return R.success("操作成功");
}
@Override
public List<TrunklineAdvanceDetailEntity> findListByStockArticleId(Long stockArticleId, Long warehouseId) {
return baseMapper.findListByStockArticleId(stockArticleId,warehouseId);
}
}

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

@ -39,8 +39,11 @@ import org.springblade.common.exception.CustomerException;
import org.springblade.common.utils.CommonUtil;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.entity.Tenant;
import org.springblade.system.feign.ISysClient;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -65,6 +68,7 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanc
private final RabbitTemplate rabbitTemplate;
private final ITrunklineAdvanceDetailService advanceDetailService;
private final IBasicdataBrandClient basicdataBrandClient;
private final ISysClient sysClient;
@Override
public boolean saveOrderAndPackage(TrunklineAdvanceDetailEntity advanceDetailEntity, Long warehouseId) {
@ -233,6 +237,16 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanc
if (Objects.isNull(orderId)) {
log.warn("##############saveOrderAndPackage: 订单信息有误 orderId={}", orderId);
throw new CustomerException(405, "订单信息有误");
}else{
if(orderId.equals(0L)){
log.warn("################saveOrderAndPackage: 订单信息保存失败 orderCode={} warehouseId={}",stockArticleEntity.getOrderCode(),stockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息保存失败");
}
if(orderId.equals(1L)){
log.warn("################saveOrderAndPackage: 订单信息正在更新 orderCode={} warehouseId={}",stockArticleEntity.getOrderCode(),stockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息正在更新,请稍后重试");
}
}
log.info("#############saveOrderAndPackage: 订单信息保存成功 orderId={}", orderId);
@ -582,6 +596,15 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanc
if (Objects.isNull(orderId)) {
log.warn("##############saveOrderAndPackage: 订单信息有误 orderId={}", orderId);
throw new CustomerException(405, "订单信息有误");
}else{
if(orderId.equals(0L)){
log.warn("################saveOrderAndPackage: 订单信息保存失败 orderCode={} warehouseId={}",stockArticleEntity.getOrderCode(),stockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息保存失败");
}
if(orderId.equals(1L)){
log.warn("################saveOrderAndPackage: 订单信息正在更新 orderCode={} warehouseId={}",stockArticleEntity.getOrderCode(),stockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息正在更新,请稍后重试");
}
}
stockArticleClient.updateAllOrderTotalNum(orderCode, total);
@ -745,7 +768,24 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanc
@Override
public boolean saveOrderAndPackages(List<TrunklineAdvanceDetailEntity> advanceDetailEntities, Long warehouseId) {
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(warehouseId);
Integer isTransfer;
R<Tenant> tenant = sysClient.getTenant(AuthUtil.getTenantId());
if(tenant.isSuccess()){
Tenant data = tenant.getData();
if(new Integer(2).equals(data.getTenantType())){
isTransfer=0;
} else {
isTransfer = 1;
}
} else {
isTransfer = 1;
}
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(warehouseId);
if (Objects.isNull(warehouseEntity)) {
log.warn("############saveOrderAndPackages: 仓库信息不存在warehouseId={}", warehouseId);
throw new CustomerException(405, "仓库信息不存在");
@ -991,7 +1031,11 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanc
parcelList.setTenantId(tenantId);
parcelList.setWarehouse(warehouseEntity.getName());
parcelList.setWarehouseId(warehouseId);
parcelList.setIsTransfer(1);
/*增加通过当前登陆人所应对的租户类型来判断是否是 中转包件 还是 目的仓包件*/
parcelList.setIsTransfer(isTransfer);
String waybillNo = ad.getWaybillNo();
if (StringUtil.isNotBlank(waybillNo)) {
WarehouseWaybillEntity waybillEntity = finalWaybillEntityMap.get(waybillNo);

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

@ -515,7 +515,7 @@ public class TrunklineCarsLoadScanServiceImpl extends BaseServiceImpl<TrunklineC
}
@Override
public int findEntityByOrderPackageCodeAndUnloadTime(String orderPackageCode, Date unloadTime) {
return baseMapper.findEntityByOrderPackageCodeAndUnloadTime(orderPackageCode,unloadTime);
public int findEntityByOrderPackageCodeAndUnloadTime(String orderPackageCode, Date unloadTime, Long warehouseId) {
return baseMapper.findEntityByOrderPackageCodeAndUnloadTime(orderPackageCode,unloadTime,warehouseId);
}
}

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

@ -55,11 +55,16 @@ import org.apache.commons.lang.StringUtils;
import org.springblade.common.annotations.RepeatSubmit;
import org.springblade.common.constant.*;
import org.springblade.common.constant.carsload.CarsLoadLogTypeConstant;
import org.springblade.common.enums.BizOperationEnums;
import org.springblade.common.exception.CustomerException;
import org.springblade.common.model.NodeFanoutMsg;
import org.springblade.common.model.PackageData;
import org.springblade.common.model.TripartiteVO;
import org.springblade.common.utils.CommonUtil;
import org.springblade.common.utils.QRCodeUtil;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
@ -1347,6 +1352,12 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
newStockArticleEntity.setWarehouseEntryTimeEnd(date);
Long orderId = distributionStockArticleClient.addData(newStockArticleEntity);
if (orderId != 0) {
if(orderId.equals(1L)){
log.warn("################unloadByLoadId: 订单信息正在更新 orderCode={} warehouseId={}",stockArticleEntity.getOrderCode(),stockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息正在更新,请稍后重试");
}
Integer isTransfer = 1;
List<DistributionParcelListVO> parcelListEntityList = distributionParcelListClient.findEntityVOListByOrderCode(orderCode, fromWarehouseId);
@ -1516,8 +1527,6 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
String content = "包件在 " + warehouseEntity.getName() + "卸车确认";
packageTrackLogAsyncService.addPackageTrackLog(AuthUtil.getTenantId(), AuthUtil.getUserId(), Func.firstLong(AuthUtil.getDeptId()), AuthUtil.getNickName(), orderPackageCodes, warehouseId, warehouseEntity.getName(), node.getCode(), content);
//同步一次系统无编码数据
syncNoSystemData(loadId, warehouseId, warehouseEntity.getName());
} catch (Exception e) {
log.warn("###############unloadPackage: 存入异常列表记录失败");
@ -2258,39 +2267,39 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadLinePhotoService.saveBatch(addUrlList);
}
TrunklineCarsLoadLineEntity updateEntity = new TrunklineCarsLoadLineEntity();
updateEntity.setId(carsLoadLineId);
// TrunklineCarsLoadLineEntity updateEntity = new TrunklineCarsLoadLineEntity();
// updateEntity.setId(carsLoadLineId);
List<TrunklineCarsLoadLinePhotoEntity> qualityList = carsLoadLinePhotoService.findListByLoadIdAndWarehouseId(loadId, warehouseId, 30, null);
//把qualityList通过position=2进行过滤生成新的list
List<TrunklineCarsLoadLinePhotoEntity> qualityListHou = qualityList.stream().filter(item -> item.getPosition().equals(2)).collect(Collectors.toList());
if(qualityListHou.size() == 0){
updateEntity.setIsUnloadPhoto(0);
trunklineCarsLoadLineService.updateById(updateEntity);
carsLoadLine.setIsUnloadPhoto(0);
trunklineCarsLoadLineService.updateById(carsLoadLine);
return R.success("上传成功");
}
List<TrunklineCarsLoadLinePhotoEntity> qualityListZuo = qualityList.stream().filter(item -> item.getPosition().equals(3)).collect(Collectors.toList());
if(qualityListZuo.size() == 0){
updateEntity.setIsUnloadPhoto(0);
trunklineCarsLoadLineService.updateById(updateEntity);
carsLoadLine.setIsUnloadPhoto(0);
trunklineCarsLoadLineService.updateById(carsLoadLine);
return R.success("上传成功");
}
List<TrunklineCarsLoadLinePhotoEntity> qualityListYou = qualityList.stream().filter(item -> item.getPosition().equals(4)).collect(Collectors.toList());
if(qualityListYou.size() == 0){
updateEntity.setIsUnloadPhoto(0);
trunklineCarsLoadLineService.updateById(updateEntity);
carsLoadLine.setIsUnloadPhoto(0);
trunklineCarsLoadLineService.updateById(carsLoadLine);
return R.success("上传成功");
}
List<TrunklineCarsLoadLinePhotoEntity> protectionList = carsLoadLinePhotoService.findListByLoadIdAndWarehouseId(loadId, warehouseId, 31, 2);
if(protectionList.size() == 0){
updateEntity.setIsUnloadPhoto(0);
trunklineCarsLoadLineService.updateById(updateEntity);
carsLoadLine.setIsUnloadPhoto(0);
trunklineCarsLoadLineService.updateById(carsLoadLine);
return R.success("上传成功");
}
updateEntity.setIsUnloadPhoto(1);
trunklineCarsLoadLineService.updateById(updateEntity);
carsLoadLine.setIsUnloadPhoto(1);
trunklineCarsLoadLineService.updateById(carsLoadLine);
return R.success("上传成功");
}
@ -5203,6 +5212,10 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
newStockArticleEntity.setWarehouseEntryTimeEnd(date);
Long orderId = distributionStockArticleClient.addData(newStockArticleEntity);
if (orderId != 0) {
if(orderId.equals(1L)){
log.warn("################zeroUnloadEnter: 订单信息正在更新 orderCode={} warehouseId={}",stockArticleEntity.getOrderCode(),stockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息正在更新,请稍后重试");
}
Integer isTransfer = 1;
List<DistributionParcelListVO> parcelListEntityList = distributionParcelListClient.findEntityVOListByOrderCode(orderCode, fromWarehouseId);
@ -5751,6 +5764,11 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
if(NumberUtil.equals(orderId,0)){
log.warn("################111111: 保存失败");
throw new CustomerException(405,"保存失败");
}else{
if(orderId.equals(1L)){
log.warn("################updateParcelListToWarehouse: 订单信息正在更新 orderCode={} warehouseId={}",stockArticleEntity.getOrderCode(),stockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息正在更新,请稍后重试");
}
}
}else{
stockArticleEntity.setGenre(1);
@ -7630,6 +7648,15 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
newStockArticleEntity.setAllocation(null);
newStockArticleEntity.setTrays(null);
orderId = distributionStockArticleClient.addData(newStockArticleEntity);
if(orderId.equals(0L)){
log.warn("################batchUnload: 订单信息保存失败 orderCode={} warehouseId={}",stockArticleEntity.getOrderCode(),stockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息保存失败");
}
if(orderId.equals(1L)){
log.warn("################batchUnload: 订单信息正在更新 orderCode={} warehouseId={}",stockArticleEntity.getOrderCode(),stockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息正在更新,请稍后重试");
}
finalOrderCodes.put(e, orderId);
}
@ -7751,6 +7778,14 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
newStockArticleEntity.setAllocation(null);
newStockArticleEntity.setTrays(null);
orderId = distributionStockArticleClient.addData(newStockArticleEntity);
if(orderId.equals(0L)){
log.warn("################batchUnload: 订单信息保存失败 orderCode={} warehouseId={}",stockArticleEntity.getOrderCode(),stockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息保存失败");
}
if(orderId.equals(1L)){
log.warn("################batchUnload: 订单信息正在更新 orderCode={} warehouseId={}",stockArticleEntity.getOrderCode(),stockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息正在更新,请稍后重试");
}
finalOrderCodes1.put(e, orderId);
}
@ -9716,6 +9751,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
// 推送签收数据给工厂
sendFactorySignTriparite(warehouseId, orderPackageCodes, warehouseEntity);
List<PackageData> packageDataList = new ArrayList<>();
List<TrunklineCarsLoadScanEntity> loadScanEntityList = trunklineCarsLoadScanService.findListByIds(loadScanIds);
//把loadScanEntityList中所有元素通过type进行分组
Map<Integer, List<TrunklineCarsLoadScanEntity>> map = loadScanEntityList.stream().collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getType));
@ -9727,30 +9764,107 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
List<String> scanCodes = trunklineCarsLoadScanEntities.stream().map(TrunklineCarsLoadScanEntity::getScanCode).collect(Collectors.toList());
//TODO 暂时注释
// carsLoadAsyncService.sendReportPackageSignData(AuthUtil.getNickName(),AuthUtil.getUserId(),warehouseId,warehouseName,carsLoadEntity,scanCodes);
// FindParamterDTO findParamterDTO = new FindParamterDTO();
// findParamterDTO.setOrderPackageCodeList(scanCodes);
// findParamterDTO.setWarehouseId(warehouseId);
// List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(findParamterDTO);
// parcelListEntityList.forEach(parcelListEntity -> {
// PackageData packageData = new PackageData();
// packageData.setWaybillNumber(parcelListEntity.getWaybillNumber());
// packageData.setBrand(parcelListEntity.getBrandName());
// packageData.setPackageCode(parcelListEntity.getOrderPackageCode());
// packageData.setMaterialCode(parcelListEntity.getMaterialCode());
// packageData.setMaterialName(parcelListEntity.getMaterialName());
// packageData.setNumber(1);
// packageData.setOrderCode(parcelListEntity.getOrderCode());
// packageData.setPackageType(PackageTypeEnums.CMP);
// packageDataList.add(packageData);
// });
}else{
trunklineCarsLoadScanEntities.forEach(carsLoadScanEntity -> {
Long scanId = carsLoadScanEntity.getId();
List<TrunklineScanZeroDetailVO> zeroDetailVOList = scanZeroDetailService.findListByCarsLoadScanId(scanId);
//把zeroDetailList中所有元素的packageId放入一个List
List<Long> packageIds = zeroDetailVOList.stream().map(TrunklineScanZeroDetailEntity::getPackageId).collect(Collectors.toList());
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findListByIds(packageIds);
//把parcelListEntityList转成以id为key的Map
Map<Long, DistributionParcelListEntity> parcelListMap = parcelListEntityList.stream().collect(Collectors.toMap(DistributionParcelListEntity::getId, Function.identity()));
List<TrunklineScanZeroDetailEntity> zeroDetailList = new ArrayList<>();
zeroDetailVOList.forEach(zeroDetailVO -> {
TrunklineScanZeroDetailEntity entity = new TrunklineScanZeroDetailEntity();
BeanUtil.copy(zeroDetailVO, entity);
zeroDetailList.add(entity);
// Long packageId = zeroDetailVO.getPackageId();
// DistributionParcelListEntity parcelList = parcelListMap.get(packageId);
// if(!Objects.isNull(parcelList)){
// PackageData packageData = new PackageData();
// packageData.setWaybillNumber(parcelList.getWaybillNumber());
// packageData.setBrand(parcelList.getBrandName());
// packageData.setProductId(zeroDetailVO.getGoodsId());
// packageData.setProductName(zeroDetailVO.getGoodsName());
// packageData.setNumber(zeroDetailVO.getUnloadNum());
// packageData.setOrderCode(parcelList.getOrderCode());
// packageData.setPackageType(PackageTypeEnums.LTL);
// packageDataList.add(packageData);
// }
});
//TODO 暂时注释
// carsLoadAsyncService.sendReportZeroPackageSignData(AuthUtil.getUserId(), AuthUtil.getNickName(), warehouseId, warehouseName, zeroDetailList, carsLoadScanEntity, carsLoadEntity);
});
}
});
// NodeFanoutMsg<TripartiteVO> tripartiteVONodeFanoutMsg = buildNodeFanoutMessage(carsLoadEntity, packageDataList, warehouseId);
// if(!Objects.isNull(tripartiteVONodeFanoutMsg)){
// rabbitTemplate.convertAndSend(FanoutConstants.trunkline.tripartite.EXCHANGE, null, com.alibaba.fastjson.JSONObject.toJSONString(tripartiteVONodeFanoutMsg));
// }
return R.success("签收成功");
}
private NodeFanoutMsg<TripartiteVO> buildNodeFanoutMessage(TrunklineCarsLoadEntity carsLoadEntity, List<PackageData> packageDataList,Long warehouseId) {
try {
BladeUser user = AuthUtil.getUser();
NodeFanoutMsg<TripartiteVO> nodeFanoutMsg = new NodeFanoutMsg<TripartiteVO>();
nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD);
nodeFanoutMsg.setNode(WorkNodeEnums.SIGN_TRIPARTITE_TRANSFER_DEPART);
BasicdataWarehouseEntity entityWarehouse = basicdataWarehouseClient.getEntityWarehouseId(warehouseId);
if (entityWarehouse != null) {
nodeFanoutMsg.setWarehouse(entityWarehouse.getName());
}
nodeFanoutMsg.setWarehouseId(warehouseId);
nodeFanoutMsg.setOperator(user.getNickName());
nodeFanoutMsg.setOperatorTime(new Date());
TripartiteVO tripartiteVO = new TripartiteVO();
BeanUtil.copy(carsLoadEntity, tripartiteVO);
// ReservationVO reservationVO = distributionReservationService.getReservationVO(reservationEntity);
tripartiteVO.setPackageDataList(packageDataList);
nodeFanoutMsg.setMain(tripartiteVO);
nodeFanoutMsg.setTenantId(AuthUtil.getTenantId());
return nodeFanoutMsg;
} catch (Exception e) {
log.warn("三方中转签收:发送三方中转签收节点消息失败", e);
}
return null;
}
private void sendFactorySignTriparite(Long warehouseId, List<String> orderPackageCodes, BasicdataWarehouseEntity warehouseEntity) {
try {
FindParamterDTO paramterDTO = new FindParamterDTO();
@ -10107,6 +10221,14 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
newEntity.setAllocation(null);
newEntity.setTrays(null);
Long orderId = distributionStockArticleClient.addData(newEntity);
if(orderId.equals(0L)){
log.warn("################getDistributionStockArticle: 订单信息保存失败 orderCode={} warehouseId={}",newEntity.getOrderCode(),newEntity.getWarehouseId());
throw new CustomerException(405,"订单信息保存失败");
}
if(orderId.equals(1L)){
log.warn("################getDistributionStockArticle: 订单信息正在更新 orderCode={} warehouseId={}",newEntity.getOrderCode(),newEntity.getWarehouseId());
throw new CustomerException(405,"订单信息正在更新,请稍后重试");
}
newEntity.setId(orderId);
return newEntity;
}
@ -11896,7 +12018,17 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
currentStockArticleEntity.setIncomingNum(0);
currentStockArticleEntity.setAllocation(null);
currentStockArticleEntity.setTrays(null);
currentStockArticleEntity.setWarehouseEntryTime(new Date());
currentStockArticleEntity.setWarehouseEntryTimeEnd(new Date());
currentOrderId = distributionStockArticleClient.addData(currentStockArticleEntity);
if(currentOrderId.equals(0L)){
log.warn("################unloadPackage: 订单信息保存失败 orderCode={} warehouseId={}",currentStockArticleEntity.getOrderCode(),currentStockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息保存失败");
}
if(currentOrderId.equals(1L)){
log.warn("################unloadPackage: 订单信息正在更新 orderCode={} warehouseId={}",currentStockArticleEntity.getOrderCode(),currentStockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息正在更新,请稍后重试");
}
currentStockArticleEntity.setId(currentOrderId);
} else {
currentOrderId = currentStockArticleEntity.getId();
@ -12109,7 +12241,17 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
currentStockArticleEntity.setGenre(1);
currentStockArticleEntity.setAllocation(null);
currentStockArticleEntity.setTrays(null);
currentStockArticleEntity.setWarehouseEntryTime(new Date());
currentStockArticleEntity.setWarehouseEntryTimeEnd(new Date());
currentOrderId = distributionStockArticleClient.addData(currentStockArticleEntity);
if(currentOrderId.equals(0L)){
log.warn("################unloadPackage: 订单信息保存失败 orderCode={} warehouseId={}",currentStockArticleEntity.getOrderCode(),currentStockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息保存失败");
}
if(currentOrderId.equals(1L)){
log.warn("################unloadPackage: 订单信息正在更新 orderCode={} warehouseId={}",currentStockArticleEntity.getOrderCode(),currentStockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息正在更新,请稍后重试");
}
currentStockArticleEntity.setId(currentOrderId);
} else {
currentOrderId = currentStockArticleEntity.getId();
@ -12281,7 +12423,17 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
stockArticleEntity.setIncomingNum(0);
stockArticleEntity.setAllocation(null);
stockArticleEntity.setTrays(null);
stockArticleEntity.setWarehouseEntryTime(new Date());
stockArticleEntity.setWarehouseEntryTimeEnd(new Date());
currentOrderId = distributionStockArticleClient.addData(stockArticleEntity);
if(currentOrderId.equals(0L)){
log.warn("################unloadPackage: 订单信息保存失败 orderCode={} warehouseId={}",stockArticleEntity.getOrderCode(),stockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息保存失败");
}
if(currentOrderId.equals(1L)){
log.warn("################unloadPackage: 订单信息正在更新 orderCode={} warehouseId={}",stockArticleEntity.getOrderCode(),stockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息正在更新,请稍后重试");
}
stockArticleEntity.setId(currentOrderId);
} else {
currentOrderId = stockArticleEntity.getId();
@ -12379,7 +12531,18 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
newStockArticle.setWarehouse(basicdataWarehouseEntity.getName());
newStockArticle.setAllocation(null);
newStockArticle.setTrays(null);
newStockArticle.setWarehouseEntryTime(new Date());
newStockArticle.setWarehouseEntryTimeEnd(new Date());
orderId = distributionStockArticleClient.addData(newStockArticle);
if(orderId.equals(0L)){
log.warn("################unloadPackage: 订单信息保存失败 orderCode={} warehouseId={}",newStockArticle.getOrderCode(),newStockArticle.getWarehouseId());
throw new CustomerException(405,"订单信息保存失败");
}
if(orderId.equals(1L)){
log.warn("################unloadPackage: 订单信息正在更新 orderCode={} warehouseId={}",newStockArticle.getOrderCode(),newStockArticle.getWarehouseId());
throw new CustomerException(405,"订单信息正在更新,请稍后重试");
}
} else {
orderId = newStockArticle.getId();
}
@ -12419,7 +12582,11 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
List<String> orderPackageCodes = new ArrayList<>();
orderPackageCodes.add(orderPackageCode);
String content = "包件在 " + warehouseName + "卸车,车次号:"+carsLoadEntity.getCarsNo()+" 卸车方式:" + IncomingTypeEnum.getValue(incomingType)+ (StringUtil.isNotBlank(unloadTrayName)?"托盘:"+unloadTrayName:"");
if(NumberUtil.equals(isData,0)){
content = "包件在 " + warehouseName + "卸车,车次号:"+carsLoadEntity.getCarsNo()+" 卸车方式:系统无编码 卸车(只记录未入库)";
}
packageTrackLogAsyncService.addPackageTrackLog(AuthUtil.getTenantId(), AuthUtil.getUserId(), Func.firstLong(AuthUtil.getDeptId()), AuthUtil.getNickName(), orderPackageCodes, warehouseId, warehouseName, WorkNodeEnums.UNLOAD_INCOMING_WAREHOUSE.getCode(), content);
carsLoadAsyncService.sendFactoryData(orderCode,orderPackageCode,warehouseId,warehouseName);
@ -12744,7 +12911,17 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
currentStockArticleEntity.setTransferQuantity(0);
currentStockArticleEntity.setSigninQuantity(0);
currentStockArticleEntity.setIncomingNum(0);
currentStockArticleEntity.setWarehouseEntryTime(new Date());
currentStockArticleEntity.setWarehouseEntryTimeEnd(new Date());
currentOrderId = distributionStockArticleClient.addData(currentStockArticleEntity);
if(currentOrderId.equals(0L)){
log.warn("################unloadPackageNoXz: 订单信息保存失败 orderCode={} warehouseId={}",currentStockArticleEntity.getOrderCode(),currentStockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息保存失败");
}
if(currentOrderId.equals(1L)){
log.warn("################unloadPackageNoXz: 订单信息正在更新 orderCode={} warehouseId={}",currentStockArticleEntity.getOrderCode(),currentStockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息正在更新,请稍后重试");
}
currentStockArticleEntity.setId(currentOrderId);
} else {
currentOrderId = currentStockArticleEntity.getId();
@ -12891,7 +13068,17 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
currentStockArticleEntity.setTransferQuantity(0);
currentStockArticleEntity.setSigninQuantity(0);
currentStockArticleEntity.setIncomingNum(0);
currentStockArticleEntity.setWarehouseEntryTime(new Date());
currentStockArticleEntity.setWarehouseEntryTimeEnd(new Date());
currentOrderId = distributionStockArticleClient.addData(currentStockArticleEntity);
if(currentOrderId.equals(0L)){
log.warn("################unloadPackageNoXz: 订单信息保存失败 orderCode={} warehouseId={}",currentStockArticleEntity.getOrderCode(),currentStockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息保存失败");
}
if(currentOrderId.equals(1L)){
log.warn("################unloadPackageNoXz: 订单信息正在更新 orderCode={} warehouseId={}",currentStockArticleEntity.getOrderCode(),currentStockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息正在更新,请稍后重试");
}
currentStockArticleEntity.setId(currentOrderId);
} else {
currentOrderId = currentStockArticleEntity.getId();
@ -13054,7 +13241,17 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
stockArticleEntity.setIncomingNum(0);
stockArticleEntity.setAllocation(null);
stockArticleEntity.setTrays(null);
stockArticleEntity.setWarehouseEntryTime(new Date());
stockArticleEntity.setWarehouseEntryTimeEnd(new Date());
currentOrderId = distributionStockArticleClient.addData(stockArticleEntity);
if(currentOrderId.equals(0L)){
log.warn("################unloadPackageNoXz: 订单信息保存失败 orderCode={} warehouseId={}",stockArticleEntity.getOrderCode(),stockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息保存失败");
}
if(currentOrderId.equals(1L)){
log.warn("################unloadPackageNoXz: 订单信息正在更新 orderCode={} warehouseId={}",stockArticleEntity.getOrderCode(),stockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息正在更新,请稍后重试");
}
stockArticleEntity.setId(currentOrderId);
} else {
currentOrderId = stockArticleEntity.getId();
@ -13149,7 +13346,17 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
newStockArticle.setWarehouse(basicdataWarehouseEntity.getName());
newStockArticle.setAllocation(null);
newStockArticle.setTrays(null);
newStockArticle.setWarehouseEntryTime(new Date());
newStockArticle.setWarehouseEntryTimeEnd(new Date());
orderId = distributionStockArticleClient.addData(newStockArticle);
if(orderId.equals(0L)){
log.warn("################unloadPackageNoXz: 订单信息保存失败 orderCode={} warehouseId={}",newStockArticle.getOrderCode(),newStockArticle.getWarehouseId());
throw new CustomerException(405,"订单信息保存失败");
}
if(orderId.equals(1L)){
log.warn("################unloadPackageNoXz: 订单信息正在更新 orderCode={} warehouseId={}",newStockArticle.getOrderCode(),newStockArticle.getWarehouseId());
throw new CustomerException(405,"订单信息正在更新,请稍后重试");
}
} else {
orderId = newStockArticle.getId();
}
@ -13338,6 +13545,16 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
List<String> scanCodeList = new ArrayList<>(scanCodeSet);
FindParamterDTO findParamterDTO = new FindParamterDTO();
findParamterDTO.setOrderPackageCodeList(scanCodeList);
findParamterDTO.setWarehouseId(warehouseId);
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(findParamterDTO);
//把parcelListEntityList转化成以orderPackageCode作为key的Map
Map<String, DistributionParcelListEntity> parcelMap = parcelListEntityList.stream()
.collect(Collectors.toMap(DistributionParcelListEntity::getOrderPackageCode, Function.identity()));
List<TrunklineAdvanceDetailEntity> allAdvanceDetailList = new ArrayList<>();
int packageBatchSize = 500;
@ -13405,7 +13622,13 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
updateScanEntity.setMaterialCode(trunklineAdvanceDetailEntity.getMaterialCode());
updateScanEntity.setMaterialName(trunklineAdvanceDetailEntity.getMaterialName());
updateScanEntity.setIsData(1);
updateScanList.add(updateScanEntity);
DistributionParcelListEntity parcelList = parcelMap.get(orderPackageCode);
if(Objects.isNull(parcelList)){
updateScanList.add(updateScanEntity);
}
}
});
@ -13438,7 +13661,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
orderPackageCodeList.add(orderPackageCode);
//查询是否有在系统无编码后进行卸车的数据
int unloadNum = trunklineCarsLoadScanService.findEntityByOrderPackageCodeAndUnloadTime(orderPackageCode,unloadTime);
int unloadNum = trunklineCarsLoadScanService.findEntityByOrderPackageCodeAndUnloadTime(orderPackageCode,unloadTime,warehouseId);
if(unloadNum > 0){
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode, warehouseId);
if(!Objects.isNull(parcelListEntity)){
@ -13461,6 +13684,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
updateParceList.add(updateEntity);
});
}
TrunklineAdvanceDetailEntity updateEntity = new TrunklineAdvanceDetailEntity();
updateEntity.setId(trunklineAdvanceDetailEntity.getId());
updateEntity.setNowWarehouseId(warehouseId);
@ -13477,10 +13701,6 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
trunklineAdvanceDetailService.updateBatchById(updateNowWarehouseList);
}
if(CollUtil.isNotEmpty(updateScanList)){
trunklineCarsLoadScanService.updateBatchById(updateScanList);
}
// List<DistributionParcelListEntity> updateParceList = new ArrayList<>();
@ -13512,6 +13732,10 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
if(CollUtil.isNotEmpty(updateScanList)){
trunklineCarsLoadScanService.updateBatchById(updateScanList);
}
// trunklineCarsLoadScanService.updateBatchById(updateScanList);
//完结所有包件异常列表
@ -13582,6 +13806,19 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
return R.fail(405, "仓库信息不存在");
}
WarehouseConfigEntity warehouseConfig = warehouseConfigClient.getWarehouseConfig(warehouseId);
if(!Objects.isNull(warehouseConfig)){
Integer isTrunklineUnloadPhoto = warehouseConfig.getIsTrunklineUnloadPhoto();
if(NumberUtil.equals(isTrunklineUnloadPhoto,1)){
//限制装车之前上传图片
Integer isUnloadPhoto = loadLineEntity.getIsUnloadPhoto();
if(NumberUtil.equals(isUnloadPhoto,0)){
log.warn("##############unloadZero: 节点还未上传卸车前图片 isUnloadPhoto={}", isUnloadPhoto);
return R.fail(405, "节点还未上传卸车前图片");
}
}
}
String warehouseName = basicdataWarehouseEntity.getName();
WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNo);
@ -13619,6 +13856,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
return R.fail(405, "零担信息卸车数量大于装车件数");
}
carsLoadScanEntity.setUnloadNum(enterNun);
carsLoadScanEntity.setUnloadNodeId(warehouseId);
carsLoadScanEntity.setUnloadNodeName(warehouseName);
@ -13849,6 +14087,11 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
newStockArticleEntity.setCarsLoadNum(0);
Long orderId = distributionStockArticleClient.addData(newStockArticleEntity);
if (orderId != 0) {
if(orderId.equals(1L)){
log.warn("################unloadZeroWithTray: 订单信息正在更新 orderCode={} warehouseId={}",newStockArticleEntity.getOrderCode(),newStockArticleEntity.getWarehouseId());
throw new CustomerException(405,"订单信息正在更新,请稍后重试");
}
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findEntityListByOrderCode(orderCode, fromWarehouseId);
List<DistributionParcelNumberEntity> ls = new ArrayList<>();
for (DistributionParcelListEntity parcelListEntity : parcelListEntityList) {

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save