Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing Details

IRC_NewDev
he 2024-11-11 10:37:51 +08:00
commit ec945b4b39
31 changed files with 54971 additions and 263 deletions

View File

@ -109,7 +109,6 @@ public static class SwaggerSetup
//路径配置设置为空表示直接在根域名localhost:8001访问该文件,
//注意localhost:8001/swagger是访问不到的去launchSettings.json把launchUrl去掉如果你想换一个路径直接写名字即可比如直接写c.Route = "doc";
options.RoutePrefix = string.Empty;
options.RoutePrefix = string.Empty;
//DocExpansion设置为none可折叠所有方法
options.DocExpansion(DocExpansion.None);

View File

@ -16,12 +16,12 @@ namespace IRaCIS.Core.API
services.AddHangfire(hangFireConfig =>
{
//本地window 调试 使用内存,服务器部署使用数据库,防止服务器任务调度到本地
//if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
//{
// hangFireConfig.UseInMemoryStorage();
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
hangFireConfig.UseInMemoryStorage();
//}
//else
}
else
{
//指定存储介质
hangFireConfig.UseSqlServerStorage(hangFireConnStr, new SqlServerStorageOptions()

View File

@ -16,6 +16,7 @@ using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using System.Collections;
using System.Globalization;
using Xceed.Document.NET;
namespace IRaCIS.Core.Application.Service;
@ -85,27 +86,27 @@ public static class ExcelExportHelper
foreach (var needTranslateProperty in needTranslatePropertyList)
{
//翻译的属性依赖其他属性
if (needTranslateProperty.IsTranslateDenpendOtherProperty)
if (itemDic.Keys.Any(t => t == needTranslateProperty.Name))
{
if (itemDic[needTranslateProperty.DependPropertyName]?.ToString().ToLower() == needTranslateProperty.DependPropertyValueStr.ToLower())
//翻译的属性依赖其他属性
if (needTranslateProperty.IsTranslateDenpendOtherProperty)
{
if (itemDic[needTranslateProperty.DependPropertyName]?.ToString().ToLower() == needTranslateProperty.DependPropertyValueStr.ToLower())
{
var beforeValue = itemDic[needTranslateProperty.Name]?.ToString();
itemDic[needTranslateProperty.Name] = translateDataList[needTranslateProperty.DicParentCode].Where(t => t.Code.ToLower() == beforeValue?.ToLower()).Select(t => isEn_US ? t.Value : t.ValueCN).FirstOrDefault() ?? String.Empty;
}
}
//普通翻译 或者某一标准翻译
else
{
var beforeValue = itemDic[needTranslateProperty.Name]?.ToString();
itemDic[needTranslateProperty.Name] = translateDataList[needTranslateProperty.DicParentCode].Where(t => t.Code.ToLower() == beforeValue?.ToLower()).Select(t => isEn_US ? t.Value : t.ValueCN).FirstOrDefault() ?? String.Empty;
}
}
//普通翻译 或者某一标准翻译
else
{
var beforeValue = itemDic[needTranslateProperty.Name]?.ToString();
itemDic[needTranslateProperty.Name] = translateDataList[needTranslateProperty.DicParentCode].Where(t => t.Code.ToLower() == beforeValue?.ToLower()).Select(t => isEn_US ? t.Value : t.ValueCN).FirstOrDefault() ?? String.Empty;
}
}
itemDic.Add("No", no++);
@ -125,6 +126,7 @@ public static class ExcelExportHelper
translateData = dic;
}
@ -162,12 +164,49 @@ public static class ExcelExportHelper
workbook.RemoveSheetAt(1);
}
var memoryStream2 = new MemoryStream();
workbook.Write(memoryStream2, true);
//中文替换项目术语
if (isEn_US == false)
{
var replaceObjectList = data.TrialObjectNameList;
var sheet = workbook.GetSheetAt(0);
int rowCount = sheet.PhysicalNumberOfRows;
for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
{
var row = sheet.GetRow(rowIndex);
var colums = row.LastCellNum;
for (int colIndex = 0; colIndex < colums; colIndex++)
{
var cell = row.GetCell(colIndex);
// 只处理字符串类型的单元格
if (cell != null)
{
var cellValue = cell.StringCellValue;
var find = replaceObjectList.FirstOrDefault(t => t.Name == cellValue);
if (find != null)
{
cell.SetCellValue(find.TrialName);
}
}
}
}
}
using (var memoryStream2 = new MemoryStream())
{
workbook.Write(memoryStream2, true);
memoryStream2.Seek(0, SeekOrigin.Begin);
templateStream = memoryStream2;
}
memoryStream2.Seek(0, SeekOrigin.Begin);
templateStream = memoryStream2;
}
// 文件名称 从sheet里面取
@ -300,25 +339,29 @@ public static class ExcelExportHelper
foreach (var needTranslateProperty in needTranslatePropertyList)
{
//翻译的属性依赖其他属性
if (needTranslateProperty.IsTranslateDenpendOtherProperty)
if (itemDic.Keys.Any(t => t == needTranslateProperty.Name))
{
if (itemDic[needTranslateProperty.DependPropertyName]?.ToString().ToLower() == needTranslateProperty.DependPropertyValueStr.ToLower())
//翻译的属性依赖其他属性
if (needTranslateProperty.IsTranslateDenpendOtherProperty)
{
if (itemDic[needTranslateProperty.DependPropertyName]?.ToString().ToLower() == needTranslateProperty.DependPropertyValueStr.ToLower())
{
var beforeValue = itemDic[needTranslateProperty.Name]?.ToString();
itemDic[needTranslateProperty.Name] = translateDataList[needTranslateProperty.DicParentCode].Where(t => t.Code.ToLower() == beforeValue?.ToLower()).Select(t => isEn_US ? t.Value : t.ValueCN).FirstOrDefault() ?? String.Empty;
}
}
//普通翻译 或者某一标准翻译
else
{
var beforeValue = itemDic[needTranslateProperty.Name]?.ToString();
itemDic[needTranslateProperty.Name] = translateDataList[needTranslateProperty.DicParentCode].Where(t => t.Code.ToLower() == beforeValue?.ToLower()).Select(t => isEn_US ? t.Value : t.ValueCN).FirstOrDefault() ?? String.Empty;
}
}
//普通翻译 或者某一标准翻译
else
{
var beforeValue = itemDic[needTranslateProperty.Name]?.ToString();
itemDic[needTranslateProperty.Name] = translateDataList[needTranslateProperty.DicParentCode].Where(t => t.Code.ToLower() == beforeValue?.ToLower()).Select(t => isEn_US ? t.Value : t.ValueCN).FirstOrDefault() ?? String.Empty;
}
}
@ -371,6 +414,38 @@ public static class ExcelExportHelper
workbook.RemoveSheetAt(1);
}
//中文替换项目术语
if (isEn_US == false)
{
var replaceObjectList = data.TrialObjectNameList;
var sheet = workbook.GetSheetAt(0);
int rowCount = sheet.PhysicalNumberOfRows;
for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
{
var row = sheet.GetRow(rowIndex);
var colums = row.LastCellNum;
for (int colIndex = 0; colIndex < colums; colIndex++)
{
var cell = row.GetCell(colIndex);
// 只处理字符串类型的单元格
if (cell != null)
{
var cellValue = cell.StringCellValue;
var find = replaceObjectList.FirstOrDefault(t => t.Name == cellValue);
if (find != null)
{
cell.SetCellValue(find.TrialName);
}
}
}
}
}
if (dynamicColumnConfig != null)
{
@ -391,7 +466,7 @@ public static class ExcelExportHelper
var originTotalEndIndex = dynamicColumnConfig.TempalteLastColumnIndex;
//减去动态移除后原始结束索引
var originRemoveEndIndex= originTotalEndIndex- dynamicRemoveColunmCount;
var originRemoveEndIndex = originTotalEndIndex - dynamicRemoveColunmCount;
//最终表 动态列开始索引
var dynamicColunmStartIndex = dynamicColumnConfig.AutoColumnStartIndex - beforeDynamicRemoveCount;
@ -513,8 +588,8 @@ public static class ExcelExportHelper
//var writeIndex = itemList.IndexOf(itemObj) + dynamicColumnConfig.AutoColumnStartIndex;
var writeIndex = dynamicColumnConfig.ColumnNameList.IndexOf(iteObjDic[dynamicColumnConfig.DynamicItemTitleName].ToString()) + dynamicColumnConfig.AutoColumnStartIndex;
var writeIndex = dynamicColumnConfig.ColumnNameList.IndexOf(iteObjDic[dynamicColumnConfig.DynamicItemTitleName].ToString()) + dynamicColumnConfig.AutoColumnStartIndex;
if (itemDicName.IsNotNullOrEmpty())
{

View File

@ -70,4 +70,8 @@
<ProjectReference Include="..\IRaCIS.Core.Infra.EFCore\IRaCIS.Core.Infra.EFCore.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Service\MinimalApiService\CodeTemplate\FrontTemplate\" />
</ItemGroup>
</Project>

View File

@ -549,23 +549,134 @@
系统模板文档配置表
</summary>
</member>
<member name="T:IRaCIS.Core.Application.Service.Common.DevelopService">
<member name="T:IRaCIS.Core.Application.Service.DictionaryService">
<summary>
开始时候一些帮助 比如根据配置的字典生成枚举
数据字典-基础数据维护
</summary>
<param name="_dictionaryRepository"></param>
</member>
<member name="M:IRaCIS.Core.Application.Service.Common.DevelopService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Dictionary},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Dictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DoctorDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Doctor},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemCriterionDictionaryCode},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialCriterionDictionaryCode},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTrialCriterionDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingSystemCriterionDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingSystemCriterionDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionSystem},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
<summary>
开始时候一些帮助 比如根据配置的字典生成枚举
数据字典-基础数据维护
</summary>
<param name="_dictionaryRepository"></param>
</member>
<member name="M:IRaCIS.Core.Application.Service.Common.DevelopService.BackDicGenerateEnum(System.String)">
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.AddBoolDic(IRaCIS.Application.Contracts.AddOrEditBasicDic)">
<summary>
根据配置的字典名生成后端枚举
添加bool
</summary>
<param name="dicName"></param>
<param name="addOrEditBasic"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetAllDictionaryKey">
<summary>
获取所有字典的Key
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.AddBasicDicAndChild(IRaCIS.Application.Contracts.AddBasicDicAndChild)">
<summary>
添加字典 的同时 一起添加子项 --New
</summary>
<param name="addBasicDicAndChild"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBasicDicList(IRaCIS.Application.Contracts.BasicDicQuery)">
<summary>
New 查询条件
</summary>
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.AddOrUpdateBasicDic(IRaCIS.Application.Contracts.AddOrEditBasicDic)">
<summary>
添加和编辑
</summary>
<param name="addOrEditBasic"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetChildList(System.Guid)">
<summary>
获取子项数组
</summary>
<param name="parentId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.DeleteDictionary(System.Guid)">
<summary> 删除字典数据 </summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBasicDataSelect(System.String[])">
<summary>
传递父亲 code 字符串 数组 返回多个下拉框数据
</summary>
<param name="searchArray"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBasicDataSelect(System.String)">
<summary>
根据父亲Code 获取单个下拉框数据
</summary>
<param name="searchKey"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBasicConfigSelect(System.String)">
<summary>
根据父亲字典分组 获取子项
</summary>
<param name="searchKey"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetCriterionDictionaryList(IRaCIS.Application.Contracts.GetCriterionDictionaryListInDto)">
<summary>
获取标准字典
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetTrialCriterionDictionaryList(IRaCIS.Application.Contracts.GetTrialCriterionDictionaryListInDto)">
<summary>
获取标准字典
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetCriterionDictionary(IRaCIS.Application.Contracts.GetCriterionDictionaryInDto)">
<summary>
获取标准指定字典
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBasicDataAllSelect(IRaCIS.Application.Contracts.GetBasicDataAllSelectInDto)">
<summary>
获取所有下拉框 枚举 bool 数据
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBoolValueState(System.Boolean)">
<summary>
获取是和否
</summary>
<param name="value"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetAuditState``1(System.Guid,``0)">
<summary>
获取审核状态
</summary>
<typeparam name="T"></typeparam>
<param name="trial"></param>
<param name="childCode"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.EventStoreRecordService.GetEventStoreRecordList(IRaCIS.Core.Application.ViewModel.EventStoreRecordQuery)">
<summary>
邮件事件消息列表
</summary>
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.EventStoreRecordService.RePublishEvent(System.Guid)">
<summary>
重新发布失败的事件消息
</summary>
<param name="eventId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Common.ExcelExportService.TrialUserListExport(IRaCIS.Application.Contracts.TrialMaintenanceExportQuery,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.CommonDocument},IRaCIS.Application.Interfaces.IDictionaryService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialUser})">
@ -833,136 +944,6 @@
<returns></returns>
<exception cref="T:System.Exception"></exception>
</member>
<member name="T:IRaCIS.Core.Application.Service.DictionaryService">
<summary>
数据字典-基础数据维护
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Dictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DoctorDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Doctor},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemCriterionDictionaryCode},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialCriterionDictionaryCode},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTrialCriterionDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingSystemCriterionDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingSystemCriterionDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionSystem},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
<summary>
数据字典-基础数据维护
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.AddBoolDic(IRaCIS.Application.Contracts.AddOrEditBasicDic)">
<summary>
添加bool
</summary>
<param name="addOrEditBasic"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetAllDictionaryKey">
<summary>
获取所有字典的Key
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.AddBasicDicAndChild(IRaCIS.Application.Contracts.AddBasicDicAndChild)">
<summary>
添加字典 的同时 一起添加子项 --New
</summary>
<param name="addBasicDicAndChild"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBasicDicList(IRaCIS.Application.Contracts.BasicDicQuery)">
<summary>
New 查询条件
</summary>
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.AddOrUpdateBasicDic(IRaCIS.Application.Contracts.AddOrEditBasicDic)">
<summary>
添加和编辑
</summary>
<param name="addOrEditBasic"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetChildList(System.Guid)">
<summary>
获取子项数组
</summary>
<param name="parentId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.DeleteDictionary(System.Guid)">
<summary> 删除字典数据 </summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBasicDataSelect(System.String[])">
<summary>
传递父亲 code 字符串 数组 返回多个下拉框数据
</summary>
<param name="searchArray"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBasicDataSelect(System.String)">
<summary>
根据父亲Code 获取单个下拉框数据
</summary>
<param name="searchKey"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBasicConfigSelect(System.String)">
<summary>
根据父亲字典分组 获取子项
</summary>
<param name="searchKey"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetCriterionDictionaryList(IRaCIS.Application.Contracts.GetCriterionDictionaryListInDto)">
<summary>
获取标准字典
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetTrialCriterionDictionaryList(IRaCIS.Application.Contracts.GetTrialCriterionDictionaryListInDto)">
<summary>
获取标准字典
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetCriterionDictionary(IRaCIS.Application.Contracts.GetCriterionDictionaryInDto)">
<summary>
获取标准指定字典
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBasicDataAllSelect(IRaCIS.Application.Contracts.GetBasicDataAllSelectInDto)">
<summary>
获取所有下拉框 枚举 bool 数据
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBoolValueState(System.Boolean)">
<summary>
获取是和否
</summary>
<param name="value"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetAuditState``1(System.Guid,``0)">
<summary>
获取审核状态
</summary>
<typeparam name="T"></typeparam>
<param name="trial"></param>
<param name="childCode"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.EventStoreRecordService.GetEventStoreRecordList(IRaCIS.Core.Application.ViewModel.EventStoreRecordQuery)">
<summary>
邮件事件消息列表
</summary>
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.EventStoreRecordService.RePublishEvent(System.Guid)">
<summary>
重新发布失败的事件消息
</summary>
<param name="eventId"></param>
<returns></returns>
</member>
<member name="T:IRaCIS.Core.Application.Service.ExploreRecommendService">
<summary>
ExploreRecommendService
@ -2316,6 +2297,21 @@
<param name="password"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.CodeTemplateService.GetDataBaseTableList(System.String,System.String)">
<summary>
获取数据库的表信息 以及字段信息
</summary>
<param name="tableName"></param>
<param name="comment"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.CodeTemplateService.GenerateEnumDefine(System.String)">
<summary>
根据字典名 code 生成枚举定义
</summary>
<param name="code"></param>
<returns></returns>
</member>
<member name="T:IRaCIS.Core.Application.Service.MinimalApiService.FileToPDFService">
<summary>
上传文件转PDF 或者给url 这边下载然后转PDF
@ -2331,7 +2327,14 @@
<param name="_hostEnvironment"></param>
</member>
<!-- Badly formed XML comment ignored for member "T:IRaCIS.Core.Application.Service.MinimalApiService.TestMinimalApiService" -->
<!-- Badly formed XML comment ignored for member "M:IRaCIS.Core.Application.Service.MinimalApiService.TestMinimalApiService.#ctor(IRaCIS.Core.Domain.Share.IUserInfo)" -->
<!-- Badly formed XML comment ignored for member "M:IRaCIS.Core.Application.Service.MinimalApiService.TestMinimalApiService.#ctor(IRaCIS.Core.Domain.Share.IUserInfo,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Infra.EFCore.TestLength})" -->
<member name="M:IRaCIS.Core.Application.Service.MinimalApiService.TestMinimalApiService.TestEfcoreJson">
<summary>
测试efcore json 列支持情况
https://devblogs.microsoft.com/dotnet/array-mapping-in-ef-core-8/
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.OAuthService.TestClientCredentialsAsync">
<summary>
测试客户端凭证代码

