|
@@ -178,13 +178,7 @@ namespace Hotline.Application.Caselibrary
|
|
|
/// <returns></returns>
|
|
|
public async Task<(int, IList<CaseDataDto>)> QueryAllCaseListAsync(CaseListDto pagedDto, CancellationToken cancellationToken)
|
|
|
{
|
|
|
- //if (!_sessionContext.OrgIsCenter)
|
|
|
- //{// 部门只能查询【部门案例库】
|
|
|
- // pagedDto.Attribution = "部门案例库";
|
|
|
- //}
|
|
|
-
|
|
|
var typeSpliceName = string.Empty;
|
|
|
- var hotspotHotSpotFullName = string.Empty;
|
|
|
|
|
|
if (!string.IsNullOrEmpty(pagedDto.CaseTypeID))
|
|
|
{
|
|
@@ -192,20 +186,12 @@ namespace Hotline.Application.Caselibrary
|
|
|
typeSpliceName = type?.SpliceName;
|
|
|
}
|
|
|
|
|
|
- if (!string.IsNullOrEmpty(pagedDto.HotspotId))
|
|
|
- {
|
|
|
- var hotspot = await _hotspotTypeRepository.GetAsync(x => x.Id == pagedDto.HotspotId);
|
|
|
- hotspotHotSpotFullName = hotspot?.HotSpotFullName;
|
|
|
- }
|
|
|
-
|
|
|
//单表分页
|
|
|
var (total, temp) = await _CaseListRepository.Queryable()
|
|
|
.Includes(x => x.CaseTypes)
|
|
|
- .Includes(x => x.HotspotType)
|
|
|
.Where(x => x.IsDeleted == false)
|
|
|
.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.Attribution), x => x.Attribution == pagedDto.Attribution)
|
|
|
.WhereIF(!string.IsNullOrEmpty(pagedDto.Title), x => x.Title.Contains(pagedDto.Title))
|
|
|
.WhereIF(!string.IsNullOrEmpty(pagedDto.Keyword), x => x.Title.Contains(pagedDto.Keyword!) ||
|
|
|
x.CreatorName!.Contains(pagedDto.Keyword!) ||
|
|
@@ -216,9 +202,7 @@ namespace Hotline.Application.Caselibrary
|
|
|
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.IsPublic.HasValue, x => x.IsPublic == pagedDto.IsPublic)
|
|
|
.WhereIF(!string.IsNullOrEmpty(typeSpliceName), x => x.CaseTypes.Any(t => t.CaseTypeSpliceName.StartsWith(typeSpliceName)))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(hotspotHotSpotFullName), x => x.HotspotType.HotSpotFullName.EndsWith(hotspotHotSpotFullName!))
|
|
|
|
|
|
.WhereIF(pagedDto.CreationTimeStart.HasValue, x => x.CreationTime >= pagedDto.CreationTimeStart)
|
|
|
.WhereIF(pagedDto.CreationTimeEnd.HasValue, x => x.CreationTime <= pagedDto.CreationTimeEnd)
|
|
@@ -303,8 +287,6 @@ namespace Hotline.Application.Caselibrary
|
|
|
|
|
|
_mapper.Map(dto, Case);
|
|
|
|
|
|
- Case.HotspotId = dto.HotspotId;
|
|
|
-
|
|
|
if (dto.Files != null && dto.Files.Count > 0)
|
|
|
Case.FileJson = await _fileRepository.AddFileAsync(dto.Files, Case.Id, "", cancellationToken);
|
|
|
else
|
|
@@ -324,7 +306,7 @@ namespace Hotline.Application.Caselibrary
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
- #region 案例库 - 下架审核
|
|
|
+ #region 案例库 - 下架&审核
|
|
|
|
|
|
/// <summary>
|
|
|
/// 下架审核
|
|
@@ -368,13 +350,17 @@ namespace Hotline.Application.Caselibrary
|
|
|
//转化
|
|
|
var CaseInfoDto = _mapper.Map<CaseInfoDto>(Case);
|
|
|
|
|
|
- if (Case != null && !string.IsNullOrEmpty(Case.Content))
|
|
|
- CaseInfoDto.Content = _bulletinApplication.GetSiteUrls(Case.Content);
|
|
|
-
|
|
|
- // 热点
|
|
|
- //var hot = await _hotspotTypeRepository.GetAsync(Case.HotspotId, cancellationToken);
|
|
|
- //if (hot != null)
|
|
|
- // CaseDto.HotspotId = hot.HotSpotFullName;
|
|
|
+ //if (Case != null && !string.IsNullOrEmpty(Case.Content))
|
|
|
+ // CaseInfoDto.Content = _bulletinApplication.GetSiteUrls(Case.Content);
|
|
|
+ if (Case != null)
|
|
|
+ {
|
|
|
+ if (!string.IsNullOrEmpty(Case.Describe))
|
|
|
+ CaseInfoDto.Content = _bulletinApplication.GetSiteUrls(Case.Describe);
|
|
|
+ if (!string.IsNullOrEmpty(Case.Result))
|
|
|
+ CaseInfoDto.Content = _bulletinApplication.GetSiteUrls(Case.Result);
|
|
|
+ if (!string.IsNullOrEmpty(Case.Reason))
|
|
|
+ CaseInfoDto.Content = _bulletinApplication.GetSiteUrls(Case.Reason);
|
|
|
+ }
|
|
|
|
|
|
if (CaseInfoDto.FileJson != null && CaseInfoDto.FileJson.Any())
|
|
|
{
|
|
@@ -408,12 +394,12 @@ namespace Hotline.Application.Caselibrary
|
|
|
var streamList = new Dictionary<string, Stream>();
|
|
|
var knowList = await _CaseListRepository.Queryable()
|
|
|
.Where(m => dto.Ids.Contains(m.Id))
|
|
|
- .Select(m => new { m.Title, m.Content })
|
|
|
+ .Select(m => new { m.Title, m.Result })
|
|
|
.ToListAsync(cancellationToken);
|
|
|
|
|
|
var tasks = knowList.Select(async item =>
|
|
|
{
|
|
|
- var stream = await Task.Run(() => item.Content.HtmlToStream(dto.FileType), cancellationToken);
|
|
|
+ var stream = await Task.Run(() => item.Result.HtmlToStream(dto.FileType), cancellationToken);
|
|
|
return new KeyValuePair<string, Stream>(
|
|
|
item.Title + dto.FileType.GetFileExtension(),
|
|
|
stream
|