diff --git a/BBWY.JDSDK/Request/QueryNewProductPriceRequest.cs b/BBWY.JDSDK/Request/QueryNewProductPriceRequest.cs index 9e95caaf..55d3e2f3 100644 --- a/BBWY.JDSDK/Request/QueryNewProductPriceRequest.cs +++ b/BBWY.JDSDK/Request/QueryNewProductPriceRequest.cs @@ -6,41 +6,42 @@ namespace Jd.Api.Request { public class QueryNewProductPriceRequest : JdRequestBase { - public string - bizToken - {get; set;} - - public Nullable - shopId - {get; set;} - - public Nullable - projectId - {get; set;} - - public string - skuidList {get; set; } - public string - source - {get; set;} - - public override string ApiName - { - get{return "jingdong.queryNewProductPrice";} - } - protected override void PrepareParam(IDictionary parameters) - { - parameters.Add("bizToken", this. bizToken + public string +bizToken + { get; set; } + + public Nullable +shopId + { get; set; } + + public Nullable +projectId + { get; set; } + + public string +skuidList + { get; set; } + public string +source + { get; set; } + + public override string ApiName + { + get { return "jingdong.queryNewProductPrice"; } + } + protected override void PrepareParam(IDictionary parameters) + { + parameters.Add("bizToken", this.bizToken ); - parameters.Add("shopId", this. shopId + parameters.Add("shopId", this.shopId ); - parameters.Add("projectId", this. projectId + parameters.Add("projectId", this.projectId ); - parameters.Add("skuidList", this. skuidList + parameters.Add("skuidList", this.skuidList ); - parameters.Add("source", this. source + parameters.Add("source", this.source ); - } + } } } @@ -48,6 +49,6 @@ namespace Jd.Api.Request - - + + diff --git a/BBWY.JDSDK/Request/QueryOrderInfoByLocCodeRequest.cs b/BBWY.JDSDK/Request/QueryOrderInfoByLocCodeRequest.cs index 606cfb48..b6d1eac3 100644 --- a/BBWY.JDSDK/Request/QueryOrderInfoByLocCodeRequest.cs +++ b/BBWY.JDSDK/Request/QueryOrderInfoByLocCodeRequest.cs @@ -6,19 +6,19 @@ namespace Jd.Api.Request { public class QueryOrderInfoByLocCodeRequest : JdRequestBase { - public string - couponCode - {get; set;} - - public override string ApiName - { - get{return "jingdong.queryOrderInfoByLocCode";} - } - protected override void PrepareParam(IDictionary parameters) - { - parameters.Add("couponCode", this. couponCode + public string +couponCode + { get; set; } + + public override string ApiName + { + get { return "jingdong.queryOrderInfoByLocCode"; } + } + protected override void PrepareParam(IDictionary parameters) + { + parameters.Add("couponCode", this.couponCode ); - } + } } } @@ -26,6 +26,6 @@ namespace Jd.Api.Request - - + + diff --git a/BBWY.JDSDK/Request/QueryProdInfoRequest.cs b/BBWY.JDSDK/Request/QueryProdInfoRequest.cs index 660fe200..d09ffa31 100644 --- a/BBWY.JDSDK/Request/QueryProdInfoRequest.cs +++ b/BBWY.JDSDK/Request/QueryProdInfoRequest.cs @@ -6,47 +6,48 @@ namespace Jd.Api.Request { public class QueryProdInfoRequest : JdRequestBase { - public Nullable - shopId - {get; set;} - - public Nullable - projectId - {get; set;} - - public string - skuList {get; set; } - public string - isProduct - {get; set;} - - public string - bizToken - {get; set;} - - public string - source - {get; set;} - - public override string ApiName - { - get{return "jingdong.queryProdInfo";} - } - protected override void PrepareParam(IDictionary parameters) - { - parameters.Add("shopId", this. shopId + public Nullable +shopId + { get; set; } + + public Nullable +projectId + { get; set; } + + public string +skuList + { get; set; } + public string +isProduct + { get; set; } + + public string +bizToken + { get; set; } + + public string +source + { get; set; } + + public override string ApiName + { + get { return "jingdong.queryProdInfo"; } + } + protected override void PrepareParam(IDictionary parameters) + { + parameters.Add("shopId", this.shopId ); - parameters.Add("projectId", this. projectId + parameters.Add("projectId", this.projectId ); - parameters.Add("skuList", this. skuList + parameters.Add("skuList", this.skuList ); - parameters.Add("isProduct", this. isProduct + parameters.Add("isProduct", this.isProduct ); - parameters.Add("bizToken", this. bizToken + parameters.Add("bizToken", this.bizToken ); - parameters.Add("source", this. source + parameters.Add("source", this.source ); - } + } } } @@ -54,6 +55,6 @@ namespace Jd.Api.Request - - + + diff --git a/BBWY.JDSDK/Request/SellerPromotionDeleteSkuInPromoRequest.cs b/BBWY.JDSDK/Request/SellerPromotionDeleteSkuInPromoRequest.cs new file mode 100644 index 00000000..e4dcb5e4 --- /dev/null +++ b/BBWY.JDSDK/Request/SellerPromotionDeleteSkuInPromoRequest.cs @@ -0,0 +1,24 @@ +using Jd.Api.Response; +using System.Collections.Generic; + +namespace Jd.Api.Request +{ + public class SellerPromotionDeleteSkuInPromoRequest : JdRequestBase + { + public long promoId { get; set; } + + public string skuId { get; set; } + + public SellerPromotionDeleteSkuInPromoRequest() + { + } + + public override string ApiName => "jingdong.seller.promotion.deleteSkuInPromo"; + + protected override void PrepareParam(IDictionary paramters) + { + paramters.Add("promoId", promoId); + paramters.Add("skuId", skuId); + } + } +} diff --git a/BBWY.JDSDK/Response/PurchaseOrderGetResponse.cs b/BBWY.JDSDK/Response/PurchaseOrderGetResponse.cs index df2230e6..167429c7 100644 --- a/BBWY.JDSDK/Response/PurchaseOrderGetResponse.cs +++ b/BBWY.JDSDK/Response/PurchaseOrderGetResponse.cs @@ -2,15 +2,16 @@ using System; using System.Xml.Serialization; using System.Collections.Generic; using Newtonsoft.Json; - using Jd.Api.Domain; - namespace Jd.Api.Response +using Jd.Api.Domain; +namespace Jd.Api.Response { -public class PurchaseOrderGetResponse:JdResponse{ - [JsonProperty("result")] -public GxResponse + public class PurchaseOrderGetResponse : JdResponse + { + [JsonProperty("result")] + public GxResponse - result - { get; set; } - } + result + { get; set; } + } } diff --git a/BBWY.JDSDK/Response/SellerPromotionDeleteSkuInPromoResponse.cs b/BBWY.JDSDK/Response/SellerPromotionDeleteSkuInPromoResponse.cs new file mode 100644 index 00000000..54794ef7 --- /dev/null +++ b/BBWY.JDSDK/Response/SellerPromotionDeleteSkuInPromoResponse.cs @@ -0,0 +1,8 @@ +using Jd.Api; + +namespace Jd.Api.Response +{ + public class SellerPromotionDeleteSkuInPromoResponse: JdResponse + { + } +} diff --git a/BBWY.Server.API/Controllers/EvaluationAssistantController.cs b/BBWY.Server.API/Controllers/EvaluationAssistantController.cs index 9cf1fde5..a8ef3b37 100644 --- a/BBWY.Server.API/Controllers/EvaluationAssistantController.cs +++ b/BBWY.Server.API/Controllers/EvaluationAssistantController.cs @@ -97,5 +97,15 @@ namespace BBWY.Server.API.Controllers { evaluationAssistantBusiness.DeletePromotionTaskAndJDTask(request); } + + /// + /// 删除任务同时删除京东活动中的奶妈SKU + /// + /// + [HttpDelete] + public void DeletePromotionTaskAndMotherSku([FromBody] DeletePromotionTaskRequest request) + { + evaluationAssistantBusiness.DeletePromotionTaskAndMotherSku(request); + } } } diff --git a/BBWY.Server.Business/EvaluationAssistant/EvaluationAssistantBusiness.cs b/BBWY.Server.Business/EvaluationAssistant/EvaluationAssistantBusiness.cs index 1df2ae05..a8352bff 100644 --- a/BBWY.Server.Business/EvaluationAssistant/EvaluationAssistantBusiness.cs +++ b/BBWY.Server.Business/EvaluationAssistant/EvaluationAssistantBusiness.cs @@ -227,8 +227,7 @@ namespace BBWY.Server.Business { foreach (var sku in skuIdList) { - if ((!string.IsNullOrEmpty(pt.CustomMotherSku) && pt.CustomMotherSku.Contains(sku)) || - (!string.IsNullOrEmpty(pt.MotherTemplateSku) && pt.MotherTemplateSku.Contains(sku))) + if (!string.IsNullOrEmpty(pt.CustomMotherSku) && pt.CustomMotherSku.Contains(sku)) { throw new BusinessException($"sku[{sku}]已存在于任务[{pt.ActivityName}]中,请删除该sku或等待任务结束"); } @@ -262,9 +261,9 @@ namespace BBWY.Server.Business giftTemplateSku = giftTemplate.GiftSkus; } - //此处预留更改,等奶妈模板完善以后改为关联查询 var runingTaskList = fsql.Select().Where(pt => pt.ShopId == dbPromotionTask.ShopId && pt.Status == Enums.PromitionTaskStatus.进行中).ToList(); + if (dbPromotionTask.MotherTemplateId != null && dbPromotionTask.MotherTemplateId != 0) { @@ -352,9 +351,34 @@ namespace BBWY.Server.Business var dbPromotionTask = fsql.Select(request.TaskId).ToOne(); if (dbPromotionTask.Status != Enums.PromitionTaskStatus.等待) { + List motherSkuIdList = new List(); + if (dbPromotionTask.MotherTemplateId != null) + { - } + } + + if (!string.IsNullOrEmpty(dbPromotionTask.CustomMotherSku)) + motherSkuIdList.AddRange(dbPromotionTask.CustomMotherSku.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)); + var httpResult = restApiService.SendRequest(GetPlatformRelayAPIHost(Enums.Platform.京东), + "api/platformsdk/DeleteJDPromotionTaskSku", + new DeleteJDPromotionTaskSkuRequest() + { + AppKey = request.AppKey, + AppSecret = request.AppSecret, + AppToken = request.AppToken, + Platform = Enums.Platform.京东, + PromotionId = dbPromotionTask.PromotionId.Value, + SkuId = string.Join(",", motherSkuIdList) + }, + GetYunDingRequestHeader(), + HttpMethod.Post); + if (httpResult.StatusCode != System.Net.HttpStatusCode.OK) + throw new BusinessException(httpResult.Content); + var response = JsonConvert.DeserializeObject(httpResult.Content); + if (!response.Success) + throw new BusinessException(response.Msg); + } fsql.Delete(request.TaskId).ExecuteAffrows(); } #endregion diff --git a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs index 6ab5dc57..f57bda97 100644 --- a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs +++ b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs @@ -1128,5 +1128,18 @@ namespace BBWY.Server.Business if (res.IsError) throw new BusinessException($"删除JD活动失败-{(string.IsNullOrEmpty(res.ErrorMsg) ? res.ErrMsg : res.ErrorMsg)}"); } + + public override void DeleteJDPromotionTaskSku(DeleteJDPromotionTaskSkuRequest request) + { + var jdClient = GetJdClient(request.AppKey, request.AppSecret); + + var req = new SellerPromotionDeleteSkuInPromoRequest(); + req.promoId = request.PromotionId; + req.skuId = request.SkuId; + + var res = jdClient.Execute(req, request.AppToken, DateTime.Now.ToLocalTime()); + if (res.IsError) + throw new BusinessException($"删除JD活动sku失败-{(string.IsNullOrEmpty(res.ErrorMsg) ? res.ErrMsg : res.ErrorMsg)}"); + } } } diff --git a/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs b/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs index cfcf98a5..d4400bbc 100644 --- a/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs +++ b/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs @@ -167,5 +167,10 @@ namespace BBWY.Server.Business { throw new NotImplementedException(); } + + public virtual void DeleteJDPromotionTaskSku(DeleteJDPromotionTaskSkuRequest request) + { + throw new NotImplementedException(); + } } } diff --git a/BBWY.Server.Model/Db/EvaluationAssistant/PromotionTask.cs b/BBWY.Server.Model/Db/EvaluationAssistant/PromotionTask.cs index 9de9b09a..2ee22255 100644 --- a/BBWY.Server.Model/Db/EvaluationAssistant/PromotionTask.cs +++ b/BBWY.Server.Model/Db/EvaluationAssistant/PromotionTask.cs @@ -63,12 +63,6 @@ namespace BBWY.Server.Model.Db public long? MotherTemplateId { get; set; } - /// - /// 奶妈模板关联的Sku - /// - [Column(IsIgnore = true)] - public string MotherTemplateSku { get; set; } - /// /// 促销活动Id /// diff --git a/BBWY.Server.Model/Dto/Request/PromotionTask/DeletePromotionTaskRequest.cs b/BBWY.Server.Model/Dto/Request/PromotionTask/DeletePromotionTaskRequest.cs index 01c5d8ec..53cdc7b1 100644 --- a/BBWY.Server.Model/Dto/Request/PromotionTask/DeletePromotionTaskRequest.cs +++ b/BBWY.Server.Model/Dto/Request/PromotionTask/DeletePromotionTaskRequest.cs @@ -9,4 +9,12 @@ { public long PromotionId { get; set; } } + + public class DeleteJDPromotionTaskSkuRequest : DeleteJDPromotionTaskRequest + { + /// + /// 多个sku之间逗号间隔 + /// + public string SkuId { get; set; } + } } diff --git a/BBWY.Server.Model/Dto/Request/PromotionTask/StartPromotionTaskRequest.cs b/BBWY.Server.Model/Dto/Request/PromotionTask/StartPromotionTaskRequest.cs index dfef0e7c..3c84baac 100644 --- a/BBWY.Server.Model/Dto/Request/PromotionTask/StartPromotionTaskRequest.cs +++ b/BBWY.Server.Model/Dto/Request/PromotionTask/StartPromotionTaskRequest.cs @@ -4,7 +4,7 @@ using System.Text; namespace BBWY.Server.Model.Dto { - public class StartPromotionTaskRequest + public class StartPromotionTaskRequest: PlatformRequest { public long Id { get; set; } } diff --git a/JD.API/Controllers/PlatformSDKController.cs b/JD.API/Controllers/PlatformSDKController.cs index 87a8dd2c..fc457684 100644 --- a/JD.API/Controllers/PlatformSDKController.cs +++ b/JD.API/Controllers/PlatformSDKController.cs @@ -297,5 +297,15 @@ namespace JD.API.API.Controllers { platformSDKBusinessList.FirstOrDefault(p => p.Platform == request.Platform).DeleteJDPromotionTask(request); } + + /// + /// 删除京东活动SKU + /// + /// + [HttpPost] + public void DeleteJDPromotionTaskSku([FromBody] DeleteJDPromotionTaskSkuRequest request) + { + platformSDKBusinessList.FirstOrDefault(p => p.Platform == request.Platform).DeleteJDPromotionTaskSku(request); + } } }