Browse Source

拳探发货回调

qianyi
shanji 2 years ago
parent
commit
d2756e88d4
  1. 16
      BBWY.Server.API/Controllers/PurchaseOrderController.cs
  2. 22
      BBWY.Server.Business/PurchaseOrder/PurchaseOrderBusiness.cs
  3. 13
      QuanTan.SDK/Model/Request/Order/QuanTanSendGoodsNotifyRequest.cs

16
BBWY.Server.API/Controllers/PurchaseOrderController.cs

@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using QuanTan.SDK.Model;
using System.Collections.Generic; using System.Collections.Generic;
namespace BBWY.Server.API.Controllers namespace BBWY.Server.API.Controllers
@ -70,8 +71,8 @@ namespace BBWY.Server.API.Controllers
/// <param name="auditOrderRequest"></param> /// <param name="auditOrderRequest"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public IList<AuditPurchaseOrderResponse> GetAuditPurchaseOrderList([FromBody]AuditOrderRequest auditOrderRequest) public IList<AuditPurchaseOrderResponse> GetAuditPurchaseOrderList([FromBody] AuditOrderRequest auditOrderRequest)
{ {
return purchaseOrderBusiness.GetAuditPurchaseOrderList(auditOrderRequest); return purchaseOrderBusiness.GetAuditPurchaseOrderList(auditOrderRequest);
} }
@ -86,5 +87,16 @@ namespace BBWY.Server.API.Controllers
{ {
purchaseOrderBusiness.CallbackFrom1688(message); purchaseOrderBusiness.CallbackFrom1688(message);
} }
/// <summary>
/// 拳探发货回调
/// </summary>
/// <param name="request"></param>
[HttpPost]
[AllowAnonymous]
public void QuanTanSendGoodsCallback([FromBody] QuanTanSendGoodsNotifyRequest request)
{
purchaseOrderBusiness.QuanTan_SendGoodsCallback(request);
}
} }
} }

22
BBWY.Server.Business/PurchaseOrder/PurchaseOrderBusiness.cs

@ -7,6 +7,7 @@ using FreeSql;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using QuanTan.SDK.Model;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -393,7 +394,7 @@ namespace BBWY.Server.Business
private void DeliveryCallbackFrom1688(JObject jObject) private void DeliveryCallbackFrom1688(JObject jObject)
{ {
var purchaseOrderId = jObject["data"].Value<string>("orderId"); var purchaseOrderId = jObject["data"].Value<string>("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);
} }
/// <summary> /// <summary>
@ -407,12 +408,25 @@ namespace BBWY.Server.Business
} }
#endregion #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
/// <summary> /// <summary>
/// 采购平台发货回调 /// 采购平台发货回调
/// </summary> /// </summary>
/// <param name="purchaseOrderId"></param> /// <param name="purchaseOrderId"></param>
/// <param name="wayBillNoResponse"></param>
/// <param name="callbackPlatform"></param> /// <param name="callbackPlatform"></param>
private void DeliveryCallback(string purchaseOrderId, Enums.Platform callbackPlatform) private void DeliveryCallback(string purchaseOrderId, WayBillNoResponse wayBillNoResponse, Enums.Platform callbackPlatform)
{ {
string currentProgress = string.Empty; string currentProgress = string.Empty;
string wayBillNoResponseInfo = string.Empty; string wayBillNoResponseInfo = string.Empty;
@ -464,7 +478,9 @@ namespace BBWY.Server.Business
OrderId = purchaseOrderId, OrderId = purchaseOrderId,
Platform = callbackPlatform 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 }); wayBillNoResponseInfo = JsonConvert.SerializeObject(new { Request = queryOrderWayBillNoRequest, Result = wayBillNoResponse });
#endregion #endregion

13
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; }
}
}
Loading…
Cancel
Save