Browse Source

发票导入功能代码更改

branch_ccpg_220107
44673626 3 years ago
parent
commit
cc704148f7
  1. 5
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Invoices/InvoiceDtoBase.cs
  2. 16
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Invoices/InvoiceAppService.cs

5
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; }

16
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<string> 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<Invoice>, List<InvoiceTHExportDto>>(entities);
string _fileName = string.Empty;
//声明导出容器
byte[] result = null;
string _fileName = string.Format("大众发票汇总_{0}.xlsx", _snowflakeIdGenerator.Create().ToString());
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();

Loading…
Cancel
Save