diff --git a/BBWY.Client/APIServices/ShopService.cs b/BBWY.Client/APIServices/ShopService.cs index 1d1da395..563472e6 100644 --- a/BBWY.Client/APIServices/ShopService.cs +++ b/BBWY.Client/APIServices/ShopService.cs @@ -42,9 +42,9 @@ namespace BBWY.Client.APIServices /// 获取部门及下属店铺 /// /// - public ApiResponse> GetDepartmentList() + public ApiResponse> GetDepartmentList() { - return SendRequest>(globalContext.BBYWApiHost, "api/vender/GetDeparmentList", null, null, HttpMethod.Get); + return SendRequest>(globalContext.BBYWApiHost, "api/vender/GetDeparmentList", null, null, HttpMethod.Get); } diff --git a/BBWY.Client/App.xaml.cs b/BBWY.Client/App.xaml.cs index 0949e230..40d6a32b 100644 --- a/BBWY.Client/App.xaml.cs +++ b/BBWY.Client/App.xaml.cs @@ -31,7 +31,9 @@ namespace BBWY.Client string userToken = string.Empty; #if DEBUG userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNDM5OTA3NDY1MDMzNDIwODAwIiwidGVhbUlkIjoiMTQzNjI4ODUwMDIzNTI0MzUyMCIsImV4cCI6MTY4MjU3NzUzNn0.76Ll9syp3R21VD01NxpHmcs7TyBKzqeob3i5avpLv-E"; //齐越小一 - //"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNDUzOTA0NTczMjM5Mzk4NDAwIiwidGVhbUlkIjoiMTQzOTg5ODI2MDg3MjM2ODEyOCIsImV4cCI6MTY4MjQwODY1OH0.Po9-Dw_CgbAB7kjh7broLGIjOdsL2JifPtodNKClRIw"; + + //userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNDM5OTA1OTcyOTk3ODUzMTg0IiwidGVhbUlkIjoiMTQzOTkwNDA1MDc3NzY5MDExMiIsImV4cCI6MTY4NjQxODcyOH0.K7-MXjt_zfNK5v_08VjmCDnhAGF6SI7sEQr5sgDn7Jk"; //齐越珍珍 + #else var uid = e.Args.Count() > 0 ? e.Args.LastOrDefault(args => args.StartsWith("uid:")) : string.Empty; if (string.IsNullOrEmpty(uid)) diff --git a/BBWY.Client/Models/APIModel/Response/Shop/ShopResponse.cs b/BBWY.Client/Models/APIModel/Response/Shop/ShopResponse.cs index 29c6e1a0..3786154c 100644 --- a/BBWY.Client/Models/APIModel/Response/Shop/ShopResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/Shop/ShopResponse.cs @@ -8,7 +8,7 @@ namespace BBWY.Client.Models public Platform PlatformId { get; set; } - public long? ShopId { get; set; } + public long ShopId { get; set; } public string ShopName { get; set; } @@ -30,4 +30,13 @@ namespace BBWY.Client.Models public string TeamName { get; set; } } + + public class DepartmentResponse + { + public string Id { get; set; } + + public string Name { get; set; } + + public IList ShopList { get; set; } + } } diff --git a/BBWY.Client/Models/MappingProfile.cs b/BBWY.Client/Models/MappingProfile.cs index d9d6c71b..a93b0001 100644 --- a/BBWY.Client/Models/MappingProfile.cs +++ b/BBWY.Client/Models/MappingProfile.cs @@ -18,15 +18,16 @@ namespace BBWY.Client.Models .ForMember(t => t.TeamName, opt => opt.MapFrom(f => f.DepartmentName)) .ForMember(t => t.Name, opt => opt.MapFrom(f => f.UserName)); - CreateMap().ForMember(t => t.ShopId, opt => opt.MapFrom(f => f.ShopId)) - .ForMember(t => t.Name, opt => opt.MapFrom(f => f.ShopName)) - .ForMember(t => t.VenderType, opt => opt.MapFrom(f => f.ShopType)) + CreateMap().ForMember(t => t.VenderType, opt => opt.MapFrom(f => f.ShopType)) .ForMember(t => t.Platform, opt => opt.MapFrom(f => f.PlatformId)) .ForMember(t => t.PurchaseAccountList, opt => opt.MapFrom(f => f.PurchaseList)); + CreateMap(); + CreateMap(); CreateMap(); CreateMap(); + } } } diff --git a/BBWY.Client/Models/Shop/Department.cs b/BBWY.Client/Models/Shop/Department.cs index 6b5ae9f9..8da5ed12 100644 --- a/BBWY.Client/Models/Shop/Department.cs +++ b/BBWY.Client/Models/Shop/Department.cs @@ -8,30 +8,11 @@ namespace BBWY.Client.Models public string Name { get; set; } - public IList ShopList { get; set; } + public IList ShopList { get; set; } public Department() { - ShopList = new List(); - } - } - - public class SimpleShop : NotifyObject - { - private bool isSelected; - - /// - /// ShopId - /// - public long Id { get; set; } - - public string Name { get; set; } - - public bool IsSelected { get => isSelected; set { Set(ref isSelected, value); } } - - public override string ToString() - { - return Name; + ShopList = new List(); } } } diff --git a/BBWY.Client/Models/Shop/Department2.cs b/BBWY.Client/Models/Shop/Department2.cs deleted file mode 100644 index 6163dfac..00000000 --- a/BBWY.Client/Models/Shop/Department2.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections.Generic; - -namespace BBWY.Client.Models -{ - public class Department2 - { - public string Id { get; set; } - - public string Name { get; set; } - - public IList ShopList { get; set; } - - public Department2() - { - ShopList = new List(); - } - } -} diff --git a/BBWY.Client/Models/Shop/Shop.cs b/BBWY.Client/Models/Shop/Shop.cs index 58823ec3..b930e46e 100644 --- a/BBWY.Client/Models/Shop/Shop.cs +++ b/BBWY.Client/Models/Shop/Shop.cs @@ -4,8 +4,10 @@ namespace BBWY.Client.Models { public class Shop : NotifyObject { - private string name; + private bool isSelected; + private string shopName; + public bool IsSelected { get => isSelected; set { Set(ref isSelected, value); } } /// /// 店铺Id /// @@ -27,7 +29,7 @@ namespace BBWY.Client.Models public string AppToken { get; set; } - public string Name { get => name; set { Set(ref name, value); } } + public string ShopName { get => shopName; set { Set(ref shopName, value); } } public IList PurchaseAccountList { get; set; } diff --git a/BBWY.Client/Models/User/User.cs b/BBWY.Client/Models/User/User.cs index e782f434..6c6b3f22 100644 --- a/BBWY.Client/Models/User/User.cs +++ b/BBWY.Client/Models/User/User.cs @@ -24,6 +24,6 @@ namespace BBWY.Client.Models public Shop Shop { get => shop; set { Set(ref shop, value); } } - public IList DepartmentList { get; set; } + public IList DepartmentList { get; set; } } } diff --git a/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs b/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs index 73002e72..a1fc3734 100644 --- a/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs +++ b/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs @@ -20,6 +20,7 @@ namespace BBWY.Client.ViewModels { public class ProcurementAuditViewModel : BaseVM, IDenpendency { + private GlobalContext globalContext; private AuditFile selectAuditFile; private bool isLoading; private bool isAudited; @@ -138,8 +139,9 @@ namespace BBWY.Client.ViewModels public ICommand ImportJDShopOrderCommand { get; set; } - public ProcurementAuditViewModel(ShopService shopService, PurchaseOrderService purchaseOrderService) + public ProcurementAuditViewModel(ShopService shopService, PurchaseOrderService purchaseOrderService, GlobalContext globalContext) { + this.globalContext = globalContext; AuditFileList = new ObservableCollection(); AuditCommand = new RelayCommand(Audit); ClearAuditCommand = new RelayCommand(ClearAudit); @@ -166,22 +168,9 @@ namespace BBWY.Client.ViewModels private void LoadDepartment() { - Task.Factory.StartNew(() => shopService.GetDepartmentList()).ContinueWith(t => - { - var response = t.Result; - if (!response.Success) - { - App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "提示")); - return; - } - - App.Current.Dispatcher.Invoke(() => - { - foreach (var d in response.Data) - DepartmentList.Add(d); - SelectedDepartment = DepartmentList[0]; - }); - }); + foreach (var d in globalContext.User.DepartmentList) + DepartmentList.Add(d); + SelectedDepartment = DepartmentList[0]; } private void Audit() @@ -220,11 +209,11 @@ namespace BBWY.Client.ViewModels } - private void AuditByPayBill(EventWaitHandle ewh, IList shopList, DateTime startDate, DateTime endDate) + private void AuditByPayBill(EventWaitHandle ewh, IList shopList, DateTime startDate, DateTime endDate) { try { - var auditPurchaseOrderResponse = purchaseOrderService.GetAuditPurchaseOrderList(shopList.Select(s => s.Id).ToList(), startDate, endDate); + var auditPurchaseOrderResponse = purchaseOrderService.GetAuditPurchaseOrderList(shopList.Select(s => s.ShopId).ToList(), startDate, endDate); if (!auditPurchaseOrderResponse.Success) throw new Exception($"获取采购单失败,{auditPurchaseOrderResponse.Msg}"); @@ -243,7 +232,7 @@ namespace BBWY.Client.ViewModels payBill.RelationPurchaseOrderId = relationPurchaseOrder.PurchaseOrderId; payBill.RelationShopOrderId = relationPurchaseOrder.OrderId; payBill.BelongShopId = relationPurchaseOrder.ShopId; - payBill.BelongShop = shopList.FirstOrDefault(s => s.Id == relationPurchaseOrder.ShopId)?.Name; + payBill.BelongShop = shopList.FirstOrDefault(s => s.ShopId == relationPurchaseOrder.ShopId)?.ShopName; #endregion } } diff --git a/BBWY.Client/ViewModels/MainViewModel.cs b/BBWY.Client/ViewModels/MainViewModel.cs index f4bf3ace..8d6758d6 100644 --- a/BBWY.Client/ViewModels/MainViewModel.cs +++ b/BBWY.Client/ViewModels/MainViewModel.cs @@ -24,11 +24,13 @@ namespace BBWY.Client.ViewModels private IHttpClientFactory httpClientFactory; private MdsApiService mdsApiService; private LogisticsService logisticsService; + private ShopService shopService; private MenuModel selectedMenuModel; private bool showShopChoosePanel; private bool showWB2RuntimeDownloadPanel; private double wb2DownloadProgress; - + private IList managerDepartment; + private WebView2Manager w2m; public GlobalContext GlobalContext { get; set; } public IList MenuList { get; set; } @@ -78,11 +80,19 @@ namespace BBWY.Client.ViewModels #endregion #region Methods - public MainViewModel(GlobalContext globalContext, MdsApiService mdsApiService, LogisticsService logisticsService, IHttpClientFactory httpClientFactory) + public MainViewModel(GlobalContext globalContext, + MdsApiService mdsApiService, + LogisticsService logisticsService, + ShopService shopService, + IHttpClientFactory httpClientFactory, + WebView2Manager w2m) { + this.w2m = w2m; + this.managerDepartment = new List() { "董事办", "财务部", "技术部" }; this.httpClientFactory = httpClientFactory; this.mdsApiService = mdsApiService; this.logisticsService = logisticsService; + this.shopService = shopService; ClosingCommand = new RelayCommand(Exit); //ChooseShopCommand = new RelayCommand((s) => ChooseShop(s)); OpenSelectShopCommand = new RelayCommand(OpenSelectShop); @@ -151,14 +161,7 @@ namespace BBWY.Client.ViewModels GlobalContext.User = mdsUserResponse.Data.Map(); #if RELEASE - if (GlobalContext.User.TeamName == "财务部") - { - App.Current.Dispatcher.Invoke(() => - { - for (var i = 0; i < 3; i++) { MenuList.RemoveAt(0); } - }); - } - else + if (!managerDepartment.Contains(GlobalContext.User.TeamName)) //非管理账号,屏蔽财务端 { App.Current.Dispatcher.Invoke(() => { @@ -167,22 +170,9 @@ namespace BBWY.Client.ViewModels } #endif + IList departmentList = null; - //请求用户信息接口 - //GlobalContext.User = new User() - //{ - // Id = userId, - // Name = "ShanJ", - // Store = new Store() - // { - // Platform = Platform.京东, - // AppKey = "120EA9EC65AB017567D78CC1139EEEA5", - // AppSecret = "866a9877f5f24b03b537483b4defe75d", - // AppToken = "d8433fb2a4994484b5d9e5a5896a6dfdmyjj" //10388155 - // } - //}; - - if (GlobalContext.User.TeamName != "财务部") + if (!managerDepartment.Contains(GlobalContext.User.TeamName)) { var shopListResponse = mdsApiService.GetShopsByUserTeam(GlobalContext.User.Id); if (!shopListResponse.Success) @@ -194,44 +184,45 @@ namespace BBWY.Client.ViewModels { ShowShopChoosePanel = false; ChooseShop(shopList[0], true); + return; } else { ShowShopChoosePanel = true; - IList department2s = new List(); + departmentList = new List(); foreach (var shop in shopList) { - var department = department2s.FirstOrDefault(d => d.Id == shop.TeamId); + var department = departmentList.FirstOrDefault(d => d.Id == shop.TeamId); if (department == null) { - department = new Department2() { Id = shop.TeamId, Name = shop.TeamName }; - department2s.Add(department); + department = new Department() { Id = shop.TeamId, Name = shop.TeamName }; + departmentList.Add(department); } department.ShopList.Add(shop); } - GlobalContext.User.DepartmentList = department2s; - - App.Current.Dispatcher.Invoke(() => - { - var selectShop = new SelectShop(department2s); - if (selectShop.ShowDialog() == true) - { - ChooseShop(selectShop.Shop, true); - } - else - { - Environment.Exit(Environment.ExitCode); - } - }); - - //App.Current.Dispatcher.Invoke(() => - //{ - // foreach (var s in shopList) - // ShopList.Add(s); - //}); - //ShowShopChoosePanel = true; } } + else + { + var response = shopService.GetDepartmentList(); + if (!response.Success) + throw new Exception(response.Msg); + departmentList = response.Data.Map>(); + } + + GlobalContext.User.DepartmentList = departmentList; + App.Current.Dispatcher.Invoke(() => + { + var selectShop = new SelectShop(departmentList); + if (selectShop.ShowDialog() == true) + { + ChooseShop(selectShop.Shop, true); + } + else + { + Environment.Exit(Environment.ExitCode); + } + }); } catch (Exception ex) { @@ -256,6 +247,12 @@ namespace BBWY.Client.ViewModels vm.WareManager.Refresh(); if (vm.IsCreateWareStock) vm.WareStock.Refresh(); + + try + { + w2m.Close(); + } + catch { } } } @@ -268,7 +265,7 @@ namespace BBWY.Client.ViewModels string.IsNullOrEmpty(shop.AppToken) || (shop.Platform == Platform.京东 && string.IsNullOrEmpty(shop.VenderType))) { - var error = $"{shop.Name} 店铺数据不完整"; + var error = $"{shop.ShopName} 店铺数据不完整"; if (_throw) throw new Exception(error); else diff --git a/BBWY.Client/Views/FinancialTerminal/ProcurementAudit.xaml b/BBWY.Client/Views/FinancialTerminal/ProcurementAudit.xaml index 9c2d9661..354083b0 100644 --- a/BBWY.Client/Views/FinancialTerminal/ProcurementAudit.xaml +++ b/BBWY.Client/Views/FinancialTerminal/ProcurementAudit.xaml @@ -43,7 +43,7 @@ - + diff --git a/BBWY.Client/Views/MainWindow.xaml b/BBWY.Client/Views/MainWindow.xaml index 2d1bb93f..a59705fa 100644 --- a/BBWY.Client/Views/MainWindow.xaml +++ b/BBWY.Client/Views/MainWindow.xaml @@ -25,7 +25,7 @@ - + diff --git a/BBWY.Client/Views/Order/GrabJDMibole.xaml.cs b/BBWY.Client/Views/Order/GrabJDMibole.xaml.cs index e8d80ad9..a010160d 100644 --- a/BBWY.Client/Views/Order/GrabJDMibole.xaml.cs +++ b/BBWY.Client/Views/Order/GrabJDMibole.xaml.cs @@ -42,6 +42,7 @@ namespace BBWY.Client.Views.Order { w2m = s.ServiceProvider.GetRequiredService(); } + w2m.Init(); grid.Children.Add(w2m.wb2); if (w2m.IsInitializationCompleted) diff --git a/BBWY.Client/Views/SelectShop.xaml b/BBWY.Client/Views/SelectShop.xaml index 123e12a5..9f2da93b 100644 --- a/BBWY.Client/Views/SelectShop.xaml +++ b/BBWY.Client/Views/SelectShop.xaml @@ -46,7 +46,7 @@ diff --git a/BBWY.Client/Views/SelectShop.xaml.cs b/BBWY.Client/Views/SelectShop.xaml.cs index 974c4329..7a8bb7f8 100644 --- a/BBWY.Client/Views/SelectShop.xaml.cs +++ b/BBWY.Client/Views/SelectShop.xaml.cs @@ -19,10 +19,10 @@ namespace BBWY.Client.Views /// public partial class SelectShop : BWindow { - public IList DepartmentList { get; set; } + public IList DepartmentList { get; set; } public Shop Shop { get; set; } - public SelectShop(IList departmentList) + public SelectShop(IList departmentList) { InitializeComponent(); this.DepartmentList = departmentList; @@ -31,7 +31,7 @@ namespace BBWY.Client.Views private void SelectShop_Loaded(object sender, RoutedEventArgs e) { - var d = cbx_department.SelectedItem as Department2; + var d = cbx_department.SelectedItem as Department; cbx_shop.ItemsSource = d.ShopList; } @@ -45,8 +45,9 @@ namespace BBWY.Client.Views private void cbx_department_SelectionChanged(object sender, SelectionChangedEventArgs e) { - var d = cbx_department.SelectedItem as Department2; + var d = cbx_department.SelectedItem as Department; cbx_shop.ItemsSource = d.ShopList; + cbx_shop.SelectedIndex = 0; } } } diff --git a/BBWY.Client/WebView2Manager.cs b/BBWY.Client/WebView2Manager.cs index 104711c3..8bd89399 100644 --- a/BBWY.Client/WebView2Manager.cs +++ b/BBWY.Client/WebView2Manager.cs @@ -11,22 +11,27 @@ namespace BBWY.Client public class WebView2Manager : IDenpendency { public WebView2 wb2 { get; private set; } - private bool isInitializationCompleted; - - public WebView2Manager() + //public WebView2Manager() + //{ + // Init(); + //} + public void Init() { - wb2 = new WebView2(); - var wb2Setting = CoreWebView2Environment.CreateAsync(userDataFolder: io.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "WebView2UserData")).Result; - wb2.EnsureCoreWebView2Async(wb2Setting); - wb2.CoreWebView2InitializationCompleted += Wb2_CoreWebView2InitializationCompleted; - wb2.NavigationCompleted += Wb2_NavigationCompleted; - wb2.WebMessageReceived += Wb2_WebMessageReceived; + if (wb2 == null) + { + wb2 = new WebView2(); + var wb2Setting = CoreWebView2Environment.CreateAsync(userDataFolder: io.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "WebView2UserData")).Result; + wb2.EnsureCoreWebView2Async(wb2Setting); + wb2.CoreWebView2InitializationCompleted += Wb2_CoreWebView2InitializationCompleted; + wb2.NavigationCompleted += Wb2_NavigationCompleted; + wb2.WebMessageReceived += Wb2_WebMessageReceived; + } } public Action OnWebMessageReceived; public Action OnNavigationCompleted; public Action CoreWebView2InitializationCompleted; - public bool IsInitializationCompleted { get => isInitializationCompleted; } + public bool IsInitializationCompleted { get ; private set; } private void Wb2_WebMessageReceived(object sender, CoreWebView2WebMessageReceivedEventArgs e) { @@ -41,18 +46,20 @@ namespace BBWY.Client private void Wb2_CoreWebView2InitializationCompleted(object sender, CoreWebView2InitializationCompletedEventArgs e) { CoreWebView2InitializationCompleted?.Invoke(e); - isInitializationCompleted = true; + IsInitializationCompleted = true; } public void Close() { if (wb2 != null && wb2.CoreWebView2 != null) { + IsInitializationCompleted = false; wb2.CoreWebView2InitializationCompleted -= Wb2_CoreWebView2InitializationCompleted; wb2.NavigationCompleted -= Wb2_NavigationCompleted; wb2.WebMessageReceived -= Wb2_WebMessageReceived; var udf = wb2.CoreWebView2.Environment.UserDataFolder; wb2.Dispose(); + wb2 = null; try { io.Directory.Delete(udf, true); diff --git a/BBWY.Server.Business/MDSBusiness.cs b/BBWY.Server.Business/MDSBusiness.cs index 58cecf5f..b65ba032 100644 --- a/BBWY.Server.Business/MDSBusiness.cs +++ b/BBWY.Server.Business/MDSBusiness.cs @@ -44,8 +44,8 @@ namespace BBWY.Server.Business AppToken = shopJToken.Value("AppToken"), Platform = (Enums.Platform)shopJToken.Value("PlatformId"), VenderType = shopJToken.Value("ShopType"), - ShopId = shopId, - Name = shopJToken.Value("ShopName"), + ShopId = shopId.ToString(), + ShopName = shopJToken.Value("ShopName"), ManagePwd = shopJToken.Value("ManagePwd") }; try { shopResponse.PlatformCommissionRatio = shopJToken.Value("PlatformCommissionRatio"); } diff --git a/BBWY.Server.Business/Vender/VenderBusiness.cs b/BBWY.Server.Business/Vender/VenderBusiness.cs index 715a19ce..341f506a 100644 --- a/BBWY.Server.Business/Vender/VenderBusiness.cs +++ b/BBWY.Server.Business/Vender/VenderBusiness.cs @@ -157,23 +157,65 @@ namespace BBWY.Server.Business { DepartmentId = ud.Id, ud.DepartmentName, + ShopPKId = s.Id, s.ShopId, - s.ShopName + s.ShopName, + s.ShopType, + s.AppKey, + s.AppSecret, + s.AppToken, + s.ManagePwd, + s.PlatformCommissionRatio, + s.PlatformId }).GroupBy(x => x.DepartmentId); if (relationGroups.Count() == 0) return null; - var list = new List(); + var departmentList = new List(); + var shopIdList = new List(); //主键Id集合 + foreach (var relationGroup in relationGroups) { var department = new DepartmentResponse() { Id = relationGroup.Key, Name = relationGroup.FirstOrDefault().DepartmentName, - ShopList = relationGroup.Select(x => new SimpleShopResponse() { Id = x.ShopId, Name = x.ShopName }).ToList() + ShopList = relationGroup.Select(x => new ShopResponse() + { + Id = x.ShopPKId, + AppKey = string.IsNullOrEmpty(x.AppKey) ? "120EA9EC65AB017567D78CC1139EEEA5" : x.AppKey, + AppSecret = string.IsNullOrEmpty(x.AppSecret) ? "866a9877f5f24b03b537483b4defe75d" : x.AppSecret, + AppToken = x.AppToken, + ManagePwd = x.ManagePwd, + Platform = (Enums.Platform)x.PlatformId, + PlatformCommissionRatio = x.PlatformCommissionRatio, + ShopId = x.ShopId, + ShopName = x.ShopName, + VenderType = x.ShopType + }).ToList() }; - list.Add(department); + departmentList.Add(department); + shopIdList.AddRange(department.ShopList.Select(s => s.Id)); + } + shopIdList = shopIdList.Distinct().ToList(); + var purchaseAccountList = freeSqlMultiDBManager.MDSfsql.Select().Where(pa => shopIdList.Contains(pa.ShopId)) + .ToList(pa => new PurchaseAccountResponse() + { + AccountName = pa.AccountName, + AppKey = pa.AppKey, + AppSecret = pa.AppSecret, + AppToken = pa.AppToken, + Id = pa.Id, + ShopId = pa.ShopId, + PurchasePlatformId = (Enums.Platform)int.Parse(pa.PurchasePlatformId) + }); + foreach (var d in departmentList) + { + foreach (var s in d.ShopList) + { + s.PurchaseList = purchaseAccountList.Where(pa => pa.ShopId == s.Id).ToList(); + } } - return list; + return departmentList; } } } diff --git a/BBWY.Server.Model/Dto/Response/Vender/DepartmentResponse.cs b/BBWY.Server.Model/Dto/Response/Vender/DepartmentResponse.cs index 56e8d6a8..ddec4899 100644 --- a/BBWY.Server.Model/Dto/Response/Vender/DepartmentResponse.cs +++ b/BBWY.Server.Model/Dto/Response/Vender/DepartmentResponse.cs @@ -8,21 +8,11 @@ namespace BBWY.Server.Model.Dto public string Name { get; set; } - public IList ShopList { get; set; } + public IList ShopList { get; set; } public DepartmentResponse() { - ShopList = new List(); + ShopList = new List(); } - } - - public class SimpleShopResponse - { - /// - /// ShopId - /// - public string Id { get; set; } - - public string Name { get; set; } - } + } } diff --git a/BBWY.Server.Model/Dto/Response/Vender/ShopResponse.cs b/BBWY.Server.Model/Dto/Response/Vender/ShopResponse.cs index 45bd4eaa..f31e934a 100644 --- a/BBWY.Server.Model/Dto/Response/Vender/ShopResponse.cs +++ b/BBWY.Server.Model/Dto/Response/Vender/ShopResponse.cs @@ -1,15 +1,16 @@ using System; using System.Collections.Generic; using System.Text; -using static BBWY.Server.Model.Enums; namespace BBWY.Server.Model.Dto { public class ShopResponse { - public long ShopId { get; set; } + public string Id { get; set; } - public string Name { get; set; } + public string ShopId { get; set; } + + public string ShopName { get; set; } /// /// 商家类型 @@ -19,7 +20,7 @@ namespace BBWY.Server.Model.Dto /// /// 店铺平台 /// - public Platform Platform { get; set; } + public Enums.Platform Platform { get; set; } public string AppKey { get; set; } @@ -30,5 +31,24 @@ namespace BBWY.Server.Model.Dto public string ManagePwd { get; set; } public decimal? PlatformCommissionRatio { get; set; } + + public IList PurchaseList { get; set; } + } + + public class PurchaseAccountResponse + { + public string Id { get; set; } + + public string AccountName { get; set; } + + public string ShopId { get; set; } + + public Enums.Platform PurchasePlatformId { get; set; } + + public string AppKey { get; set; } + + public string AppSecret { get; set; } + + public string AppToken { get; set; } } }