diff --git a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orderCatch/DouDianOrderCatchServiceImpl.java b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orderCatch/DouDianOrderCatchServiceImpl.java index 16abb40419..aa7b304c91 100644 --- a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orderCatch/DouDianOrderCatchServiceImpl.java +++ b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orderCatch/DouDianOrderCatchServiceImpl.java @@ -232,21 +232,13 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService { } ordersDO.setRefundStatus(String.valueOf(HaokaOrderRefundStatus)); // 获取计划手机号 - for (com.doudian.open.api.order_orderDetail.data.LogisticsInfoItem logisticsInfoItem : logisticsInfo) { - for (com.doudian.open.api.order_orderDetail.data.ProductInfoItem productInfoItem : logisticsInfoItem.getProductInfo()) { - String skuOrderId = productInfoItem.getSkuOrderId(); - if(skuOrderId.equals(orderId)){ - String productName = productInfoItem.getProductName(); - ordersDO.setSupplierProductName(productName); - List skuSpecs = productInfoItem.getSkuSpecs(); - for (com.doudian.open.api.order_orderDetail.data.SkuSpecsItem skuSpec : skuSpecs) { - String name = skuSpec.getName(); - String planMobile = getPlanMobile(name); - if(planMobile != null){ - ordersDO.setPlanMobile(planMobile); - } - } - } + String productName = skuOrderListItem.getProductName(); + ordersDO.setSupplierProductName(productName); + for (com.doudian.open.api.order_orderDetail.data.SpecItem specItem : skuOrderListItem.getSpec()) { + String value = specItem.getValue(); + String planMobile = getPlanMobile(value); + if(planMobile != null){ + ordersDO.setPlanMobile(planMobile); } } // 查询订单是否存在 不存在则新增,存在则更新 @@ -305,6 +297,14 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService { // 106 doudian_trade_TradeCanceled // 订单取消消息 TradeTradeCanceledParam tradeTradeCanceledParam = gson.fromJson(message.getData()+"", TradeTradeCanceledParam.class); + Long pId = tradeTradeCanceledParam.getPId(); +// 更新订单取消 + List ordersDOS = ordersMapper.selectList(new LambdaQueryWrapperX().eq(OrdersDO::getRealSourceId, pId).eq(OrdersDO::getDeleted, 0)); + if(CollectionUtil.isNotEmpty(ordersDOS)){ + OrdersDO ordersDO = ordersDOS.get(0); + ordersDO.setRefundStatus("300"); + ordersMapper.updateById(ordersDO); + } } else if("110".equals(tag)) { // 110 doudian_trade_TradePending // 订单已支付待处理 @@ -417,21 +417,13 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService { } ordersDO.setRefundStatus(String.valueOf(HaokaOrderRefundStatus)); // 获取计划手机号 - for (com.doudian.open.api.order_orderDetail.data.LogisticsInfoItem logisticsInfoItem : logisticsInfo) { - for (com.doudian.open.api.order_orderDetail.data.ProductInfoItem productInfoItem : logisticsInfoItem.getProductInfo()) { - String skuOrderId = productInfoItem.getSkuOrderId(); - if(skuOrderId.equals(orderId)){ - String productName = productInfoItem.getProductName(); - ordersDO.setSupplierProductName(productName); - List skuSpecs = productInfoItem.getSkuSpecs(); - for (com.doudian.open.api.order_orderDetail.data.SkuSpecsItem skuSpec : skuSpecs) { - String name = skuSpec.getName(); - String planMobile = getPlanMobile(name); - if(planMobile != null){ - ordersDO.setPlanMobile(planMobile); - } - } - } + String productName = skuOrderListItem.getProductName(); + ordersDO.setSupplierProductName(productName); + for (com.doudian.open.api.order_orderDetail.data.SpecItem specItem : skuOrderListItem.getSpec()) { + String value = specItem.getValue(); + String planMobile = getPlanMobile(value); + if(planMobile != null){ + ordersDO.setPlanMobile(planMobile); } } // 查询订单是否存在 不存在则新增,存在则更新 @@ -609,21 +601,13 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService { ordersDO.setRefundStatus(String.valueOf(HaokaOrderRefundStatus)); ordersDO.setStatusName(skuOrderListItem.getOrderStatusDesc()); // 获取计划手机号 - for (LogisticsInfoItem logisticsInfoItem : logisticsInfo) { - for (ProductInfoItem productInfoItem : logisticsInfoItem.getProductInfo()) { - String skuOrderId = productInfoItem.getSkuOrderId(); - if(skuOrderId.equals(orderId)){ - String productName = productInfoItem.getProductName(); - ordersDO.setSupplierProductName(productName); - List skuSpecs = productInfoItem.getSkuSpecs(); - for (SkuSpecsItem skuSpec : skuSpecs) { - String name = skuSpec.getName(); - String planMobile = getPlanMobile(name); - if(planMobile != null){ - ordersDO.setPlanMobile(planMobile); - } - } - } + String productName = skuOrderListItem.getProductName(); + ordersDO.setSupplierProductName(productName); + for (SpecItem specItem : skuOrderListItem.getSpec()) { + String value = specItem.getValue(); + String planMobile = getPlanMobile(value); + if(planMobile != null){ + ordersDO.setPlanMobile(planMobile); } } // 查询订单是否存在 不存在则新增,存在则更新 @@ -735,12 +719,12 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService { private String getPlanMobile(String skuName) { // 去除空格 String noSpace = StringUtils.deleteWhitespace(skuName); - String pattern = "(?<=\\/)\\d{11}"; + String pattern = "1\\d{10}"; Pattern compile = Pattern.compile(pattern); Matcher matcher = compile.matcher(noSpace); if(matcher.find()){ // 找到匹配手机号 - return matcher.group(1); + return matcher.group(0); }else { return null; }