diff --git a/IRaCIS.Core.API/_ServiceExtensions/AutofacModuleSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/AutofacModuleSetup.cs index a544bcd40..815c31af2 100644 --- a/IRaCIS.Core.API/_ServiceExtensions/AutofacModuleSetup.cs +++ b/IRaCIS.Core.API/_ServiceExtensions/AutofacModuleSetup.cs @@ -63,7 +63,7 @@ namespace IRaCIS.Core.API //Autofac 注册拦截器 需要注意的是生成api上服务上的动态代理AOP失效 间接掉用不影响 containerBuilder.RegisterType(); - containerBuilder.RegisterType(); + //containerBuilder.RegisterType(); //containerBuilder.RegisterType(); //containerBuilder.RegisterType().As().SingleInstance(); diff --git a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs index e9387c5c2..8861207d7 100644 --- a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs +++ b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs @@ -59,22 +59,7 @@ namespace IRaCIS.Application.Services [HttpPost] public async Task AddOrUpdateBasicDic(AddOrEditBasicDic addOrEditBasic) { - //if (addOrEditBasic.Id == null) - //{ - // var entity = await _dicRepository.InsertDictionaryAsync(addOrEditBasic); - // await _dicRepository.UpdateFromQueryAsync(t => t.ParentId == Guid.Empty, - // u => new Dictionary() { ParentId = null }); - - // return ResponseOutput.Ok(entity.Id.ToString()); - //} - //else - //{ - // var entity = await _dicRepository.InsertOrUpdateAsync(addOrEditBasic, true); - - - // return ResponseOutput.Ok(entity.Id.ToString()); - //} var entity = await _dicRepository.InsertOrUpdateAsync(addOrEditBasic, true); return ResponseOutput.Ok(entity.Id.ToString()); diff --git a/IRaCIS.Core.Application/Service/Common/MailService.cs b/IRaCIS.Core.Application/Service/Common/MailService.cs index 82996e084..ec6275f9f 100644 --- a/IRaCIS.Core.Application/Service/Common/MailService.cs +++ b/IRaCIS.Core.Application/Service/Common/MailService.cs @@ -187,7 +187,6 @@ namespace IRaCIS.Application.Services - public async Task SendMail(Guid userId, string userName, string emailAddress, int verificationCode) { @@ -236,52 +235,7 @@ namespace IRaCIS.Application.Services } } - public async Task SendEmailForExternalUser(string emailAddress, string verificationCode) - { - var messageToSend = new MimeMessage(); - //发件地址 - messageToSend.From.Add(new MailboxAddress("GRR", "iracis_grr@163.com")); - //收件地址 - messageToSend.To.Add(new MailboxAddress(String.Empty, emailAddress)); - //主题 - messageToSend.Subject = "GRR External User survey (Verification Code)"; - messageToSend.Body = new TextPart("plain") - { - Text = $@"Hey ,you are login for site survey via email. The verification code is: {verificationCode}, If it is not your own operation, please ignore it! - - -- GRR" - }; - using (var smtp = new MailKit.Net.Smtp.SmtpClient()) - { - smtp.MessageSent += (sender, args) => - { - // args.Response - var code = verificationCode.ToString(); - _ = _verificationCodeRepository.AddAsync(new VerificationCode() - { - CodeType = 0, - HasSend = true, - Code = code, - UserId = Guid.Empty,//此时不知道用户 - EmailOrPhone = emailAddress, - ExpirationTime = DateTime.Now.AddMinutes(3) - }).Result; - _ = _verificationCodeRepository.SaveChangesAsync().Result; - - }; - - smtp.ServerCertificateValidationCallback = (s, c, h, e) => true; - - await smtp.ConnectAsync("smtp.163.com", 25, SecureSocketOptions.StartTls); - - await smtp.AuthenticateAsync("iracis_grr@163.com", "XLWVQKZAEKLDWOAH"); - - await smtp.SendAsync(messageToSend); - - await smtp.DisconnectAsync(true); - } - } } } \ No newline at end of file diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs index ad4cb0376..d307ac8c0 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs @@ -56,6 +56,33 @@ namespace IRaCIS.Core.Application.Contracts public string UploadStartTimeStr => UploadStartTime.ToString("yyyy-MM-dd HH:mm:ss.fff"); public string UploadFinishedTimeStr => UploadFinishedTime.ToString("yyyy-MM-dd HH:mm:ss.fff"); + + public string TimeInterval + { + get + { + + var tSpan = UploadFinishedTime - UploadStartTime; + + if (tSpan.Seconds == 0 && tSpan.Minutes==0 && tSpan.Hours == 0) + { + return $"{tSpan.Milliseconds}毫秒"; + } + else if ( tSpan.Minutes == 0 && tSpan.Hours == 0) + { + return $"{tSpan.Seconds}秒"; + } + else if ( tSpan.Hours == 0) + { + return $"{tSpan.Minutes} 分钟 {tSpan.Seconds} 秒"; + } + else + { + return $" {tSpan.Hours} 小时 {tSpan.Minutes} 分钟 {tSpan.Seconds} 秒"; + } + } + } + public DateTime UploadStartTime { get; set; } diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index f4abbffc3..a2aa0f257 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -1,12 +1,7 @@ -using IRaCIS.Core.Infrastructure.ExpressionExtend; -using IRaCIS.Application.Interfaces; -using IRaCIS.Application.Contracts; -using IRaCIS.Core.Infra.EFCore; +using IRaCIS.Application.Contracts; using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Infrastructure; using System.Text.RegularExpressions; -using Autofac.Extras.DynamicProxy; -using IRaCIS.Core.API.Utility.AOP; using Microsoft.AspNetCore.Mvc; using Panda.DynamicWebApi.Attributes; @@ -15,7 +10,6 @@ using Microsoft.AspNetCore.Authorization; namespace IRaCIS.Application.Services { [ApiExplorerSettings(GroupName = "Management")] - [Intercept(typeof(UserAddAOP))] public class UserService : BaseService, IUserService { private readonly IRepository _userRepository; diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs index 26a06c449..c668ec0f3 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs @@ -181,7 +181,7 @@ namespace IRaCIS.Core.Application public async Task UpdateTrialState(Guid trialId, string trialStatusStr, Guid signId, string? reason, [FromServices] IEasyCachingProvider _provider) { - var trial = await _trialRepository.Where(t => t.Id == trialId, true).IgnoreQueryFilters().FirstOrDefaultAsync().IfNullThrowException(); + var trial = (await _trialRepository.Where(t => t.Id == trialId, true).IgnoreQueryFilters().FirstOrDefaultAsync()).IfNullThrowException(); if (trialStatusStr == StaticData.TrialOngoing) {