View File

@ -227,7 +227,7 @@ namespace IRaCIS.Core.Application.Service
{
var lastTask = (subject.VisitTaskList.Take(filterObj.PlanVisitCount).Last()).Clone();
var existGlobal = _visitTaskRepository.Where(t => t.SubjectId == lastTask.SubjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Global && t.VisitTaskNum == lastTask.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global]).ProjectTo<VisitTaskSimpleDTO>(_mapper.ConfigurationProvider).FirstOrDefault();
var existGlobal = _visitTaskRepository.Where(t => t.SubjectId == lastTask.SubjectId && t.ArmEnum==lastTask.ArmEnum && t.TrialReadingCriterionId == trialReadingCriterionId && t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Global && t.VisitTaskNum == lastTask.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global]).ProjectTo<VisitTaskSimpleDTO>(_mapper.ConfigurationProvider).FirstOrDefault();
if (existGlobal == null)
@ -469,7 +469,7 @@ namespace IRaCIS.Core.Application.Service
var lastTask = (subjectAddTaskList.Take(filterObj.PlanVisitCount).Last()).Clone();
var existGlobal = _visitTaskRepository.Where(t => t.SubjectId == lastTask.SubjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Global && t.VisitTaskNum == lastTask.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global]).ProjectTo<VisitTaskGroupSimpleDTO>(_mapper.ConfigurationProvider).FirstOrDefault();
var existGlobal = _visitTaskRepository.Where(t => t.SubjectId == lastTask.SubjectId && t.ArmEnum == lastTask.ArmEnum && t.TrialReadingCriterionId == trialReadingCriterionId && t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Global && t.VisitTaskNum == lastTask.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global]).ProjectTo<VisitTaskGroupSimpleDTO>(_mapper.ConfigurationProvider).FirstOrDefault();
if (existGlobal == null)

