Browse Source

获取退款单 云鼎接口

qianyi
shanji 3 years ago
parent
commit
c65ccf6193
  1. 11
      BBWY.Server.API/Controllers/PlatformSDKController.cs
  2. 151
      BBWY.Server.Business/PlatformSDK/JDBusiness.cs
  3. 2
      BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs
  4. 71
      BBWY.Server.Model/Db/Order/AfterSaleOrder.cs
  5. 24
      BBWY.Server.Model/Db/Order/OrderCost.cs
  6. 17
      BBWY.Server.Model/Dto/Request/Order/SearchRefundPlatformOrderRequest.cs

11
BBWY.Server.API/Controllers/PlatformSDKController.cs

@ -152,5 +152,16 @@ namespace BBWY.Server.API.Controllers
{ {
return platformSDKBusinessList.FirstOrDefault(p => p.Platform == getOrderInfoRequest.Platform).GetOrderSimpleInfo(getOrderInfoRequest); return platformSDKBusinessList.FirstOrDefault(p => p.Platform == getOrderInfoRequest.Platform).GetOrderSimpleInfo(getOrderInfoRequest);
} }
/// <summary>
/// 获取退款单列表
/// </summary>
/// <param name="searchRefundPlatformOrderRequest"></param>
/// <returns></returns>
[HttpPost]
public JArray GetRefundList([FromBody] SearchRefundPlatformOrderRequest searchRefundPlatformOrderRequest)
{
return platformSDKBusinessList.FirstOrDefault(p => p.Platform == searchRefundPlatformOrderRequest.Platform).GetRefundList(searchRefundPlatformOrderRequest);
}
} }
} }

151
BBWY.Server.Business/PlatformSDK/JDBusiness.cs

