Browse Source

财务部技术部董事办获取所有店铺,切换店铺清空webview2缓存

qianyi
shanji 3 years ago
parent
commit
3bb766babc
  1. 4
      BBWY.Client/APIServices/ShopService.cs
  2. 4
      BBWY.Client/App.xaml.cs
  3. 11
      BBWY.Client/Models/APIModel/Response/Shop/ShopResponse.cs
  4. 7
      BBWY.Client/Models/MappingProfile.cs
  5. 23
      BBWY.Client/Models/Shop/Department.cs
  6. 18
      BBWY.Client/Models/Shop/Department2.cs
  7. 6
      BBWY.Client/Models/Shop/Shop.cs
  8. 2
      BBWY.Client/Models/User/User.cs
  9. 29
      BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs
  10. 99
      BBWY.Client/ViewModels/MainViewModel.cs
  11. 2
      BBWY.Client/Views/FinancialTerminal/ProcurementAudit.xaml
  12. 2
      BBWY.Client/Views/MainWindow.xaml
  13. 1
      BBWY.Client/Views/Order/GrabJDMibole.xaml.cs
  14. 2
      BBWY.Client/Views/SelectShop.xaml
  15. 9
      BBWY.Client/Views/SelectShop.xaml.cs
  16. 29
      BBWY.Client/WebView2Manager.cs
  17. 4
      BBWY.Server.Business/MDSBusiness.cs
  18. 52
      BBWY.Server.Business/Vender/VenderBusiness.cs
  19. 16
      BBWY.Server.Model/Dto/Response/Vender/DepartmentResponse.cs
  20. 28
      BBWY.Server.Model/Dto/Response/Vender/ShopResponse.cs

4
BBWY.Client/APIServices/ShopService.cs

@ -42,9 +42,9 @@ namespace BBWY.Client.APIServices
/// 获取部门及下属店铺
/// </summary>
/// <returns></returns>
public ApiResponse<IList<Department>> GetDepartmentList()
public ApiResponse<IList<DepartmentResponse>> GetDepartmentList()
{
return SendRequest<IList<Department>>(globalContext.BBYWApiHost, "api/vender/GetDeparmentList", null, null, HttpMethod.Get);
return SendRequest<IList<DepartmentResponse>>(globalContext.BBYWApiHost, "api/vender/GetDeparmentList", null, null, HttpMethod.Get);
}

4
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))

11
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<ShopResponse> ShopList { get; set; }
}
}

7
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<ShopResponse, Shop>().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<ShopResponse, Shop>().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<PurchaseAccountResponse, PurchaseAccount>();
CreateMap<DepartmentResponse, Department>();
CreateMap<PurchaseOrderResponse, PurchaseOrder>();
CreateMap<ToDayOrderAchievementResponse, ToDayOrderAchievement>();
}
}
}

23
BBWY.Client/Models/Shop/Department.cs

@ -8,30 +8,11 @@ namespace BBWY.Client.Models
public string Name { get; set; }
public IList<SimpleShop> ShopList { get; set; }
public IList<Shop> ShopList { get; set; }
public Department()
{
ShopList = new List<SimpleShop>();
}
}
public class SimpleShop : NotifyObject
{
private bool isSelected;
/// <summary>
/// ShopId
/// </summary>
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<Shop>();
}
}
}

18
BBWY.Client/Models/Shop/Department2.cs

@ -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<Shop> ShopList { get; set; }
public Department2()
{
ShopList = new List<Shop>();
}
}
}

6
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); } }
/// <summary>
/// 店铺Id
/// </summary>
@ -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<PurchaseAccount> PurchaseAccountList { get; set; }

2
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<Department2> DepartmentList { get; set; }
public IList<Department> DepartmentList { get; set; }
}
}

29
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<AuditFile>();
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<SimpleShop> shopList, DateTime startDate, DateTime endDate)
private void AuditByPayBill(EventWaitHandle ewh, IList<Shop> 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
}
}

99
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<string> managerDepartment;
private WebView2Manager w2m;
public GlobalContext GlobalContext { get; set; }
public IList<MenuModel> 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<string>() { "董事办", "财务部", "技术部" };
this.httpClientFactory = httpClientFactory;
this.mdsApiService = mdsApiService;
this.logisticsService = logisticsService;
this.shopService = shopService;
ClosingCommand = new RelayCommand<System.ComponentModel.CancelEventArgs>(Exit);
//ChooseShopCommand = new RelayCommand<Shop>((s) => ChooseShop(s));
OpenSelectShopCommand = new RelayCommand(OpenSelectShop);
@ -151,14 +161,7 @@ namespace BBWY.Client.ViewModels
GlobalContext.User = mdsUserResponse.Data.Map<User>();
#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<Department> 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<Department2> department2s = new List<Department2>();
departmentList = new List<Department>();
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<IList<Department>>();
}
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

