diff --git a/BBWY.Server.API/Controllers/PurchaseOrderController.cs b/BBWY.Server.API/Controllers/PurchaseOrderController.cs index 98b921e5..d64e47fc 100644 --- a/BBWY.Server.API/Controllers/PurchaseOrderController.cs +++ b/BBWY.Server.API/Controllers/PurchaseOrderController.cs @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using QuanTan.SDK.Model; using System.Collections.Generic; namespace BBWY.Server.API.Controllers @@ -70,8 +71,8 @@ namespace BBWY.Server.API.Controllers /// /// [HttpPost] - public IList GetAuditPurchaseOrderList([FromBody]AuditOrderRequest auditOrderRequest) - { + public IList GetAuditPurchaseOrderList([FromBody] AuditOrderRequest auditOrderRequest) + { return purchaseOrderBusiness.GetAuditPurchaseOrderList(auditOrderRequest); } @@ -86,5 +87,16 @@ namespace BBWY.Server.API.Controllers { purchaseOrderBusiness.CallbackFrom1688(message); } + + /// + /// 拳探发货回调 + /// + /// + [HttpPost] + [AllowAnonymous] + public void QuanTanSendGoodsCallback([FromBody] QuanTanSendGoodsNotifyRequest request) + { + purchaseOrderBusiness.QuanTan_SendGoodsCallback(request); + } } } diff --git a/BBWY.Server.Business/PurchaseOrder/PurchaseOrderBusiness.cs b/BBWY.Server.Business/PurchaseOrder/PurchaseOrderBusiness.cs index 55ee5a21..302c74ae 100644 --- a/BBWY.Server.Business/PurchaseOrder/PurchaseOrderBusiness.cs +++ b/BBWY.Server.Business/PurchaseOrder/PurchaseOrderBusiness.cs @@ -7,6 +7,7 @@ using FreeSql; using Microsoft.Extensions.Options; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using QuanTan.SDK.Model; using System; using System.Collections.Generic; using System.Linq; @@ -393,7 +394,7 @@ namespace BBWY.Server.Business private void DeliveryCallbackFrom1688(JObject jObject) { var purchaseOrderId = jObject["data"].Value("orderId"); - Task.Factory.StartNew(() => DeliveryCallback(purchaseOrderId, Enums.Platform.阿里巴巴), CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.PurchaseOrderCallbackTaskScheduler); + Task.Factory.StartNew(() => DeliveryCallback(purchaseOrderId, null, Enums.Platform.阿里巴巴), CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.PurchaseOrderCallbackTaskScheduler); } /// @@ -407,12 +408,25 @@ namespace BBWY.Server.Business } #endregion + #region 拳探回调 + public void QuanTan_SendGoodsCallback(QuanTanSendGoodsNotifyRequest request) + { + Task.Factory.StartNew(() => DeliveryCallback(request.OrderId, new WayBillNoResponse() + { + LogisticsCompanyId = request.ExpressId, + LogisticsCompanyName = request.ExpressName, + WayBillNo = request.WayBillNo, + }, Enums.Platform.拳探), CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.PurchaseOrderCallbackTaskScheduler); + } + #endregion + /// /// 采购平台发货回调 /// /// + /// /// - private void DeliveryCallback(string purchaseOrderId, Enums.Platform callbackPlatform) + private void DeliveryCallback(string purchaseOrderId, WayBillNoResponse wayBillNoResponse, Enums.Platform callbackPlatform) { string currentProgress = string.Empty; string wayBillNoResponseInfo = string.Empty; @@ -464,7 +478,9 @@ namespace BBWY.Server.Business OrderId = purchaseOrderId, Platform = callbackPlatform }; - var wayBillNoResponse = platformSDKBusinessList.FirstOrDefault(p => p.Platform == callbackPlatform).GetWayBillNoByOrderId(queryOrderWayBillNoRequest); + + if (wayBillNoResponse == null) + wayBillNoResponse = platformSDKBusinessList.FirstOrDefault(p => p.Platform == callbackPlatform).GetWayBillNoByOrderId(queryOrderWayBillNoRequest); wayBillNoResponseInfo = JsonConvert.SerializeObject(new { Request = queryOrderWayBillNoRequest, Result = wayBillNoResponse }); #endregion diff --git a/QuanTan.SDK/Model/Request/Order/QuanTanSendGoodsNotifyRequest.cs b/QuanTan.SDK/Model/Request/Order/QuanTanSendGoodsNotifyRequest.cs new file mode 100644 index 00000000..c6e327ef --- /dev/null +++ b/QuanTan.SDK/Model/Request/Order/QuanTanSendGoodsNotifyRequest.cs @@ -0,0 +1,13 @@ +namespace QuanTan.SDK.Model +{ + public class QuanTanSendGoodsNotifyRequest + { + public string OrderId { get; set; } + + public string WayBillNo { get; set; } + + public string ExpressId { get; set; } + + public string ExpressName { get; set; } + } +}