wanggang 1 year ago
parent
commit
fb405b28dd
  1. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs
  2. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Application/ImportExcelCommon/ExportImporter.cs

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs

@ -17,6 +17,7 @@ using SettleAccount.Job.SignalR;
//using ShardingCore;
using Win.Sfs.SettleAccount.Entities.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Syncs;
using Win.Sfs.SettleAccount.ExcelImporter;
namespace Win.Sfs.SettleAccount;
@ -73,6 +74,7 @@ public class Startup
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
ExportImporter.ServiceProvider = app.ApplicationServices;
app.UseCors("Default");
app.UseResponseCompression();
app.UseRouting();

7
code/src/Modules/SettleAccount/src/SettleAccount.Application/ImportExcelCommon/ExportImporter.cs

@ -36,13 +36,14 @@ using Magicodes.ExporterAndImporter.Core.Filters;
using OfficeOpenXml.Attributes;
using Win.Sfs.SettleAccount.Attributes;
using Magicodes.ExporterAndImporter.Core.Extension;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.BlobStoring;
namespace Win.Sfs.SettleAccount.ExcelImporter
{
public class ExportImporter
{
public static IServiceProvider ServiceProvider { get; set; }
private readonly IExporter _csvExporter = new Magicodes.ExporterAndImporter.Csv.CsvExporter();//导出CSV
private readonly IExcelImporter _importer = new Magicodes.ExporterAndImporter.Excel.ExcelImporter();//导入Excel
@ -51,6 +52,8 @@ namespace Win.Sfs.SettleAccount.ExcelImporter
public virtual async Task<List<T>> UploadExcelImport<T>([FromForm] IFormFileCollection files, IExcelImportAppService _excelImportService)
where T : class, new()
{
using var fs = ServiceProvider.CreateScope();
var fc = fs.ServiceProvider.GetRequiredService<IBlobContainer<MyFileContainer>>();
Type type = typeof(T).GetType();
var ImportList = new List<T>();
ExcelImportResult returnResult = new ExcelImportResult();

Loading…
Cancel
Save