合并冲突
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
commit
9ad1bbdd7d
|
|
@ -54,6 +54,11 @@ public class SegmentationAddOrEdit
|
||||||
|
|
||||||
public Guid VisitTaskId { get; set; }
|
public Guid VisitTaskId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文件大小,单位字节
|
||||||
|
/// </summary>
|
||||||
|
public long FileSize { get; set; } = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SegmentationQuery:PageInput
|
public class SegmentationQuery:PageInput
|
||||||
|
|
@ -77,7 +82,30 @@ public class SegmentationQuery:PageInput
|
||||||
public Guid? TrialId { get; set; }
|
public Guid? TrialId { get; set; }
|
||||||
|
|
||||||
public Guid? VisitTaskId { get; set; }
|
public Guid? VisitTaskId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SegmentationVersionView
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public Guid SegmentationId { get; set; }
|
||||||
|
public int Version { get; set; }
|
||||||
|
public string SegmentationJson { get; set; }
|
||||||
|
public string SEGUrl { get; set; }
|
||||||
|
public long FileSize { get; set; }
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
public string CreateUserName { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SegmentationVersionQuery : PageInput
|
||||||
|
{
|
||||||
|
public Guid SegmentationId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RestoreSegmentationVersionInDto
|
||||||
|
{
|
||||||
|
public Guid SegmentationId { get; set; }
|
||||||
|
public Guid VersionId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
|
||||||
IRepository<Segment> _segmentRepository,
|
IRepository<Segment> _segmentRepository,
|
||||||
IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository,
|
IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository,
|
||||||
IRepository<ReadingTableQuestionTrial> _readingTableQuestionTrialRepository,
|
IRepository<ReadingTableQuestionTrial> _readingTableQuestionTrialRepository,
|
||||||
|
IRepository<SegmentationVersion> _segmentationVersionRepository,
|
||||||
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer): BaseService, ISegmentationService
|
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer): BaseService, ISegmentationService
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -69,17 +70,87 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
|
||||||
/// <param name="addOrEditSegmentation"></param>
|
/// <param name="addOrEditSegmentation"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IResponseOutput> AddOrUpdateSegmentation(SegmentationAddOrEdit addOrEditSegmentation)
|
public async Task<IResponseOutput> AddOrUpdateSegmentation(SegmentationAddOrEdit addOrEditSegmentation)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if (addOrEditSegmentation.Id != null)
|
||||||
|
{
|
||||||
|
await SaveSegmentationVersionAsync(addOrEditSegmentation.Id.Value);
|
||||||
|
}
|
||||||
|
|
||||||
var entity = await _segmentationRepository.InsertOrUpdateAsync(addOrEditSegmentation, true);
|
var entity = await _segmentationRepository.InsertOrUpdateAsync(addOrEditSegmentation, true);
|
||||||
|
|
||||||
return ResponseOutput.Ok(entity.Id.ToString());
|
return ResponseOutput.Ok(entity.Id.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// 添加新版本
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="segmentationId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task SaveSegmentationVersionAsync(Guid segmentationId)
|
||||||
|
{
|
||||||
|
var data = await _segmentationRepository.FirstOrDefaultNoTrackingAsync(x => x.Id == segmentationId);
|
||||||
|
// 如果是新增或修改,记录一条版本信息
|
||||||
|
var maxVersion = await _segmentationVersionRepository
|
||||||
|
.Where(x => x.SegmentationId == data.Id)
|
||||||
|
.OrderByDescending(x => x.Version)
|
||||||
|
.Select(x => x.Version)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
var newVersion = maxVersion + 1;
|
||||||
|
var versionEntity = new SegmentationVersion
|
||||||
|
{
|
||||||
|
SegmentationId = data.Id,
|
||||||
|
Version = newVersion,
|
||||||
|
SegmentationJson = data.SegmentationJson,
|
||||||
|
SEGUrl = data.SEGUrl,
|
||||||
|
FileSize = data.FileSize,
|
||||||
|
};
|
||||||
|
|
||||||
|
await _segmentationVersionRepository.AddAsync(versionEntity);
|
||||||
|
|
||||||
|
await _segmentationRepository.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取分割组历史版本
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inQuery"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<PageOutput<SegmentationVersionView>> GetSegmentationVersionList(SegmentationVersionQuery inQuery)
|
||||||
|
{
|
||||||
|
var versionQueryable = _segmentationVersionRepository
|
||||||
|
.Where(x => x.SegmentationId == inQuery.SegmentationId)
|
||||||
|
.ProjectTo<SegmentationVersionView>(_mapper.ConfigurationProvider);
|
||||||
|
var defalutSortArray = new string[] { nameof(SegmentationVersion.Version) + " desc" };
|
||||||
|
var pageList = await versionQueryable.ToPagedListAsync(inQuery, defalutSortArray);
|
||||||
|
|
||||||
|
return pageList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 恢复分割组历史版本
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IResponseOutput> RestoreSegmentationVersion(RestoreSegmentationVersionInDto inDto)
|
||||||
|
{
|
||||||
|
var version = await _segmentationVersionRepository.Where(x => x.Id == inDto.VersionId && x.SegmentationId == inDto.SegmentationId).FirstNotNullAsync();
|
||||||
|
var segmentation = await _segmentationRepository.Where(x => x.Id == inDto.SegmentationId).FirstNotNullAsync();
|
||||||
|
await _segmentationRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.SegmentationId, t => new Segmentation
|
||||||
|
{
|
||||||
|
SegmentationJson = version.SegmentationJson,
|
||||||
|
SEGUrl = version.SEGUrl,
|
||||||
|
FileSize = version.FileSize,
|
||||||
|
});
|
||||||
|
await _segmentationRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
return ResponseOutput.Ok();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 删除分割组
|
/// 删除分割组
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using IRaCIS.Core.Application.Contracts;
|
using IRaCIS.Core.Application.Contracts;
|
||||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||||
using IRaCIS.Core.Application.ViewModel;
|
using IRaCIS.Core.Application.ViewModel;
|
||||||
|
|
@ -25,6 +25,8 @@ namespace IRaCIS.Core.Application.Service
|
||||||
CreateMap<Segmentation, SegmentationView>();
|
CreateMap<Segmentation, SegmentationView>();
|
||||||
CreateMap<Segmentation, SegmentationAddOrEdit>().ReverseMap();
|
CreateMap<Segmentation, SegmentationAddOrEdit>().ReverseMap();
|
||||||
|
|
||||||
|
CreateMap<SegmentationVersion, SegmentationVersionView>();
|
||||||
|
|
||||||
// 在此处拷贝automapper 映射
|
// 在此处拷贝automapper 映射
|
||||||
|
|
||||||
CreateMap<SegmentBinding, SegmentBindingView>()
|
CreateMap<SegmentBinding, SegmentBindingView>()
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,11 @@ public class Segmentation : BaseFullDeleteAuditEntity
|
||||||
[MaxLength]
|
[MaxLength]
|
||||||
public string SEGUrl { get; set; } = string.Empty;
|
public string SEGUrl { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文件大小,单位字节
|
||||||
|
/// </summary>
|
||||||
|
public long FileSize { get; set; } = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否保存
|
/// 是否保存
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
namespace IRaCIS.Core.Domain.Models;
|
||||||
|
|
||||||
|
[Comment("分割文件版本")]
|
||||||
|
[Table("SegmentationVersion")]
|
||||||
|
public class SegmentationVersion : BaseAddAuditEntity
|
||||||
|
{
|
||||||
|
#region 导航属性
|
||||||
|
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
[ForeignKey("SegmentationId")]
|
||||||
|
public Segmentation Segmentation { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 分割分组Id
|
||||||
|
/// </summary>
|
||||||
|
public Guid SegmentationId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 版本号,默认为1,每次更新分割分组时版本号加1
|
||||||
|
/// </summary>
|
||||||
|
public int Version { get; set; } = 1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 分组的Json
|
||||||
|
/// </summary>
|
||||||
|
[MaxLength]
|
||||||
|
public string SegmentationJson { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SEG文件的URL地址
|
||||||
|
/// </summary>
|
||||||
|
[MaxLength]
|
||||||
|
public string SEGUrl { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文件大小,单位字节
|
||||||
|
/// </summary>
|
||||||
|
public long FileSize { get; set; } = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -371,6 +371,8 @@ public class IRaCISDBContext : DbContext
|
||||||
public virtual DbSet<ReadingUserConfig> ReadingUserConfig { get; set; }
|
public virtual DbSet<ReadingUserConfig> ReadingUserConfig { get; set; }
|
||||||
public virtual DbSet<Segmentation> Segmentation { get; set; }
|
public virtual DbSet<Segmentation> Segmentation { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<SegmentationVersion> SegmentationVersion { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<Segment> Segment { get; set; }
|
public virtual DbSet<Segment> Segment { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<SegmentBinding> SegmentBinding { get; set; }
|
public virtual DbSet<SegmentBinding> SegmentBinding { get; set; }
|
||||||
|
|
|
||||||
22209
IRaCIS.Core.Infra.EFCore/Migrations/20260506053458_SegmentationVersion.Designer.cs
generated
Normal file
22209
IRaCIS.Core.Infra.EFCore/Migrations/20260506053458_SegmentationVersion.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,72 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class SegmentationVersion : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<long>(
|
||||||
|
name: "FileSize",
|
||||||
|
table: "Segmentation",
|
||||||
|
type: "bigint",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0L);
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "SegmentationVersion",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
SegmentationId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
Version = table.Column<int>(type: "int", nullable: false),
|
||||||
|
SegmentationJson = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
SEGUrl = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
FileSize = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_SegmentationVersion", x => x.Id)
|
||||||
|
.Annotation("SqlServer:Clustered", false);
|
||||||
|
|
||||||
|
},
|
||||||
|
comment: "分割文件版本");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_SegmentationVersion_CreateTime",
|
||||||
|
table: "SegmentationVersion",
|
||||||
|
column: "CreateTime")
|
||||||
|
.Annotation("SqlServer:Clustered", true);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Segmentation_VisitTask_VisitTaskId",
|
||||||
|
table: "Segmentation",
|
||||||
|
column: "VisitTaskId",
|
||||||
|
principalTable: "VisitTask",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Segmentation_VisitTask_VisitTaskId",
|
||||||
|
table: "Segmentation");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "SegmentationVersion");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "FileSize",
|
||||||
|
table: "Segmentation");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -9493,6 +9493,9 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
b.Property<DateTime?>("DeletedTime")
|
b.Property<DateTime?>("DeletedTime")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<long>("FileSize")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
b.Property<bool>("IsDeleted")
|
||||||
.HasColumnType("bit");
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
|
@ -9550,6 +9553,48 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.SegmentationVersion", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<long>("FileSize")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<string>("SEGUrl")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<Guid>("SegmentationId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("SegmentationJson")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("Version")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);
|
||||||
|
|
||||||
|
b.HasIndex("CreateTime");
|
||||||
|
|
||||||
|
SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("CreateTime"));
|
||||||
|
|
||||||
|
b.ToTable("SegmentationVersion", t =>
|
||||||
|
{
|
||||||
|
t.HasComment("分割文件版本");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.ShortcutKey", b =>
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.ShortcutKey", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
|
|
@ -19264,6 +19309,25 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
b.Navigation("VisitTask");
|
b.Navigation("VisitTask");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.SegmentationVersion", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CreateUserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("IRaCIS.Core.Domain.Models.Segmentation", "Segmentation")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("SegmentationId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("CreateUserRole");
|
||||||
|
|
||||||
|
b.Navigation("Segmentation");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.ShortcutKey", b =>
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.ShortcutKey", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
|
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue