diff --git a/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs index 6b57d26ed..1519ab090 100644 --- a/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs +++ b/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs @@ -3,6 +3,7 @@ // 生成时间 2022-03-28 16:43:52 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 //-------------------------------------------------------------------- +using DocumentFormat.OpenXml.Wordprocessing; using IRaCIS.Core.Infra.EFCore.Common; using System.ComponentModel.DataAnnotations; @@ -63,6 +64,26 @@ namespace IRaCIS.Core.Application.ViewModel } + + public class ModuleTypeData + { + + public bool IsShow { get; set; } + + public Guid Id { get; set; } + public Guid? ParentId { get; set; } + public Guid DictionaryId { get; set; } + + public int ShowOrder { get; set; } + public string DictionaryValue { get; set; } + + } + + public class GetModuleTypeListInDto + { + public Guid TrialId { get; set; } + } + /// /// 复制其他对象到当前对象 /// diff --git a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs index bb34a6ed0..78541cf08 100644 --- a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs @@ -7,6 +7,7 @@ using IRaCIS.Application.Contracts; using IRaCIS.Core.Application.Interfaces; using IRaCIS.Core.Application.ViewModel; +using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Infra.EFCore.Common; using MassTransit; @@ -15,6 +16,8 @@ using Microsoft.Data.SqlClient; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Npgsql; +using NPOI.POIFS.Properties; +using NPOI.SS.Formula.Functions; namespace IRaCIS.Core.Application.Service { @@ -29,6 +32,7 @@ namespace IRaCIS.Core.Application.Service IRepository _qCChallengeRepository, IRepository _dictionaryRepository, IRepository _trialRepository, + IRepository _trialAuditShowRepository, IRepository _userRoleRepository, IRepository _checkChallengeDialogRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IFrontAuditConfigService @@ -1134,18 +1138,80 @@ namespace IRaCIS.Core.Application.Service return ResponseOutput.Ok(); } + /// + /// 获取模块类型列表 + /// + /// + /// + [HttpPost] + public async Task GetModuleTypeList(GetModuleTypeListInDto inDto) + { + + + + + var allfront = await (from data in _frontAuditConfigRepository.AsQueryable() + join dic in _dictionaryRepository.Where(x => x.Parent.Code == "ModuleType" && x.IsEnable) on data.ModuleTypeId equals dic.Id + join trialshow in _trialAuditShowRepository.Where(x => x.TrialId == inDto.TrialId) on data.Id equals trialshow.FrontAuditConfigId into trialshowtemp + from lefttrialshow in trialshowtemp.DefaultIfEmpty() + select new ModuleTypeData() + { + IsShow = lefttrialshow == null ? data.IsDefaultChoice : lefttrialshow.IsShow, + Id = data.Id, + ParentId = data.ParentId, + DictionaryId = dic.Id, + ShowOrder= dic.ShowOrder, + DictionaryValue = _userInfo.IsEn_Us ? dic.Value : dic.ValueCN, + }).ToListAsync(); + + var result = allfront.Where(x => x.IsShow).ToList(); + FindParent(result, result.Select(x => x.ParentId).ToList()); + void FindParent(List re, List Parentids) + { + + var parentList = allfront.Where(x => Parentids.Contains(x.Id)).ToList(); + if (parentList.Count > 0) + { + re.AddRange(parentList); + + FindParent(re, parentList.Select(x => x.ParentId).ToList()); + } + } + + + return result.OrderBy(x => x.ShowOrder).Select(x => new { + + x.DictionaryId, + x.DictionaryValue + }).Distinct().ToList(); + + + + + } + /// /// 获取Description /// /// + /// /// [HttpGet] - public async Task> GetModuleTypeDescriptionList(Guid moduleTypeId) + public async Task> GetModuleTypeDescriptionList(Guid moduleTypeId,Guid trialId) { - var result = (await _frontAuditConfigRepository.Where(x => x.ModuleTypeId == moduleTypeId && x.ObjectTypeId != null && x.OptTypeId != null && x.Description.Length > 0).Select(x => new { x.Description, x.DescriptionCN, x.Sort }).OrderBy(t => t.Sort).ToListAsync() - ).Select(t => _userInfo.IsEn_Us ? t.Description : t.DescriptionCN).Distinct().ToList(); - return result; + + + var result = from data in _frontAuditConfigRepository.Where(x => x.ModuleTypeId == moduleTypeId && x.ObjectTypeId != null && x.OptTypeId != null && x.Description.Length > 0) + join trialshow in _trialAuditShowRepository.Where(x => x.TrialId == trialId) on data.Id equals trialshow.FrontAuditConfigId into trialshowtemp + from lefttrialshow in trialshowtemp.DefaultIfEmpty() + select new + { + IsShow= lefttrialshow==null? data.IsDefaultChoice : lefttrialshow.IsShow, + Description= _userInfo.IsEn_Us ? data.Description : data.DescriptionCN + }; + + return result.Where(x=>x.IsShow).Select(x=>x.Description).Distinct().ToList(); } ///