From ad6fe0ec87e4e7cf8615e49aad15bd028aa0896b Mon Sep 17 00:00:00 2001 From: shanj <18996038927@163.com> Date: Tue, 7 Feb 2023 02:41:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E9=92=89=E9=92=89=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=20=E8=AF=84=E4=BB=B7=E5=8A=A9=E6=89=8B=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=8E=A5=E5=8F=A3=20=E4=BF=AE=E5=A4=8D=E7=9B=91?= =?UTF-8?q?=E6=8E=A7=E4=BB=BB=E5=8A=A1=E5=BC=80=E5=A7=8B=E4=B8=8B=E4=B8=80?= =?UTF-8?q?=E8=BD=AE=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EvaluationAssistantController.cs | 10 ++++++++++ .../EvaluationAssistantBusiness.cs | 19 +++++++++++++++--- BBWY.Server.Business/Vender/VenderBusiness.cs | 8 ++++++-- .../PromotionTask/PJZSShopSettingRequest.cs | 20 +++++++++++++++++++ PJZS/MainWindow.xaml.cs | 2 ++ PJZS/Models/APIModel/Shop/ShopResponse.cs | 10 ++++++++++ PJZS/Models/Shop/Shop.cs | 10 ++++++++++ 7 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 BBWY.Server.Model/Dto/Request/PromotionTask/PJZSShopSettingRequest.cs diff --git a/BBWY.Server.API/Controllers/EvaluationAssistantController.cs b/BBWY.Server.API/Controllers/EvaluationAssistantController.cs index 38f34006..f100217f 100644 --- a/BBWY.Server.API/Controllers/EvaluationAssistantController.cs +++ b/BBWY.Server.API/Controllers/EvaluationAssistantController.cs @@ -139,6 +139,16 @@ namespace BBWY.Server.API.Controllers evaluationAssistantBusiness.StopPromotionTask(request); } + /// + /// 修改评价助手店铺设置 + /// + /// + [HttpPost] + public void EditPJZSSettings([FromBody] PJZSShopSettingRequest request) + { + evaluationAssistantBusiness.EditPJZSSettings(request); + } + /// /// 开始监控 /// diff --git a/BBWY.Server.Business/EvaluationAssistant/EvaluationAssistantBusiness.cs b/BBWY.Server.Business/EvaluationAssistant/EvaluationAssistantBusiness.cs index 930e1192..a90fdde7 100644 --- a/BBWY.Server.Business/EvaluationAssistant/EvaluationAssistantBusiness.cs +++ b/BBWY.Server.Business/EvaluationAssistant/EvaluationAssistantBusiness.cs @@ -28,10 +28,13 @@ namespace BBWY.Server.Business private List validOrderStateList; private List preTaskStateList; private ProductBusiness productBusiness; + private FreeSqlMultiDBManager freeSqlMultiDBManager; + private char[] spliter; - public EvaluationAssistantBusiness(RestApiService restApiService, IOptions options, YunDingBusiness yunDingBusiness, IFreeSql fsql, IIdGenerator idGenerator, TaskSchedulerManager taskSchedulerManager, VenderBusiness venderBusiness, DingDingBusiness dingDingBusiness, NLogManager nLogManager, ProductBusiness productBusiness) : base(restApiService, options, yunDingBusiness) + public EvaluationAssistantBusiness(RestApiService restApiService, IOptions options, YunDingBusiness yunDingBusiness, IFreeSql fsql, IIdGenerator idGenerator, TaskSchedulerManager taskSchedulerManager, VenderBusiness venderBusiness, DingDingBusiness dingDingBusiness, NLogManager nLogManager, ProductBusiness productBusiness, FreeSqlMultiDBManager freeSqlMultiDBManager) : base(restApiService, options, yunDingBusiness) { + this.fsql = fsql; this.idGenerator = idGenerator; this.taskSchedulerManager = taskSchedulerManager; @@ -39,6 +42,7 @@ namespace BBWY.Server.Business this.dingDingBusiness = dingDingBusiness; this.nLogManager = nLogManager; this.productBusiness = productBusiness; + this.freeSqlMultiDBManager = freeSqlMultiDBManager; validOrderStateList = new List() { Enums.OrderState.待出库, @@ -691,6 +695,15 @@ namespace BBWY.Server.Business throw new BusinessException(response.Msg); fsql.Update(request.Id).Set(pt => pt.Status, Enums.PromitionTaskStatus.已停止).ExecuteAffrows(); } + + public void EditPJZSSettings(PJZSShopSettingRequest request) + { + var shopId = request.ShopId.ToString(); + freeSqlMultiDBManager.MDSfsql.Update().Set(s => s.PJZSDingDingKey, request.PJZSDingDingKey) + .Set(s => s.PJZSDingDingWebHook, request.PJZSDingDingWebHook) + .Where(s => s.ShopId == shopId) + .ExecuteAffrows(); + } #endregion #region 自动任务 @@ -702,8 +715,8 @@ namespace BBWY.Server.Business //开始下一轮开始任务 var nextPromotionTaskList = fsql.Select().WhereIf(shopId != null, pt => pt.ShopId == shopId) - .Where(pt => pt.Status == Enums.PromitionTaskStatus.等待 && - pt.PreTaskId == -1).ToList(pt => new { Id = pt.Id, ShopId = pt.ShopId }); + .Where(pt => pt.Status == Enums.PromitionTaskStatus.等待 && pt.PreTaskId == -1) + .ToList(pt => new { Id = pt.Id, ShopId = pt.ShopId }); if (nextPromotionTaskList.Count() > 0) { foreach (var nextTask in nextPromotionTaskList) diff --git a/BBWY.Server.Business/Vender/VenderBusiness.cs b/BBWY.Server.Business/Vender/VenderBusiness.cs index 9c779eb7..05196c33 100644 --- a/BBWY.Server.Business/Vender/VenderBusiness.cs +++ b/BBWY.Server.Business/Vender/VenderBusiness.cs @@ -226,7 +226,9 @@ namespace BBWY.Server.Business s.SkuSafeTurnoverDays, s.SiNanDingDingKey, s.SiNanDingDingWebHook, - s.SiNanPolicyLevel + s.SiNanPolicyLevel, + s.PJZSDingDingWebHook, + s.PJZSDingDingKey }).GroupBy(x => x.DepartmentId); if (relationGroups.Count() == 0) return null; @@ -259,7 +261,9 @@ namespace BBWY.Server.Business SkuSafeTurnoverDays = x.SkuSafeTurnoverDays, SiNanDingDingKey = x.SiNanDingDingKey, SiNanDingDingWebHook = x.SiNanDingDingWebHook, - SiNanPolicyLevel = x.SiNanPolicyLevel + SiNanPolicyLevel = x.SiNanPolicyLevel, + PJZSDingDingKey = x.PJZSDingDingKey, + PJZSDingDingWebHook = x.PJZSDingDingWebHook }).ToList() }; departmentList.Add(department); diff --git a/BBWY.Server.Model/Dto/Request/PromotionTask/PJZSShopSettingRequest.cs b/BBWY.Server.Model/Dto/Request/PromotionTask/PJZSShopSettingRequest.cs new file mode 100644 index 00000000..f4948ef5 --- /dev/null +++ b/BBWY.Server.Model/Dto/Request/PromotionTask/PJZSShopSettingRequest.cs @@ -0,0 +1,20 @@ +namespace BBWY.Server.Model.Dto +{ + public class PJZSShopSettingRequest + { + /// + /// 店铺Id,Shop对象的ShopId (注意不是Shop对象的主键) + /// + public long ShopId { get; set; } + + /// + /// 评价助手的钉钉地址 + /// + public string PJZSDingDingWebHook { get; set; } + + /// + /// 评价助手的钉钉密钥 + /// + public string PJZSDingDingKey { get; set; } + } +} diff --git a/PJZS/MainWindow.xaml.cs b/PJZS/MainWindow.xaml.cs index 1fc5ad02..bf1bf989 100644 --- a/PJZS/MainWindow.xaml.cs +++ b/PJZS/MainWindow.xaml.cs @@ -176,6 +176,8 @@ namespace PJZS shop.AppKey2 = s2.AppKey2; shop.AppSecret2 = s2.AppSecret2; shop.AppToken2 = s2.AppToken2; + shop.PJZSDingDingKey = s2.PJZSDingDingKey; + shop.PJZSDingDingWebHook = s2.PJZSDingDingWebHook; } } } diff --git a/PJZS/Models/APIModel/Shop/ShopResponse.cs b/PJZS/Models/APIModel/Shop/ShopResponse.cs index 5e5fde8a..71894398 100644 --- a/PJZS/Models/APIModel/Shop/ShopResponse.cs +++ b/PJZS/Models/APIModel/Shop/ShopResponse.cs @@ -56,6 +56,16 @@ namespace PJZS.Models /// 司南钉钉密钥 /// public string SiNanDingDingKey { get; set; } + + /// + /// PJZS钉钉WebHook地址 + /// + public string PJZSDingDingWebHook { get; set; } + + /// + /// PJZS钉钉密钥 + /// + public string PJZSDingDingKey { get; set; } } public class DepartmentResponse diff --git a/PJZS/Models/Shop/Shop.cs b/PJZS/Models/Shop/Shop.cs index a52dac43..f0c25115 100644 --- a/PJZS/Models/Shop/Shop.cs +++ b/PJZS/Models/Shop/Shop.cs @@ -71,6 +71,16 @@ namespace PJZS /// public string SiNanDingDingKey { get; set; } + /// + /// PJZS钉钉WebHook地址 + /// + public string PJZSDingDingWebHook { get; set; } + + /// + /// PJZS钉钉密钥 + /// + public string PJZSDingDingKey { get; set; } + public override string ToString() { return ShopName;