View File

@ -30,7 +30,7 @@ namespace IRaCIS.Core.Application.Service
.WhereIf(queryCommonDocument.CriterionTypeEnum != null, t => t.CriterionTypeEnum == queryCommonDocument.CriterionTypeEnum)
.WhereIf(queryCommonDocument.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == queryCommonDocument.BusinessScenarioEnum)
.WhereIf(!string.IsNullOrEmpty(queryCommonDocument.Code), t => t.Code.Contains(queryCommonDocument.Code))
.WhereIf(!string.IsNullOrEmpty(queryCommonDocument.Name), t => t.Name.Contains(queryCommonDocument.Name))
.WhereIf(!string.IsNullOrEmpty(queryCommonDocument.Name), t => t.Name.Contains(queryCommonDocument.Name) || t.NameCN.Contains(queryCommonDocument.Name))
.ProjectTo<CommonDocumentView>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.Id });
return await commonDocumentQueryable.ToPagedListAsync(queryCommonDocument);

View File

@ -1,25 +0,0 @@
using Microsoft.AspNetCore.Mvc;
namespace IRaCIS.Core.Application.Service.Common
{
/// <summary>
/// 开始时候一些帮助 比如根据配置的字典生成枚举
/// </summary>
/// <param name="_dictionaryRepository"></param>
[ApiExplorerSettings(GroupName = "Common")]
public class DevelopService(IRepository<Dictionary> _dictionaryRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService
{
/// <summary>
/// 根据配置的字典名生成后端枚举
/// </summary>
/// <param name="dicName"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> BackDicGenerateEnum(string dicName)
{
return ResponseOutput.Ok();
}
}
}

View File

@ -26,37 +26,6 @@ namespace IRaCIS.Core.Application.Service
IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrial, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IDictionaryService
{
public async Task<IResponseOutput> GenerateEnumDefine(string code)
{
var searchList = await _dicRepository.Where(t => t.Parent.Code == code && t.ParentId != null && t.IsEnable).ProjectTo<BasicDicSelect>(_mapper.ConfigurationProvider).ToListAsync();
// StringBuilder 用于构建枚举代码字符串
var enumCode = new StringBuilder();
// 生成枚举定义
enumCode.AppendLine($"public enum {code}");
enumCode.AppendLine("{");
foreach (var item in searchList)
{
// 添加 XML 注释作为枚举描述
enumCode.AppendLine($" /// <summary>");
enumCode.AppendLine($" /// {item.ValueCN}"); // 假设你有一个描述字段
enumCode.AppendLine($" /// </summary>");
// 每个枚举值生成
enumCode.AppendLine($" {item.Value.Trim().Replace(" ", "")} = {item.Code},");
}
enumCode.AppendLine("}");
// 返回生成的枚举代码
var enumStr = enumCode.ToString();
return ResponseOutput.Ok(enumStr);
}
/// <summary>
/// 添加bool
/// </summary>

View File

@ -1611,7 +1611,7 @@ namespace IRaCIS.Core.Application.Service.Common
//一致性分析
.WhereIf(inQuery.ReadingExportType == ExportResult.DetailedTableOfIntraReaderAnalysisResults, t => t.IsSelfAnalysis == true || t.IsSelfAnalysis == null)
.WhereIf(inQuery.ReadingExportType == ExportResult.DetailedTableOfIntraReaderAnalysisResults, t => t.IsSelfAnalysis == null ? t.Subject.SubjectVisitTaskList.Any(u => u.IsSelfAnalysis == true && u.DoctorUserId == t.DoctorUserId && u.TrialReadingCriterionId == t.TrialReadingCriterionId) : true)
.WhereIf(inQuery.ReadingExportType == ExportResult.DetailedTableOfIntraReaderAnalysisResults, t => t.IsSelfAnalysis == null ? t.Subject.SubjectVisitTaskList.Any(u => u.IsSelfAnalysis == true && u.VisitTaskNum == t.VisitTaskNum && u.DoctorUserId == t.DoctorUserId && u.TrialReadingCriterionId == t.TrialReadingCriterionId) : true)
.WhereIf(inQuery.ReadingExportType == ExportResult.DetailedTableOfInterReaderAnalysisResults, t => t.IsSelfAnalysis == false || t.IsSelfAnalysis == null)
//访视和全局查询已签名完成的,裁判可以是未签名,未完成的
@ -1730,12 +1730,14 @@ namespace IRaCIS.Core.Application.Service.Common
//处理再次阅片人的结果
if (selfAnalysisTask != null)
{
foreach (var qItem in selfAnalysisTask.QuestionAnswerList)
var cloneQuestionAnswerList = selfAnalysisTask.QuestionAnswerList.Clone();
foreach (var qItem in cloneQuestionAnswerList)
{
qItem.QuestionName = qItem.QuestionName + $"{(_userInfo.IsEn_Us ? "(Again)" : "()")}";
}
item.QuestionAnswerList = item.QuestionAnswerList.Union(selfAnalysisTask?.QuestionAnswerList).ToList();
item.QuestionAnswerList = item.QuestionAnswerList.Union(cloneQuestionAnswerList).ToList();
}
}
@ -1794,7 +1796,7 @@ namespace IRaCIS.Core.Application.Service.Common
var columNameList = list.SelectMany(t => t.QuestionAnswerList).Where(t => t.QuestionName.IsNotNullOrEmpty()).Select(t => t.QuestionName).Distinct().ToList();
exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId);
exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list.Where(t => t.ReadingCategory != ReadingCategory.Global).ToList(), _userInfo.TimeZoneId);
exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId);
var dynamicColumnConfig = new DynamicColumnConfig()

