diff --git a/KJD_WebService/Controllers/WX/WXShopRevenueStatisticsController.cs b/KJD_WebService/Controllers/WX/WXShopRevenueStatisticsController.cs
index 3ef2a9f..6305634 100644
--- a/KJD_WebService/Controllers/WX/WXShopRevenueStatisticsController.cs
+++ b/KJD_WebService/Controllers/WX/WXShopRevenueStatisticsController.cs
@@ -50,57 +50,7 @@ namespace KJD_Web.Controllers.WX
{
return GetShopStats(request, request.GroupType);
}
- ///
- /// 外部调用
- ///
- ///
- ///
- public IHttpActionResult GetShopStatsExternal(ShopStatsRequest request)
- {
- Dictionary> ret; try
- {
- if (request == null) throw new ArgumentNullException(nameof(request));
- if (request.StartDate == null) throw new ArgumentNullException(nameof(request.StartDate));
- if (request.EndDate == null) throw new ArgumentNullException(nameof(request.EndDate));
- if (request.ShopIds == null || request.ShopIds.Count == 0) throw new ArgumentNullException(nameof(request.ShopIds));
- Dictionary dict = _freeSql.Select()
- .Where(a => request.ShopIds.Contains(a.AppKey))
- .ToList(a => new { a.Id, a.AppKey })
- .ToDictionary(a => a.Id.ToString(), a => a.AppKey);
- var shopIds = dict.Keys.ToList();
- ret = _statsService.GetShopStats(request.StartDate, request.EndDate, "", shopIds, request.GroupType);
- var newRet = new Dictionary>();
- foreach (var item in ret)
- {
-
- if (dict.TryGetValue(item.Key, out var appKey))
- {
- item.Value.ForEach(a => a.ShopId = appKey);
- newRet[appKey] = item.Value;
- }
- else
- {
- newRet[item.Key] = item.Value;
- }
- }
-
- return Ok(ApiResult.Success(newRet));
- }
- catch (ArgumentNullException ex)
- {
- return Ok(ApiResult.Fail(ex.Message, ResultCode.Fail));
- }
- catch (ArgumentException ex)
- {
- return Ok(ApiResult.Fail(ex.Message, ResultCode.Fail));
-
- }
- catch (Exception ex)
- {
- return Ok(ApiResult.Fail("查询失败:", ResultCode.ServerError));
- }
- }
///
/// 商铺销售趋势:按天返回所有商铺合计的销售额和订单数(无数据的天补 0)
@@ -160,5 +110,104 @@ namespace KJD_Web.Controllers.WX
return Ok(ApiResult.Fail("查询失败", ResultCode.ServerError));
}
}
+
+
+ #region 外部接口
+
+ ///
+ /// 外部调用
+ ///
+ ///
+ ///
+ public IHttpActionResult GetShopStatsExternal(ShopStatsRequest request)
+ {
+ Dictionary> ret;
+ try
+ {
+ if (request == null) throw new ArgumentNullException(nameof(request));
+ if (request.StartDate == null) throw new ArgumentNullException(nameof(request.StartDate));
+ if (request.EndDate == null) throw new ArgumentNullException(nameof(request.EndDate));
+ if (request.ShopIds == null || request.ShopIds.Count == 0) throw new ArgumentNullException(nameof(request.ShopIds));
+ Dictionary dict = _freeSql.Select()
+ .Where(a => request.ShopIds.Contains(a.AppKey))
+ .ToList(a => new { a.Id, a.AppKey })
+ .ToDictionary(a => a.Id.ToString(), a => a.AppKey);
+ var shopIds = dict.Keys.ToList();
+ ret = _statsService.GetShopStats(request.StartDate, request.EndDate, "", shopIds, request.GroupType);
+ var newRet = new Dictionary>();
+
+ foreach (var item in ret)
+ {
+
+ if (dict.TryGetValue(item.Key, out var appKey))
+ {
+ item.Value.ForEach(a => a.ShopId = appKey);
+ newRet[appKey] = item.Value;
+ }
+ else
+ {
+ newRet[item.Key] = item.Value;
+ }
+ }
+
+ return Ok(ApiResult.Success(newRet));
+ }
+ catch (ArgumentNullException ex)
+ {
+ return Ok(ApiResult.Fail(ex.Message, ResultCode.Fail));
+ }
+ catch (ArgumentException ex)
+ {
+ return Ok(ApiResult.Fail(ex.Message, ResultCode.Fail));
+
+ }
+ catch (Exception ex)
+ {
+ return Ok(ApiResult.Fail("查询失败:", ResultCode.ServerError));
+ }
+ }
+
+
+
+ ///
+ /// 订单明细统一入口:有效订单 / 退款订单 / 买手未退回金额的订单,三种列表返回同一结构
+ /// 请求参数 OrderType:All(默认全部) / Valid(有效订单) / Refund(退款订单) / BuyerUnrefunded(买手未退回金额)
+ /// 时间范围为订单创建时间,商铺ID为空时按用户名的商铺查询
+ ///
+ public IHttpActionResult GetShopOrderDetailsExternal(ShopStatsRequest request)
+ {
+ List ret;
+ try
+ {
+ if (request == null) throw new ArgumentNullException(nameof(request));
+ if (request.StartDate == null) throw new ArgumentNullException(nameof(request.StartDate));
+ if (request.EndDate == null) throw new ArgumentNullException(nameof(request.EndDate));
+ if (request.ShopIds == null || request.ShopIds.Count == 0) throw new ArgumentNullException(nameof(request.ShopIds));
+ Dictionary dict = _freeSql.Select()
+ .Where(a => request.ShopIds.Contains(a.AppKey))
+ .ToList(a => new { a.Id, a.AppKey })
+ .ToDictionary(a => a.Id.ToString(), a => a.AppKey);
+ var shopIds = dict.Keys.ToList();
+
+
+ ret = _statsService.GetShopOrderDetails(request.StartDate, request.EndDate, request.OrderType, "", shopIds);
+ //return Ok(ApiResult.Success(ret));
+
+
+
+ foreach (var item in ret)
+ {
+ item.ShopId= dict[item.ShopId];
+ }
+
+ return Ok(ApiResult.Success(ret));
+
+ }
+ catch (Exception ex)
+ {
+ return Ok(ApiResult.Fail("查询失败", ResultCode.ServerError));
+ }
+ }
+ #endregion
}
}
diff --git a/KJD_WebService/Responses/Shops/ShopOrderDetailResponse.cs b/KJD_WebService/Responses/Shops/ShopOrderDetailResponse.cs
index f796bf8..3938ce4 100644
--- a/KJD_WebService/Responses/Shops/ShopOrderDetailResponse.cs
+++ b/KJD_WebService/Responses/Shops/ShopOrderDetailResponse.cs
@@ -17,7 +17,7 @@ public class ShopOrderDetailResponse
///
/// 店铺ID
///
- public long ShopId { get; set; }
+ public string ShopId { get; set; }
///
/// 店铺名称
diff --git a/KJD_WebService/Services/Shops/ShopRevenueStatisticsService.cs b/KJD_WebService/Services/Shops/ShopRevenueStatisticsService.cs
index 612108c..3d6375b 100644
--- a/KJD_WebService/Services/Shops/ShopRevenueStatisticsService.cs
+++ b/KJD_WebService/Services/Shops/ShopRevenueStatisticsService.cs
@@ -231,7 +231,7 @@ public class ShopRevenueStatisticsService : ITransientDependency
result.Add(new ShopOrderDetailResponse
{
- ShopId = order.ShopId,
+ ShopId = order.ShopId.ToString(),
ShopName = order.ShopName,
OrderId = order.OrderId,
CreateTime = order.CreateTime,