修改导出文件名

Uat_Study
hang 2022-04-12 09:35:42 +08:00
parent 1a2dbd150a
commit eefe406b99
7 changed files with 30 additions and 18 deletions

View File

@ -7,7 +7,7 @@ namespace IRaCIS.Core.Application.Service;
public static class ExcelExportHelper
{
//MiniExcel_Export
public static async Task<IActionResult> DataExportAsync(string code, object data, IRepository<CommonDocument> _commonDocumentRepository, IWebHostEnvironment _hostEnvironment)
public static async Task<IActionResult> DataExportAsync(string code, object data, string exportFileNamePrefix, IRepository<CommonDocument> _commonDocumentRepository, IWebHostEnvironment _hostEnvironment)
{
var doc = _commonDocumentRepository.AsQueryable(true).FirstOrDefault(t => t.Code == code);
@ -38,7 +38,7 @@ public static class ExcelExportHelper
return new FileStreamResult(memoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
{
FileDownloadName = $"{doc.Name}_{DateTime.Now.ToString("yyyy-MM-dd:hh:mm:ss")}.xlsx"
FileDownloadName = $"{exportFileNamePrefix}_{doc.Name}_{DateTime.Now.ToString("yyyy-MM-dd:hh:mm:ss")}.xlsx"
};
#endregion

View File

@ -126,6 +126,9 @@ namespace IRaCIS.Application.Contracts
{
public string TrialSiteCode { get; set; } = String.Empty;
public string TrialSiteAliasName { get; set; } = String.Empty;
public string UserRealName => LastName + " / " + FirstName;
}

View File

@ -42,18 +42,17 @@ namespace IRaCIS.Core.Application
TotalNeedSignTrialDocCount = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin
? 0
: await _trialDocumentRepository
.Where(t => t.IsDeleted == false || (t.IsDeleted == true &&
t.TrialDocConfirmedUserList.Any(t =>
t.ConfirmUserId == _userInfo.Id)))
: await _trialDocumentRepository.AsQueryable(true)
.Where(t => t.IsDeleted == false || (t.IsDeleted == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id)))
.SelectMany(t => t.NeedConfirmedUserTypeList)
.CountAsync(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId),
HaveSignedTrialDocCount = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin
? 0
: await _trialDocumentRepository
.Where(t => t.NeedConfirmedUserTypeList.Any(
t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
.Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
.SelectMany(t => t.TrialDocConfirmedUserList)
.CountAsync(t => t.ConfirmUserId == _userInfo.Id),

View File

@ -34,7 +34,6 @@ namespace IRaCIS.Application.Services
public async Task<IActionResult> TrialUserListExport(TrialMaintenanceExportQuery param, [FromServices] IRepository<CommonDocument> _commonDocumentRepository)
{
var exportInfo = (await _trialRepository.Where(t => t.Id == param.TrialId).IgnoreQueryFilters().ProjectTo<TrialUserExportDTO>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
exportInfo.TrialUserList = await _trialUseRepository.Where(t => t.TrialId == param.TrialId).IgnoreQueryFilters()
@ -48,13 +47,8 @@ namespace IRaCIS.Application.Services
t => (t.User.LastName + " / " + t.User.FirstName).Contains(param.UserRealName))
.ProjectTo<TrialMaintenanceDTO>(_mapper.ConfigurationProvider).ToListAsync();
return await ExcelExportHelper.DataExportAsync(StaticData.TrialUserList_Export, exportInfo, _commonDocumentRepository, _hostEnvironment);
return await ExcelExportHelper.DataExportAsync(StaticData.TrialUserList_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment);
}

View File

@ -58,8 +58,7 @@ namespace IRaCIS.Core.Application.Services
.ProjectTo<SiteUserExportDTO>(_mapper.ConfigurationProvider).ToListAsync();
return await ExcelExportHelper.DataExportAsync(StaticData.TrialSiteUserList_Export, exportInfo, _commonDocumentRepository, _hostEnvironment);
return await ExcelExportHelper.DataExportAsync(StaticData.TrialSiteUserList_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment);
}
@ -106,7 +105,7 @@ namespace IRaCIS.Core.Application.Services
var exportInfo = data;
return await ExcelExportHelper.DataExportAsync(StaticData.TrialSiteUserSummary_Export, exportInfo, _commonDocumentRepository, _hostEnvironment);
return await ExcelExportHelper.DataExportAsync(StaticData.TrialSiteUserSummary_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment);
}

View File

@ -1,4 +1,5 @@
using System;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
namespace IRaCIS.Core.Infra.EFCore
{
@ -38,5 +39,7 @@ namespace IRaCIS.Core.Infra.EFCore
string PermissionStr { get; }
string IP { get; }
bool IsEn_Us { get; }
}
}

View File

@ -184,6 +184,20 @@ namespace IRaCIS.Core.Infra.EFCore.AuthUser
}
}
public bool IsEn_Us
{
get
{
var lan = _accessor?.HttpContext?.Request?.Headers["Accept-Language"];
if ( !string.IsNullOrEmpty(lan.Value))
{
return lan.Value == "en-US,en;q=0.5".ToString();
}
return true;
}
}
}
public static class ClaimAttributes