diff --git a/BBWY.Client/APIServices/StatisticsService.cs b/BBWY.Client/APIServices/StatisticsService.cs index 4c60ec25..3efe0543 100644 --- a/BBWY.Client/APIServices/StatisticsService.cs +++ b/BBWY.Client/APIServices/StatisticsService.cs @@ -17,7 +17,7 @@ namespace BBWY.Client.APIServices /// 今日业绩统计 /// /// - public ApiResponse GetTodayAchievementStatistics(DateTime startTime, DateTime endTime,long shopId) + public ApiResponse GetTodayAchievementStatistics(DateTime startTime, DateTime endTime, long shopId) { return SendRequest(globalContext.BBYWApiHost, "Api/Statistics/GetOrderAchievementStatistics", new { @@ -32,5 +32,15 @@ namespace BBWY.Client.APIServices { return SendRequest(globalContext.BBYWApiHost, "Api/Statistics/GetOrderCountStatistics", $"shopId={shopId}&startDate={startDate:yyyy-MM-dd}&endDate={endDate:yyyy-MM-dd}", null, HttpMethod.Get); } + + /// + /// 刷单组个人统计 + /// + /// + /// + public ApiResponse GetSDGroupPersonStatistics(string sdOperator) + { + return SendRequest(globalContext.BBYWApiHost, $"/Api/Statistics/GetSDGroupPersonStatistics/{sdOperator}", null, null, HttpMethod.Get); + } } } diff --git a/BBWY.Client/App.xaml.cs b/BBWY.Client/App.xaml.cs index cc29e8ed..2b6ae76e 100644 --- a/BBWY.Client/App.xaml.cs +++ b/BBWY.Client/App.xaml.cs @@ -32,10 +32,10 @@ namespace BBWY.Client string userToken = string.Empty; #if DEBUG //齐越山鸡 - userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTM1MzMwMzI4ODkyMTQ5NzYwIiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNDM2Mjg4NTAwMjM1MjQzNTIwIiwiZXhwIjoxNjk0NjY5NjkxfQ.cSwro-7bGwOu92YejH9JhMenTai7Mvf99i2paQCmxIw"; + //userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTM1MzMwMzI4ODkyMTQ5NzYwIiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNDM2Mjg4NTAwMjM1MjQzNTIwIiwiZXhwIjoxNjk0NjY5NjkxfQ.cSwro-7bGwOu92YejH9JhMenTai7Mvf99i2paQCmxIw"; //刷单组测试 - //userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTcxODUyODE0OTAzMTUyNjQwIiwidGVhbUlkIjoiMTU3MTg1MjQ1MDI5NjUwMDIyNCIsInNvblRlYW1JZHMiOiIiLCJleHAiOjE2OTUxNDc2ODh9.hVupdHnhgHHGo3QrMSDqhINqtq6Q5_RovWyXjiMkkEs"; + userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTcxODUyODE0OTAzMTUyNjQwIiwidGVhbUlkIjoiMTU3MTg1MjQ1MDI5NjUwMDIyNCIsInNvblRlYW1JZHMiOiIiLCJleHAiOjE2OTUxNDc2ODh9.hVupdHnhgHHGo3QrMSDqhINqtq6Q5_RovWyXjiMkkEs"; //齐越愉辰 //userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNDM5OTEyNDU1MzExNDYyNDAwIiwidGVhbUlkIjoiMTQzOTg5ODYxNzM1ODg0ODAwMCIsInNvblRlYW1JZHMiOiIiLCJleHAiOjE2OTUwNDA0ODZ9.0TvEhPzTeKvpQY31E5YhgfvRBJHYdvwWRrEHNnF9kkA"; //齐越悠仁 diff --git a/BBWY.Client/Models/APIModel/Response/Statistics/SDGroupPersonStatisticsResponse.cs b/BBWY.Client/Models/APIModel/Response/Statistics/SDGroupPersonStatisticsResponse.cs new file mode 100644 index 00000000..ffab5d5b --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/Statistics/SDGroupPersonStatisticsResponse.cs @@ -0,0 +1,9 @@ +namespace BBWY.Client.Models +{ + public class SDGroupPersonStatisticsResponse + { + public int MySDCount { get; set; } + + public decimal OrderPayment { get; set; } + } +} diff --git a/BBWY.Client/Models/MappingProfile.cs b/BBWY.Client/Models/MappingProfile.cs index 20eb37d1..7ddf4128 100644 --- a/BBWY.Client/Models/MappingProfile.cs +++ b/BBWY.Client/Models/MappingProfile.cs @@ -28,7 +28,7 @@ namespace BBWY.Client.Models CreateMap(); CreateMap(); - + CreateMap(); } } } diff --git a/BBWY.Client/Models/Statistics/SDGroupPersonStatistics.cs b/BBWY.Client/Models/Statistics/SDGroupPersonStatistics.cs new file mode 100644 index 00000000..a418f1f1 --- /dev/null +++ b/BBWY.Client/Models/Statistics/SDGroupPersonStatistics.cs @@ -0,0 +1,12 @@ +namespace BBWY.Client.Models +{ + public class SDGroupPersonStatistics : NotifyObject + { + private int mySDCount; + private decimal orderPayment; + + public int MySDCount { get => mySDCount; set { Set(ref mySDCount, value); } } + + public decimal OrderPayment { get => orderPayment; set { Set(ref orderPayment, value); } } + } +} diff --git a/BBWY.Client/ViewModels/Order/OrderListViewModel.cs b/BBWY.Client/ViewModels/Order/OrderListViewModel.cs index 2e220c35..d161d960 100644 --- a/BBWY.Client/ViewModels/Order/OrderListViewModel.cs +++ b/BBWY.Client/ViewModels/Order/OrderListViewModel.cs @@ -156,13 +156,13 @@ namespace BBWY.Client.ViewModels if (IsSDGroup) { querySDOperator = globalContext.User.Name; + SDGroupInit(); } else { queryShopId = globalContext.User.Shop.ShopId; } - SDGroupInit(); random = new Random(); this.globalContext = globalContext; this.orderService = orderService; @@ -359,7 +359,7 @@ namespace BBWY.Client.ViewModels } else { - + Task.Factory.StartNew(()=> LoadSDGroupPersonStatistics()); } } @@ -504,7 +504,7 @@ namespace BBWY.Client.ViewModels } else if (storageType == StorageType.SD) { - var sd = new SD(orderId, true, order.VenderRemark, order.Flag, string.Empty, null, string.Empty, globalContext.User.Name, 0M, 0M, 0M); + var sd = new SD(orderId, true, order.VenderRemark, order.Flag, string.Empty, null, string.Empty, globalContext.User.Name, 0M, 0M, 0M, IsSDGroup ? SDType.刷单组 : SDType.自刷); sd.Closed += Sd_Closed; sd.ShowDialog(); } diff --git a/BBWY.Client/ViewModels/Order/OrderListViewModel_SDGroup.cs b/BBWY.Client/ViewModels/Order/OrderListViewModel_SDGroup.cs index 0a685d06..afdb46d3 100644 --- a/BBWY.Client/ViewModels/Order/OrderListViewModel_SDGroup.cs +++ b/BBWY.Client/ViewModels/Order/OrderListViewModel_SDGroup.cs @@ -22,12 +22,14 @@ namespace BBWY.Client.ViewModels public Shop SdGroupSelectedShop { get => sdGroupSelectedShop; set { Set(ref sdGroupSelectedShop, value); } } + public SDGroupPersonStatistics SDGroupPersonStatistics { get; set; } private void SDGroupInit() { SetSDButtinIndexCommand = new RelayCommand(SetSDButtinIndex); SDGroupSelectedShopChangedCommand = new RelayCommand(SDGroupSelectedShopChanged); SDGroupPullCommand = new RelayCommand(SDGroupPull); + SDGroupPersonStatistics = new SDGroupPersonStatistics(); } private void SetSDButtinIndex(int index) @@ -71,5 +73,12 @@ namespace BBWY.Client.ViewModels }); }); } + + private void LoadSDGroupPersonStatistics() + { + var response = statisticsService.GetSDGroupPersonStatistics(querySDOperator); + if (response.Success) + response.Data.Map(SDGroupPersonStatistics); + } } } diff --git a/BBWY.Client/Views/Order/SDGroup.xaml b/BBWY.Client/Views/Order/SDGroup.xaml index 353f104e..8c3b2957 100644 --- a/BBWY.Client/Views/Order/SDGroup.xaml +++ b/BBWY.Client/Views/Order/SDGroup.xaml @@ -135,6 +135,25 @@ + + + + + + + + + + + + + + + + + + /// [HttpGet] - public OrderCountStatisticsResponse GetOrderCountStatistics([FromQuery]long shopId, [FromQuery]DateTime startDate, [FromQuery]DateTime endDate) - { - return statisticsBusiness.GetOrderCountStatistics(shopId, startDate, endDate); + public OrderCountStatisticsResponse GetOrderCountStatistics([FromQuery] long shopId, [FromQuery] DateTime startDate, [FromQuery] DateTime endDate) + { + return statisticsBusiness.GetOrderCountStatistics(shopId, startDate, endDate); + } + + /// + /// 刷单组个人统计 + /// + /// + /// + [HttpGet("{sdOperator}")] + public SDGroupPersonStatisticsResponse GetSDGroupPersonStatistics([FromRoute] string sdOperator) + { + return statisticsBusiness.GetSDGroupPersonStatistics(sdOperator); } } } diff --git a/BBWY.Server.Business/Statistics/StatisticsBusiness.cs b/BBWY.Server.Business/Statistics/StatisticsBusiness.cs index df054738..e2402686 100644 --- a/BBWY.Server.Business/Statistics/StatisticsBusiness.cs +++ b/BBWY.Server.Business/Statistics/StatisticsBusiness.cs @@ -270,5 +270,19 @@ namespace BBWY.Server.Business (o.StorageType == null && o.OrderState != Enums.OrderState.等待采购))).Count(); return response; } + + /// + /// SD组个人统计 + /// + /// + /// + public SDGroupPersonStatisticsResponse GetSDGroupPersonStatistics(string sdOperator) + { + return fsql.Select().Where(o => o.StorageType == Enums.StorageType.SD && o.SDOperator == sdOperator).ToAggregate(g => new SDGroupPersonStatisticsResponse + { + MySDCount = g.Count(), + OrderPayment = g.Sum(g.Key.OrderPayment) + }); + } } } diff --git a/BBWY.Server.Model/Dto/Response/Statistics/SDGroupPersonStatisticsResponse.cs b/BBWY.Server.Model/Dto/Response/Statistics/SDGroupPersonStatisticsResponse.cs new file mode 100644 index 00000000..6b0b5938 --- /dev/null +++ b/BBWY.Server.Model/Dto/Response/Statistics/SDGroupPersonStatisticsResponse.cs @@ -0,0 +1,15 @@ +namespace BBWY.Server.Model.Dto +{ + public class SDGroupPersonStatisticsResponse + { + /// + /// 我的总刷单量 + /// + public int MySDCount { get; set; } + + /// + /// 实付金额 + /// + public decimal OrderPayment { get; set; } + } +}