Merge branch 'Test.IRC' of http://192.168.3.69:2000/XCKJ/irc-netcore-api into Test.IRC
commit
0b59b0a2cb
|
@ -74,10 +74,9 @@
|
|||
<PackageReference Include="ExcelDataReader.DataSet" Version="3.6.0" />
|
||||
<PackageReference Include="DistributedLock.Redis" Version="1.0.2" />
|
||||
<PackageReference Include="DistributedLock.SqlServer" Version="1.0.3" />
|
||||
<PackageReference Include="fo-dicom" Version="5.1.1" />
|
||||
<PackageReference Include="fo-dicom.Imaging.ImageSharp" Version="5.1.0" />
|
||||
<PackageReference Include="fo-dicom.Codecs" Version="5.1.0">
|
||||
<TreatAsUsed>true</TreatAsUsed>
|
||||
</PackageReference>
|
||||
<PackageReference Include="fo-dicom.Codecs" Version="5.10.8" />
|
||||
<PackageReference Include="Magicodes.IE.Core" Version="2.7.4.5" />
|
||||
<PackageReference Include="Magicodes.IE.Csv" Version="2.7.4.5">
|
||||
<TreatAsUsed>true</TreatAsUsed>
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
var trialDocumentQueryable = _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == queryTrialDocument.TrialId)
|
||||
.WhereIf(!string.IsNullOrEmpty(queryTrialDocument.Name), t => t.Name.Contains(queryTrialDocument.Name))
|
||||
.WhereIf(queryTrialDocument.FileTypeId != null, t => t.FileTypeId == queryTrialDocument.FileTypeId)
|
||||
.ProjectTo<TrialDocumentView>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, isEn_Us=_userInfo.IsEn_Us });
|
||||
.ProjectTo<TrialDocumentView>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, isEn_Us = _userInfo.IsEn_Us });
|
||||
|
||||
return await trialDocumentQueryable.ToPagedListAsync(queryTrialDocument.PageIndex, queryTrialDocument.PageSize, queryTrialDocument.SortField, queryTrialDocument.Asc);
|
||||
}
|
||||
|
@ -74,12 +74,12 @@ namespace IRaCIS.Core.Application.Services
|
|||
[HttpPost]
|
||||
public async Task<UnionDocumentWithConfirmInfoView?> GetNextUnSignDocument(GetNextUnSignDocumentInDto inDto)
|
||||
{
|
||||
var result =await this.GetUserDocumentList(new TrialUserDocUnionQuery()
|
||||
var result = await this.GetUserDocumentList(new TrialUserDocUnionQuery()
|
||||
{
|
||||
Asc = inDto.Asc,
|
||||
IsSign = false,
|
||||
SortField = inDto.SortField,
|
||||
TrialId= inDto.TrialId,
|
||||
TrialId = inDto.TrialId,
|
||||
PageIndex = 1,
|
||||
PageSize = 1,
|
||||
});
|
||||
|
@ -88,7 +88,8 @@ namespace IRaCIS.Core.Application.Services
|
|||
{
|
||||
return result.Data.CurrentPageData.First();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -100,7 +101,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
/// <param name="querySystemDocument"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task< IResponseOutput<PageOutput<UnionDocumentWithConfirmInfoView>> > GetUserDocumentList(TrialUserDocUnionQuery querySystemDocument)
|
||||
public async Task<IResponseOutput<PageOutput<UnionDocumentWithConfirmInfoView>>> GetUserDocumentList(TrialUserDocUnionQuery querySystemDocument)
|
||||
{
|
||||
#region https://github.com/dotnet/efcore/issues/16243 操作不行
|
||||
////系统文档查询
|
||||
|
@ -164,7 +165,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
|
||||
var trialId = querySystemDocument.TrialId;
|
||||
|
||||
var trialInfo = await (_repository.Where<Trial>(t => t.Id == querySystemDocument.TrialId).Select(t => new { t.TrialFinishedTime,t.TrialStatusStr } ).FirstOrDefaultAsync());
|
||||
var trialInfo = await (_repository.Where<Trial>(t => t.Id == querySystemDocument.TrialId).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstOrDefaultAsync());
|
||||
|
||||
//系统文档查询
|
||||
var systemDocumentQueryable = from needConfirmedUserType in _repository.Where<SystemDocNeedConfirmedUserType>(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)
|
||||
|
@ -187,10 +188,10 @@ namespace IRaCIS.Core.Application.Services
|
|||
Name = needConfirmedUserType.SystemDocument.Name,
|
||||
Path = needConfirmedUserType.SystemDocument.Path,
|
||||
FileTypeId = needConfirmedUserType.SystemDocument.FileTypeId,
|
||||
FileType = _userInfo.IsEn_Us? needConfirmedUserType.SystemDocument.FileType.Value: needConfirmedUserType.SystemDocument.FileType.ValueCN,
|
||||
FileType = _userInfo.IsEn_Us ? needConfirmedUserType.SystemDocument.FileType.Value : needConfirmedUserType.SystemDocument.FileType.ValueCN,
|
||||
UpdateTime = needConfirmedUserType.SystemDocument.UpdateTime,
|
||||
|
||||
FullFilePath = needConfirmedUserType.SystemDocument.Path ,
|
||||
FullFilePath = needConfirmedUserType.SystemDocument.Path,
|
||||
|
||||
ConfirmUserId = confirm.ConfirmUserId,
|
||||
ConfirmTime = confirm.ConfirmTime,
|
||||
|
@ -214,12 +215,12 @@ namespace IRaCIS.Core.Application.Services
|
|||
Id = trialDoc.Id,
|
||||
IsSystemDoc = false,
|
||||
CreateTime = trialDoc.CreateTime,
|
||||
FullFilePath = trialDoc.Path ,
|
||||
FullFilePath = trialDoc.Path,
|
||||
IsDeleted = trialDoc.IsDeleted,
|
||||
Name = trialDoc.Name,
|
||||
Path = trialDoc.Path,
|
||||
FileTypeId = trialDoc.FileTypeId,
|
||||
FileType = _userInfo.IsEn_Us ? trialDoc.FileType.Value: trialDoc.FileType.ValueCN,
|
||||
FileType = _userInfo.IsEn_Us ? trialDoc.FileType.Value : trialDoc.FileType.ValueCN,
|
||||
UpdateTime = trialDoc.UpdateTime,
|
||||
SignViewMinimumMinutes = trialDoc.SignViewMinimumMinutes,
|
||||
|
||||
|
@ -232,18 +233,44 @@ namespace IRaCIS.Core.Application.Services
|
|||
|
||||
};
|
||||
|
||||
|
||||
#region 报错 奇怪的bug
|
||||
var unionQuery = systemDocumentQueryable.Union(trialDocQueryable)
|
||||
.WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name))
|
||||
.WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId)
|
||||
.WhereIf(querySystemDocument.IsSign == true, t => t.ConfirmTime != null)
|
||||
.WhereIf(querySystemDocument.IsSign == false, t => t.ConfirmTime == null);
|
||||
.WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name))
|
||||
.WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId)
|
||||
.WhereIf(querySystemDocument.IsSign == true, t => t.ConfirmTime != null)
|
||||
.WhereIf(querySystemDocument.IsSign == false, t => t.ConfirmTime == null);
|
||||
|
||||
|
||||
|
||||
var result = await unionQuery.ToPagedListAsync(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc);
|
||||
#endregion
|
||||
|
||||
var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId== querySystemDocument.TrialId && t.Trial.TrialStatusStr != StaticData.TrialState.TrialStopped)
|
||||
#region 临时方案
|
||||
|
||||
//var list1 = systemDocumentQueryable
|
||||
// .WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name))
|
||||
// .WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId)
|
||||
// .WhereIf(querySystemDocument.IsSign == true, t => t.ConfirmTime != null)
|
||||
// .WhereIf(querySystemDocument.IsSign == false, t => t.ConfirmTime == null).ToList();
|
||||
|
||||
//var list2 = trialDocQueryable
|
||||
// .WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name))
|
||||
//.WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId)
|
||||
//.WhereIf(querySystemDocument.IsSign == true, t => t.ConfirmTime != null)
|
||||
//.WhereIf(querySystemDocument.IsSign == false, t => t.ConfirmTime == null).ToList();
|
||||
|
||||
//var list3 = list1.Union(list2).ToList();
|
||||
|
||||
//var result=list3.ToPagedList(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == querySystemDocument.TrialId && t.Trial.TrialStatusStr != StaticData.TrialState.TrialStopped)
|
||||
.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id))
|
||||
.Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime!=null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
.Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
.CountAsync();
|
||||
|
||||
|
||||
|
@ -254,15 +281,12 @@ namespace IRaCIS.Core.Application.Services
|
|||
var trialTaskConfig = _trialRepository.Where(t => t.Id == querySystemDocument.TrialId).ProjectTo<TrialProcessConfigDTO>(_mapper.ConfigurationProvider).FirstOrDefault();
|
||||
|
||||
|
||||
//var trialCriterionAdditionalAssessmentTypeList = _trialCriterionAdditionalAssessmentTypeRepository
|
||||
// .Where(t => t.TrialReadingCriterion.TrialId == trialId && t.IsSelected == true && t.TrialReadingCriterion.IsSigned).Select(t=>new { t.CriterionType,t.AdditionalAssessmentType}).ToList();
|
||||
|
||||
var isManualGenerateTask = _readingQuestionCriterionTrialRepository.Where(t => t.TrialId == trialId && t.IsSigned && t.IsAutoCreate == false).Any();
|
||||
var isAdditionalAssessment = _readingQuestionCriterionTrialRepository.Where(t => t.TrialId == trialId && t.IsSigned && t.IsAdditionalAssessment == true
|
||||
&& t.TrialCriterionAdditionalAssessmentTypeList.Any(c =>/*c.AdditionalAssessmentType==Domain.Share.Reading.AdditionalAssessmentType.BrainMetastasis &&*/ c.IsSelected == true)).Any();
|
||||
|
||||
var isManualGenerateTask= _readingQuestionCriterionTrialRepository.Where(t=>t.TrialId==trialId && t.IsSigned && t.IsAutoCreate==false).Any();
|
||||
var isAdditionalAssessment = _readingQuestionCriterionTrialRepository.Where(t => t.TrialId == trialId && t.IsSigned && t.IsAdditionalAssessment == true
|
||||
&&t.TrialCriterionAdditionalAssessmentTypeList.Any(c=>/*c.AdditionalAssessmentType==Domain.Share.Reading.AdditionalAssessmentType.BrainMetastasis &&*/ c.IsSelected==true)).Any();
|
||||
|
||||
return ResponseOutput.Ok<PageOutput<UnionDocumentWithConfirmInfoView>>( result, new { NeedSignCount = needSignTrialDocCount + needSignSystemDocCount, NeedSignTrialDocCount = needSignTrialDocCount, NeedSignSystemDocCount = needSignSystemDocCount, IsAdditionalAssessment = isAdditionalAssessment && isManualGenerateTask, TrialStatusStr = trialInfo.TrialStatusStr,TrialConfig= trialTaskConfig });
|
||||
return ResponseOutput.Ok<PageOutput<UnionDocumentWithConfirmInfoView>>(result, new { NeedSignCount = needSignTrialDocCount + needSignSystemDocCount, NeedSignTrialDocCount = needSignTrialDocCount, NeedSignSystemDocCount = needSignSystemDocCount, IsAdditionalAssessment = isAdditionalAssessment && isManualGenerateTask, TrialStatusStr = trialInfo.TrialStatusStr, TrialConfig = trialTaskConfig });
|
||||
}
|
||||
|
||||
|
||||
|
@ -274,7 +298,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
/// <param name="querySystemDocument"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<(PageOutput<UnionDocumentWithConfirmInfoView>,object)> GetDocumentConfirmList(DocumentTrialUnionQuery querySystemDocument)
|
||||
public async Task<(PageOutput<UnionDocumentWithConfirmInfoView>, object)> GetDocumentConfirmList(DocumentTrialUnionQuery querySystemDocument)
|
||||
{
|
||||
|
||||
|
||||
|
@ -345,7 +369,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
UserTypeId = trialUser.User.UserTypeId,
|
||||
UserTypeShortName = trialUser.User.UserTypeRole.UserTypeShortName,
|
||||
|
||||
FullFilePath = trialDocumentNeedConfirmedUserType.TrialDocument.Path
|
||||
FullFilePath = trialDocumentNeedConfirmedUserType.TrialDocument.Path
|
||||
};
|
||||
|
||||
|
||||
|
@ -400,7 +424,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
.CountAsync();
|
||||
|
||||
|
||||
return (result, new { NeedSignCount = needSignTrialDocCount + needSignSystemDocCount, NeedSignTrialDocCount = needSignTrialDocCount, NeedSignSystemDocCount = needSignSystemDocCount,TrialStatusStr = trialInfo.TrialStatusStr });
|
||||
return (result, new { NeedSignCount = needSignTrialDocCount + needSignSystemDocCount, NeedSignTrialDocCount = needSignTrialDocCount, NeedSignSystemDocCount = needSignSystemDocCount, TrialStatusStr = trialInfo.TrialStatusStr });
|
||||
}
|
||||
|
||||
|
||||
|
@ -426,14 +450,14 @@ namespace IRaCIS.Core.Application.Services
|
|||
[HttpGet("{trialId:guid}")]
|
||||
public async Task<IResponseOutput> GetTrialDocAndSystemDocType(Guid trialId)
|
||||
{
|
||||
var result = await _trialDocumentRepository.Where(t => t.TrialId == trialId).Select(t => new { FileType = _userInfo.IsEn_Us? t.FileType.Value :t.FileType.ValueCN, t.FileTypeId })
|
||||
var result = await _trialDocumentRepository.Where(t => t.TrialId == trialId).Select(t => new { FileType = _userInfo.IsEn_Us ? t.FileType.Value : t.FileType.ValueCN, t.FileTypeId })
|
||||
.Union(_systemDocumentRepository.Select(t => new { FileType = _userInfo.IsEn_Us ? t.FileType.Value : t.FileType.ValueCN, t.FileTypeId }))
|
||||
.ToListAsync();
|
||||
|
||||
return ResponseOutput.Ok(result);
|
||||
}
|
||||
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt", "AfterStopCannNotOpt" })]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt", "AfterStopCannNotOpt" })]
|
||||
//[Authorize(Policy = IRaCISPolicy.PM)]
|
||||
public async Task<IResponseOutput> AddOrUpdateTrialDocument(AddOrEditTrialDocument addOrEditTrialDocument)
|
||||
{
|
||||
|
@ -444,7 +468,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
|
||||
if (await _trialDocumentRepository.AnyAsync(t => t.FileTypeId == addOrEditTrialDocument.FileTypeId && t.Name == addOrEditTrialDocument.Name && t.TrialId == addOrEditTrialDocument.TrialId, true))
|
||||
{
|
||||
//---该项目中已经存在同类型的同名文件。
|
||||
//---该项目中已经存在同类型的同名文件。
|
||||
return ResponseOutput.NotOk(_localizer["TrialD_DuplicateFileInProject"]);
|
||||
}
|
||||
|
||||
|
@ -456,7 +480,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
{
|
||||
if (await _trialDocumentRepository.AnyAsync(t => t.FileTypeId == addOrEditTrialDocument.FileTypeId && t.Name == addOrEditTrialDocument.Name && t.Id != addOrEditTrialDocument.Id && t.TrialId == addOrEditTrialDocument.TrialId, true))
|
||||
{
|
||||
//---该项目中已经存在同类型的同名文件。
|
||||
//---该项目中已经存在同类型的同名文件。
|
||||
return ResponseOutput.NotOk(_localizer["TrialD_DuplicateFileInProject"]);
|
||||
}
|
||||
|
||||
|
@ -505,7 +529,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
/// <returns></returns>
|
||||
[HttpDelete("{trialId:guid}/{trialDocumentId:guid}")]
|
||||
//[Authorize(Policy = IRaCISPolicy.PM)]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt", "AfterStopCannNotOpt" })]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt", "AfterStopCannNotOpt" })]
|
||||
public async Task<IResponseOutput> DeleteTrialDocument(Guid trialDocumentId, Guid trialId)
|
||||
{
|
||||
if (await _trialDocumentRepository.AsQueryable(true).Where(t => t.Id == trialDocumentId).AnyAsync(t => t.TrialDocConfirmedUserList.Any()))
|
||||
|
@ -534,7 +558,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
var success = false;
|
||||
if (isSystemDoc)
|
||||
{
|
||||
if(!await _systemDocConfirmedUserRepository.AnyAsync(t=>t.SystemDocumentId==documentId && t.ConfirmUserId == _userInfo.Id))
|
||||
if (!await _systemDocConfirmedUserRepository.AnyAsync(t => t.SystemDocumentId == documentId && t.ConfirmUserId == _userInfo.Id))
|
||||
{
|
||||
await _repository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now });
|
||||
|
||||
|
@ -598,17 +622,17 @@ namespace IRaCIS.Core.Application.Services
|
|||
if (userConfirmCommand.isSystemDoc)
|
||||
{
|
||||
|
||||
var sysDocConfirm = await _systemDocConfirmedUserRepository.FirstOrDefaultAsync(t => t.SystemDocumentId == userConfirmCommand.DocumentId && t.ConfirmUserId == _userInfo.Id,true);
|
||||
var sysDocConfirm = await _systemDocConfirmedUserRepository.FirstOrDefaultAsync(t => t.SystemDocumentId == userConfirmCommand.DocumentId && t.ConfirmUserId == _userInfo.Id, true);
|
||||
|
||||
if(sysDocConfirm.ConfirmTime != null)
|
||||
if (sysDocConfirm.ConfirmTime != null)
|
||||
{
|
||||
//---该文件已经签名
|
||||
//---该文件已经签名
|
||||
return ResponseOutput.NotOk(_localizer["TrialD_FileAlreadySigned"]);
|
||||
}
|
||||
|
||||
if (sysDocConfirm.IsDeleted)
|
||||
{
|
||||
//---文件已废除,签署失败!
|
||||
//---文件已废除,签署失败!
|
||||
return ResponseOutput.NotOk(_localizer["TrialD_ObsoleteFile"]);
|
||||
}
|
||||
|
||||
|
@ -629,13 +653,13 @@ namespace IRaCIS.Core.Application.Services
|
|||
|
||||
if (trialDocConfirm.ConfirmTime != null)
|
||||
{
|
||||
//---该文件已经签名
|
||||
//---该文件已经签名
|
||||
return ResponseOutput.NotOk(_localizer["TrialD_FileAlreadySigned"]);
|
||||
}
|
||||
|
||||
if (trialDocConfirm.IsDeleted)
|
||||
{
|
||||
//---文件已废除,签署失败!
|
||||
//---文件已废除,签署失败!
|
||||
return ResponseOutput.NotOk(_localizer["TrialD_ObsoleteFile"]);
|
||||
}
|
||||
|
||||
|
@ -730,7 +754,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
Id = t.Id,
|
||||
IsSystemDoc = true,
|
||||
CreateTime = t.CreateTime,
|
||||
FullFilePath = t.Path ,
|
||||
FullFilePath = t.Path,
|
||||
IsDeleted = t.IsDeleted,
|
||||
Name = t.Name,
|
||||
Path = t.Path,
|
||||
|
@ -748,7 +772,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
Id = t.Id,
|
||||
IsSystemDoc = false,
|
||||
CreateTime = t.CreateTime,
|
||||
FullFilePath = t.Path ,
|
||||
FullFilePath = t.Path,
|
||||
IsDeleted = t.IsDeleted,
|
||||
Name = t.Name,
|
||||
Path = t.Path,
|
||||
|
|
|
@ -8,8 +8,4 @@
|
|||
<OutputPath>..\bin</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="EntityFrameworkCore.Projectables.Abstractions" Version="2.3.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using EntityFrameworkCore.Projectables;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
|
||||
namespace IRaCIS.Core.Domain.Models
|
||||
|
@ -92,7 +93,7 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// </summary>
|
||||
public bool AutoCutNextTask { get; set; } = false;
|
||||
|
||||
[NotMapped]
|
||||
[Projectable]
|
||||
public string FullName => LastName + " / " + FirstName;
|
||||
|
||||
//[Projectable] public string FullName => $"{LastName} / {FirstName}";
|
||||
|
|
|
@ -8,7 +8,9 @@
|
|||
<OutputPath>..\bin</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -17,13 +19,10 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EFCore.BulkExtensions" Version="6.5.6" />
|
||||
<PackageReference Include="EntityFrameworkCore.Triggered" Version="3.2.1" />
|
||||
<PackageReference Include="EFCore.BulkExtensions" Version="7.1.6" />
|
||||
<PackageReference Include="EntityFrameworkCore.Triggered" Version="3.2.2" />
|
||||
<PackageReference Include="EntityFrameworkCore.Projectables" Version="2.3.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.10" />
|
||||
<PackageReference Include="EntityFrameworkCore.Exceptions.SqlServer" Version="6.0.3.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="7.0.12" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
|
||||
<PackageReference Include="NewId" Version="4.0.1" />
|
||||
|
|
|
@ -257,11 +257,6 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="12.0.1" />
|
||||
<PackageReference Include="AutoMapper.Collection.EntityFrameworkCore" Version="9.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.10" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.12" />
|
||||
<PackageReference Include="SharpCompress" Version="0.34.1" />
|
||||
<PackageReference Include="SharpZipLib" Version="1.4.2" />
|
||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.5" />
|
||||
|
|
|
@ -3,6 +3,8 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq.Dynamic.Core;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
|
||||
namespace IRaCIS.Core.Infrastructure.Extention
|
||||
{
|
||||
|
@ -23,7 +25,7 @@ namespace IRaCIS.Core.Infrastructure.Extention
|
|||
|
||||
if (count == 0)
|
||||
{
|
||||
return new PageOutput<T>() { CurrentPageData=new T[0] };
|
||||
return new PageOutput<T>() { CurrentPageData = new T[0] };
|
||||
}
|
||||
|
||||
|
||||
|
@ -49,10 +51,10 @@ namespace IRaCIS.Core.Infrastructure.Extention
|
|||
}
|
||||
|
||||
//单字段排序 异步
|
||||
public static async Task<PageOutput<T>> ToPagedListAsync<T>(this IQueryable<T> source, int pageNumber, int pageSize, string defaultSortFiled = "Id", bool isAsc = true,bool isMultiSortFiled=false, string[] sortArray=default, CancellationToken cancellationToken = default)
|
||||
public static async Task<PageOutput<T>> ToPagedListAsync<T>(this IQueryable<T> source, int pageNumber, int pageSize, string defaultSortFiled = "Id", bool isAsc = true, bool isMultiSortFiled = false, string[] sortArray = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
|
||||
if (isMultiSortFiled&& sortArray==default)
|
||||
if (isMultiSortFiled && sortArray == default)
|
||||
{
|
||||
throw new System.Exception("The sort field must be specified");
|
||||
}
|
||||
|
@ -83,7 +85,7 @@ namespace IRaCIS.Core.Infrastructure.Extention
|
|||
{
|
||||
var sortString = string.Join(',', sortArray);
|
||||
|
||||
source= source.OrderBy(sortString);
|
||||
source = source.OrderBy(sortString);
|
||||
}
|
||||
source = source.Skip((pageNumber - 1) * pageSize);
|
||||
var items = await source
|
||||
|
@ -102,8 +104,47 @@ namespace IRaCIS.Core.Infrastructure.Extention
|
|||
return pagedList;
|
||||
}
|
||||
|
||||
|
||||
public static PageOutput<T> ToPagedList<T>(this IList<T> source, int pageIndex, int pageSize, string defaultSortFiled = "Id", bool isAsc = true)
|
||||
{
|
||||
if (pageIndex <= 0)
|
||||
{
|
||||
pageIndex = 1;
|
||||
}
|
||||
if (pageSize <= 0)
|
||||
{
|
||||
pageSize = 10;
|
||||
}
|
||||
var count = source.Count();
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
return new PageOutput<T>() { CurrentPageData = new List<T>() };
|
||||
}
|
||||
|
||||
var propName = string.IsNullOrWhiteSpace(defaultSortFiled) ? "Id" : defaultSortFiled;
|
||||
|
||||
IQueryable<T> sourceQuery = isAsc ? source.AsQueryable().OrderBy(propName) : source.AsQueryable().OrderBy(propName + " desc");
|
||||
|
||||
sourceQuery = sourceQuery.Skip((pageIndex - 1) * pageSize);
|
||||
|
||||
var items = sourceQuery
|
||||
.Take(pageSize)
|
||||
.ToArray();
|
||||
|
||||
var pagedList = new PageOutput<T>()
|
||||
{
|
||||
PageIndex = pageIndex,
|
||||
PageSize = pageSize,
|
||||
TotalCount = count,
|
||||
CurrentPageData = items
|
||||
};
|
||||
|
||||
return pagedList;
|
||||
}
|
||||
|
||||
//多字段排序 ["a asc", "b desc", "c asc"]
|
||||
public static PageOutput<T> ToPagedList<T>(this IQueryable<T> source, int pageIndex, int pageSize,string[] sortArray)
|
||||
public static PageOutput<T> ToPagedList<T>(this IQueryable<T> source, int pageIndex, int pageSize, string[] sortArray)
|
||||
{
|
||||
if (pageIndex <= 0)
|
||||
{
|
||||
|
@ -180,5 +221,8 @@ namespace IRaCIS.Core.Infrastructure.Extention
|
|||
|
||||
return pagedList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.8" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="3.1.0">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.12" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
|
Loading…
Reference in New Issue