From 38d5c5dff86860f775bc44bef90652908f5928bf Mon Sep 17 00:00:00 2001 From: shanj <18996038927@163.com> Date: Mon, 24 Apr 2023 19:36:03 +0800 Subject: [PATCH 1/5] 1 --- BBWY.Server.Business/PlatformSDK/LogisticsCompanyConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BBWY.Server.Business/PlatformSDK/LogisticsCompanyConverter.cs b/BBWY.Server.Business/PlatformSDK/LogisticsCompanyConverter.cs index 50717732..5de458c2 100644 --- a/BBWY.Server.Business/PlatformSDK/LogisticsCompanyConverter.cs +++ b/BBWY.Server.Business/PlatformSDK/LogisticsCompanyConverter.cs @@ -30,7 +30,7 @@ namespace BBWY.Server.Business new LogisticsCompanyRelationship(){SourceName="德邦快递",TargetName="德邦快递",SecondTargetName="德邦快运"}, new LogisticsCompanyRelationship(){SourceName="其它",TargetName="厂家自送"}, new LogisticsCompanyRelationship(){SourceName="极兔速递",TargetName="厂家自送"}, - new LogisticsCompanyRelationship(){SourceName="中通快运",TargetName="中通快运"}, + //new LogisticsCompanyRelationship(){SourceName="中通快运",TargetName="中通快运"}, new LogisticsCompanyRelationship(){SourceName="龙邦速递",TargetName="龙邦快递"}, new LogisticsCompanyRelationship(){SourceName="安能物流",TargetName="安能物流"}, new LogisticsCompanyRelationship(){SourceName="德坤物流",TargetName="厂家自送"}, From 54240f4d42c3965dbcc2c1a3c03d4e2bcc7c22ac Mon Sep 17 00:00:00 2001 From: shanji <18996038927@163.com> Date: Wed, 26 Apr 2023 12:49:27 +0800 Subject: [PATCH 2/5] 1 --- BBWY.Server.Business/Sync/ProductSyncBusiness.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/BBWY.Server.Business/Sync/ProductSyncBusiness.cs b/BBWY.Server.Business/Sync/ProductSyncBusiness.cs index 3a4f3cc9..deca5696 100644 --- a/BBWY.Server.Business/Sync/ProductSyncBusiness.cs +++ b/BBWY.Server.Business/Sync/ProductSyncBusiness.cs @@ -206,11 +206,11 @@ namespace BBWY.Server.Business.Sync public void SyncAllShopProduct() { var shopList = venderBusiness.GetShopList(platform: Enums.Platform.京东); - SyncProduct(shopList.FirstOrDefault(s => s.ShopId == "12657364"), true); //布莱特玩具专营店 - //foreach (var shop in shopList) - //{ - // Task.Factory.StartNew(() => SyncProduct(shop), System.Threading.CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.ProductSyncTaskScheduler); - //} + //SyncProduct(shopList.FirstOrDefault(s => s.ShopId == "12657364"), true); //布莱特玩具专营店 + foreach (var shop in shopList) + { + Task.Factory.StartNew(() => SyncProduct(shop), System.Threading.CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.ProductSyncTaskScheduler); + } } /// From b2c06a9ba7c086507149c985f8b361c48e31cdf7 Mon Sep 17 00:00:00 2001 From: shanji <18996038927@163.com> Date: Wed, 26 Apr 2023 13:45:13 +0800 Subject: [PATCH 3/5] =?UTF-8?q?Sku=E5=88=A0=E9=99=A4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sync/ProductSyncBusiness.cs | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/BBWY.Server.Business/Sync/ProductSyncBusiness.cs b/BBWY.Server.Business/Sync/ProductSyncBusiness.cs index deca5696..4d268fc1 100644 --- a/BBWY.Server.Business/Sync/ProductSyncBusiness.cs +++ b/BBWY.Server.Business/Sync/ProductSyncBusiness.cs @@ -68,6 +68,7 @@ namespace BBWY.Server.Business.Sync List inserSkuList = new List(); List> updateProductSkuList = new List>(); + List deletedSkuIdList = new List(); var productIds = productList.Items.Select(p => p.Id); var dbProducts = fsql.Select().Where(p => p.ShopId == shopId && productIds.Contains(p.Id)).ToList(); @@ -89,6 +90,13 @@ namespace BBWY.Server.Business.Sync }); if (skuList == null || skuList.Count() == 0) continue; + + //排查已删除的sku + var currentDbSkus = dbProductSkus.Where(dbsku => dbsku.ProductId == product.Id).ToList(); + var deletedSkuList = currentDbSkus.Where(dbsku => skuList.Count(s => s.Id == dbsku.Id) == 0).ToList(); + if (deletedSkuList.Count() > 0) + deletedSkuIdList.AddRange(deletedSkuList.Select(dbsku => dbsku.Id)); + foreach (var sku in skuList) { var categoryId = sku.Source.Value("categoryId"); @@ -159,6 +167,8 @@ namespace BBWY.Server.Business.Sync if (updateProductSkuList.Count > 0) foreach (var update in updateProductSkuList) update.ExecuteAffrows(); + if (deletedSkuIdList.Count() > 0) + fsql.Delete(deletedSkuIdList).ExecuteAffrows(); }); } @@ -179,7 +189,8 @@ namespace BBWY.Server.Business.Sync AppKey = shop.AppKey, AppSecret = shop.AppSecret, AppToken = shop.AppToken, - Platform = shop.PlatformId + Platform = shop.PlatformId, + Spu = "10021182557318" }; while (true) { @@ -219,11 +230,11 @@ namespace BBWY.Server.Business.Sync public void SyncAllShopAllProduct() { var shopList = venderBusiness.GetShopList(); - //SyncProduct(shopList.FirstOrDefault(s => s.ShopName == "奥德汽车用品专营店"), true); - foreach (var shop in shopList) - { - Task.Factory.StartNew(() => SyncProduct(shop, true), CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.ProductSyncTaskScheduler); - } + SyncProduct(shopList.FirstOrDefault(s => s.ShopName == "趣弈手机配件专营店"), true); + //foreach (var shop in shopList) + //{ + // Task.Factory.StartNew(() => SyncProduct(shop, true), CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.ProductSyncTaskScheduler); + //} } } } From 166cd267b95819b98b8d39ab59d29ff2442be360 Mon Sep 17 00:00:00 2001 From: shanji <18996038927@163.com> Date: Wed, 26 Apr 2023 13:52:55 +0800 Subject: [PATCH 4/5] 1 --- BBWY.Server.Business/Sync/ProductSyncBusiness.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/BBWY.Server.Business/Sync/ProductSyncBusiness.cs b/BBWY.Server.Business/Sync/ProductSyncBusiness.cs index 4d268fc1..e659f07b 100644 --- a/BBWY.Server.Business/Sync/ProductSyncBusiness.cs +++ b/BBWY.Server.Business/Sync/ProductSyncBusiness.cs @@ -189,8 +189,7 @@ namespace BBWY.Server.Business.Sync AppKey = shop.AppKey, AppSecret = shop.AppSecret, AppToken = shop.AppToken, - Platform = shop.PlatformId, - Spu = "10021182557318" + Platform = shop.PlatformId }; while (true) { @@ -230,11 +229,11 @@ namespace BBWY.Server.Business.Sync public void SyncAllShopAllProduct() { var shopList = venderBusiness.GetShopList(); - SyncProduct(shopList.FirstOrDefault(s => s.ShopName == "趣弈手机配件专营店"), true); - //foreach (var shop in shopList) - //{ - // Task.Factory.StartNew(() => SyncProduct(shop, true), CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.ProductSyncTaskScheduler); - //} + //SyncProduct(shopList.FirstOrDefault(s => s.ShopName == "趣弈手机配件专营店"), true); + foreach (var shop in shopList) + { + Task.Factory.StartNew(() => SyncProduct(shop, true), CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.ProductSyncTaskScheduler); + } } } } From 10c129de5b71fe2dd831b0b2968795c342337210 Mon Sep 17 00:00:00 2001 From: shanji <18996038927@163.com> Date: Wed, 26 Apr 2023 14:04:15 +0800 Subject: [PATCH 5/5] 1 --- BBWY.Server.Business/Sync/ProductSyncBusiness.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/BBWY.Server.Business/Sync/ProductSyncBusiness.cs b/BBWY.Server.Business/Sync/ProductSyncBusiness.cs index e659f07b..dbda2854 100644 --- a/BBWY.Server.Business/Sync/ProductSyncBusiness.cs +++ b/BBWY.Server.Business/Sync/ProductSyncBusiness.cs @@ -68,7 +68,6 @@ namespace BBWY.Server.Business.Sync List inserSkuList = new List(); List> updateProductSkuList = new List>(); - List deletedSkuIdList = new List(); var productIds = productList.Items.Select(p => p.Id); var dbProducts = fsql.Select().Where(p => p.ShopId == shopId && productIds.Contains(p.Id)).ToList(); @@ -95,7 +94,13 @@ namespace BBWY.Server.Business.Sync var currentDbSkus = dbProductSkus.Where(dbsku => dbsku.ProductId == product.Id).ToList(); var deletedSkuList = currentDbSkus.Where(dbsku => skuList.Count(s => s.Id == dbsku.Id) == 0).ToList(); if (deletedSkuList.Count() > 0) - deletedSkuIdList.AddRange(deletedSkuList.Select(dbsku => dbsku.Id)); + { + foreach (var deletedSku in deletedSkuList) + { + var update = fsql.Update(deletedSku.Id).Set(s => s.State, 4); + updateProductSkuList.Add(update); + } + } foreach (var sku in skuList) { @@ -167,8 +172,6 @@ namespace BBWY.Server.Business.Sync if (updateProductSkuList.Count > 0) foreach (var update in updateProductSkuList) update.ExecuteAffrows(); - if (deletedSkuIdList.Count() > 0) - fsql.Delete(deletedSkuIdList).ExecuteAffrows(); }); }