|
@@ -17,6 +17,8 @@ using SqlSugar;
|
|
|
using Hotline.CaseLibrary;
|
|
|
using Hotline.Orders;
|
|
|
using Hotline.KnowledgeBase;
|
|
|
+using Hotline.Share.Enums.Planlibrary;
|
|
|
+using System.Numerics;
|
|
|
|
|
|
namespace Hotline.Application.Caselibrary
|
|
|
{
|
|
@@ -211,6 +213,11 @@ namespace Hotline.Application.Caselibrary
|
|
|
.Where(x => (x.Status == ECaseStatus.Drafts && x.CreatorId == _sessionContext.UserId) || (x.Status != ECaseStatus.Drafts))
|
|
|
.WhereIF(OrgSeedData.CenterId != pagedDto.CreateOrgId && !string.IsNullOrEmpty(pagedDto.CreateOrgId), x => x.CreatorOrgId != null && x.CreatorOrgId.StartsWith(pagedDto.CreateOrgId!))
|
|
|
.WhereIF(!string.IsNullOrEmpty(pagedDto.Title), x => x.Title.Contains(pagedDto.Title))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(pagedDto.Abstract), x => x.Abstract.Contains(pagedDto.Abstract))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(pagedDto.Describe), x => x.Describe.Contains(pagedDto.Describe))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(pagedDto.Result), x => x.Result.Contains(pagedDto.Result))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(pagedDto.Reason), x => x.Reason.Contains(pagedDto.Reason))
|
|
|
+
|
|
|
.WhereIF(!string.IsNullOrEmpty(pagedDto.Keyword), x => x.Title.Contains(pagedDto.Keyword!) ||
|
|
|
x.CreatorName!.Contains(pagedDto.Keyword!) ||
|
|
|
x.CreatorOrgName!.Contains(pagedDto.Keyword!))
|
|
@@ -219,7 +226,7 @@ namespace Hotline.Application.Caselibrary
|
|
|
pagedDto.Status != ECaseStatus.All,
|
|
|
x => x.Status == pagedDto.Status && ((x.ExpiredTime != null && x.ExpiredTime > DateTime.Now) || x.ExpiredTime == null))
|
|
|
.WhereIF(pagedDto.Status.HasValue && pagedDto.Status == ECaseStatus.OffShelf, x => x.Status == pagedDto.Status || (x.ExpiredTime != null && x.ExpiredTime < DateTime.Now && x.Status != ECaseStatus.Drafts))
|
|
|
- .WhereIF(pagedDto.Status.HasValue && pagedDto.Status == ECaseStatus.NewDrafts, x => x.Status == ECaseStatus.Drafts || x.Status == ECaseStatus.Revert)
|
|
|
+ .WhereIF(pagedDto.Status.HasValue && pagedDto.Status == ECaseStatus.NewDrafts, x => x.Status == ECaseStatus.Drafts || x.Status == ECaseStatus.Revert || x.Status == ECaseStatus.NewDrafts)
|
|
|
.WhereIF(!string.IsNullOrEmpty(typeSpliceName), x => x.CaseTypes.Any(t => t.CaseTypeSpliceName.StartsWith(typeSpliceName)))
|
|
|
|
|
|
.WhereIF(pagedDto.CreationTimeStart.HasValue, x => x.CreationTime >= pagedDto.CreationTimeStart)
|
|
@@ -237,10 +244,10 @@ namespace Hotline.Application.Caselibrary
|
|
|
.WhereIF(pagedDto.ExaminTimeStart.HasValue, x => x.ExaminTime >= pagedDto.ExaminTimeStart)
|
|
|
.WhereIF(pagedDto.ExaminTimeEnd.HasValue, x => x.ExaminTime <= pagedDto.ExaminTimeEnd)
|
|
|
|
|
|
- .OrderByIF(string.IsNullOrEmpty(pagedDto.SortField), d => d.CreationTime, OrderByType.Desc)
|
|
|
- .OrderByIF(pagedDto is { SortField: "PageView" }, d => d.PageView, OrderByType.Desc) //阅读量
|
|
|
- .OrderByIF(pagedDto is { SortField: "Score" }, d => d.Score, OrderByType.Desc) //评分
|
|
|
- .OrderByIF(pagedDto is { SortField: "CreationTime" }, d => d.CreationTime, OrderByType.Desc) //创建时间
|
|
|
+ .OrderByIF(string.IsNullOrEmpty(pagedDto.SortField), x => x.CreationTime, OrderByType.Desc)
|
|
|
+ .OrderByIF(pagedDto is { SortField: "pageView" }, x => x.PageView, OrderByType.Desc) //阅读量
|
|
|
+ .OrderByIF(pagedDto is { SortField: "score" }, x => x.Score, OrderByType.Desc) //评分
|
|
|
+ .OrderByIF(pagedDto is { SortField: "creationTime" }, x => x.CreationTime, OrderByType.Desc) //创建时间
|
|
|
|
|
|
.ToPagedListAsync(pagedDto.PageIndex, pagedDto.PageSize, cancellationToken);
|
|
|
|
|
@@ -303,22 +310,36 @@ namespace Hotline.Application.Caselibrary
|
|
|
if (any)
|
|
|
throw UserFriendlyException.SameMessage("当前案例标题存在重复标题!");
|
|
|
|
|
|
- _mapper.Map(dto, Case);
|
|
|
-
|
|
|
- if (dto.Files != null && dto.Files.Count > 0)
|
|
|
- Case.FileJson = await _fileRepository.AddFileAsync(dto.Files, Case.Id, "", cancellationToken);
|
|
|
+ if (dto.ApplyStatus == ECaseApplyStatus.Delete)
|
|
|
+ {
|
|
|
+ Case.Status = (ECaseStatus)dto.Status;
|
|
|
+ Case.ApplyStatus = (ECaseApplyStatus)dto.ApplyStatus;
|
|
|
+ Case.Id = dto.Id;
|
|
|
+ Case.ApplyReason = dto.ApplyReason;
|
|
|
+ }
|
|
|
else
|
|
|
- Case.FileJson = new List<Share.Dtos.File.FileJson>();
|
|
|
+ {
|
|
|
+ _mapper.Map(dto, Case);
|
|
|
+
|
|
|
+ if (dto.Files != null && dto.Files.Count > 0)
|
|
|
+ Case.FileJson = await _fileRepository.AddFileAsync(dto.Files, Case.Id, "", cancellationToken);
|
|
|
+ else
|
|
|
+ Case.FileJson = new List<Share.Dtos.File.FileJson>();
|
|
|
+ }
|
|
|
|
|
|
await _caseListRepository.UpdateNullAsync(Case, cancellationToken);
|
|
|
- if (dto.CaseTypes.Any())
|
|
|
+
|
|
|
+ if (dto.ApplyStatus != ECaseApplyStatus.Delete)
|
|
|
{
|
|
|
- var anyRelationTypes = await _caseRelationTypeRepository.Queryable().Where(x => x.CaseId == Case.Id).ToListAsync();
|
|
|
- if (anyRelationTypes.Any())
|
|
|
- await _caseRelationTypeRepository.RemoveRangeAsync(anyRelationTypes);
|
|
|
- List<CaseRelationType> types = _mapper.Map<List<CaseRelationType>>(dto.CaseTypes);
|
|
|
- types.ForEach(x => x.CaseId = dto.Id);
|
|
|
- await _caseRelationTypeRepository.AddRangeAsync(types, cancellationToken);
|
|
|
+ if (dto.CaseTypes.Any())
|
|
|
+ {
|
|
|
+ var anyRelationTypes = await _caseRelationTypeRepository.Queryable().Where(x => x.CaseId == Case.Id).ToListAsync();
|
|
|
+ if (anyRelationTypes.Any())
|
|
|
+ await _caseRelationTypeRepository.RemoveRangeAsync(anyRelationTypes);
|
|
|
+ List<CaseRelationType> types = _mapper.Map<List<CaseRelationType>>(dto.CaseTypes);
|
|
|
+ types.ForEach(x => x.CaseId = dto.Id);
|
|
|
+ await _caseRelationTypeRepository.AddRangeAsync(types, cancellationToken);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -368,7 +389,10 @@ namespace Hotline.Application.Caselibrary
|
|
|
Case.ExaminTime = dto.ExaminTime;
|
|
|
Case.ExaminManId = dto.ExaminManId;
|
|
|
Case.ExaminOrganizeId = dto.ExaminOrganizeId;
|
|
|
+ Case.ExaminOpinion = dto.ExaminOpinion;
|
|
|
Case.UpdateTime = dto.UpdateTime;
|
|
|
+ Case.OnShelfTime = dto.OnShelfTime;
|
|
|
+ Case.OffShelfTime = dto.OffShelfTime;
|
|
|
|
|
|
if (Case.ApplyStatus == ECaseApplyStatus.Delete)
|
|
|
{
|