@ -265,65 +265,65 @@ namespace BBWY.Server.Business
} }
} }
foreach (var orderToken in orderJtokens) //foreach (var orderToken in orderJtokens)
{ //{
var order = new OrderResponse() // var order = new OrderResponse()
{ // {
Id = orderToken.Value<string>("orderId"), // Id = orderToken.Value<string>("orderId"),
BuyerAccount = orderToken.Value<string>("pin"), // BuyerAccount = orderToken.Value<string>("pin"),
BuyerRemark = orderToken.Value<string>("orderRemark"), // BuyerRemark = orderToken.Value<string>("orderRemark"),
Consignee = new ConsigneeResponse() // Consignee = new ConsigneeResponse()
{ // {
Address = orderToken["consigneeInfo"].Value<string>("fullAddress"), // Address = orderToken["consigneeInfo"].Value<string>("fullAddress"),
City = orderToken["consigneeInfo"].Value<string>("city"), // City = orderToken["consigneeInfo"].Value<string>("city"),
Province = orderToken["consigneeInfo"].Value<string>("province"), // Province = orderToken["consigneeInfo"].Value<string>("province"),
County = orderToken["consigneeInfo"].Value<string>("county"), // County = orderToken["consigneeInfo"].Value<string>("county"),
Town = orderToken["consigneeInfo"].Value<string>("town"), // Town = orderToken["consigneeInfo"].Value<string>("town"),
ContactName = orderToken["consigneeInfo"].Value<string>("fullname"), // ContactName = orderToken["consigneeInfo"].Value<string>("fullname"),
Mobile = orderToken["consigneeInfo"].Value<string>("mobile"), // Mobile = orderToken["consigneeInfo"].Value<string>("mobile"),
TelePhone = orderToken["consigneeInfo"].Value<string>("telephone") // TelePhone = orderToken["consigneeInfo"].Value<string>("telephone")
}, // },
FreightPrice = orderToken.Value<decimal>("freightPrice"), // FreightPrice = orderToken.Value<decimal>("freightPrice"),
OrderEndTime = orderToken.Value<DateTime?>("orderEndTime"), // OrderEndTime = orderToken.Value<DateTime?>("orderEndTime"),
OrderStartTime = orderToken.Value<DateTime>("orderStartTime"), // OrderStartTime = orderToken.Value<DateTime>("orderStartTime"),
OrderPayment = orderToken.Value<decimal>("orderPayment"), // OrderPayment = orderToken.Value<decimal>("orderPayment"),
OrderSellerPrice = orderToken.Value<decimal>("orderSellerPrice"), // OrderSellerPrice = orderToken.Value<decimal>("orderSellerPrice"),
OrderTotalPrice = orderToken.Value<decimal>("orderTotalPrice"), // OrderTotalPrice = orderToken.Value<decimal>("orderTotalPrice"),
OrderType = (Enums.OrderType)orderToken.Value<int>("orderType"), // OrderType = (Enums.OrderType)orderToken.Value<int>("orderType"),
OrderStateText = orderToken.Value<string>("orderStateRemark"), // OrderStateText = orderToken.Value<string>("orderStateRemark"),
Platform = Enums.Platform., // Platform = Enums.Platform.京东,
//Sh = orderToken.Value<string>("venderId"), // //Sh = orderToken.Value<string>("venderId"),
VenderRemark = orderToken.Value<string>("venderRemark"), // VenderRemark = orderToken.Value<string>("venderRemark"),
WaybillNo = orderToken.Value<string>("waybill"), // WaybillNo = orderToken.Value<string>("waybill"),
StoreOrder = orderToken.Value<string>("storeOrder"), // StoreOrder = orderToken.Value<string>("storeOrder"),
ItemList = ((JArray)orderToken["itemInfoList"]).Select(skuToken => new OrderSkuResponse() // ItemList = ((JArray)orderToken["itemInfoList"]).Select(skuToken => new OrderSkuResponse()
{ // {
Id = skuToken.Value<string>("skuId"), // Id = skuToken.Value<string>("skuId"),
ItemTotal = skuToken.Value<int>("itemTotal"), // ItemTotal = skuToken.Value<int>("itemTotal"),
Price = skuToken.Value<decimal>("jdPrice"), // Price = skuToken.Value<decimal>("jdPrice"),
ProductId = skuToken.Value<string>("wareId"), // ProductId = skuToken.Value<string>("wareId"),
Title = skuToken.Value<string>("skuName").SimplifySkuName(), // Title = skuToken.Value<string>("skuName").SimplifySkuName(),
ProductNo = skuToken.Value<string>("productNo") // ProductNo = skuToken.Value<string>("productNo")
}).ToList() // }).ToList()
}; // };
if (order.StoreOrder == "京仓订单") // if (order.StoreOrder == "京仓订单")
order.StorageType = Enums.StorageType.; // order.StorageType = Enums.StorageType.京仓;
else if (order.StoreOrder == "云仓订单") // else if (order.StoreOrder == "云仓订单")
order.StorageType = Enums.StorageType.; // order.StorageType = Enums.StorageType.云仓;
var payType = orderToken.Value<string>("payType"); // var payType = orderToken.Value<string>("payType");
if (payType.Contains("-")) // if (payType.Contains("-"))
order.PayType = (Enums.PayType)Convert.ToInt32(payType.Substring(0, 1)); // order.PayType = (Enums.PayType)Convert.ToInt32(payType.Substring(0, 1));
//翻译订单状态 // //翻译订单状态
//未付款 NOT_PAY // //未付款 NOT_PAY
#region // #region
#endregion // #endregion
//response.Items.Add(order); // //response.Items.Add(order);
} //}
return orderJtokens; return orderJtokens;
} }
@ -437,5 +437,38 @@ namespace BBWY.Server.Business
throw new BusinessException($"{response.Json["jingdong_pop_order_shipment_responce"]["sopjosshipment_result"].Value<string>("chineseErrCode")}"); throw new BusinessException($"{response.Json["jingdong_pop_order_shipment_responce"]["sopjosshipment_result"].Value<string>("chineseErrCode")}");
} }
} }
public override JArray GetRefundList(SearchRefundPlatformOrderRequest searchRefundPlatformOrderRequest)
{
var jdClient = GetJdClient(searchRefundPlatformOrderRequest.AppKey, searchRefundPlatformOrderRequest.AppSecret);
AscServiceAndRefundViewRequest req = new AscServiceAndRefundViewRequest();
//req.orderId = ;
//req.applyTimeBegin = ;
//req.applyTimeEnd = ;
if (!string.IsNullOrEmpty(searchRefundPlatformOrderRequest.OrderId))
req.orderId = long.Parse(searchRefundPlatformOrderRequest.OrderId);
req.approveTimeBegin = searchRefundPlatformOrderRequest.StartDate;
req.approveTimeEnd = searchRefundPlatformOrderRequest.EndDate;
req.pageNumber = searchRefundPlatformOrderRequest.PageIndex.ToString();
req.pageSize = searchRefundPlatformOrderRequest.PageSize.ToString();
var response = jdClient.Execute(req, searchRefundPlatformOrderRequest.AppToken, DateTime.Now.ToLocalTime());
if (searchRefundPlatformOrderRequest.SaveResponseLog)
logger.Info($"获取退款订单 Request:{JsonConvert.SerializeObject(searchRefundPlatformOrderRequest)} Response:{JsonConvert.SerializeObject(response)}");
if (response.IsError)
throw new BusinessException($"获取退款订单失败 {(string.IsNullOrEmpty(response.ErrorMsg) ? response.ErrMsg : response.ErrorMsg)}");
if (response.Json == null)
response.Json = JsonConvert.DeserializeObject<JObject>(response.Body);
//return base.GetRefundList(searchRefundPlatformOrderRequest);
return (JArray)response.Json["jingdong_asc_serviceAndRefund_view_responce"]["data"];
}
} }
} }

