diff --git a/IRaCIS.Core.Application/Service/Common/DevelopService.cs b/IRaCIS.Core.Application/Service/Common/DevelopService.cs
new file mode 100644
index 000000000..c70b19425
--- /dev/null
+++ b/IRaCIS.Core.Application/Service/Common/DevelopService.cs
@@ -0,0 +1,30 @@
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace IRaCIS.Core.Application.Service.Common
+{
+
+ ///
+ /// 开始时候一些帮助 比如根据配置的字典生成枚举
+ ///
+ ///
+ [ApiExplorerSettings(GroupName = "Common")]
+ public class DevelopService(IRepository _dictionaryRepository) : BaseService
+ {
+ ///
+ /// 根据配置的字典名生成后端枚举
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task BackDicGenerateEnum(string dicName)
+ {
+
+ return ResponseOutput.Ok();
+ }
+ }
+}
diff --git a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs
index aff06bd50..1335532d1 100644
--- a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs
@@ -22,1244 +22,1244 @@ using IRaCIS.Core.Infrastructure.Extention;
namespace IRaCIS.Core.Application.Service
{
- ///
- /// FrontAuditConfigService
- ///
- [ApiExplorerSettings(GroupName = "Reviewer")]
+ ///
+ /// FrontAuditConfigService
+ ///
+ [ApiExplorerSettings(GroupName = "Reviewer")]
public class FrontAuditConfigService(
- IRepository _frontAuditConfigRepository,
- IRepository _qCChallengeDialogRepository,
- IRepository _dataInspectionRepository,
- IRepository _qCChallengeRepository,
- IRepository _dictionaryRepository,
- IRepository _trialRepository,
+ IRepository _frontAuditConfigRepository,
+ IRepository _qCChallengeDialogRepository,
+ IRepository _dataInspectionRepository,
+ IRepository _qCChallengeRepository,
+ IRepository _dictionaryRepository,
+ IRepository _trialRepository,
IRepository _userRepository,
IRepository _checkChallengeDialogRepository) : BaseService, IFrontAuditConfigService
{
-
-
- ///
- /// 获取数据库所有表
- ///
- ///
- [HttpPost]
- public async Task> GetDatabaseTables()
- {
- return await _frontAuditConfigRepository._dbContext.GetTableList().ToListAsync();
- }
-
- ///
- /// 获取查询对象
- ///
- ///
- ///
- [HttpPost]
- public async Task> GetDialogList(AccessToDialogueInDto inDto)
- {
- List data = new List();
-
- switch (inDto.Type)
- {
- case AccessToDialogueEnum.Question:
-
- AccessToDialogueOutDto title = (await _qCChallengeRepository.Where(x => x.Id == inDto.Id).Include(x => x.CreateUser).Select(x => new AccessToDialogueOutDto()
- {
- CreateTime = x.CreateTime,
- CreateUserName = x.CreateUser.UserName,
- TalkContent = x.Content,
- IsTitle = true,
- }).FirstOrDefaultAsync()) ?? new AccessToDialogueOutDto();
-
- data = await _qCChallengeDialogRepository.Where(x => x.QCChallengeId == inDto.Id && x.CreateTime <= inDto.Createtime).Include(x => x.CreateUser).Select(
- x => new AccessToDialogueOutDto()
- {
- CreateTime = x.CreateTime,
- CreateUserName = x.CreateUser.UserName,
- TalkContent = x.TalkContent
- }
- ).OrderBy(x => x.CreateTime).ToListAsync();
-
- data.Insert(0, title);
-
- break;
- case AccessToDialogueEnum.Consistency:
- data = await _checkChallengeDialogRepository.Where(x => x.SubjectVisitId == inDto.Id && x.CreateTime <= inDto.Createtime).Include(x => x.CreateUser).Select(
- x => new AccessToDialogueOutDto()
- {
- CreateTime = x.CreateTime,
- CreateUserName = x.CreateUser.UserName,
- TalkContent = x.TalkContent
- }
- ).OrderBy(x => x.CreateTime).ToListAsync();
- break;
-
- }
-
- return data;
- }
-
- ///
- /// 获取表列名
- ///
- ///
- [HttpPost]
- public async Task> GetTableColumn(string tableName)
- {
- return await _frontAuditConfigRepository._dbContext.GetTableColumn(tableName).ToListAsync();
- }
-
- ///
- /// 复制配置项及其子项
- ///
- /// 传入对象
- ///
- [HttpPost]
- public async Task CopyFrontAuditConfigItem(CopyFrontAuditConfigItemDto input)
- {
- var id = NewId.NextGuid();
- List frontAudits = new List();
-
- var frontAuditConfig = (await _frontAuditConfigRepository.FirstOrDefaultAsync(x => x.Id == input.ChildId)).Clone();
- var fronts = await _frontAuditConfigRepository.Where(x => x.ParentId == frontAuditConfig.Id).ToListAsync();
- fronts.ForEach(x =>
- {
- x.Id = NewId.NextGuid();
- x.ParentId = id;
- });
- frontAuditConfig.ParentId = input.ParentId;
- frontAuditConfig.Id = id;
- frontAudits.Add(frontAuditConfig);
- frontAudits.AddRange(fronts);
-
- await _frontAuditConfigRepository.AddRangeAsync(frontAudits);
- await _frontAuditConfigRepository.SaveChangesAsync();
-
- }
-
- ///
- /// 批量添加字段
- ///
- /// 数据集
- ///
- public async Task BatchAddFrontAudit(BatchAddFrontAudit data)
- {
- var maxSort = await _frontAuditConfigRepository.Where(x => x.ParentId == data.ParentId).MaxAsync(x => x.Sort);
-
- List fronts = new List();
- foreach (var item in data.Columns)
- {
- maxSort++;
- fronts.Add(new FrontAuditConfig()
- {
- Sort = maxSort,
- Code = item.Name,
- ValueCN = item.Remake,
- IsEnable = true,
- ParentId = data.ParentId
- });
- }
-
- await _frontAuditConfigRepository.AddRangeAsync(fronts);
- }
-
- ///
- /// 翻译稽查数据
- ///
- ///
- ///
- [HttpPost]
- public async Task> SetInspectionEnumValue(SetInspectionEnumValueDto dto)
- {
- return await SetInspectionEnumValueDataList(dto, dto.AuditDataIds.FirstOrDefault());
- }
-
-
- public async Task> GetInspectionJsonDataList(Guid trialId, Guid id)
- {
- //找到上一条Id
-
-
- var currentInspection = await _dataInspectionRepository.Where(t => t.Id == id).Select(t => new { t.GeneralId, t.ObjectRelationParentId, t.CreateTime }).FirstNotNullAsync();
-
- var beforeId = await _dataInspectionRepository.Where(x => x.GeneralId == currentInspection.GeneralId && x.CreateTime <= currentInspection.CreateTime && x.Id != id).OrderByDescending(x => x.CreateTime).Select(t => t.Id)
- .FirstOrDefaultAsync();
-
- List searchGuidList = new List() { id };
-
- if (beforeId != Guid.Empty)
- {
- searchGuidList.Add(beforeId);
- }
-
- return await SetInspectionEnumValueDataList(new SetInspectionEnumValueDto() { TrialId = trialId, AuditDataIds = searchGuidList }, id);
- }
-
-
-
- ///
- /// 翻译稽查数据
- ///
- ///
- ///
- ///
- private async Task> SetInspectionEnumValueDataList(SetInspectionEnumValueDto dto, Guid currentInspectionId)
- {
- var auditDatas = await _dataInspectionRepository.AsQueryable().Where(x => dto.AuditDataIds.Contains(x.Id)).Select(x => new SetInspectionEnumDataDto()
- {
- Id = x.Id,
- JsonStr = x.JsonDetail,
- Identification = x.Identification,
- ObjectRelationParentId = x.ObjectRelationParentId,
- ObjectRelationParentId2 = x.ObjectRelationParentId2,
- ObjectRelationParentId3 = x.ObjectRelationParentId3,
- CreateTime = x.CreateTime,
- BatchId = x.BatchId,
-
- }).ToListAsync();
-
-
-
-
- var listIdentification = auditDatas.Select(x => x.Identification).Distinct().ToList();
- foreach (var item in auditDatas)
- {
- Dictionary jsonDict = (JsonConvert.DeserializeObject>(item.JsonStr)).IfNullThrowException();
-
- if (!jsonDict.ContainsKey(nameof(InspectionJsonDetail.CommonData)))
- {
- jsonDict.Add(nameof(InspectionJsonDetail.CommonData), new { });
- }
-
- //查询关联父层级数据
- if (item.Id == currentInspectionId)
- {
- //把父层级的数据的 CommonData 数据合并(每一个层级把下面层级需要的数据放在CommonData 里面) 麻烦点是每个层级都需要记录一些信息,而且名称不能重复
-
- var objectLsit = new List