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;