diff --git a/BBWY.Client/BBWYAppSettings.json b/BBWY.Client/BBWYAppSettings.json index 11018a67..f6dee4d4 100644 --- a/BBWY.Client/BBWYAppSettings.json +++ b/BBWY.Client/BBWYAppSettings.json @@ -5,5 +5,5 @@ "JOSApiHost": "", "1688ApiHost": "", "QKApiHost": "http://localhost:8080" - // "QKApiHost": "http://qiku.qiyue666.com" + //"QKApiHost": "http://qiku.qiyue666.com" } \ No newline at end of file diff --git a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs index b49118b7..9ca94398 100644 --- a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs +++ b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs @@ -3,6 +3,7 @@ using BBWY.Common.Models; using BBWY.Server.Model; using BBWY.Server.Model.Dto; using Jd.ACES; +using Jd.ACES.Common; using Jd.Api; using Jd.Api.Request; using Jd.Api.Response; @@ -1419,5 +1420,27 @@ namespace BBWY.Server.Business return res.Json["jingdong_asc_freight_view_responce"]["result"]["data"]; } + + public override JToken GetJDInStorePurchaseOrderDetail(GetJDInStorePurchaseOrderDetailRequest request) + { + var jdClient = GetJdClient(request.AppKey, request.AppSecret); + var req = new EclpPoQueryPoOrderRequest(); + req.poOrderNo = request.PoOrderNo; + var res = jdClient.Execute(req, request.AppToken, DateTime.Now.ToLocalTime()); + if (res.Json == null) + res.Json = JObject.Parse(res.Body); + return res.Json; + } + + public override JToken GetJDSupplierDetail(GetJDSupplierDetailRequest request) + { + var jdClient = GetJdClient(request.AppKey, request.AppSecret); + var req = new EclpMasterQuerySupplierRequest(); + req.deptNo = request.DeptNo; + var res = jdClient.Execute(req, request.AppToken, DateTime.Now.ToLocalTime()); + if (res.Json == null) + res.Json = JObject.Parse(res.Body); + return res.Json; + } } } diff --git a/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs b/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs index 9cf355de..9c10ee3e 100644 --- a/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs +++ b/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs @@ -213,6 +213,25 @@ namespace BBWY.Server.Business throw new NotImplementedException(); } - + /// + /// 获取京东入库采购单详情 + /// + /// + /// + /// + public virtual JToken GetJDInStorePurchaseOrderDetail(GetJDInStorePurchaseOrderDetailRequest request) + { + throw new NotImplementedException(); + } + + /// + /// 获取京东供应商信息 + /// + /// + /// + public virtual JToken GetJDSupplierDetail(GetJDSupplierDetailRequest request) + { + throw new NotImplementedException(); + } } } diff --git a/BBWY.Server.Model/Dto/Request/JD/GetJDInStorePurchaseOrderDetailRequest.cs b/BBWY.Server.Model/Dto/Request/JD/GetJDInStorePurchaseOrderDetailRequest.cs new file mode 100644 index 00000000..e14c92b0 --- /dev/null +++ b/BBWY.Server.Model/Dto/Request/JD/GetJDInStorePurchaseOrderDetailRequest.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Server.Model.Dto +{ + public class GetJDInStorePurchaseOrderDetailRequest:PlatformRequest + { + /// + /// 入库采购单号 + /// + public string PoOrderNo { get; set; } + } +} diff --git a/BBWY.Server.Model/Dto/Request/JD/GetJDSupplierDetailRequest.cs b/BBWY.Server.Model/Dto/Request/JD/GetJDSupplierDetailRequest.cs new file mode 100644 index 00000000..6baf6d67 --- /dev/null +++ b/BBWY.Server.Model/Dto/Request/JD/GetJDSupplierDetailRequest.cs @@ -0,0 +1,7 @@ +namespace BBWY.Server.Model.Dto +{ + public class GetJDSupplierDetailRequest:PlatformRequest + { + public string DeptNo { get; set; } + } +} diff --git a/BBWY.Test/Program.cs b/BBWY.Test/Program.cs index ec05aa1d..851a27c3 100644 --- a/BBWY.Test/Program.cs +++ b/BBWY.Test/Program.cs @@ -2,11 +2,16 @@ using com.alibaba.openapi.client.policy; using Jd.Api; using Jd.Api.Request; +using Jd.Api.Response; using Microsoft.Extensions.DependencyInjection; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using System; using System.Linq; using System.Net.Http; +using System.Runtime.CompilerServices; using System.Security.Cryptography; +using System.Security.Policy; using System.Text; namespace BBWY.Test @@ -44,80 +49,28 @@ namespace BBWY.Test var appSecret = "8a42bc2301e8439b896e99f5475e0a9b"; ////0e61c4a8ec3e4df4b5836e10884db9220yth 齐盛 - //var token = "2ace3023200c4ea9aa682bbf8bffee18jztm"; //布莱特玩具 - //var token = "01f5be2cb4d741dda66bce2356941597mdfm"; //布莱特玩具 token2 - //var token = "01dc6f6e7fc34dcd99090d690312556cmdfk"; //齐盛 - //var token = "9fffa982da23446fb035499ae5622f49odjk"; //腾奇 - //var token = "c22ff4d37b6c4bbd82cd9e8d0dab42dbziyz"; //森王车品 - //var token = "44c19a1c1fbd4641957e6e8985ed1358jmtl"; //森王玩具 - //var token = "4a0ddc095e054c7aa90adcaccb14f83cwzgr"; //可比车品 - var token = "50a4c0f5c55848b5a8a715709e8d6fe0jntb"; //卿卿玩具专营店 - - var request = new - { - AppKey = "3944754", - AppSecret = "NahdPJS5uzM", - AppToken = "a9a67b4a-1117-4ae6-8422-8188eedd3480", - OrderId = "1885695962273561469" - }; - - { - var client = GetSyncAPIClient(request.AppKey, request.AppSecret); - RequestPolicy reqPolicy = new RequestPolicy(); - reqPolicy.HttpMethod = "POST"; - reqPolicy.NeedAuthorization = false; - reqPolicy.RequestSendTimestamp = false; - reqPolicy.UseHttps = false; - reqPolicy.UseSignture = true; - reqPolicy.AccessPrivateApi = false; - - Request _request = new Request(); - APIId apiId = new APIId(); - apiId.Name = "alibaba.trade.getLogisticsInfos.buyerView"; - apiId.NamespaceValue = "com.alibaba.logistics"; - apiId.Version = 1; - _request.ApiId = apiId; - - var param = new { orderId = request.OrderId, webSite = "1688", fields = "logisticsCompanyId,logisticsCompanyName,logisticsBillNo" }; - _request.RequestEntity = param; - if (!string.IsNullOrEmpty(request.AppToken)) - _request.AccessToken = request.AppToken; - var result = client.NewRequest(_request, reqPolicy); - } - - { - var client = GetSyncAPIClient(request.AppKey, request.AppSecret); - RequestPolicy reqPolicy = new RequestPolicy(); - reqPolicy.HttpMethod = "POST"; - reqPolicy.NeedAuthorization = false; - reqPolicy.RequestSendTimestamp = false; - reqPolicy.UseHttps = false; - reqPolicy.UseSignture = true; - reqPolicy.AccessPrivateApi = false; - - Request _request = new Request(); - APIId apiId = new APIId - { - Name = "alibaba.trade.get.buyerView", - NamespaceValue = "com.alibaba.trade", - Version = 1 - }; - _request.ApiId = apiId; - - var param = new - { - webSite = "1688", - orderId = request.OrderId, - includeFields = "baseInfo,productItems" - }; - _request.RequestEntity = param; - if (!string.IsNullOrEmpty(request.AppToken)) - _request.AccessToken = request.AppToken; - var result = client.NewRequest(_request, reqPolicy); - } - - - + var token = "2ace3023200c4ea9aa682bbf8bffee18jztm"; //布莱特玩具 + //var token = "01f5be2cb4d741dda66bce2356941597mdfm"; //布莱特玩具 token2 + //var token = "01dc6f6e7fc34dcd99090d690312556cmdfk"; //齐盛 + //var token = "9fffa982da23446fb035499ae5622f49odjk"; //腾奇 + //var token = "c22ff4d37b6c4bbd82cd9e8d0dab42dbziyz"; //森王车品 + //var token = "44c19a1c1fbd4641957e6e8985ed1358jmtl"; //森王玩具 + //var token = "4a0ddc095e054c7aa90adcaccb14f83cwzgr"; //可比车品 + //var token = "50a4c0f5c55848b5a8a715709e8d6fe0jntb"; //卿卿玩具专营店 + var client = GetJdClient(appkey, appSecret); + + var req1 = new EclpPoQueryPoOrderRequest(); + req1.poOrderNo = "EPL4418077994061"; + var response1 = client.Execute(req1, token, DateTime.Now.ToLocalTime()); + Console.WriteLine(JsonConvert.SerializeObject(response1)); + + if (response1.Json == null) + response1.Json = JObject.Parse(response1.Body); + + var req2 = new EclpMasterQuerySupplierRequest(); + req2.deptNo = response1.Json["jingdong_eclp_po_queryPoOrder_responce"]["queryPoModelList"].Children().FirstOrDefault().Value("deptNo"); + var response2 = client.Execute(req2, token, DateTime.Now.ToLocalTime()); + Console.WriteLine(JsonConvert.SerializeObject(response2)); Console.ReadKey(); } diff --git a/JD.API/Controllers/PlatformSDKController.cs b/JD.API/Controllers/PlatformSDKController.cs index 5436dbba..b5455af1 100644 --- a/JD.API/Controllers/PlatformSDKController.cs +++ b/JD.API/Controllers/PlatformSDKController.cs @@ -2,7 +2,6 @@ using BBWY.Server.Model; using BBWY.Server.Model.Dto; using JD.API.Filters; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json.Linq; using System.Collections.Generic; @@ -341,7 +340,7 @@ namespace JD.API.API.Controllers /// /// [HttpPost] - public JArray GetServiceOrderList([FromBody] QueryServiceOrderRequest request) + public JArray GetServiceOrderList([FromBody] BBWY.Server.Model.Dto.QueryServiceOrderRequest request) { return platformSDKBusinessList.FirstOrDefault(p => p.Platform == request.Platform).GetServiceOrderList(request); } @@ -367,5 +366,27 @@ namespace JD.API.API.Controllers { return platformSDKBusinessList.FirstOrDefault(p => p.Platform == request.Platform).GetServiceOrderDeliveryDetail(request); } + + /// + /// 获取京东入库采购单详情 + /// + /// + /// + [HttpPost] + public JToken GetJDInStorePurchaseOrderDetail([FromBody] GetJDInStorePurchaseOrderDetailRequest request) + { + return platformSDKBusinessList.FirstOrDefault(p => p.Platform == request.Platform).GetJDInStorePurchaseOrderDetail(request); + } + + /// + /// 获取京东供应商详情 + /// + /// + /// + [HttpPost] + public JToken GetJDSupplierDetail([FromBody] GetJDSupplierDetailRequest request) + { + return platformSDKBusinessList.FirstOrDefault(p => p.Platform == request.Platform).GetJDSupplierDetail(request); + } } }