From 1ab720ca9c43b76f30e60070c09c680979c03e10 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 23 May 2022 16:42:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=B2=A1=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SiteSurvey/TrialSiteSurveyService.cs | 36 +---- .../TrialUserPreparationService.cs | 136 ------------------ 2 files changed, 3 insertions(+), 169 deletions(-) delete mode 100644 IRaCIS.Core.Application/Service/TrialSiteUser/TrialUserPreparationService.cs diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index e7c61717d..001d1c538 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -73,38 +73,6 @@ namespace IRaCIS.Core.Application.Contracts return ResponseOutput.Ok(); - #region MyRegion - - //var verificationType = VerifyType.Email; - ////检查手机或者邮箱是否有效 - //if (!Regex.IsMatch(userInfo.Email, @"/^1[34578]\d{9}$/") && !Regex.IsMatch(userInfo.Email, @"^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$")) - //{ - - // throw new BusinessValidationFailedException(verificationType == VerifyType.Email - // ? "Please input a legal email" - // : "Please input a legal phone"); - - //} - - ////邮箱 - //if (verificationType == VerifyType.Email) - //{ - // //验证码 6位 - // int verificationCode = new Random().Next(100000, 1000000); - - // await _mailVerificationService.AnolymousSendEmail(userInfo.Email, verificationCode); - //} - ////手机短信 - //else - //{ - - //} - - //return ResponseOutput.Ok(); - - #endregion - - } /// @@ -862,7 +830,7 @@ namespace IRaCIS.Core.Application.Contracts - //废弃 + #region 废弃 //Site 调研邀请 public async Task SendInviteEmail(InviteEmailCommand inviteEmailCommand) { @@ -972,6 +940,8 @@ namespace IRaCIS.Core.Application.Contracts return ResponseOutput.Ok(); } + #endregion + } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialUserPreparationService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialUserPreparationService.cs deleted file mode 100644 index 989e53f5b..000000000 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialUserPreparationService.cs +++ /dev/null @@ -1,136 +0,0 @@ -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 2022-03-24 13:22:54 -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- - -using IRaCIS.Core.Domain.Models; -using Microsoft.AspNetCore.Mvc; -using IRaCIS.Core.Application.Interfaces; -using IRaCIS.Core.Application.ViewModel; -using IRaCIS.Core.Domain.Share; -using IRaCIS.Core.Infra.EFCore; -using Microsoft.AspNetCore.Authorization; -using Panda.DynamicWebApi.Attributes; - -namespace IRaCIS.Core.Application.Service -{ - /// - /// TrialUserPreparation Service - /// - [ApiExplorerSettings(GroupName = "Trial")] - public class TrialUserPreparationService : BaseService, ITrialUserPreparationService - { - private readonly IRepository _trialUserPreparationRepository; - private readonly IRepository _trialExternalUseRepository; - private readonly IRepository _userRepository; - private readonly IRepository _trialUserRepository; - private readonly IRepository _trialSiteUserSurveyRepository; - private readonly IRepository _trialSiteUseRepository; - - public TrialUserPreparationService(IRepository trialUserPreparationRepository, - IRepository trialExternalUseRepository, - IRepository userRepository, IRepository trialUserRepository, IRepository trialSiteUserSurveyRepository, IRepository trialSiteUseRepository) - { - _trialUserPreparationRepository = trialUserPreparationRepository; - _trialExternalUseRepository = trialExternalUseRepository; - _userRepository = userRepository; - _trialUserRepository = trialUserRepository; - _trialSiteUserSurveyRepository = trialSiteUserSurveyRepository; - _trialSiteUseRepository = trialSiteUseRepository; - } - - /// - /// 项目下 人员邀请 加入列表 - /// - /// - /// - public async Task> GetTrialUserPreparationList(TrialUserPreparationQuery queryTrialUserPreparation) - { - - - var trialUserPreparationQueryable = _trialUserPreparationRepository - .WhereIf(queryTrialUserPreparation.UserTypeId != null, t => t.User.UserTypeId == queryTrialUserPreparation.UserTypeId) - .ProjectTo(_mapper.ConfigurationProvider); - - return await trialUserPreparationQueryable.ToListAsync(); - } - - - /// - /// 不带Token访问 加入项目 记录 同意与否 - /// - /// - /// - [AllowAnonymous] - public async Task JoinTrial(JoinCommand joinCommand) - { - - - await UserJoinTrialAsync(joinCommand.TrialUserInfo); - } - - - - - - - - - - - /// - /// 用户加入项目 - /// - /// - /// - [NonDynamicMethod] - public async Task UserJoinTrialAsync(UserJoinTrialCommand joinTrialCommand) - { - var trialId = joinTrialCommand.TrialId; - var userId = joinTrialCommand.UserId; - - if (joinTrialCommand.IsExternal) - { - - //判断TrialUser中是否存在 不存在就插入 - if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId)) - { - - await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId }); - - - await _trialExternalUseRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.SystemUserId == userId, - u => new TrialExternalUser() { InviteState = TrialExternalUserStateEnum.UserConfirmed }); - - - await _userRepository.SaveChangesAsync(); - } - } - else - { - if (joinTrialCommand.SiteId == null) - { - return ResponseOutput.NotOk("传参有误, SiteId必传"); - } - - if (!_trialUserRepository.Where(t => t.TrialId == trialId && t.UserId == userId).Any()) - { - await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId }); - - await _trialSiteUseRepository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId =(Guid) joinTrialCommand.SiteId, UserId = userId }); - } - } - - await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable }); - - - return ResponseOutput.Ok(); - - } - - - - - } -}