diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index e7f09042e..e40bb10a3 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -80,7 +80,24 @@ namespace IRaCIS.Core.Application.Service.Common t => t.UserRole.OrganizationName.Contains(param.OrganizationName)) .WhereIf(!string.IsNullOrWhiteSpace(param.UserRealName), t => (t.UserRole.FullName).Contains(param.UserRealName)) - .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + .Select(t=>new TrialMaintenanceDTO() + { + UserRealName=t.UserRole.IdentityUser.FullName, + UserName=t.UserRole.IdentityUser.UserName, + UserType=t.UserRole.UserTypeRole.UserTypeShortName, + Phone=t.UserRole.IdentityUser.Phone, + EMail=t.UserRole.IdentityUser.EMail, + OrganizationName= t.UserRole.IdentityUser.OrganizationName, + + IsDeleted=t.TrialUser.IsDeleted, + JoinTime=t.TrialUser.JoinTime, + RemoveTime=t.TrialUser.RemoveTime, + + //角色授权禁用时间 + CreateTime=t.CreateTime, + DeletedTime=t.DeletedTime, + }).OrderBy(t=>t.UserRealName) + .ToListAsync(); exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId); exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs index 140ad9408..bca7df395 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs @@ -96,38 +96,22 @@ namespace IRaCIS.Application.Contracts public class TrialMaintenanceDTO : UserTrialCommand { - //[JsonIgnore] - //public int No { get; set; } - //For MiniExcel ExcelFormat - public string State => IsDeleted ? "退出" : "加入"; - - - //[ValueMapping(text: "退出", true)] - //[ValueMapping(text: "加入", false)] [DictionaryTranslateAttribute("IsUserExitTrial")] public bool IsDeleted { get; set; } - //[ExporterHeader(Format = "yyyy-mm-DD hh:mm:ss")] - [ExcelFormat("yyyy-MM-dd hh:mm:ss")] public DateTime? DeletedTime { get; set; } - //[ExporterHeader(Format = "yyyy-mm-DD")] - [ExcelFormat("yyyy-MM-dd")] public DateTime? RemoveTime { get; set; } public string RemoveTimeStr => RemoveTime?.ToString("yyyy-MM-dd") ?? string.Empty; - //[ExporterHeader(Format = "yyyy-mm-DD")] - [ExcelFormat("yyyy-MM-dd")] public DateTime? JoinTime { get; set; } public string JoinTimeStr => JoinTime?.ToString("yyyy-MM-dd") ?? string.Empty; - //[ExporterHeader(Format = "yyyy-mm-DD hh:mm:ss")] - [ExcelFormat("yyyy-MM-dd HH:mm:ss")] public DateTime CreateTime { get; set; } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs index 9deef590d..b6e0a3afd 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs @@ -7,6 +7,7 @@ using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Domain.Share; using MassTransit.Serialization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore.Storage.Json; using System; namespace IRaCIS.Core.Application.Service @@ -114,7 +115,10 @@ namespace IRaCIS.Core.Application.Service [HttpPut] public async Task UpdateTrialUserRole(UpdateTrialUserRoleCommand updateCommand) { - await _trialUseRoleRepository.UpdatePartialFromQueryAsync(t => updateCommand.IdList.Contains(t.Id), u => new TrialUserRole() { IsDeleted = updateCommand.IsDeleted }, true, true); + + DateTime? deleteTime = updateCommand.IsDeleted ? DateTime.Now : null; + + await _trialUseRoleRepository.UpdatePartialFromQueryAsync(t => updateCommand.IdList.Contains(t.Id), u => new TrialUserRole() { IsDeleted = updateCommand.IsDeleted, DeletedTime = deleteTime }, true, true); return ResponseOutput.Ok(); }