From 5c663ec3e9d36ceac537f3e60486ab22fa6b92e6 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Wed, 4 Jun 2025 10:50:28 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=B1=BB=E5=9E=8B=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/DTO/FrontAuditConfigViewModel.cs | 21 +++++ .../Inspection/FrontAuditConfigService.cs | 76 ++++++++++++++++++- 2 files changed, 93 insertions(+), 4 deletions(-) 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..aa0b2edb5 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,82 @@ namespace IRaCIS.Core.Application.Service return ResponseOutput.Ok(); } + /// + /// 获取模块类型列表 + /// + /// + /// + [HttpPost] + public async Task GetModuleTypeList(GetModuleTypeListInDto inDto) + { + + from u in _frontAuditConfigRepository.AsQueryable() + join p in _frontAuditConfigRepository.Where(x => x.EnumType == "Foreign" && x.IsEnable) on u.Id equals p.ParentId + + + + 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(); } /// From 5d8f94ef65f50cd3299640a33b1729b61bfe3081 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Wed, 4 Jun 2025 10:51:32 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Inspection/FrontAuditConfigService.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs index aa0b2edb5..78541cf08 100644 --- a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs @@ -1147,8 +1147,6 @@ namespace IRaCIS.Core.Application.Service public async Task GetModuleTypeList(GetModuleTypeListInDto inDto) { - from u in _frontAuditConfigRepository.AsQueryable() - join p in _frontAuditConfigRepository.Where(x => x.EnumType == "Foreign" && x.IsEnable) on u.Id equals p.ParentId