增加 商铺统计update 日志用于排查bug

This commit is contained in:
chfei committed 2026-10-19 15:23:36 +08:00
1 parent 86d30fec47
commit aff674c862
3 files changed
+28 -12

No files matched your search

@@ -358,7 +358,7 @@ public class ShopRevenueStatisticsService : ITransientDependency
/// 更新
/// </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))
{
allUpdateStats.AddRange(_freeSql.Select<WeiOrderEntity>()
.Where(a => batch.Contains(a.OrderId))
var query = _freeSql.Select<WeiOrderEntity>()
.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
{
ShopId = a.ShopId.ToString(),
@@ -432,16 +437,19 @@ public class ShopRevenueStatisticsService : ITransientDependency
// 2. 这些日期走"全量执行":对所有商铺跑
foreach (var item in dict)
{
string _date = DateTime.Now.ToString("yyyy-MM-dd");
if (item.Value.Count > 1000)
{
_logger.Info($"更新全天:{_date}");
ShopDailyStats(item.Key);
}
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}天数据";
_logger.Info(log);
Debug.WriteLine(log);
+1 -1
View File
@@ -129,7 +129,7 @@ internal class GiftLogisticsTest
public void GetOrderStatus()
{
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}")));
}
}
+14 -6
View File
@@ -105,8 +105,8 @@ internal class ShopTest
{
get
{
DateTime startDate = DateTime.Parse("2026/06/01");
DateTime endDate = DateTime.Parse("2026/07/31");
DateTime startDate = DateTime.Parse("2026/10/5");
DateTime endDate = DateTime.Parse("2026/10/14");
for (DateTime d = startDate; d <= endDate; d = d.AddDays(1))
{
@@ -137,10 +137,10 @@ internal class ShopTest
public void GetShopSalesOrderTest()
{
var shopService = _container.Resolve<ShopService>();
var shopIds =shopService.GetShopIds("taiyuanqiji");
shopIds = null;
var shopIds =shopService.GetShopIds("15937791563");
//shopIds = null;
var shopStatsService = _container.Resolve<ShopRevenueStatisticsService>();
DateTime date = DateTime.Parse("2026/10/11");
DateTime date = DateTime.Parse("2026/10/17");
Console.WriteLine($"开始:{date.ToLongDateString()}");
try
@@ -159,7 +159,15 @@ internal class ShopTest
public void UpdateStatsTest()
{
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]