From cc704148f7d1129a21ed7a8c1a81fdecf9966c11 Mon Sep 17 00:00:00 2001 From: 44673626 <44673626@qq.com> Date: Wed, 17 Nov 2021 16:17:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E7=A5=A8=E5=AF=BC=E5=85=A5=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/Invoices/InvoiceDtoBase.cs | 5 +++++ .../Entities/Invoices/InvoiceAppService.cs | 18 +++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Invoices/InvoiceDtoBase.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Invoices/InvoiceDtoBase.cs index 3f51d4cd..365e33a6 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Invoices/InvoiceDtoBase.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Invoices/InvoiceDtoBase.cs @@ -322,7 +322,12 @@ namespace Win.Sfs.SettleAccount.Entities.Invoices //public string Accounting { get; set; } //[Display(Name = "记账日期")] //public DateTime AccountDate { get; set; } + public virtual Guid ParentId { get; set; } + public virtual Guid BranchId { get; set; } + public virtual Guid UserId { get; set; } + + public virtual int FileType { get; set; } public string Site { get; set; } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Invoices/InvoiceAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Invoices/InvoiceAppService.cs index e70499f9..6941507f 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Invoices/InvoiceAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Invoices/InvoiceAppService.cs @@ -326,6 +326,7 @@ namespace Win.Sfs.SettleAccount.Entities.Invoices //[Authorize(SettleAccountPermissions.Invoices.Default)] virtual public async Task ExportAsync(InvoiceRequestDto input) { + IExporter _csv = new CsvExporter(); IExporter _excel = new ExcelExporter(); if (!string.IsNullOrEmpty(input.Version)) @@ -337,13 +338,24 @@ namespace Win.Sfs.SettleAccount.Entities.Invoices var dtoDetails = ObjectMapper.Map, List>(entities); - + string _fileName = string.Empty; //声明导出容器 byte[] result = null; - string _fileName = string.Format("大众发票汇总_{0}.xlsx", _snowflakeIdGenerator.Create().ToString()); - result = await _excel.ExportAsByteArray(dtoDetails); + switch (input.FileType) + { + case 0: + _fileName = string.Format("大众发票汇总_{0}.csv", input.UserId.ToString()); + result = await _csv.ExportAsByteArray(dtoDetails); + break; + case 1: + _fileName = string.Format("大众发票汇总_{0}.xlsx", input.UserId.ToString()); + result = await _excel.ExportAsByteArray(dtoDetails); + break; + } + //string _fileName = string.Format("大众发票汇总_{0}.xlsx", _snowflakeIdGenerator.Create().ToString()); + //result = await _excel.ExportAsByteArray(dtoDetails); result.ShouldNotBeNull();