From c65ccf61935e72043f60f850af373453e0e6e582 Mon Sep 17 00:00:00 2001
From: shanji <18996038927@163.com>
Date: Thu, 7 Jul 2022 16:38:53 +0800
Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=80=80=E6=AC=BE=E5=8D=95?=
=?UTF-8?q?=20=E4=BA=91=E9=BC=8E=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/PlatformSDKController.cs | 11 ++
.../PlatformSDK/JDBusiness.cs | 151 +++++++++++-------
.../PlatformSDK/PlatformSDKBusiness.cs | 2 +
BBWY.Server.Model/Db/Order/AfterSaleOrder.cs | 71 ++++++++
BBWY.Server.Model/Db/Order/OrderCost.cs | 24 +++
.../Order/SearchRefundPlatformOrderRequest.cs | 17 ++
6 files changed, 217 insertions(+), 59 deletions(-)
create mode 100644 BBWY.Server.Model/Db/Order/AfterSaleOrder.cs
create mode 100644 BBWY.Server.Model/Dto/Request/Order/SearchRefundPlatformOrderRequest.cs
diff --git a/BBWY.Server.API/Controllers/PlatformSDKController.cs b/BBWY.Server.API/Controllers/PlatformSDKController.cs
index 2598d376..0bf59013 100644
--- a/BBWY.Server.API/Controllers/PlatformSDKController.cs
+++ b/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);
}
+
+ ///
+ /// 获取退款单列表
+ ///
+ ///
+ ///
+ [HttpPost]
+ public JArray GetRefundList([FromBody] SearchRefundPlatformOrderRequest searchRefundPlatformOrderRequest)
+ {
+ return platformSDKBusinessList.FirstOrDefault(p => p.Platform == searchRefundPlatformOrderRequest.Platform).GetRefundList(searchRefundPlatformOrderRequest);
+ }
}
}
diff --git a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs
index 68e6f504..570270af 100644
--- a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs
+++ b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs
@@ -265,65 +265,65 @@ namespace BBWY.Server.Business
}
}
- foreach (var orderToken in orderJtokens)
- {
- var order = new OrderResponse()
- {
- Id = orderToken.Value("orderId"),
- BuyerAccount = orderToken.Value("pin"),
- BuyerRemark = orderToken.Value("orderRemark"),
- Consignee = new ConsigneeResponse()
- {
- Address = orderToken["consigneeInfo"].Value("fullAddress"),
- City = orderToken["consigneeInfo"].Value("city"),
- Province = orderToken["consigneeInfo"].Value("province"),
- County = orderToken["consigneeInfo"].Value("county"),
- Town = orderToken["consigneeInfo"].Value("town"),
- ContactName = orderToken["consigneeInfo"].Value("fullname"),
- Mobile = orderToken["consigneeInfo"].Value("mobile"),
- TelePhone = orderToken["consigneeInfo"].Value("telephone")
- },
- FreightPrice = orderToken.Value("freightPrice"),
- OrderEndTime = orderToken.Value("orderEndTime"),
- OrderStartTime = orderToken.Value("orderStartTime"),
- OrderPayment = orderToken.Value("orderPayment"),
- OrderSellerPrice = orderToken.Value("orderSellerPrice"),
- OrderTotalPrice = orderToken.Value("orderTotalPrice"),
- OrderType = (Enums.OrderType)orderToken.Value("orderType"),
- OrderStateText = orderToken.Value("orderStateRemark"),
- Platform = Enums.Platform.京东,
- //Sh = orderToken.Value("venderId"),
- VenderRemark = orderToken.Value("venderRemark"),
- WaybillNo = orderToken.Value("waybill"),
- StoreOrder = orderToken.Value("storeOrder"),
- ItemList = ((JArray)orderToken["itemInfoList"]).Select(skuToken => new OrderSkuResponse()
- {
- Id = skuToken.Value("skuId"),
- ItemTotal = skuToken.Value("itemTotal"),
- Price = skuToken.Value("jdPrice"),
- ProductId = skuToken.Value("wareId"),
- Title = skuToken.Value("skuName").SimplifySkuName(),
- ProductNo = skuToken.Value("productNo")
- }).ToList()
- };
-
- if (order.StoreOrder == "京仓订单")
- order.StorageType = Enums.StorageType.京仓;
- else if (order.StoreOrder == "云仓订单")
- order.StorageType = Enums.StorageType.云仓;
-
- var payType = orderToken.Value("payType");
- if (payType.Contains("-"))
- order.PayType = (Enums.PayType)Convert.ToInt32(payType.Substring(0, 1));
-
- //翻译订单状态
- //未付款 NOT_PAY
- #region
-
- #endregion
-
- //response.Items.Add(order);
- }
+ //foreach (var orderToken in orderJtokens)
+ //{
+ // var order = new OrderResponse()
+ // {
+ // Id = orderToken.Value("orderId"),
+ // BuyerAccount = orderToken.Value("pin"),
+ // BuyerRemark = orderToken.Value("orderRemark"),
+ // Consignee = new ConsigneeResponse()
+ // {
+ // Address = orderToken["consigneeInfo"].Value("fullAddress"),
+ // City = orderToken["consigneeInfo"].Value("city"),
+ // Province = orderToken["consigneeInfo"].Value("province"),
+ // County = orderToken["consigneeInfo"].Value("county"),
+ // Town = orderToken["consigneeInfo"].Value("town"),
+ // ContactName = orderToken["consigneeInfo"].Value("fullname"),
+ // Mobile = orderToken["consigneeInfo"].Value("mobile"),
+ // TelePhone = orderToken["consigneeInfo"].Value("telephone")
+ // },
+ // FreightPrice = orderToken.Value("freightPrice"),
+ // OrderEndTime = orderToken.Value("orderEndTime"),
+ // OrderStartTime = orderToken.Value("orderStartTime"),
+ // OrderPayment = orderToken.Value("orderPayment"),
+ // OrderSellerPrice = orderToken.Value("orderSellerPrice"),
+ // OrderTotalPrice = orderToken.Value("orderTotalPrice"),
+ // OrderType = (Enums.OrderType)orderToken.Value("orderType"),
+ // OrderStateText = orderToken.Value("orderStateRemark"),
+ // Platform = Enums.Platform.京东,
+ // //Sh = orderToken.Value("venderId"),
+ // VenderRemark = orderToken.Value("venderRemark"),
+ // WaybillNo = orderToken.Value("waybill"),
+ // StoreOrder = orderToken.Value("storeOrder"),
+ // ItemList = ((JArray)orderToken["itemInfoList"]).Select(skuToken => new OrderSkuResponse()
+ // {
+ // Id = skuToken.Value("skuId"),
+ // ItemTotal = skuToken.Value("itemTotal"),
+ // Price = skuToken.Value("jdPrice"),
+ // ProductId = skuToken.Value("wareId"),
+ // Title = skuToken.Value("skuName").SimplifySkuName(),
+ // ProductNo = skuToken.Value("productNo")
+ // }).ToList()
+ // };
+
+ // if (order.StoreOrder == "京仓订单")
+ // order.StorageType = Enums.StorageType.京仓;
+ // else if (order.StoreOrder == "云仓订单")
+ // order.StorageType = Enums.StorageType.云仓;
+
+ // var payType = orderToken.Value("payType");
+ // if (payType.Contains("-"))
+ // order.PayType = (Enums.PayType)Convert.ToInt32(payType.Substring(0, 1));
+
+ // //翻译订单状态
+ // //未付款 NOT_PAY
+ // #region
+
+ // #endregion
+
+ // //response.Items.Add(order);
+ //}
return orderJtokens;
}
@@ -437,5 +437,38 @@ namespace BBWY.Server.Business
throw new BusinessException($"{response.Json["jingdong_pop_order_shipment_responce"]["sopjosshipment_result"].Value("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(response.Body);
+
+ //return base.GetRefundList(searchRefundPlatformOrderRequest);
+ return (JArray)response.Json["jingdong_asc_serviceAndRefund_view_responce"]["data"];
+ }
}
}
diff --git a/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs b/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs
index 92ff17b7..be91a655 100644
--- a/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs
+++ b/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs
@@ -98,5 +98,7 @@ namespace BBWY.Server.Business
{
throw new NotImplementedException();
}
+
+ public virtual JArray GetRefundList(SearchRefundPlatformOrderRequest searchRefundPlatformOrderRequest) { throw new NotImplementedException(); }
}
}
diff --git a/BBWY.Server.Model/Db/Order/AfterSaleOrder.cs b/BBWY.Server.Model/Db/Order/AfterSaleOrder.cs
new file mode 100644
index 00000000..b72b794f
--- /dev/null
+++ b/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; }
+
+ ///
+ /// 商品处理结果
+ ///
+ [Column(DbType = "int(255)")]
+ public int? ProductResult { get; set; }
+
+ ///
+ /// 退款金额
+ ///
+ [Column(DbType = "decimal(20,2)")]
+ public decimal? RefundAmount { get; set; } = 0.00M;
+
+ ///
+ /// 退款时间
+ ///
+ [Column(DbType = "datetime")]
+ public DateTime? RefundTime { get; set; }
+
+ ///
+ /// 售后补发成本
+ ///
+ [Column(DbType = "decimal(20,2)")]
+ public decimal? ReissueAfterSaleAmount { get; set; } = 0.00M;
+
+ ///
+ /// 补发快递费
+ ///
+ [Column(DbType = "decimal(20,2)")]
+ public decimal? ReissueFreight { get; set; } = 0.00M;
+
+ ///
+ /// 补发货款成本
+ ///
+ [Column(DbType = "decimal(20,2)")]
+ public decimal? ReissueProductAmount { get; set; } = 0.00M;
+
+ ///
+ /// 服务单处理结果
+ ///
+ [Column(DbType = "int(1)")]
+ public int? ServiceResult { get; set; }
+
+ public long? ShopId { get; set; }
+
+ [Column(StringLength = 50)]
+ public string SkuId { get; set; }
+
+ }
+
+}
diff --git a/BBWY.Server.Model/Db/Order/OrderCost.cs b/BBWY.Server.Model/Db/Order/OrderCost.cs
index 8e80ceee..495c4ebb 100644
--- a/BBWY.Server.Model/Db/Order/OrderCost.cs
+++ b/BBWY.Server.Model/Db/Order/OrderCost.cs
@@ -60,6 +60,30 @@ namespace BBWY.Server.Model.Db
[Column(DbType = "datetime")]
public DateTime? CreateTime { get; set; }
+
+ ///
+ /// 退款金额
+ ///
+ [Column(DbType = "decimal(20,2)")]
+ public decimal RefundAmount { get; set; } = 0.00M;
+
+ ///
+ /// 补发快递费
+ ///
+ [Column(DbType = "decimal(20,2)")]
+ public decimal ReissueFreight { get; set; } = 0.00M;
+
+ ///
+ /// 补发货款成本
+ ///
+ [Column(DbType = "decimal(20,2)")]
+ public decimal ReissueProductAmount { get; set; } = 0.00M;
+
+ ///
+ /// 售后补偿成本
+ ///
+ [Column(DbType = "decimal(20,2)")]
+ public decimal ReissueAfterSaleAmount { get; set; } = 0.00M;
}
}
diff --git a/BBWY.Server.Model/Dto/Request/Order/SearchRefundPlatformOrderRequest.cs b/BBWY.Server.Model/Dto/Request/Order/SearchRefundPlatformOrderRequest.cs
new file mode 100644
index 00000000..c79d8958
--- /dev/null
+++ b/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; }
+ }
+}