View File

@ -0,0 +1,46 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Service.DTO;
public class TemplateTable
{
public string TableName { get; set; }
public string Comment { get; set; }
public List<TemplateTableProperty> AddOrEditPropertyList => TablePropertyList.Where(t => !AddOrUpdateExcludeNameList.Contains(t.PropertyName)).ToList();
[JsonIgnore]
public List<TemplateTableProperty> TablePropertyList { get; set; }
[JsonIgnore]
public List<string> AddOrUpdateExcludeNameList = new List<string>() { "CreateUserId", "UpdateUserId", "CreateTime", "UpdateTime", "DeleteUserId", "IsDeleted", "DeletedTime" };
}
public class TemplateTableProperty
{
public string ColumnName { get; set; }
public string PropertyName { get; set; }
public string CSharpType { get; set; }
public bool IsNullable { get; set; }
public int? MaxLength { get; set; }
public bool IsPrimarykey { get; set; }
public string Comment { get; set; }
}

View File

@ -0,0 +1,119 @@
using DocumentFormat.OpenXml.Office2016.Drawing.ChartDrawing;
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.Service.DTO;
using Microsoft.AspNetCore.Builder;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.Extensions.Configuration;
using NPOI.HPSF;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Service
{
public class CodeTemplateService(IRepository<Dictionary> _dicRepository,IMapper _mapper, IConfiguration _configuration) : ServiceBase
{
static string GetCSharpType(Type type)
{
if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))
{
var underlyingType = Nullable.GetUnderlyingType(type);
return $"{GetCSharpType(underlyingType)}?";
}
return type switch
{
_ when type == typeof(int) => "int",
_ when type == typeof(long) => "long",
_ when type == typeof(short) => "short",
_ when type == typeof(byte) => "byte",
_ when type == typeof(bool) => "bool",
_ when type == typeof(decimal) => "decimal",
_ when type == typeof(double) => "double",
_ when type == typeof(float) => "float",
_ when type == typeof(Guid) => "Guid",
_ when type == typeof(DateTime) => "DateTime",
_ when type == typeof(string) => "string",
_ => type.Name // 非常见类型,返回 .NET 类型名称
};
}
/// <summary>
/// 获取数据库的表信息 以及字段信息
/// </summary>
/// <param name="tableName"></param>
/// <param name="comment"></param>
/// <returns></returns>
public List<TemplateTable> GetDataBaseTableList(string tableName, string comment)
{
var contextOptions = new DbContextOptionsBuilder<IRaCISDBContext>().UseSqlServer(_configuration.GetSection("ConnectionStrings:RemoteNew").Value).Options;
using var dbContext = new IRaCISDBContext(contextOptions);
var dbModel = dbContext.Model;
var list = dbModel.GetEntityTypes().Where(t => t.GetTableName().IsNotNullOrEmpty())
.WhereIf(tableName.IsNotNullOrEmpty(), t => t.GetTableName()!.Contains(tableName))
.WhereIf(comment.IsNotNullOrEmpty(), t => t.GetComment().Contains(comment))
.Select(t => new TemplateTable()
{
TableName = t.GetTableName()!,
TablePropertyList = t.GetProperties().Select(property => new TemplateTableProperty()
{
PropertyName = property.Name,
ColumnName = property.GetColumnName(),
IsNullable = property.IsNullable,
IsPrimarykey = property.IsKey(),
CSharpType = GetCSharpType(property.ClrType),
Comment = property.GetComment() ?? string.Empty
}).ToList()
}).ToList();
return list;
}
/// <summary>
/// 根据字典名 code 生成枚举定义
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public async Task<IResponseOutput> GenerateEnumDefine(string code)
{
var searchList = await _dicRepository.Where(t => t.Parent.Code == code && t.ParentId != null && t.IsEnable).ProjectTo<BasicDicSelect>(_mapper.ConfigurationProvider).ToListAsync();
// StringBuilder 用于构建枚举代码字符串
var enumCode = new StringBuilder();
// 生成枚举定义
enumCode.AppendLine($"public enum {code}");
enumCode.AppendLine("{");
foreach (var item in searchList)
{
// 添加 XML 注释作为枚举描述
enumCode.AppendLine($" /// <summary>");
enumCode.AppendLine($" /// {item.ValueCN}"); // 假设你有一个描述字段
enumCode.AppendLine($" /// </summary>");
// 每个枚举值生成
enumCode.AppendLine($" {item.Value.Trim().Replace(" ", "")} = {item.Code},");
}
enumCode.AppendLine("}");
// 返回生成的枚举代码
var enumStr = enumCode.ToString();
return ResponseOutput.Ok(enumStr);
}
}
}

