From 662c49d9b0676f77f88fe426ae1d0c81d61fe977 Mon Sep 17 00:00:00 2001 From: sanji Date: Sun, 3 Mar 2024 17:29:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E6=9E=B6=E6=88=90=E5=8A=9F=E4=B9=8B?= =?UTF-8?q?=E5=90=8E=E7=AB=8B=E5=8D=B3=E5=90=8C=E6=AD=A5=E8=B5=A0=E5=93=81?= =?UTF-8?q?=E5=88=B0=E4=BA=A7=E5=93=81=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EvaluationAssistantBusiness.cs | 53 +++++++++++++++---- .../PlatformSDK/JDBusiness.cs | 3 +- .../Sync/ProductSyncBusiness.cs | 2 +- BBWY.Server.Model/Db/Product/ProductSku.cs | 5 ++ .../StartPromotionTaskResponse.cs | 5 +- 5 files changed, 55 insertions(+), 13 deletions(-) diff --git a/BBWY.Server.Business/EvaluationAssistant/EvaluationAssistantBusiness.cs b/BBWY.Server.Business/EvaluationAssistant/EvaluationAssistantBusiness.cs index a87021ca..261e6d58 100644 --- a/BBWY.Server.Business/EvaluationAssistant/EvaluationAssistantBusiness.cs +++ b/BBWY.Server.Business/EvaluationAssistant/EvaluationAssistantBusiness.cs @@ -1,6 +1,7 @@ using BBWY.Common.Extensions; using BBWY.Common.Http; using BBWY.Common.Models; +using BBWY.Server.Business.Sync; using BBWY.Server.Model; using BBWY.Server.Model.Db; using BBWY.Server.Model.Dto; @@ -32,10 +33,22 @@ namespace BBWY.Server.Business private List preTaskStateList; private ProductBusiness productBusiness; private FreeSqlMultiDBManager freeSqlMultiDBManager; + private ProductSyncBusiness productSyncBusiness; private char[] spliter; - public EvaluationAssistantBusiness(RestApiService restApiService, IOptions options, YunDingBusiness yunDingBusiness, IFreeSql fsql, IIdGenerator idGenerator, TaskSchedulerManager taskSchedulerManager, VenderBusiness venderBusiness, QYMessageCenterBusiness qyMessageCenterBusiness, NLogManager nLogManager, ProductBusiness productBusiness, FreeSqlMultiDBManager freeSqlMultiDBManager) : base(restApiService, options, yunDingBusiness) + public EvaluationAssistantBusiness(RestApiService restApiService, + IOptions options, + YunDingBusiness yunDingBusiness, + IFreeSql fsql, + IIdGenerator idGenerator, + TaskSchedulerManager taskSchedulerManager, + VenderBusiness venderBusiness, + QYMessageCenterBusiness qyMessageCenterBusiness, + NLogManager nLogManager, + ProductBusiness productBusiness, + FreeSqlMultiDBManager freeSqlMultiDBManager, + ProductSyncBusiness productSyncBusiness) : base(restApiService, options, yunDingBusiness) { this.fsql = fsql; @@ -47,6 +60,7 @@ namespace BBWY.Server.Business this.nLogManager = nLogManager; this.productBusiness = productBusiness; this.freeSqlMultiDBManager = freeSqlMultiDBManager; + this.productSyncBusiness = productSyncBusiness; validOrderStateList = new List() { Enums.OrderState.待出库, @@ -723,15 +737,6 @@ namespace BBWY.Server.Business pt.PreTaskId == -1)).Any(); if (!haveNextTask) { - //if (!string.IsNullOrEmpty(shop.PJZSDingDingKey) && !string.IsNullOrEmpty(shop.PJZSDingDingWebHook)) - //{ - // try - // { - // dingDingBusiness.SendDingDingBotMessage(shop.PJZSDingDingKey, shop.PJZSDingDingWebHook, $"评价助手\n店铺:{shop.ShopName}\n任务列表无后续任务,为避免空档请及时设置后续任务"); - // } - // catch { } - //} - try { qyMessageCenterBusiness.SendMessage(shop.TeamId, shop.TeamId, shop.ShopId, "PJZS", shop.ShopName, "任务列表无后续任务,为避免空档请及时设置后续任务", "NOTASK", "PJZS API", string.Empty); @@ -739,6 +744,34 @@ namespace BBWY.Server.Business catch { } } #endregion + + #region 立即同步赠品到产品库 + { + if (startResponse.GiftSkuList != null && startResponse.GiftSkuList.Count() > 0) + { + var insertGiftSkuList = startResponse.GiftSkuList.Select(x => new ProductSku() + { + Id = x.Id, + IsGift = true, + Logo = x.Logo, + Platform = Enums.Platform.京东, + Price = x.Price, + ProductId = x.ProductId, + ShopId = shopId, + State = x.State, + Title = x.Title, + CategoryId = x.Source.Value("categoryId"), + CategoryName = productSyncBusiness.GetCategoryName(shop, x.Source.Value("categoryId")), + CreateTime = x.CreateTime + }); + try + { + fsql.Insert(insertGiftSkuList).ExecuteAffrows(); + } + catch { } + } + } + #endregion } /// diff --git a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs index c9b7a93d..fc7428e9 100644 --- a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs +++ b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs @@ -1620,7 +1620,8 @@ namespace BBWY.Server.Business { BrandName = brandName, JDPromotionId = promotionId, - DeleteGiftSkuList = giftSkuIdList + DeleteGiftSkuList = giftSkuIdList, + GiftSkuList = giftSkuList }; } catch (Exception ex) diff --git a/BBWY.Server.Business/Sync/ProductSyncBusiness.cs b/BBWY.Server.Business/Sync/ProductSyncBusiness.cs index 9ac8291f..9b603083 100644 --- a/BBWY.Server.Business/Sync/ProductSyncBusiness.cs +++ b/BBWY.Server.Business/Sync/ProductSyncBusiness.cs @@ -276,7 +276,7 @@ namespace BBWY.Server.Business.Sync } } - private string GetCategoryName(ShopResponse shop, string categoryId) + public string GetCategoryName(ShopResponse shop, string categoryId) { if (categoryCache.TryGetValue(categoryId, out string name)) return name; diff --git a/BBWY.Server.Model/Db/Product/ProductSku.cs b/BBWY.Server.Model/Db/Product/ProductSku.cs index 34580af0..e5969bb7 100644 --- a/BBWY.Server.Model/Db/Product/ProductSku.cs +++ b/BBWY.Server.Model/Db/Product/ProductSku.cs @@ -57,6 +57,11 @@ namespace BBWY.Server.Model.Db /// 1:业务团队 2:供应链 /// public int? Purchaser { get; set; } + + /// + /// 是否为赠品 + /// + public bool IsGift { get; set; } = false; } } diff --git a/BBWY.Server.Model/Dto/Response/PromotionTask/StartPromotionTaskResponse.cs b/BBWY.Server.Model/Dto/Response/PromotionTask/StartPromotionTaskResponse.cs index c3457e17..2000972a 100644 --- a/BBWY.Server.Model/Dto/Response/PromotionTask/StartPromotionTaskResponse.cs +++ b/BBWY.Server.Model/Dto/Response/PromotionTask/StartPromotionTaskResponse.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using BBWY.Server.Model.Db; +using System.Collections.Generic; namespace BBWY.Server.Model.Dto { @@ -9,6 +10,8 @@ namespace BBWY.Server.Model.Dto public long JDPromotionId { get; set; } public IList DeleteGiftSkuList { get; set; } + + public IList GiftSkuList { get; set; } } public class StartPromotionDelayTaskResponse