增加 商铺统计update 日志用于排查bug
This commit is contained in:
1 parent
86d30fec47
commit
aff674c862
3 files changed
+28
-12
No files matched your search
@@ -358,7 +358,7 @@ public class ShopRevenueStatisticsService : ITransientDependency
|
|||||||
/// 更新
|
/// 更新
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
public void UpdateStats(DateTime date)
|
public void UpdateStats(DateTime date, List<long> shopIds = null)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
商铺新增订单创建时间
|
商铺新增订单创建时间
|
||||||
@@ -406,8 +406,13 @@ public class ShopRevenueStatisticsService : ITransientDependency
|
|||||||
//查询订单归属商铺和时间
|
//查询订单归属商铺和时间
|
||||||
foreach (string[] batch in Batch(allUpdateOrderIds, BatchSize))
|
foreach (string[] batch in Batch(allUpdateOrderIds, BatchSize))
|
||||||
{
|
{
|
||||||
allUpdateStats.AddRange(_freeSql.Select<WeiOrderEntity>()
|
var query = _freeSql.Select<WeiOrderEntity>()
|
||||||
.Where(a => batch.Contains(a.OrderId))
|
.Where(a => batch.Contains(a.OrderId));
|
||||||
|
if (shopIds != null && shopIds.Count > 0)
|
||||||
|
{
|
||||||
|
query.Where(a => shopIds.Contains(a.ShopId));
|
||||||
|
}
|
||||||
|
allUpdateStats.AddRange(query
|
||||||
.ToList(a => new UpdateStatsInfo
|
.ToList(a => new UpdateStatsInfo
|
||||||
{
|
{
|
||||||
ShopId = a.ShopId.ToString(),
|
ShopId = a.ShopId.ToString(),
|
||||||
@@ -432,16 +437,19 @@ public class ShopRevenueStatisticsService : ITransientDependency
|
|||||||
// 2. 这些日期走"全量执行":对所有商铺跑
|
// 2. 这些日期走"全量执行":对所有商铺跑
|
||||||
foreach (var item in dict)
|
foreach (var item in dict)
|
||||||
{
|
{
|
||||||
|
string _date = DateTime.Now.ToString("yyyy-MM-dd");
|
||||||
if (item.Value.Count > 1000)
|
if (item.Value.Count > 1000)
|
||||||
{
|
{
|
||||||
|
_logger.Info($"更新全天:{_date}");
|
||||||
ShopDailyStats(item.Key);
|
ShopDailyStats(item.Key);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShopDailyStats(item.Key, item.Value);
|
var _shopIds = item.Value.Distinct().ToList();
|
||||||
|
_logger.Info($"{_date} 更新指定商铺:{string.Join(",", _shopIds)}");
|
||||||
|
ShopDailyStats(item.Key, _shopIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string log = $"更新统计:{dict.Count}天数据";
|
string log = $"更新统计:{dict.Count}天数据";
|
||||||
_logger.Info(log);
|
_logger.Info(log);
|
||||||
Debug.WriteLine(log);
|
Debug.WriteLine(log);
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ internal class GiftLogisticsTest
|
|||||||
public void GetOrderStatus()
|
public void GetOrderStatus()
|
||||||
{
|
{
|
||||||
var logisticsService = _container.Resolve<VirtualLogisticsService>();
|
var logisticsService = _container.Resolve<VirtualLogisticsService>();
|
||||||
var data = logisticsService.GetOrderStatus(["260927-623588227382767"]);
|
var data = logisticsService.GetOrderStatus(["261013-396791693624092_1"]);
|
||||||
Console.WriteLine(string.Join(" ", data.Select(a => $"{a.OrderSn}:{a.KuaidiSn}:{a.ShopOrder}:{a.DeliveryStatus}")));
|
Console.WriteLine(string.Join(" ", data.Select(a => $"{a.OrderSn}:{a.KuaidiSn}:{a.ShopOrder}:{a.DeliveryStatus}")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,8 +105,8 @@ internal class ShopTest
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
DateTime startDate = DateTime.Parse("2026/06/01");
|
DateTime startDate = DateTime.Parse("2026/10/5");
|
||||||
DateTime endDate = DateTime.Parse("2026/07/31");
|
DateTime endDate = DateTime.Parse("2026/10/14");
|
||||||
|
|
||||||
for (DateTime d = startDate; d <= endDate; d = d.AddDays(1))
|
for (DateTime d = startDate; d <= endDate; d = d.AddDays(1))
|
||||||
{
|
{
|
||||||
@@ -137,10 +137,10 @@ internal class ShopTest
|
|||||||
public void GetShopSalesOrderTest()
|
public void GetShopSalesOrderTest()
|
||||||
{
|
{
|
||||||
var shopService = _container.Resolve<ShopService>();
|
var shopService = _container.Resolve<ShopService>();
|
||||||
var shopIds =shopService.GetShopIds("taiyuanqiji");
|
var shopIds =shopService.GetShopIds("15937791563");
|
||||||
shopIds = null;
|
//shopIds = null;
|
||||||
var shopStatsService = _container.Resolve<ShopRevenueStatisticsService>();
|
var shopStatsService = _container.Resolve<ShopRevenueStatisticsService>();
|
||||||
DateTime date = DateTime.Parse("2026/10/11");
|
DateTime date = DateTime.Parse("2026/10/17");
|
||||||
|
|
||||||
Console.WriteLine($"开始:{date.ToLongDateString()}");
|
Console.WriteLine($"开始:{date.ToLongDateString()}");
|
||||||
try
|
try
|
||||||
@@ -159,7 +159,15 @@ internal class ShopTest
|
|||||||
public void UpdateStatsTest()
|
public void UpdateStatsTest()
|
||||||
{
|
{
|
||||||
var shopService = _container.Resolve<ShopRevenueStatisticsService>();
|
var shopService = _container.Resolve<ShopRevenueStatisticsService>();
|
||||||
shopService.UpdateStats(DateTime.Now.AddDays(-1).Date);
|
shopService.UpdateStats(DateTime.Now.AddDays(-2).Date,new List<long>
|
||||||
|
{
|
||||||
|
1960967267443628991,
|
||||||
|
1960967267443628989,
|
||||||
|
1960967267443628993,
|
||||||
|
1960967267443628994,
|
||||||
|
1960967267443628990,
|
||||||
|
1960967267443628992,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|||||||
Reference in new issue
Block a user