View File

@ -21,9 +21,62 @@ namespace IRaCIS.Core.Application.Service.MinimalApiService
/// </summary>
[ApiExplorerSettings(GroupName = "Institution")]
public class TestMinimalApiService(IUserInfo _userInfo) : ServiceBase
public class TestMinimalApiService(IUserInfo _userInfo, IRepository<TestLength> _testLengthRepository) : ServiceBase
{
/// <summary>
/// 测试efcore json 列支持情况
/// https://devblogs.microsoft.com/dotnet/array-mapping-in-ef-core-8/
/// </summary>
/// <returns></returns>
public async Task<IResponseOutput> TestEfcoreJson()
{
var dateTime = DateTime.Parse("2024-11-08");
//await _testLengthRepository.AddAsync(new TestLength()
//{
// Name = "Testddd",
// TestJsonObjectLsit=new List<TestJsonObject>() { new TestJsonObject() { Name="name1",Description="des1"} , new TestJsonObject() { Name = "name1", Description = "des1" } }
//});
//await _testLengthRepository.SaveChangesAsync();
//对于json 对象 不能使用count any 操作,但是简单的类型可以的
var jobjectList = _testLengthRepository.AsQueryable().ToList();
var jobjectList1 = _testLengthRepository.AsQueryable().Where(t=>t.TestJsonObjectLsit.Any(c=>c.Name=="name1")).ToList();
var jobjectList2 = _testLengthRepository.AsQueryable().Where(t => t.TestJsonObjectLsit.Any(c => c.Name == "name1")).SelectMany(t=>t.TestJsonObjectLsit).ToList();
var d1 = _testLengthRepository.Where(t => t.StringList.Any(t => t == "string1")).ToList();
var d2 = _testLengthRepository.Where(t => t.StringList.Contains("string1")).ToList();
//selectMany 报错 不支持
//var d20 = _testLengthRepository.Where(t => t.StringList.Contains("string1")).SelectMany(t => t.StringList).ToList();
var d3 = _testLengthRepository.Where(t => t.TestEnumList.Contains(TestEnum.Default)).ToList();
var d4 = _testLengthRepository.Where(t => t.TestEnumList.Any(t => t == TestEnum.Default)).ToList();
var d5 = _testLengthRepository.Where(t => t.DateTimeList.Contains(dateTime)).ToList();
var d6 = _testLengthRepository.Where(t => t.DateTimeList.Any(t => t == dateTime)).ToList();
var d7 = _testLengthRepository.Where(t=>t.DateTimeList.Any(t=>t.Year==2024)).ToList();
var d8 = _testLengthRepository.Where(t => t.DateTimeList.Any(t => t.Month == 11)).ToList();
var d90 = _testLengthRepository.Where(t => t.DateTimeList.Any(t => t.Year == 2024)).Select(t => t.DateTimeList).ToList();
//selectMany 报错 不支持
//var d9 = _testLengthRepository.Where(t => t.DateTimeList.Any(t => t.Year == 2024)).SelectMany(t=>t.DateTimeList).ToList();
//var d10 = _testLengthRepository.Where(t => t.DateTimeList.Any(t => t.Year == 2024)).SelectMany(t => t.DateTimeList).Where(t=>t>dateTime.AddSeconds(1)).ToList();
return ResponseOutput.Ok();
}
[TrialGlobalLimit("AddOrUpdateTrial", "BeforeOngoingCantOpt", "AfterStopCannNotOpt")]
public Task<List<string>> GetProjectList1Async()
@ -38,7 +91,7 @@ namespace IRaCIS.Core.Application.Service.MinimalApiService
}
[AllowAnonymous]
[TrialGlobalLimit( "BeforeOngoingCantOpt")]
[TrialGlobalLimit("BeforeOngoingCantOpt")]
public IResponseOutput GetTest()
{

View File

@ -1087,6 +1087,7 @@ namespace IRaCIS.Core.Application.Contracts
public string UserName { get; set; }
public bool? IsBaseline { get; set; }
public ReadingCategory ReadingCategory { get; set; }
/// <summary>
/// 自身一致性分析任务上会有这个值

View File

@ -68,7 +68,6 @@ namespace IRaCIS.Core.Application.Contracts
public List<string> ModalityList { get; set; } = new List<string>();
public string TrialObjectNameConfigStr { get; set; }
public List<TrialObjectNameConfig> TrialObjectNameList { get; set; }

View File

@ -88,7 +88,7 @@ namespace IRaCIS.Application.Contracts
public string CriterionName { get; set; } = string.Empty;
public List<TrialObjectNameConfig> TrialObjectNameList { get; set; }
}
public class TrialModalitySelectDto