2
BBWY.Client/Views/FinancialTerminal/ProcurementAudit.xaml

@ -43,7 +43,7 @@
<hc:CheckComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="5,2.5">
<CheckBox Content="{Binding Name}" IsChecked="{Binding IsSelected,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
<CheckBox Content="{Binding ShopName}" IsChecked="{Binding IsSelected,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</StackPanel>
</DataTemplate>
</hc:CheckComboBox.ItemTemplate>

2
BBWY.Client/Views/MainWindow.xaml

@ -25,7 +25,7 @@
<TextBlock Text="{Binding GlobalContext.User.Name}"/>
<!--<TextBlock Text="{Binding GlobalContext.User.TeamName}" Margin="5,0,0,0"/>
<TextBlock Text="{Binding GlobalContext.User.Shop.Platform}" Margin="5,0,0,0"/>-->
<TextBlock Text="{Binding GlobalContext.User.Shop.Name}" Margin="5,0,0,0"/>
<TextBlock Text="{Binding GlobalContext.User.Shop.ShopName}" Margin="5,0,0,0"/>
<TextBlock Text="v10018" Margin="5,0,0,0"/>
</StackPanel>
</Border>

1
BBWY.Client/Views/Order/GrabJDMibole.xaml.cs

@ -42,6 +42,7 @@ namespace BBWY.Client.Views.Order
{
w2m = s.ServiceProvider.GetRequiredService<WebView2Manager>();
}
w2m.Init();
grid.Children.Add(w2m.wb2);
if (w2m.IsInitializationCompleted)

2
BBWY.Client/Views/SelectShop.xaml

@ -46,7 +46,7 @@
<ComboBox x:Name="cbx_shop" Width="150" Height="25"
SelectedIndex="0"
HorizontalAlignment="Left" VerticalContentAlignment="Center"
DisplayMemberPath="Name"
DisplayMemberPath="ShopName"
Grid.Column="1" Grid.Row="1" Margin="5,5,0,5"/>
</Grid>

9
BBWY.Client/Views/SelectShop.xaml.cs

@ -19,10 +19,10 @@ namespace BBWY.Client.Views
/// </summary>
public partial class SelectShop : BWindow
{
public IList<Department2> DepartmentList { get; set; }
public IList<Department> DepartmentList { get; set; }
public Shop Shop { get; set; }
public SelectShop(IList<Department2> departmentList)
public SelectShop(IList<Department> 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;
}
}
}

29
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<CoreWebView2WebMessageReceivedEventArgs> OnWebMessageReceived;
public Action<CoreWebView2NavigationCompletedEventArgs> OnNavigationCompleted;
public Action<CoreWebView2InitializationCompletedEventArgs> 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);

4
BBWY.Server.Business/MDSBusiness.cs

@ -44,8 +44,8 @@ namespace BBWY.Server.Business
AppToken = shopJToken.Value<string>("AppToken"),
Platform = (Enums.Platform)shopJToken.Value<int>("PlatformId"),
VenderType = shopJToken.Value<string>("ShopType"),
ShopId = shopId,
Name = shopJToken.Value<string>("ShopName"),
ShopId = shopId.ToString(),
ShopName = shopJToken.Value<string>("ShopName"),
ManagePwd = shopJToken.Value<string>("ManagePwd")
};
try { shopResponse.PlatformCommissionRatio = shopJToken.Value<decimal?>("PlatformCommissionRatio"); }

52
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<DepartmentResponse>();
var departmentList = new List<DepartmentResponse>();
var shopIdList = new List<string>(); //主键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<Purchaseaccount>().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;
}
}
}

16
BBWY.Server.Model/Dto/Response/Vender/DepartmentResponse.cs

@ -8,21 +8,11 @@ namespace BBWY.Server.Model.Dto
public string Name { get; set; }
public IList<SimpleShopResponse> ShopList { get; set; }
public IList<ShopResponse> ShopList { get; set; }
public DepartmentResponse()
{
ShopList = new List<SimpleShopResponse>();
ShopList = new List<ShopResponse>();
}
}
public class SimpleShopResponse
{
/// <summary>
/// ShopId
/// </summary>
public string Id { get; set; }
public string Name { get; set; }
}
}
}

28
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; }
/// <summary>
/// 商家类型
@ -19,7 +20,7 @@ namespace BBWY.Server.Model.Dto
/// <summary>
/// 店铺平台
/// </summary>
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<PurchaseAccountResponse> 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; }
}
}

Loading…
Cancel
Save