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-09-29 13:59:21 +08:00
commit c24adcd09c
13 changed files with 17838 additions and 14 deletions

View File

@ -60,7 +60,7 @@ public class SystemEmailSendConfig
public string CompanyShortNameCN { get; set; } = string.Empty;
public string IsEnv_US { get; set; }
public bool IsEnv_US { get; set; }
}
public class SystemEmailSendConfigView

View File

@ -3,6 +3,7 @@
using AutoMapper;
using IRaCIS.Core.Domain;
using MassTransit;
using Microsoft.EntityFrameworkCore;
namespace IRaCIS.Core.Application.MassTransit.Consumer;
@ -22,7 +23,15 @@ public class AddSubjectTriggerConsumer(IRepository<SubjectVisit> _subjectVisitRe
{
public async Task Consume(ConsumeContext<AddSubjectTriggerCommand> context)
{
var addSubjectEvent= context.Message;
var addSubjectEvent = context.Message;
{
Console.WriteLine(_visitStageRepository._dbContext.GetHashCode());
Console.WriteLine("两个 DbContext 不是同一个实例");
}
//添加受试者的时候,获取访视计划列表,添加到受试者访视表。
var visitPlanList = await _visitStageRepository.Where(t => t.TrialId == addSubjectEvent.TrialId && t.IsConfirmed).ToListAsync();

View File

@ -14,7 +14,7 @@ namespace IRaCIS.Core.Application.ViewModel
public Guid UpdateUserId { get; set; }
public DateTime UpdateTime { get; set; }
public string IsEnv_US { get; set; }
public bool IsEnv_US { get; set; }
}
///<summary>PublishLogQuery 列表查询参数模型</summary>

View File

@ -58,7 +58,7 @@ namespace IRaCIS.Core.Application.Contracts
/// </summary>
public bool IsImageReplicationAcrossTrial { get; set; } = false;
[MaxLength]
public string BodyPartTypes { get; set; } = string.Empty;

View File

@ -6,6 +6,7 @@ using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore;
using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Infrastructure.Encryption;
using IRaCIS.Core.Infrastructure.NewtonsoftJson;
@ -18,8 +19,11 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using MiniExcelLibs;
using NPOI.SS.Formula.Functions;
using NPOI.XWPF.UserModel;
using System.Runtime.InteropServices;
using System.Text;
using Tea;
namespace IRaCIS.Core.Application.Service
@ -121,12 +125,32 @@ namespace IRaCIS.Core.Application.Service
}
//My project is a monolithic project,And the efcore context repository is scoped registered.
public async Task<IResponseOutput> TestMasstransitMeditor([FromServices] IMediator _mediator, [FromServices] IRepository<TestLength> _testLengthRepository)
{
await _testLengthRepository.AddAsync(new TestLength() { Name = "zhouhang1" });
var dbContext = _testLengthRepository._dbContext;
var dbContext2 = _trialRepository._dbContext;
if (ReferenceEquals(dbContext, dbContext2))
{
Console.WriteLine("两个 DbContext 是同一个实例");
Console.WriteLine(dbContext.GetHashCode());
Console.WriteLine(dbContext2.GetHashCode());
}
// add 1 recored
await _testLengthRepository.AddAsync(new TestLength() { Name = "xxxx" });
// The consumer method will inject the repository and add 3 pieces of data, but the savechanges method of the repository will not be called
await _mediator.Send(new AddSubjectTriggerCommand { SubjectId = Guid.Empty });
// this will save 1 record not 4 record ,Why is the dbcontext different? Can it be in the same transaction?
await _testLengthRepository.SaveChangesAsync();
return ResponseOutput.Ok();

View File

@ -170,6 +170,8 @@ public partial class Trial : BaseFullDeleteAuditEntity
[Comment("跨项目复制")]
public bool IsImageReplicationAcrossTrial { get; set; } = false;
[MaxLength]
public string BodyPartTypes { get; set; } = "鼻咽部|脑部|颈部|胸部|上/下腹部|盆腔|全身|其他";
public string Modalitys { get; set; } = string.Empty;

View File

@ -12,4 +12,5 @@ public class AddSubjectTriggerCommand : DomainCommand
public Guid TrialId { get; set; }
public Guid TrialSiteId { get; set; }
}

View File

@ -13,7 +13,7 @@ public class IRaCISDBContextFactory : IDesignTimeDbContextFactory<IRaCISDBContex
public IRaCISDBContext CreateDbContext(string[] args)
{
var optionsBuilder = new DbContextOptionsBuilder<IRaCISDBContext>();
optionsBuilder.UseSqlServer("Server=106.14.89.110,1433;Database=Test_IRC_KEY;User ID=sa;Password=xc@123456;TrustServerCertificate=true", contextOptionsBuilder => contextOptionsBuilder.EnableRetryOnFailure());
optionsBuilder.UseSqlServer("Server=106.14.89.110,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true", contextOptionsBuilder => contextOptionsBuilder.EnableRetryOnFailure());
//迁移的时候,不生成外键
optionsBuilder.ReplaceService<IMigrationsSqlGenerator, NoForeignKeyMigrationsSqlGenerator>();
return new IRaCISDBContext(optionsBuilder.Options);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,73 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Infra.EFCore.Migrations
{
/// <inheritdoc />
public partial class TrialModifyField : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "BodyPartTypes",
table: "Trial",
type: "nvarchar(max)",
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(400)",
oldMaxLength: 400);
migrationBuilder.AlterColumn<DateOnly>(
name: "EndDate",
table: "Education",
type: "date",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldNullable: true);
migrationBuilder.AlterColumn<DateOnly>(
name: "BeginDate",
table: "Education",
type: "date",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldNullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "BodyPartTypes",
table: "Trial",
type: "nvarchar(400)",
maxLength: 400,
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(max)");
migrationBuilder.AlterColumn<DateTime>(
name: "EndDate",
table: "Education",
type: "datetime2",
nullable: true,
oldClrType: typeof(DateOnly),
oldType: "date",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "BeginDate",
table: "Education",
type: "datetime2",
nullable: true,
oldClrType: typeof(DateOnly),
oldType: "date",
oldNullable: true);
}
}
}

View File

@ -1654,8 +1654,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("BeginDate")
.HasColumnType("datetime2");
b.Property<DateOnly?>("BeginDate")
.HasColumnType("date");
b.Property<string>("City")
.IsRequired()
@ -1696,8 +1696,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.Property<Guid>("DoctorId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("EndDate")
.HasColumnType("datetime2");
b.Property<DateOnly?>("EndDate")
.HasColumnType("date");
b.Property<string>("Major")
.IsRequired()
@ -3320,7 +3320,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("BeginDate")
b.Property<DateOnly?>("BeginDate")
.HasColumnType("date");
b.Property<string>("City")
@ -3352,7 +3352,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.Property<Guid>("DoctorId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("EndDate")
b.Property<DateOnly?>("EndDate")
.HasColumnType("date");
b.Property<string>("Hospital")
@ -9856,8 +9856,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.Property<string>("BodyPartTypes")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("CROId")
.HasColumnType("uniqueidentifier");