View File

@ -908,10 +908,10 @@ namespace IRaCIS.Core.Application
trialConfig.Modalitys = $"{String.Join('|', trialConfig.ModalityList)}";
trialConfig.TrialObjectNameConfigStr=JsonConvert.SerializeObject(trialConfig.TrialObjectNameList);
_mapper.Map(trialConfig, trialInfo);
trialInfo.UpdateTime = DateTime.Now;
//_trialRepository.MarkAsModified(trialInfo, nameof(trialInfo.TrialObjectNameList));
//await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialConfig.TrialId && t.IsSigned == false, u => new ReadingQuestionCriterionTrial() { CriterionModalitys = trialConfig.Modalitys });
@ -1351,11 +1351,11 @@ namespace IRaCIS.Core.Application
/// <returns></returns>
public async Task<TrialExtraConfig> GetTrialExtralConfig(Guid trialId)
{
var extralObj = _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.TrialExtraConfigJsonStr, t.TrialObjectNameConfigStr }).FirstOrDefault();
var extralObj = _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.TrialExtraConfigJsonStr, t.TrialObjectNameList }).FirstOrDefault();
var extralConfig = JsonConvert.DeserializeObject<TrialExtraConfig>(extralObj?.TrialExtraConfigJsonStr) ?? new TrialExtraConfig();
extralConfig.TrialObjectNameList = JsonConvert.DeserializeObject<List<TrialObjectNameConfig>>(extralObj?.TrialObjectNameConfigStr) ?? new List<TrialObjectNameConfig>();
extralConfig.TrialObjectNameList = extralObj.TrialObjectNameList;
return extralConfig;
}

