Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
d4115d3306
|
@ -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; }
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -26,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;
|
||||
|
@ -427,8 +429,29 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> 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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -502,19 +525,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> 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 +541,21 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> 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);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交订单
|
||||
*
|
||||
|
@ -557,8 +583,12 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> 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);
|
||||
|
@ -589,6 +619,8 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
|||
// 记录操作记录
|
||||
OrderOperateLogSaveReqVO logSaveReqVO = new OrderOperateLogSaveReqVO();
|
||||
logSaveReqVO.setOrderId(ordersDO.getId());
|
||||
// 失败原因
|
||||
String reason = ordersDO.getReason();
|
||||
if (success) {
|
||||
// 订单调用接口返回结果
|
||||
logSaveReqVO.setMsgSource("1");
|
||||
|
@ -600,10 +632,12 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> 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,12 +648,14 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
|||
logSaveReqVO.setMsgType("0");
|
||||
ordersDO.setStatus(470L);
|
||||
logSaveReqVO.setMsg("提单成功");
|
||||
ordersDO.setMemo("提单成功");
|
||||
ordersDO.setPlanMobileProduced(ordersDO.getPlanMobile());
|
||||
String planMobileProduced = orderData.getPlanMobileProduced();
|
||||
if (StringUtils.isNotEmpty(planMobileProduced)){
|
||||
ordersDO.setPlanMobileProduced(planMobileProduced);
|
||||
}
|
||||
|
||||
// 如果是抖音订单 则需要调用抖音接口 返回审核结果
|
||||
orderRevicer(ordersDO.getSource(), ordersDO.getRealSourceId());
|
||||
}
|
||||
} else {
|
||||
// 系统失败操作记录
|
||||
|
@ -628,6 +664,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
|||
logSaveReqVO.setMsgType("1");
|
||||
// 产品定义存在问题
|
||||
ordersDO.setStatus(450L);
|
||||
ordersDO.setReason(reason+"\n"+msg);
|
||||
}
|
||||
orderOperateLogService.createOrderOperateLog(logSaveReqVO);
|
||||
// 更新订单
|
||||
|
|
Loading…
Reference in New Issue