修改导表日期处理
parent
4d4af84716
commit
28587c8e91
|
@ -377,7 +377,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
//public bool IsUrgent { get; set; }
|
||||
|
||||
//[ExcelColumn(Name = "FirstGiveMedicineTime", Format = "yyyy-MM-dd")]
|
||||
public DateTime? FirstGiveMedicineTime { get; set; }
|
||||
public DateOnly? FirstGiveMedicineTime { get; set; }
|
||||
|
||||
|
||||
public string FirstGiveMedicineTimeStr => FirstGiveMedicineTime?.ToString("yyyy-MM-dd");
|
||||
|
|
|
@ -263,8 +263,7 @@ public partial class Trial : BaseFullDeleteAuditEntity
|
|||
[Comment("项目术语配置Json字符串")]
|
||||
[StringLength(2000)]
|
||||
public List<TrialObjectNameConfig> TrialObjectNameList { get; set; }
|
||||
//[NotMapped]
|
||||
//public List<TrialObjectNameConfig> TrialObjectNameList => JsonConvert.DeserializeObject<List<TrialObjectNameConfig>>(TrialObjectNameConfigStr) ?? new List<TrialObjectNameConfig>();
|
||||
|
||||
}
|
||||
|
||||
[ComplexType]
|
||||
|
@ -275,5 +274,4 @@ public class TrialObjectNameConfig
|
|||
public string TrialName { get; set; }
|
||||
|
||||
public bool IsDefault { get; set; }
|
||||
|
||||
}
|
|
@ -67,13 +67,13 @@ public class IRaCISDBContext : DbContext
|
|||
// 使用部分加密值转换器,前 2 个字符不加密,方便模糊搜索
|
||||
entity.Property(e => e.Name).HasConversion(new PartialEncryptionConverter(2));
|
||||
|
||||
entity.OwnsMany(x => x.TestJsonObjectLsit, ownedNavigationBuilder =>
|
||||
{
|
||||
ownedNavigationBuilder.ToJson();
|
||||
});
|
||||
//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));
|
||||
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 =>
|
||||
|
@ -81,7 +81,7 @@ public class IRaCISDBContext : DbContext
|
|||
//项目术语配置
|
||||
entity.OwnsMany(x => x.TrialObjectNameList, ownedNavigationBuilder =>
|
||||
{
|
||||
ownedNavigationBuilder.ToJson();
|
||||
ownedNavigationBuilder.ToJson() ;
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -595,8 +595,9 @@ public class TestLength : Entity
|
|||
[StringLength(1000)]
|
||||
public List<TestEnum> TestEnumList { get; set; } = new List<TestEnum>();
|
||||
|
||||
[MaxLength]
|
||||
public List<TestJsonObject> TestJsonObjectLsit { get; set; }
|
||||
|
||||
public DateOnly? TestDate { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace IRaCIS.Core.API._ServiceExtensions.NewtonsoftJson
|
|||
return obj;
|
||||
|
||||
// 将对象序列化为 JSON 字符串
|
||||
string json = JsonConvert.SerializeObject(obj,new JsonSerializerSettings() { DateFormatString= "yyyy-MM-dd HH:mm:ss.fff" });
|
||||
string json = JsonConvert.SerializeObject(obj, new JsonSerializerSettings() { DateFormatString = "yyyy-MM-dd HH:mm:ss.fff" });
|
||||
|
||||
// 将 JSON 字符串反序列化回对象
|
||||
var deserializedObj = JsonConvert.DeserializeObject<T>(json, new JsonSerializerSettings
|
||||
|
@ -80,7 +80,7 @@ namespace IRaCIS.Core.API._ServiceExtensions.NewtonsoftJson
|
|||
return deserializedObj!;
|
||||
}
|
||||
|
||||
public static string DateTimeInternationalToString(DateTime? dateTime, string? clientZoneId=null)
|
||||
public static string DateTimeInternationalToString(DateTime? dateTime, string? clientZoneId = null)
|
||||
{
|
||||
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
|
||||
|
||||
|
@ -94,6 +94,12 @@ namespace IRaCIS.Core.API._ServiceExtensions.NewtonsoftJson
|
|||
needDealTime = TimeZoneInfo.ConvertTime(needDealTime, TimeZoneInfo.Local, TimeZoneInfo.FindSystemTimeZoneById(clientZoneId));
|
||||
}
|
||||
|
||||
if (needDealTime.Hour == 0 && needDealTime.Minute == 0 && needDealTime.Second == 0)
|
||||
{
|
||||
return needDealTime.ToString("yyyy-MM-dd");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isEn_US)
|
||||
{
|
||||
//暂时保持一致,等需求确认,修改英文要展示的日期格式
|
||||
|
@ -104,6 +110,9 @@ namespace IRaCIS.Core.API._ServiceExtensions.NewtonsoftJson
|
|||
return needDealTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Empty;
|
||||
|
|
Loading…
Reference in New Issue