2
BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs

@ -98,5 +98,7 @@ namespace BBWY.Server.Business
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public virtual JArray GetRefundList(SearchRefundPlatformOrderRequest searchRefundPlatformOrderRequest) { throw new NotImplementedException(); }
} }
} }

71
BBWY.Server.Model/Db/Order/AfterSaleOrder.cs

@ -0,0 +1,71 @@
using FreeSql.DataAnnotations;
using System;
namespace BBWY.Server.Model.Db
{
[Table(Name = "aftersaleorder", DisableSyncStructure = true)]
public partial class Aftersaleorder {
[Column(IsPrimary = true)]
public long Id { get; set; }
[Column(DbType = "datetime")]
public DateTime? CreateTime { get; set; }
[Column(StringLength = 50)]
public string OrderId { get; set; }
[Column(StringLength = 50)]
public string ProductId { get; set; }
/// <summary>
/// 商品处理结果
/// </summary>
[Column(DbType = "int(255)")]
public int? ProductResult { get; set; }
/// <summary>
/// 退款金额
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal? RefundAmount { get; set; } = 0.00M;
/// <summary>
/// 退款时间
/// </summary>
[Column(DbType = "datetime")]
public DateTime? RefundTime { get; set; }
/// <summary>
/// 售后补发成本
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal? ReissueAfterSaleAmount { get; set; } = 0.00M;
/// <summary>
/// 补发快递费
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal? ReissueFreight { get; set; } = 0.00M;
/// <summary>
/// 补发货款成本
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal? ReissueProductAmount { get; set; } = 0.00M;
/// <summary>
/// 服务单处理结果
/// </summary>
[Column(DbType = "int(1)")]
public int? ServiceResult { get; set; }
public long? ShopId { get; set; }
[Column(StringLength = 50)]
public string SkuId { get; set; }
}
}

24
BBWY.Server.Model/Db/Order/OrderCost.cs

@ -60,6 +60,30 @@ namespace BBWY.Server.Model.Db
[Column(DbType = "datetime")] [Column(DbType = "datetime")]
public DateTime? CreateTime { get; set; } public DateTime? CreateTime { get; set; }
/// <summary>
/// 退款金额
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal RefundAmount { get; set; } = 0.00M;
/// <summary>
/// 补发快递费
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal ReissueFreight { get; set; } = 0.00M;
/// <summary>
/// 补发货款成本
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal ReissueProductAmount { get; set; } = 0.00M;
/// <summary>
/// 售后补偿成本
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal ReissueAfterSaleAmount { get; set; } = 0.00M;
} }
} }

17
BBWY.Server.Model/Dto/Request/Order/SearchRefundPlatformOrderRequest.cs

@ -0,0 +1,17 @@
using System;
namespace BBWY.Server.Model.Dto
{
public class SearchRefundPlatformOrderRequest : PlatformRequest
{
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
public int PageIndex { get; set; }
public int PageSize { get; set; }
public string OrderId { get; set; }
}
}
Loading…
Cancel
Save