View File

@ -5,7 +5,7 @@ namespace IRaCIS.Core.Domain.Models;
[Comment("后台 - 系统账户")]
[Table("User")]
public class User : BaseFullDeleteAuditEntity
public class User : BaseFullAuditEntity
{
#region 导航属性

View File

@ -1,5 +1,6 @@
using IRaCIS.Core.Domain.Share;
using System.Linq;
using ZstdSharp.Unsafe;
namespace IRaCIS.Core.Domain.Models;
@ -260,17 +261,19 @@ public partial class Trial : BaseFullDeleteAuditEntity
public bool IsTrialPACSConfirmed { get; set; }
[Comment("项目术语配置Json字符串")]
[StringLength(1000)]
public string TrialObjectNameConfigStr { get; set; }
[NotMapped]
public List<TrialObjectNameConfig> TrialObjectNameList => JsonConvert.DeserializeObject<List<TrialObjectNameConfig>>(TrialObjectNameConfigStr) ?? new List<TrialObjectNameConfig>();
[StringLength(2000)]
public List<TrialObjectNameConfig> TrialObjectNameList { get; set; }
//[NotMapped]
//public List<TrialObjectNameConfig> TrialObjectNameList => JsonConvert.DeserializeObject<List<TrialObjectNameConfig>>(TrialObjectNameConfigStr) ?? new List<TrialObjectNameConfig>();
}
[ComplexType]
public class TrialObjectNameConfig
{
public string Name { get; set; }
public string TrialName { get; set; }
public bool IsDefault { get; set; }
}

View File

@ -2,7 +2,9 @@
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Infra.EFCore.Common;
using IRaCIS.Core.Infrastructure.Encryption;
using IRaCIS.Core.Infrastructure.Extention;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Newtonsoft.Json;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Data;
@ -59,11 +61,28 @@ public class IRaCISDBContext : DbContext
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<TestLength>(entity =>
{
// 使用部分加密值转换器,前 2 个字符不加密,方便模糊搜索
entity.Property(e => e.Name)
.HasConversion(new PartialEncryptionConverter(2));
entity.Property(e => e.Name).HasConversion(new PartialEncryptionConverter(2));
entity.OwnsMany(x => x.TestJsonObjectLsit, ownedNavigationBuilder =>
{
ownedNavigationBuilder.ToJson();
});
//entity.Property(e => e.TestJsonObjectLsit).HasConversion(v => v == null ? "[]" : JsonConvert.SerializeObject(v),
// v => string.IsNullOrEmpty(v) ? null : JsonConvert.DeserializeObject<List<TestJsonObject>>(v));
});
modelBuilder.Entity<Trial>(entity =>
{
//项目术语配置
entity.OwnsMany(x => x.TrialObjectNameList, ownedNavigationBuilder =>
{
ownedNavigationBuilder.ToJson();
});
});
#region pgsql codefirst 配置 暂时屏蔽
@ -558,7 +577,7 @@ public class IRaCISDBContext : DbContext
public virtual DbSet<TestLength> TestLength { get; set; }
public virtual DbSet<EventStoreRecord> EventStoreRecord { get; set; }
public virtual DbSet<EventStoreRecord> EventStoreRecord { get; set; }
@ -567,6 +586,32 @@ public class IRaCISDBContext : DbContext
public class TestLength : Entity
{
public string Name { get; set; }
[StringLength(1000)]
public string[] StringList { get; set; }=new string[] { };
public List<DateTime> DateTimeList { get; set; } = new List<DateTime>();
[StringLength(1000)]
public List<TestEnum> TestEnumList { get; set; } = new List<TestEnum>();
[MaxLength]
public List<TestJsonObject> TestJsonObjectLsit { get; set; }
}
public record TestJsonObject
{
public string Name { get; set; }
public string Description { get; set; }
}
public enum TestEnum
{
Default = 0,
First = 1
}

View File

