From 1718dca3afcb2078bda1e24d2cf2647ce7842a17 Mon Sep 17 00:00:00 2001 From: ljl Date: Tue, 5 Dec 2023 15:01:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biz/service/impl/DsMessageServiceImpl.java | 10 ++++++++-- .../biz/service/impl/LogisticsServiceImpl.java | 18 +++++++++--------- .../main/java/com/ms/web/controller/Test.java | 2 +- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/biz/service/impl/DsMessageServiceImpl.java b/ms-biz/src/main/java/com/ms/biz/service/impl/DsMessageServiceImpl.java index 5d8e607..447077a 100644 --- a/ms-biz/src/main/java/com/ms/biz/service/impl/DsMessageServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/biz/service/impl/DsMessageServiceImpl.java @@ -27,6 +27,7 @@ import com.ms.biz.service.DsMessageConsumerBufferService; import com.ms.biz.service.DsMessageConsumerQueueService; import com.ms.biz.service.DsMessageService; import com.ms.api.dto.dsorder.*; +import com.ms.biz.service.LogisticsService; import com.ms.biz.tool.CommonTool; import com.ms.biz.util.DDApi; import com.ms.dal.entity.*; @@ -63,6 +64,8 @@ public class DsMessageServiceImpl implements DsMessageService { private RefundPurchaseOrderMapper refundPurchaseOrderMapper; private RefundPurchaseOrderSkuMapper refundPurchaseOrderSkuMapper; + private LogisticsService logisticsService; + @Override public int deleteByPrimaryKey(Long id) { return dsMessageMapper.deleteByPrimaryKey(id); @@ -339,11 +342,14 @@ public class DsMessageServiceImpl implements DsMessageService { OrderLogisticsAddMultiPackParam param = new OrderLogisticsAddMultiPackParam(); param.setOrderId(purchaseOrderDTO.getPlatformOrderId()); + Map matchResult = logisticsService.matchLogisticsInfo("1688DS", purchaseOrderDTO.getPurchaseOrderLogisticsName(), purchaseOrderDTO.getPurchaseOrderWaybillCode(), null); + String logisticsName = matchResult.get("logisticsName"); + String waybillCode = matchResult.get("waybillCode"); + List packageList = new ArrayList<>(); PackListItem packListItem = new PackListItem(); - packListItem.setLogisticsCode(purchaseOrderDTO.getPurchaseOrderWaybillCode()); + packListItem.setLogisticsCode(waybillCode); - String logisticsName = LogisticsConst.getDDLogisticsName(purchaseOrderDTO.getPurchaseOrderLogisticsName()); Logistics logistics = logisticsMapper.getByLogisticsName(logisticsName); if (logistics == null) { log.info("物流不存在: 1688[{}] 抖店[{}]", purchaseOrderDTO.getPurchaseOrderLogisticsName(), logisticsName); diff --git a/ms-biz/src/main/java/com/ms/biz/service/impl/LogisticsServiceImpl.java b/ms-biz/src/main/java/com/ms/biz/service/impl/LogisticsServiceImpl.java index 43faf93..b8561cd 100644 --- a/ms-biz/src/main/java/com/ms/biz/service/impl/LogisticsServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/biz/service/impl/LogisticsServiceImpl.java @@ -194,34 +194,34 @@ public class LogisticsServiceImpl implements LogisticsService{ } if ((logisticsName.contains("中通") && logisticsName.contains("中通快运")) || (Arrays.asList("其他", "其它", "其它快递", "卖家负责配送").contains(logisticsName) && CommonTool.isMatch("^78299\\d+$", waybillCode))) { - logisticsName = "中通快递"; + logisticsName = "中通快递(常用)"; } if (logisticsName.contains("EMS") || logisticsName.contains("邮政标准")) { - logisticsName = "邮政EMS"; + logisticsName = "EMS(常用)"; } else if (logisticsName.contains("邮政") && logisticsName.contains("邮政电商标快")) { logisticsName = "邮政快递包裹"; } if ((logisticsName.contains("圆通") && logisticsName.contains("圆通快运")) || (Arrays.asList("其他", "其它", "其它快递", "卖家负责配送").contains(logisticsName) && Pattern.compile("^YT\\d+$").matcher(waybillCode).find())) { - logisticsName = "圆通快递"; + logisticsName = "圆通快递(常用)"; } if (logisticsName.contains("国通")) { logisticsName = "国通快递"; } if (logisticsName.contains("申通达") || (Arrays.asList("点点送", "菜鸟裹裹商家寄件", "官方直送", "其他", "其它", "其它快递", "卖家负责配送").contains(logisticsName) && Pattern.compile("^77[03567]\\d+$").matcher(waybillCode).find())) { - logisticsName = "申通快递"; + logisticsName = "申通快递(常用)"; } if ((logisticsName.contains("韵达") && logisticsName.contains("韵达快运")) || ("官方物流".equals(logisticsName) && Pattern.compile("^462\\d+$").matcher(waybillCode).find())) { - logisticsName = "韵达快递"; + logisticsName = "韵达快递(常用)"; } if (logisticsName.contains("德邦") && (logisticsName.contains("德邦物流") || Pattern.compile("^DPK\\d+$").matcher(waybillCode).find())) { - logisticsName = "德邦快递"; + logisticsName = "德邦快递(常用)"; } if (Arrays.asList("其他", "其它", "卖家负责配送").contains(logisticsName) && Pattern.compile("^2\\d{8,9}").matcher(waybillCode).find()) { - logisticsName = "德邦快递"; + logisticsName = "德邦快递(常用)"; } if (Pattern.compile("圆通.+快递").matcher(logisticsName).find()) { - logisticsName = "圆通快递"; + logisticsName = "圆通快递(常用)"; } if (Pattern.compile("^JT\\d+$").matcher(waybillCode).find() && (logisticsName.contains("龙邦速递") || logisticsName.contains("百世") || logisticsName.contains("极兔") || Arrays.asList("其他", "其它", "卖家负责配送", "点点送", "ju ti").contains(logisticsName))) { logisticsName = "极兔速递"; @@ -230,7 +230,7 @@ public class LogisticsServiceImpl implements LogisticsService{ logisticsName = "百世快运"; } if (Pattern.compile("^SF\\d+$").matcher(waybillCode).find()) { - logisticsName = "顺丰快递"; + logisticsName = "顺丰速运(常用)"; } if (logisticsName.contains("丰网")) { logisticsName = "丰网速运"; diff --git a/ms-web/src/main/java/com/ms/web/controller/Test.java b/ms-web/src/main/java/com/ms/web/controller/Test.java index 5e6f04a..0a7d861 100644 --- a/ms-web/src/main/java/com/ms/web/controller/Test.java +++ b/ms-web/src/main/java/com/ms/web/controller/Test.java @@ -274,7 +274,7 @@ public class Test { @GetMapping("/match-rule") public String matchRule() { - Map result = logisticsService.matchLogisticsInfo("1688DS", "顺丰速运", "SF1610042925672", null); + Map result = logisticsService.matchLogisticsInfo("1688DS", "顺丰", "SF1610042925672", null); System.out.println(result); return result.toString(); }