From fd3aeaff4ca354b7ae2846c1ce6057370017d1ef Mon Sep 17 00:00:00 2001 From: "{872297557@qq.com}" <872297557@qq.com> Date: Wed, 18 Jan 2023 11:19:50 +0800 Subject: [PATCH 1/2] x --- .../Service/Common/DTO/DictionaryModel.cs | 5 +++ .../Service/Common/DictionaryService.cs | 6 ++-- .../Service/Common/_MapConfig.cs | 5 ++- .../SiteSurvey/TrialSiteUserSurveyService.cs | 35 ++++++++++--------- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Common/DTO/DictionaryModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/DictionaryModel.cs index 4c278ddcb..83c88f70e 100644 --- a/IRaCIS.Core.Application/Service/Common/DTO/DictionaryModel.cs +++ b/IRaCIS.Core.Application/Service/Common/DTO/DictionaryModel.cs @@ -98,6 +98,11 @@ namespace IRaCIS.Application.Contracts public string Description { get; set; } = string.Empty; } + + public class BasicDicSelectCopy:BasicDicSelect + { + + } public class BasicDicSelect { public Guid Id { get; set; } diff --git a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs index 995217b61..4634797a0 100644 --- a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs +++ b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs @@ -201,14 +201,16 @@ namespace IRaCIS.Application.Services /// /// /// - public async Task> GetBasicDataSelect(string searchKey) + public async Task> GetBasicDataSelect(string searchKey) { - var searchList = await _dicRepository.Where(t => t.Parent.Code == searchKey && t.ParentId != null && t.IsEnable).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + var searchList = await _dicRepository.Where(t => t.Parent.Code == searchKey && t.ParentId != null && t.IsEnable).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); return searchList; } + + /// /// 根据父亲字典分组 获取子项 /// diff --git a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs index 67e4ef6fc..142c56b3b 100644 --- a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs @@ -39,10 +39,13 @@ namespace IRaCIS.Core.Application.Service CreateMap().ReverseMap(); + CreateMap() + .ForMember(o => o.ParentChildCodeEnum, t => t.MapFrom(u => u.Parent.ChildCodeEnum)) + .ForMember(o => o.Value, t => t.MapFrom(u => u.MappedValue)) + .ForMember(o => o.ParentCode, t => t.MapFrom(u => u.Parent.Code)); CreateMap() .ForMember(o => o.ParentChildCodeEnum, t => t.MapFrom(u => u.Parent.ChildCodeEnum)) - .ForMember(o => o.Value, t => t.MapFrom(u => u.MappedValue)) .ForMember(o => o.ParentCode, t => t.MapFrom(u => u.Parent.Code)); var token = ""; diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs index aad23f9b1..d8877f22a 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs @@ -74,30 +74,31 @@ namespace IRaCIS.Core.Application.Contracts //找下系统中是否存在该用户类型的 并且邮箱 或者手机的账户 var sysUserInfo = await _repository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email).Include(t => t.UserTypeRole).FirstOrDefaultAsync(); - if (sysUserInfo == null) - { - sysUserInfo = new User() { IsZhiZhun=false,IsTestUser= (trialType == TrialType.NoneOfficial) }; - } - - if (trialType == TrialType.OfficialTrial || trialType == TrialType.Training) + if (sysUserInfo != null) { - if (sysUserInfo.IsTestUser) + if (trialType == TrialType.OfficialTrial || trialType == TrialType.Training) { - throw new BusinessValidationFailedException("正式类型 、培训类型的项目 不允许加入测试用户 "); + if (sysUserInfo.IsTestUser) + { + throw new BusinessValidationFailedException("正式类型 、培训类型的项目 不允许加入测试用户 "); + + } + } + + if (trialType == TrialType.NoneOfficial) + { + + if (sysUserInfo.IsTestUser == false) + { + throw new BusinessValidationFailedException("测试项目 不允许加入正式用户 "); + + } } } - if (trialType == TrialType.NoneOfficial) - { - - if (sysUserInfo.IsTestUser == false) - { - throw new BusinessValidationFailedException("测试项目 不允许加入正式用户 "); - - } - } + } var entity = await _trialSiteUserSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteUserSurvey, true); From 44e05180c5de74e216c80369c62c73d1193e0433 Mon Sep 17 00:00:00 2001 From: "{872297557@qq.com}" <872297557@qq.com> Date: Wed, 18 Jan 2023 11:25:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8DQC=20=20=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E9=97=AE=E9=A2=98=E7=B1=BB=E5=9E=8B=20=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E8=BF=9B=E8=A1=8C=E5=9B=BD=E9=99=85=E5=8C=96=20=20?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E4=B8=8D=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Common/DictionaryService.cs | 8 ++++---- .../Service/Common/Interface/IDictionaryService.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs index 4634797a0..7188c9f54 100644 --- a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs +++ b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs @@ -187,10 +187,10 @@ namespace IRaCIS.Application.Services /// /// [HttpPost] - public async Task>> GetBasicDataSelect(string[] searchArray) + public async Task>> GetBasicDataSelect(string[] searchArray) { - var searchList = await _dicRepository.Where(t => searchArray.Contains(t.Parent.Code) && t.ParentId != null && t.IsEnable).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + var searchList = await _dicRepository.Where(t => searchArray.Contains(t.Parent.Code) && t.ParentId != null && t.IsEnable).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); return searchList.GroupBy(t => t.ParentCode).ToDictionary(g => g.Key, g => g.OrderBy(t => t.ShowOrder).ToList()); @@ -201,9 +201,9 @@ namespace IRaCIS.Application.Services /// /// /// - public async Task> GetBasicDataSelect(string searchKey) + public async Task> GetBasicDataSelect(string searchKey) { - var searchList = await _dicRepository.Where(t => t.Parent.Code == searchKey && t.ParentId != null && t.IsEnable).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + var searchList = await _dicRepository.Where(t => t.Parent.Code == searchKey && t.ParentId != null && t.IsEnable).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); return searchList; } diff --git a/IRaCIS.Core.Application/Service/Common/Interface/IDictionaryService.cs b/IRaCIS.Core.Application/Service/Common/Interface/IDictionaryService.cs index 6ff953c7d..a30dfd5b1 100644 --- a/IRaCIS.Core.Application/Service/Common/Interface/IDictionaryService.cs +++ b/IRaCIS.Core.Application/Service/Common/Interface/IDictionaryService.cs @@ -33,7 +33,7 @@ namespace IRaCIS.Application.Interfaces /// Task GetBasicDataTranslateItem(string parentCode, T childCode); - Task>> GetBasicDataSelect(string[] searchArray); + Task>> GetBasicDataSelect(string[] searchArray); } }