diff --git a/BBWYB.PurchaserCapture/App.xaml b/BBWYB.PurchaserCapture/App.xaml new file mode 100644 index 0000000..796be7b --- /dev/null +++ b/BBWYB.PurchaserCapture/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/BBWYB.PurchaserCapture/App.xaml.cs b/BBWYB.PurchaserCapture/App.xaml.cs new file mode 100644 index 0000000..03ed6cd --- /dev/null +++ b/BBWYB.PurchaserCapture/App.xaml.cs @@ -0,0 +1,22 @@ +using Microsoft.Extensions.Configuration; +using System.Configuration; +using System.Data; +using System.Windows; + +namespace BBWYB.PurchaserCapture +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + public IServiceProvider ServiceProvider { get; private set; } + public IConfiguration Configuration { get; private set; } + + protected override void OnStartup(StartupEventArgs e) + { + base.OnStartup(e); + } + } + +} diff --git a/BBWYB.PurchaserCapture/AssemblyInfo.cs b/BBWYB.PurchaserCapture/AssemblyInfo.cs new file mode 100644 index 0000000..b0ec827 --- /dev/null +++ b/BBWYB.PurchaserCapture/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/BBWYB.PurchaserCapture/BBWYB.PurchaserCapture.csproj b/BBWYB.PurchaserCapture/BBWYB.PurchaserCapture.csproj new file mode 100644 index 0000000..a668083 --- /dev/null +++ b/BBWYB.PurchaserCapture/BBWYB.PurchaserCapture.csproj @@ -0,0 +1,17 @@ + + + + WinExe + net6.0-windows + enable + enable + true + + + + + + + + + diff --git a/BBWYB.PurchaserCapture/MainWindow.xaml b/BBWYB.PurchaserCapture/MainWindow.xaml new file mode 100644 index 0000000..a08f3b2 --- /dev/null +++ b/BBWYB.PurchaserCapture/MainWindow.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/BBWYB.PurchaserCapture/MainWindow.xaml.cs b/BBWYB.PurchaserCapture/MainWindow.xaml.cs new file mode 100644 index 0000000..4e2b178 --- /dev/null +++ b/BBWYB.PurchaserCapture/MainWindow.xaml.cs @@ -0,0 +1,24 @@ +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BBWYB.PurchaserCapture +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/BBWYB.Server.Business/Purchaser/PurchaserBusiness.cs b/BBWYB.Server.Business/Purchaser/PurchaserBusiness.cs index 673dfb4..f846559 100644 --- a/BBWYB.Server.Business/Purchaser/PurchaserBusiness.cs +++ b/BBWYB.Server.Business/Purchaser/PurchaserBusiness.cs @@ -10,9 +10,11 @@ namespace BBWYB.Server.Business { public class PurchaserBusiness : BaseBusiness, IDenpendency { - public PurchaserBusiness(IFreeSql fsql, NLogManager nLogManager, IIdGenerator idGenerator) : base(fsql, nLogManager, idGenerator) - { + private FreeSqlMultiDBManager _freeSqlMultiDBManager; + public PurchaserBusiness(IFreeSql fsql, NLogManager nLogManager, IIdGenerator idGenerator, FreeSqlMultiDBManager freeSqlMultiDBManager) : base(fsql, nLogManager, idGenerator) + { + this._freeSqlMultiDBManager = freeSqlMultiDBManager; } public ListResponse QueryPurchaserNameList(string keywords) @@ -164,8 +166,7 @@ namespace BBWYB.Server.Business var poList = fsql.Select() .InnerJoin((opi, o) => opi.OrderId == o.Id) .WhereIf(request.ShopId != null && request.ShopId > 0, (opi, o) => opi.ShopId == request.ShopId) - .Where((opi, o) => opi.ShopId == request.ShopId && - opi.IsEnabled == true && + .Where((opi, o) => opi.IsEnabled == true && o.OrderState != Enums.OrderState.已取消 && purchaserIdList.Contains(opi.PurchaserId)) .GroupBy((opi, o) => opi.PurchaserId) @@ -191,7 +192,7 @@ namespace BBWYB.Server.Business .ToList(g => new { PurchaserId = g.Key, - PurchaseAmount = g.Sum(g.Value.Item1.SkuAmount) + g.Sum(g.Value.Item1.PurchaseFreight) + PurchaseAmount = g.Sum(g.Value.Item1.SkuAmount + g.Value.Item1.PurchaseFreight) }); #endregion @@ -227,7 +228,7 @@ namespace BBWYB.Server.Business #endregion #region 最近采购的店铺商品 - var recent30d = DateTime.Now.AddDays(-00); + var recent30d = DateTime.Now.AddDays(-90); var bePurchasedProductSkuList = fsql.Select() .InnerJoin((opi, opri, o, ps) => opi.OrderId == o.Id) .InnerJoin((opi, opri, o, ps) => opri.PurchaseOrderId == opi.PurchaseOrderId) @@ -253,6 +254,8 @@ namespace BBWYB.Server.Business g.Key.SkuName, g.Key.SourceSkuId }); + var belongSkuIdList = bePurchasedProductSkuList.Select(x => x.SourceSkuId).Distinct().ToList(); + var belongSkuList = _freeSqlMultiDBManager.BBWYCfsql.Select(belongSkuIdList).ToList(ps => new { ps.Id, ps.Logo }); #endregion @@ -303,12 +306,16 @@ namespace BBWYB.Server.Business #endregion #region 最近采购店铺商品 - purchaser.Recent30dProductSku = bePurchasedProductSkuList.Where(x => x.PurchaserId == purchaser.Id).Take(10).Select(x => new RecentPurchasedSkuResponse() + purchaser.Recent30dProductSku = bePurchasedProductSkuList.Where(x => x.PurchaserId == purchaser.Id).Take(10).Select(x => { - Id = x.Id, - Logo = x.Logo, - SkuName = x.SkuName, - BelongSku = x.SourceSkuId + var belongSku = belongSkuList.FirstOrDefault(b => b.Id == x.SourceSkuId); + return new RecentPurchasedSkuResponse() + { + Id = x.Id, + Logo = belongSku?.Logo ?? x.Logo, + SkuName = x.SkuName, + BelongSku = x.SourceSkuId + }; }).ToList(); #endregion diff --git a/BBWYB.Server.Model/Db/BBWY/ProductSku.cs b/BBWYB.Server.Model/Db/BBWY/ProductSku.cs new file mode 100644 index 0000000..ad67223 --- /dev/null +++ b/BBWYB.Server.Model/Db/BBWY/ProductSku.cs @@ -0,0 +1,57 @@ +using FreeSql.DataAnnotations; +using System; + +namespace BBWYB.Server.Model.Db.BBWY +{ + + [Table(Name = "productsku", DisableSyncStructure = true)] + public partial class ProductSku + { + + /// + /// SKU + /// + [Column(StringLength = 50, IsPrimary = true, IsNullable = false)] + public string Id { get; set; } + + [Column(DbType = "datetime")] + public DateTime? CreateTime { get; set; } + + + public string Logo { get; set; } + + [Column(DbType = "int(1)", MapType = typeof(int))] + public Enums.Platform Platform { get; set; } + + /// + /// 售价 + /// + [Column(DbType = "decimal(18,2)")] + public decimal? Price { get; set; } + + /// + /// SPU + /// + [Column(StringLength = 50)] + public string ProductId { get; set; } + + + public long? ShopId { get; set; } + + + public string Title { get; set; } + + /// + /// 京东Sku状态【1:上架 2:下架 4:删除】 + /// + public int? State { get; set; } + + /// + /// 三级类目Id + /// + public int? CategoryId { get; set; } + + public string CategoryName { get; set; } + } + +} diff --git a/BBWYB.Server.Model/Dto/Request/Purchaser/QueryPurchaserRequest.cs b/BBWYB.Server.Model/Dto/Request/Purchaser/QueryPurchaserRequest.cs index 2975a21..038c03e 100644 --- a/BBWYB.Server.Model/Dto/Request/Purchaser/QueryPurchaserRequest.cs +++ b/BBWYB.Server.Model/Dto/Request/Purchaser/QueryPurchaserRequest.cs @@ -4,7 +4,6 @@ namespace BBWYB.Server.Model.Dto { public class QueryPurchaserRequest { - [Required] public long? ShopId { get; set; } public string Spu { get; set; } diff --git a/bbwyb.sln b/bbwyb.sln index a8c631b..22ce2b7 100644 --- a/bbwyb.sln +++ b/bbwyb.sln @@ -46,10 +46,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "U", "U", "{D34B0974-D525-4B EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "U", "U\U.csproj", "{FE3D9812-2D75-4850-8AEA-CE88BAF2F17A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebTest", "WebTest\WebTest.csproj", "{EFCA7129-3069-4F92-A0BD-663D014B82AD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebTest", "WebTest\WebTest.csproj", "{EFCA7129-3069-4F92-A0BD-663D014B82AD}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{97653DB2-605C-4582-AC6E-2A09D2E8EB44}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BBWYB.PurchaserCapture", "BBWYB.PurchaserCapture\BBWYB.PurchaserCapture.csproj", "{736D1C5D-4B7A-45C4-863A-6EFF6DCAE1E1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -104,6 +106,10 @@ Global {EFCA7129-3069-4F92-A0BD-663D014B82AD}.Debug|Any CPU.Build.0 = Debug|Any CPU {EFCA7129-3069-4F92-A0BD-663D014B82AD}.Release|Any CPU.ActiveCfg = Release|Any CPU {EFCA7129-3069-4F92-A0BD-663D014B82AD}.Release|Any CPU.Build.0 = Release|Any CPU + {736D1C5D-4B7A-45C4-863A-6EFF6DCAE1E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {736D1C5D-4B7A-45C4-863A-6EFF6DCAE1E1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {736D1C5D-4B7A-45C4-863A-6EFF6DCAE1E1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {736D1C5D-4B7A-45C4-863A-6EFF6DCAE1E1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -125,6 +131,7 @@ Global {FE3D9812-2D75-4850-8AEA-CE88BAF2F17A} = {D34B0974-D525-4BD1-90DE-B2CF5FE47AA4} {EFCA7129-3069-4F92-A0BD-663D014B82AD} = {97653DB2-605C-4582-AC6E-2A09D2E8EB44} {97653DB2-605C-4582-AC6E-2A09D2E8EB44} = {878D0106-F55F-4813-9158-F2729D460F9C} + {736D1C5D-4B7A-45C4-863A-6EFF6DCAE1E1} = {1E7D36DB-A817-4208-8FC6-36A66FAB17E5} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0D069898-04B7-4D24-A6A4-D7C703B8BFFC}