From f7abead0e5573f09f191aa3e61217a6a5267e82d Mon Sep 17 00:00:00 2001 From: Damonny <826010988@qq.com> Date: Fri, 7 Mar 2025 11:18:57 +0800 Subject: [PATCH 1/4] =?UTF-8?q?update:=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E5=8E=9F=E5=9B=A0=E5=86=85=E5=AE=B9=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/haoka/service/orders/OrdersServiceImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java index d425b127a4..ee787a3d1b 100644 --- a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java +++ b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java @@ -589,6 +589,8 @@ public class OrdersServiceImpl extends ServiceImpl imple // 记录操作记录 OrderOperateLogSaveReqVO logSaveReqVO = new OrderOperateLogSaveReqVO(); logSaveReqVO.setOrderId(ordersDO.getId()); + // 失败原因 + String reason = ordersDO.getReason(); if (success) { // 订单调用接口返回结果 logSaveReqVO.setMsgSource("1"); @@ -600,10 +602,12 @@ public class OrdersServiceImpl extends ServiceImpl imple ordersDO.setUpstreamOrderStatus(Integer.valueOf(orderStatusCode)); // api记录成功操作记录 if ("0".equals(orderStatusCode)) { + String supplierOrderStatusDesc = orderData.getSupplierOrderStatusDesc(); // 提交异常 logSaveReqVO.setMsgType("1"); ordersDO.setStatus(-460L); - logSaveReqVO.setMsg(orderData.getSupplierOrderStatusDesc()); + logSaveReqVO.setMsg(supplierOrderStatusDesc); + ordersDO.setReason(reason+"\n"+supplierOrderStatusDesc); } else { // 成功 470 // ordersDO 记录 create param 和 响应信息 @@ -614,6 +618,7 @@ public class OrdersServiceImpl extends ServiceImpl imple logSaveReqVO.setMsgType("0"); ordersDO.setStatus(470L); logSaveReqVO.setMsg("提单成功"); + ordersDO.setMemo("提单成功"); ordersDO.setPlanMobileProduced(ordersDO.getPlanMobile()); String planMobileProduced = orderData.getPlanMobileProduced(); if (StringUtils.isNotEmpty(planMobileProduced)){ @@ -628,6 +633,7 @@ public class OrdersServiceImpl extends ServiceImpl imple logSaveReqVO.setMsgType("1"); // 产品定义存在问题 ordersDO.setStatus(450L); + ordersDO.setReason(reason+"\n"+msg); } orderOperateLogService.createOrderOperateLog(logSaveReqVO); // 更新订单 From d4947dce0b4deb89b58497e3b63989bd3074d9ea Mon Sep 17 00:00:00 2001 From: Damonny <826010988@qq.com> Date: Fri, 7 Mar 2025 14:36:14 +0800 Subject: [PATCH 2/4] =?UTF-8?q?update:=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=88=90=E5=8A=9F=E9=80=9A=E7=9F=A5=E9=A1=BA?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/haoka/enums/LogisticsCompany.java | 61 +++++++++++++++++++ .../service/orders/OrdersServiceImpl.java | 37 ++++++----- 2 files changed, 83 insertions(+), 15 deletions(-) create mode 100644 yudao-module-haoka/yudao-module-haoka-api/src/main/java/cn/iocoder/yudao/module/haoka/enums/LogisticsCompany.java diff --git a/yudao-module-haoka/yudao-module-haoka-api/src/main/java/cn/iocoder/yudao/module/haoka/enums/LogisticsCompany.java b/yudao-module-haoka/yudao-module-haoka-api/src/main/java/cn/iocoder/yudao/module/haoka/enums/LogisticsCompany.java new file mode 100644 index 0000000000..5b00cde6b4 --- /dev/null +++ b/yudao-module-haoka/yudao-module-haoka-api/src/main/java/cn/iocoder/yudao/module/haoka/enums/LogisticsCompany.java @@ -0,0 +1,61 @@ +package cn.iocoder.yudao.module.haoka.enums; + +public enum LogisticsCompany { + SHUNFENG(44L, "顺丰快递", "shunfeng"), + YUANTONG(85L, "圆通快递", "yuantong"), + ZHONGTONG(115L, "中通快递", "zhongtong"), + YOUSU(117L, "优速快递", "youshuwuliu"), + EMS(118L, "邮政EMS", "ems"), + JD(120L, "京东配送", "jd"), + YUNDA(121L, "韵达快递", "yunda"), + ZHAIJISONG(129L, "宅急送快递", "zhaijisong"), + DEBANG(131L, "德邦快递", "debangwuliu"), + POST(132L, "邮政快递包裹", "youzhengguonei"), + SUER(155L, "速尔快递", "suer"), + CAINIAO(191L, "菜鸟物流", "danniao"), + BAISHI(204L, "百世快递", "baishiwuliu"), + JINGGUANG(281L, "京广速递", "jinguangsudikuaijian"), + SHENTONG(1001L, "申通快递", "shentong"), + DANNIAO(500L, "丹鸟快递", "danniao"), + // 其他未匹配的物流公司 + QUANFENG(116L, "全峰快递", "xiaoshidayun"), + TIANTIAN(119L, "天天快递", "xiaoshidayun"), + KUAIJIE(122L, "快捷快递", "xiaoshidayun"), + GUOTONG(124L, "国通快递", "xiaoshidayun"), + NO_LOGISTICS(1000L, "无需物流", "xiaoshidayun"), + PROVINCE_SELF(1002L, "省公司自建物流", "xiaoshidayun"), + PROVINCE_SELF2(10002L, "省公司自建物流", "xiaoshidayun"); + + private final Long ourCode; + private final String ourName; + private final String otherCode; + + LogisticsCompany(Long ourCode, String ourName, String otherCode) { + this.ourCode = ourCode; + this.ourName = ourName; + this.otherCode = otherCode; + } + + public static String getOtherSystemCode(Long ourCode) { + for (LogisticsCompany company : values()) { + if (company.ourCode == ourCode) { + return company.otherCode; + } + } + return null; + } + public static String getOtherSystemName(Long ourCode) { + for (LogisticsCompany company : values()) { + if (company.ourCode == ourCode) { + return company.name(); + } + } + return null; + } + + + // Getter方法 + public Long getOurCode() { return ourCode; } + public String getOurName() { return ourName; } + public String getOtherCode() { return otherCode; } +} \ No newline at end of file diff --git a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java index ee787a3d1b..108030f326 100644 --- a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java +++ b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java @@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.haoka.controller.admin.product.vo.ProductLimitAre import cn.iocoder.yudao.module.haoka.controller.admin.product.vo.ProductLimitCardRespVO; import cn.iocoder.yudao.module.haoka.controller.admin.product.vo.ProductLimitRespVO; import cn.iocoder.yudao.module.haoka.dal.dataobject.blacklist.BlackListDO; +import cn.iocoder.yudao.module.haoka.enums.LogisticsCompany; import cn.iocoder.yudao.module.haoka.service.api.models.ApiDealResp; import cn.iocoder.yudao.module.haoka.service.api.ApiDealStrategyService; import cn.iocoder.yudao.module.haoka.service.api.models.OrderApiCreateParam; @@ -427,8 +428,10 @@ public class OrdersServiceImpl extends ServiceImpl imple String trackingNumber = updateObj.getTrackingNumber(); if(StringUtils.isNotBlank(trackingNumber)){ Long trackingCompanyId = updateObj.getTrackingCompanyId(); + String otherSystemCode = LogisticsCompany.getOtherSystemCode(trackingCompanyId); + String otherSystemName = LogisticsCompany.getOtherSystemName(trackingCompanyId); DouDianOrderCatchServiceImpl douDianOrderCatchService = new DouDianOrderCatchServiceImpl(); - douDianOrderCatchService.logisticsAdd(updateObj.getRealSourceId(),"","",trackingNumber); + douDianOrderCatchService.logisticsAdd(updateObj.getRealSourceId(),otherSystemName,otherSystemCode,trackingNumber); } } } @@ -502,19 +505,7 @@ public class OrdersServiceImpl extends ServiceImpl imple updateOrderById(updateObj); } // 如果是抖音订单 则需要调用抖音接口 返回审核结果 - String source = ordersOld.getSource(); - if("2".equals(source)){ - if(status != null && status == 450L){ - //审核通过 - DouDianOrderCatchServiceImpl douDianOrderCatchService = new DouDianOrderCatchServiceImpl(); - douDianOrderCatchService.reviewOrder(0L,ordersOld.getRealSourceId()); - } - if(status != null && status == -450L){ - //审核不通过 - DouDianOrderCatchServiceImpl douDianOrderCatchService = new DouDianOrderCatchServiceImpl(); - douDianOrderCatchService.reviewOrder(200005L,ordersOld.getRealSourceId()); - } - } +// orderRevicer(ordersOld.getSource(), ordersOld.getRealSourceId()); // 状态变化:发送短信提醒 if (updateObj.getStatus() != null && !updateObj.getStatus().equals(ordersOld.getStatus())) { smsTaskService.sendSMS( @@ -530,6 +521,21 @@ public class OrdersServiceImpl extends ServiceImpl imple } } + private static void orderRevicer(String source, String realSourceId) { + if("2".equals(source)){ +// if(status != null && status == 450L){ + //审核通过 + DouDianOrderCatchServiceImpl douDianOrderCatchService = new DouDianOrderCatchServiceImpl(); + douDianOrderCatchService.reviewOrder(0L, realSourceId); +// } +// if(status != null && status == -450L){ +// //审核不通过 +// DouDianOrderCatchServiceImpl douDianOrderCatchService = new DouDianOrderCatchServiceImpl(); +// douDianOrderCatchService.reviewOrder(200005L, realSourceId); +// } + } + } + /** * 提交订单 * @@ -624,7 +630,8 @@ public class OrdersServiceImpl extends ServiceImpl imple if (StringUtils.isNotEmpty(planMobileProduced)){ ordersDO.setPlanMobileProduced(planMobileProduced); } - + // 如果是抖音订单 则需要调用抖音接口 返回审核结果 + orderRevicer(ordersDO.getSource(), ordersDO.getRealSourceId()); } } else { // 系统失败操作记录 From f3a6b6cbc4140e9063890739be1e4cfa158297f7 Mon Sep 17 00:00:00 2001 From: Damonny <826010988@qq.com> Date: Fri, 7 Mar 2025 15:10:55 +0800 Subject: [PATCH 3/4] =?UTF-8?q?update:=E5=BC=BA=E5=88=B6=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BD=BF=E8=AE=A2=E5=8D=95=E5=8F=AF=E4=BB=A5=E8=BF=9B=E5=85=A5?= =?UTF-8?q?=E5=8F=91=E8=B4=A7=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/haoka/service/orders/OrdersServiceImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java index 108030f326..2ae7a6dbfa 100644 --- a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java +++ b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java @@ -563,8 +563,12 @@ public class OrdersServiceImpl extends ServiceImpl imple Long status = updateReqVO.getStatus(); if("1".equals(String.valueOf(status))){ // 提交成功 - ordersDO.setStatus(470L); - ordersDO.setUpstreamOrderStatus(470); + ordersDO.setStatus(500L); + ordersDO.setUpstreamOrderStatus(500); + String source = ordersDO.getSource(); + String realSourceId = ordersDO.getRealSourceId(); + // 如果是抖音订单 则需要调用抖音接口 返回审核结果 source判断了抖音 + orderRevicer(source, realSourceId); }else { // 提交失败 ordersDO.setStatus(-460L); From 30bfee046ec45f60e6876e52994c5c58c9c1e56f Mon Sep 17 00:00:00 2001 From: Damonny <826010988@qq.com> Date: Fri, 7 Mar 2025 15:44:28 +0800 Subject: [PATCH 4/4] =?UTF-8?q?update:=E5=8F=91=E8=B4=A7=E5=90=8E=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E8=AE=A2=E5=8D=95=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DouDianOrderCatchServiceImpl.java | 4 +++- .../service/orders/OrdersServiceImpl.java | 22 ++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) 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 dc7eb6f7e8..a5cc6035b9 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 @@ -834,7 +834,7 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService { * @param companyCode 快递公司编码 * @param logisticsCode 物流单号 */ - public void logisticsAdd(String OrderId,String company,String companyCode,String logisticsCode){ + public OrderLogisticsAddResponse logisticsAdd(String OrderId,String company,String companyCode,String logisticsCode){ try { OrderLogisticsAddRequest request = new OrderLogisticsAddRequest(); OrderLogisticsAddParam param = request.getParam(); @@ -849,9 +849,11 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService { //入参为code AccessToken accessToken= AccessTokenBuilder.build(SYNC_SHOP_ID); OrderLogisticsAddResponse response = request.execute(accessToken); + return response; } catch (Exception e) { log.error("订单发货失败,{}",e.getMessage()); } + return null; } } diff --git a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java index 2ae7a6dbfa..6e534e16b9 100644 --- a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java +++ b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java @@ -27,6 +27,7 @@ import cn.iocoder.yudao.module.haoka.utils.SnowflakeId; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.doudian.open.api.order_addOrderRemark.param.OrderAddOrderRemarkParam; +import com.doudian.open.api.order_logisticsAdd.OrderLogisticsAddResponse; import com.google.common.collect.Lists; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -431,7 +432,26 @@ public class OrdersServiceImpl extends ServiceImpl imple String otherSystemCode = LogisticsCompany.getOtherSystemCode(trackingCompanyId); String otherSystemName = LogisticsCompany.getOtherSystemName(trackingCompanyId); DouDianOrderCatchServiceImpl douDianOrderCatchService = new DouDianOrderCatchServiceImpl(); - douDianOrderCatchService.logisticsAdd(updateObj.getRealSourceId(),otherSystemName,otherSystemCode,trackingNumber); + OrderLogisticsAddResponse response = douDianOrderCatchService.logisticsAdd(updateObj.getRealSourceId(), otherSystemName, otherSystemCode, trackingNumber); + if(response!= null){ + if("10000".equals(response.getCode())){ +// 订单发货成功 + updateObj.setStatus(550L); + updateObj.setUpstreamOrderStatus(550); + updateObj.setSellerMemo(oldOrderDo+"\n"+"订单发货成功"); + }else { + String subMsg = response.getSubMsg(); + OrderOperateLogSaveReqVO logSaveReqVO = new OrderOperateLogSaveReqVO(); + logSaveReqVO.setOrderId(updateObj.getId()); + logSaveReqVO.setMsg("订单发货失败:"+subMsg); + logSaveReqVO.setMsgType("0"); + logSaveReqVO.setMsgSource("1"); + log.error("订单发货失败,{}",subMsg); + updateObj.setReason(oldOrderDo.getReason() + "\n"+ "订单发货失败:"+subMsg); + orderOperateLogService.createOrderOperateLog(logSaveReqVO); + } + updateOrderById(updateObj); + } } } }