|
|
@ -8,11 +8,15 @@ using System.Linq.Expressions; |
|
|
|
using System.Text.Json; |
|
|
|
using System.Threading; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using DocumentFormat.OpenXml.Math; |
|
|
|
using DocumentFormat.OpenXml.Spreadsheet; |
|
|
|
using EFCore.BulkExtensions; |
|
|
|
using JetBrains.Annotations; |
|
|
|
using Microsoft.AspNetCore.Http; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using Microsoft.Net.Http.Headers; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.Application.Dtos; |
|
|
|
using Volo.Abp.Application.Services; |
|
|
@ -324,8 +328,30 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq |
|
|
|
var result = await ImportInternalAsync(requestInput, inputFileBytes).ConfigureAwait(false); |
|
|
|
var bytes = result.FileContents; |
|
|
|
result.FileContents = null; |
|
|
|
HttpContextAccessor.HttpContext.Response.Headers.Add("X-Response", JsonSerializer.Serialize(new { result.ExceptionMessage, result.FileName, result.FileCode, result })); |
|
|
|
return new FileContentResult(bytes, ExportImportService.ContentType) { FileDownloadName = result.FileName }; |
|
|
|
|
|
|
|
HttpContextAccessor.HttpContext.Response.Headers.AccessControlExposeHeaders="X-Response"; |
|
|
|
HttpContextAccessor.HttpContext.Response.Headers.Add("X-Response", |
|
|
|
JsonSerializer.Serialize(new { result.ExceptionMessage, result.FileName, result.FileCode, result })); |
|
|
|
|
|
|
|
var resultAction = new TestResult(bytes, ExportImportService.ContentType) { FileDownloadName = result.FileName }; |
|
|
|
resultAction.errorNum = result.ErrorNum; |
|
|
|
resultAction.successNum = resultAction.successNum; |
|
|
|
return resultAction; |
|
|
|
} |
|
|
|
|
|
|
|
public class TestResult: FileContentResult |
|
|
|
{ |
|
|
|
public byte[]_bytes { get; set; } |
|
|
|
public int errorNum { get; set; } |
|
|
|
public int successNum { get; set; } |
|
|
|
|
|
|
|
public TestResult([NotNull] byte[] fileContents, [NotNull] string contentType) : base(fileContents, contentType) |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
public TestResult([NotNull] byte[] fileContents, [NotNull] MediaTypeHeaderValue contentType) : base(fileContents, contentType) |
|
|
|
{ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|