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(); }