From cc09355011a686b468ba95b6fbc45c3b444f8bbb Mon Sep 17 00:00:00 2001 From: shanj <18996038927@163.com> Date: Mon, 30 May 2022 00:21:49 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=AE=A1=E8=AE=A1=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=BD=92=E5=B1=9E=E5=BA=97=E9=93=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BBWY.Client/APIServices/ShopService.cs | 10 ++++++ .../Response/OrderBelongShopResponse.cs | 13 +++++++ .../ProcurementAuditViewModel.cs | 34 +++++++++++++++++-- BBWY.Server.Business/Order/OrderBusiness.cs | 2 +- .../Vender/OrderBelongShopResponse.cs | 2 +- 5 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 BBWY.Client/Models/APIModel/Response/OrderBelongShopResponse.cs diff --git a/BBWY.Client/APIServices/ShopService.cs b/BBWY.Client/APIServices/ShopService.cs index 234f969e..78082e38 100644 --- a/BBWY.Client/APIServices/ShopService.cs +++ b/BBWY.Client/APIServices/ShopService.cs @@ -27,5 +27,15 @@ namespace BBWY.Client.APIServices purchaseAccount.PurchasePlatformId }, null, HttpMethod.Post); } + + /// + /// 根据订单Id查询归属店铺 + /// + /// + /// + public ApiResponse> GetOrderBelongShop(IList orderIdList) + { + return SendRequest>(globalContext.BBYWApiHost, "api/order/GetOrderBelongShop", orderIdList, null, HttpMethod.Post); + } } } diff --git a/BBWY.Client/Models/APIModel/Response/OrderBelongShopResponse.cs b/BBWY.Client/Models/APIModel/Response/OrderBelongShopResponse.cs new file mode 100644 index 00000000..f3952443 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/OrderBelongShopResponse.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +namespace BBWY.Client.Models +{ + public class OrderBelongShopResponse + { + public long ShopId { get; set; } + + public string ShopName { get; set; } + + public IList OrderIdList { get; set; } + } +} diff --git a/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs b/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs index 089cbd38..af6d353b 100644 --- a/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs +++ b/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs @@ -1,4 +1,5 @@ -using BBWY.Client.Extensions; +using BBWY.Client.APIServices; +using BBWY.Client.Extensions; using BBWY.Client.Models; using BBWY.Common.Models; using GalaSoft.MvvmLight.Command; @@ -25,6 +26,7 @@ namespace BBWY.Client.ViewModels private bool isShowPurchaseOrderPanel; private bool isShowShopOrderPanel; private bool onlyException; + private ShopService shopService; public IList AuditFileList { get; set; } @@ -114,12 +116,13 @@ namespace BBWY.Client.ViewModels public ICommand ImportJDShopOrderCommand { get; set; } - public ProcurementAuditViewModel() + public ProcurementAuditViewModel(ShopService shopService) { AuditFileList = new ObservableCollection(); AuditCommand = new RelayCommand(Audit); ClearAuditCommand = new RelayCommand(ClearAudit); ImportAliPayBillCommand = new RelayCommand(ImportAliPayBill); + this.shopService = shopService; Import1688PurchaseOrderCommand = new RelayCommand(Import1688PurchaseOrder); @@ -214,6 +217,20 @@ namespace BBWY.Client.ViewModels payBill.RelationShopOrderId = relationShopOrder.OrderId; #endregion } + + var relationShoporderIds = AuditPayBillList.Where(p => !string.IsNullOrEmpty(p.RelationShopOrderId)).Select(p => p.RelationShopOrderId).ToList(); + var belongResponse = shopService.GetOrderBelongShop(relationShoporderIds); + if (!belongResponse.Success || belongResponse.Data.Count() == 0) + return; + + foreach (var payBill in AuditPayBillList) + { + if (string.IsNullOrEmpty(payBill.RelationShopOrderId)) + continue; + var belongShop = belongResponse.Data.FirstOrDefault(x => x.OrderIdList.Contains(payBill.RelationShopOrderId)); + if (belongShop != null) + payBill.BelongShop = belongShop.ShopName; + } } catch (Exception ex) { @@ -262,6 +279,19 @@ namespace BBWY.Client.ViewModels purchaseOrder.RelationShopOrderId = relationShopOrder.OrderId; #endregion } + + var relationShopOrderIds = AuditPurchaseOrderList.Where(p => !string.IsNullOrEmpty(p.RelationShopOrderId)).Select(p => p.RelationShopOrderId).ToList(); + var belongResponse = shopService.GetOrderBelongShop(relationShopOrderIds); + if (!belongResponse.Success || belongResponse.Data.Count() == 0) + return; + foreach (var purchaseOrder in AuditPurchaseOrderList) + { + if (string.IsNullOrEmpty(purchaseOrder.RelationShopOrderId)) + continue; + var belongShop = belongResponse.Data.FirstOrDefault(x => x.OrderIdList.Contains(purchaseOrder.RelationShopOrderId)); + if (belongShop != null) + purchaseOrder.BelongShop = belongShop.ShopName; + } } catch (Exception ex) { diff --git a/BBWY.Server.Business/Order/OrderBusiness.cs b/BBWY.Server.Business/Order/OrderBusiness.cs index 4ffe5d82..cf818e82 100644 --- a/BBWY.Server.Business/Order/OrderBusiness.cs +++ b/BBWY.Server.Business/Order/OrderBusiness.cs @@ -348,7 +348,7 @@ namespace BBWY.Server.Business var orderBelongShop = new OrderBelongShopResponse() { ShopId = orderGroup.Key, - ShpName = shop.ShopName, + ShopName = shop.ShopName, OrderIdList = orderGroup.Select(x => x.OrderId).ToList() }; list.Add(orderBelongShop); diff --git a/BBWY.Server.Model/Dto/Response/Vender/OrderBelongShopResponse.cs b/BBWY.Server.Model/Dto/Response/Vender/OrderBelongShopResponse.cs index f7cc99f3..04395cf5 100644 --- a/BBWY.Server.Model/Dto/Response/Vender/OrderBelongShopResponse.cs +++ b/BBWY.Server.Model/Dto/Response/Vender/OrderBelongShopResponse.cs @@ -6,7 +6,7 @@ namespace BBWY.Server.Model.Dto { public long ShopId { get; set; } - public string ShpName { get; set; } + public string ShopName { get; set; } public IList OrderIdList { get; set; } }