@ -3,11 +3,14 @@ using IRaCIS.Core.Domain.BaseModel;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore.Common;
using IRaCIS.Core.Infrastructure.Extention;
using MassTransit;
using MassTransit.Mediator;
using MassTransit.Transports;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.Extensions.Logging;
using Microsoft.VisualBasic;
using System.Collections;
using System.Data;
@ -75,9 +78,18 @@ public class AuditEntityInterceptor(IUserInfo _userInfo,
//.Where(x => !typeof(DataInspection).IsAssignableFrom(x.Entity.GetType()))
.ToList())
{
//foreach (var property in entry.Navigations.Where(t => typeof(IEnumerable).IsAssignableFrom(t.Metadata.ClrType) && t.Metadata.ClrType !=typeof(string) /*&& t.CurrentValue == null*/))
//{
// Console.WriteLine($"属性名{property.Metadata.Name} 现在值:{property.CurrentValue.ToJsonStr()}");
//}
// 检查属性是否为string类型并且值为null
foreach (var property in entry.Properties.Where(t => t.Metadata.ClrType == typeof(string) && t.CurrentValue == null))
{
property.CurrentValue = string.Empty;
}
@ -142,7 +154,8 @@ public class AuditEntityInterceptor(IUserInfo _userInfo,
var inspectionGeneralIdList = context.ChangeTracker.Entries().Where(t => typeof(DataInspection).IsAssignableFrom(t.Entity.GetType())).Select(t => ((DataInspection)t.Entity).GeneralId).ToList();
var entities = context.ChangeTracker.Entries().Where(u => (u.State == EntityState.Modified || u.State == EntityState.Deleted || u.State == EntityState.Added))
.Where(t => !typeof(DataInspection).IsAssignableFrom(t.Entity.GetType()) && !inspectionGeneralIdList.Contains(((Entity)t.Entity).Id))
.Where(t => !typeof(DataInspection).IsAssignableFrom(t.Entity.GetType()) && typeof(Entity).IsAssignableFrom(t.Entity.GetType())
&& !inspectionGeneralIdList.Contains(((Entity)t.Entity).Id))
.ToList();
AuditingData auditingData = new AuditingData((IRaCISDBContext)context, _userInfo);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,53 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Infra.EFCore.Migrations
{
/// <inheritdoc />
public partial class TestEfcoreJson : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "DateTimeList",
table: "TestLength",
type: "nvarchar(max)",
nullable: false,
defaultValue: "[]");
migrationBuilder.AddColumn<string>(
name: "StringList",
table: "TestLength",
type: "nvarchar(1000)",
maxLength: 1000,
nullable: false,
defaultValue: "[]");
migrationBuilder.AddColumn<string>(
name: "TestEnumList",
table: "TestLength",
type: "nvarchar(1000)",
maxLength: 1000,
nullable: false,
defaultValue: "[]");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DateTimeList",
table: "TestLength");
migrationBuilder.DropColumn(
name: "StringList",
table: "TestLength");
migrationBuilder.DropColumn(
name: "TestEnumList",
table: "TestLength");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Infra.EFCore.Migrations
{
/// <inheritdoc />
public partial class TestJsonObject : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "TestJsonObjectLsit",
table: "TestLength",
type: "nvarchar(max)",
nullable: false,
defaultValue: "");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "TestJsonObjectLsit",
table: "TestLength");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,44 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Infra.EFCore.Migrations
{
/// <inheritdoc />
public partial class TrialJson : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "TrialObjectNameConfigStr",
table: "Trial");
migrationBuilder.AddColumn<string>(
name: "TrialObjectNameList",
table: "Trial",
type: "nvarchar(2000)",
maxLength: 2000,
nullable: false,
defaultValue: "",
comment: "项目术语配置Json字符串");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "TrialObjectNameList",
table: "Trial");
migrationBuilder.AddColumn<string>(
name: "TrialObjectNameConfigStr",
table: "Trial",
type: "nvarchar(1000)",
maxLength: 1000,
nullable: false,
defaultValue: "",
comment: "项目术语配置Json字符串");
}
}
}

View File

@ -10407,10 +10407,10 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.Property<DateTime?>("TrialFinishedTime")
.HasColumnType("datetime2");
b.Property<string>("TrialObjectNameConfigStr")
b.Property<string>("TrialObjectNameList")
.IsRequired()
.HasMaxLength(1000)
.HasColumnType("nvarchar(1000)")
.HasMaxLength(2000)
.HasColumnType("nvarchar(2000)")
.HasComment("项目术语配置Json字符串");
b.Property<string>("TrialStatusStr")
@ -13744,11 +13744,29 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("DateTimeList")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b.Property<string>("StringList")
.IsRequired()
.HasMaxLength(1000)
.HasColumnType("nvarchar(1000)");
b.Property<string>("TestEnumList")
.IsRequired()
.HasMaxLength(1000)
.HasColumnType("nvarchar(1000)");
b.Property<string>("TestJsonObjectLsit")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("TestLength");

View File

@ -73,7 +73,7 @@ namespace IRaCIS.Core.Infra.EFCore
#endregion
void MarkAsModified<TFrom>(TFrom entity, string propertyName);
}

View File

@ -4,6 +4,7 @@ using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Infrastructure.Extention;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.Extensions.Localization;
@ -445,6 +446,15 @@ namespace IRaCIS.Core.Infra.EFCore
#endregion
public void MarkAsModified<TFrom>(TFrom entity, string propertyName)
{
// 获取属性的元数据
var entry = _dbContext.Entry(entity);
// 设置指定属性为已修改
entry.Property(propertyName).IsModified = true;
}
#region 异步查询

View File

@ -87,13 +87,13 @@ public partial class <#= EntityType.Name #>: BaseFullAuditEntity
{
var maxLength = property.GetMaxLength();
if (maxLength.HasValue && maxLength != 200) // 仅当长度不为200时生成[StringLength]
if (maxLength.HasValue && maxLength != 400) // 仅当长度不为200时生成[StringLength]
{
#>
[StringLength(<#= maxLength.Value #>)]
<#
}
else if(maxLength.HasValue && maxLength == 200){}
else if(maxLength.HasValue && maxLength == 400){}
else
{
#>