项目术语配置,导表统一处理
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
4145421087
commit
47be1e52c9
|
@ -16,6 +16,7 @@ using NPOI.SS.UserModel;
|
||||||
using NPOI.XSSF.UserModel;
|
using NPOI.XSSF.UserModel;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using Xceed.Document.NET;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Service;
|
namespace IRaCIS.Core.Application.Service;
|
||||||
|
|
||||||
|
@ -84,6 +85,8 @@ public static class ExcelExportHelper
|
||||||
|
|
||||||
|
|
||||||
foreach (var needTranslateProperty in needTranslatePropertyList)
|
foreach (var needTranslateProperty in needTranslatePropertyList)
|
||||||
|
{
|
||||||
|
if (itemDic.Keys.Any(t => t == needTranslateProperty.Name))
|
||||||
{
|
{
|
||||||
//翻译的属性依赖其他属性
|
//翻译的属性依赖其他属性
|
||||||
if (needTranslateProperty.IsTranslateDenpendOtherProperty)
|
if (needTranslateProperty.IsTranslateDenpendOtherProperty)
|
||||||
|
@ -103,9 +106,7 @@ public static class ExcelExportHelper
|
||||||
|
|
||||||
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[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++);
|
itemDic.Add("No", no++);
|
||||||
|
@ -125,6 +126,7 @@ public static class ExcelExportHelper
|
||||||
|
|
||||||
translateData = dic;
|
translateData = dic;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -162,7 +164,41 @@ public static class ExcelExportHelper
|
||||||
workbook.RemoveSheetAt(1);
|
workbook.RemoveSheetAt(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var memoryStream2 = new MemoryStream();
|
//中文替换项目术语
|
||||||
|
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);
|
workbook.Write(memoryStream2, true);
|
||||||
|
|
||||||
memoryStream2.Seek(0, SeekOrigin.Begin);
|
memoryStream2.Seek(0, SeekOrigin.Begin);
|
||||||
|
@ -170,6 +206,9 @@ public static class ExcelExportHelper
|
||||||
templateStream = memoryStream2;
|
templateStream = memoryStream2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// 文件名称 从sheet里面取
|
// 文件名称 从sheet里面取
|
||||||
//fileNmae = workbook.GetSheetName(0);
|
//fileNmae = workbook.GetSheetName(0);
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -299,6 +338,8 @@ public static class ExcelExportHelper
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var needTranslateProperty in needTranslatePropertyList)
|
foreach (var needTranslateProperty in needTranslatePropertyList)
|
||||||
|
{
|
||||||
|
if (itemDic.Keys.Any(t => t == needTranslateProperty.Name))
|
||||||
{
|
{
|
||||||
//翻译的属性依赖其他属性
|
//翻译的属性依赖其他属性
|
||||||
if (needTranslateProperty.IsTranslateDenpendOtherProperty)
|
if (needTranslateProperty.IsTranslateDenpendOtherProperty)
|
||||||
|
@ -318,6 +359,8 @@ public static class ExcelExportHelper
|
||||||
|
|
||||||
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[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);
|
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)
|
if (dynamicColumnConfig != null)
|
||||||
{
|
{
|
||||||
|
@ -391,7 +466,7 @@ public static class ExcelExportHelper
|
||||||
var originTotalEndIndex = dynamicColumnConfig.TempalteLastColumnIndex;
|
var originTotalEndIndex = dynamicColumnConfig.TempalteLastColumnIndex;
|
||||||
|
|
||||||
//减去动态移除后原始结束索引
|
//减去动态移除后原始结束索引
|
||||||
var originRemoveEndIndex= originTotalEndIndex- dynamicRemoveColunmCount;
|
var originRemoveEndIndex = originTotalEndIndex - dynamicRemoveColunmCount;
|
||||||
|
|
||||||
//最终表 动态列开始索引
|
//最终表 动态列开始索引
|
||||||
var dynamicColunmStartIndex = dynamicColumnConfig.AutoColumnStartIndex - beforeDynamicRemoveCount;
|
var dynamicColunmStartIndex = dynamicColumnConfig.AutoColumnStartIndex - beforeDynamicRemoveCount;
|
||||||
|
|
|
@ -88,7 +88,7 @@ namespace IRaCIS.Application.Contracts
|
||||||
|
|
||||||
public string CriterionName { get; set; } = string.Empty;
|
public string CriterionName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public List<TrialObjectNameConfig> TrialObjectNameList { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TrialModalitySelectDto
|
public class TrialModalitySelectDto
|
||||||
|
|
|
@ -78,8 +78,7 @@ public class IRaCISDBContext : DbContext
|
||||||
|
|
||||||
modelBuilder.Entity<Trial>(entity =>
|
modelBuilder.Entity<Trial>(entity =>
|
||||||
{
|
{
|
||||||
|
//项目术语配置
|
||||||
|
|
||||||
entity.OwnsMany(x => x.TrialObjectNameList, ownedNavigationBuilder =>
|
entity.OwnsMany(x => x.TrialObjectNameList, ownedNavigationBuilder =>
|
||||||
{
|
{
|
||||||
ownedNavigationBuilder.ToJson();
|
ownedNavigationBuilder.ToJson();
|
||||||
|
|
|
@ -3,11 +3,14 @@ using IRaCIS.Core.Domain.BaseModel;
|
||||||
using IRaCIS.Core.Domain.Models;
|
using IRaCIS.Core.Domain.Models;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
using IRaCIS.Core.Infra.EFCore.Common;
|
using IRaCIS.Core.Infra.EFCore.Common;
|
||||||
|
using IRaCIS.Core.Infrastructure.Extention;
|
||||||
using MassTransit;
|
using MassTransit;
|
||||||
using MassTransit.Mediator;
|
using MassTransit.Mediator;
|
||||||
using MassTransit.Transports;
|
using MassTransit.Transports;
|
||||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.VisualBasic;
|
||||||
|
using System.Collections;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,9 +78,18 @@ public class AuditEntityInterceptor(IUserInfo _userInfo,
|
||||||
//.Where(x => !typeof(DataInspection).IsAssignableFrom(x.Entity.GetType()))
|
//.Where(x => !typeof(DataInspection).IsAssignableFrom(x.Entity.GetType()))
|
||||||
.ToList())
|
.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
|
// 检查属性是否为string类型,并且值为null
|
||||||
foreach (var property in entry.Properties.Where(t => t.Metadata.ClrType == typeof(string) && t.CurrentValue == null))
|
foreach (var property in entry.Properties.Where(t => t.Metadata.ClrType == typeof(string) && t.CurrentValue == null))
|
||||||
{
|
{
|
||||||
|
|
||||||
property.CurrentValue = string.Empty;
|
property.CurrentValue = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue