|
|
@ -16,6 +16,7 @@ using System.Collections.Concurrent; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Net.Http; |
|
|
|
using System.Threading; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Yitter.IdGenerator; |
|
|
|
|
|
|
@ -63,6 +64,32 @@ namespace BBWY.Server.Business |
|
|
|
SyncOrder(shop, orderId, startTime, endTime, isAuto: false, Enums.SortTimeType.StartTime); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 手动同步订单
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="shopId"></param>
|
|
|
|
/// <param name="orderIds"></param>
|
|
|
|
/// <param name="startTime"></param>
|
|
|
|
/// <param name="endTime"></param>
|
|
|
|
public void ManualSyncOrder(long shopId, IList<string> orderIds, DateTime? startTime = null, DateTime? endTime = null) |
|
|
|
{ |
|
|
|
var shop = venderBusiness.GetShopByShopId(shopId.ToString()); |
|
|
|
Task.Factory.StartNew(() => |
|
|
|
{ |
|
|
|
var i = 1; |
|
|
|
foreach (var orderId in orderIds) |
|
|
|
{ |
|
|
|
SyncOrder(shop, orderId, startTime, endTime, isAuto: false, Enums.SortTimeType.StartTime); |
|
|
|
Thread.Sleep(500); |
|
|
|
i++; |
|
|
|
Console.WriteLine(); |
|
|
|
Console.WriteLine($"Sync Order {orderId}, {i}"); |
|
|
|
} |
|
|
|
Console.WriteLine("job done"); |
|
|
|
}, System.Threading.CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.SyncOrderTaskScheduler); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void SyncOrder(ShopResponse shop, string orderId, DateTime? startTime = null, DateTime? endTime = null, bool isAuto = false, Enums.SortTimeType? sortTimeType = null) |
|
|
|
{ |
|
|
|
try |
|
|
@ -74,7 +101,7 @@ namespace BBWY.Server.Business |
|
|
|
var relayAPIHost = GetPlatformRelayAPIHost(shop.PlatformId); |
|
|
|
var orderListApiResult = restApiService.SendRequest(relayAPIHost, "api/PlatformSDK/GetOrderList", new SearchPlatformOrderRequest() |
|
|
|
{ |
|
|
|
StartDate = startTime ?? DateTime.Now.AddHours(-3), |
|
|
|
StartDate = startTime ?? DateTime.Now.AddHours(shop.ShopName.Contains("腾奇") ? -0.5 : -3), |
|
|
|
EndDate = endTime ?? DateTime.Now, |
|
|
|
AppKey = shop.AppKey, |
|
|
|
AppSecret = shop.AppSecret, |
|
|
@ -297,6 +324,8 @@ namespace BBWY.Server.Business |
|
|
|
foreach (var orderJToken in noGiftOrderList) |
|
|
|
{ |
|
|
|
var orderId = orderJToken.Value<string>("orderId"); |
|
|
|
if (insertOrderList.Count(o => o.Id == orderId) > 0) |
|
|
|
continue; |
|
|
|
var dbOrder = dbOrderList.FirstOrDefault(o => o.Id == orderId); |
|
|
|
var isNewOrder = dbOrder == null; |
|
|
|
SDCalculationCostRequest sDCalculationCostRequest = null; //SD信息埋点
|
|
|
@ -654,6 +683,8 @@ namespace BBWY.Server.Business |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fsql.Transaction(() => |
|
|
|
{ |
|
|
|
if (insertOrderList.Count() > 0) |
|
|
|