@@ -350,6 +350,18 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
/// </summary>
|
||||
public int? NewStaffTrainDays { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否发布
|
||||
/// </summary>
|
||||
|
||||
public bool IsPublish { get; set; } = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class PublishSystemDocumentInDto
|
||||
{
|
||||
public List<Guid> Ids { get; set; }
|
||||
}
|
||||
|
||||
public class AddOrEditSystemDocument : SystemDocumentAddOrEdit
|
||||
|
||||
@@ -5,8 +5,12 @@
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Domain;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using UserRole = IRaCIS.Core.Domain.Models.UserRole;
|
||||
using IRaCIS.Core.Application.MassTransit.Consumer;
|
||||
using MassTransit.Mediator;
|
||||
|
||||
namespace IRaCIS.Core.Application.Services
|
||||
{
|
||||
@@ -16,6 +20,7 @@ namespace IRaCIS.Core.Application.Services
|
||||
[ApiExplorerSettings(GroupName = "Trial")]
|
||||
public class SystemDocumentService(IRepository<SystemDocument> _systemDocumentRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IScopedMediator _mediatorScoped,
|
||||
IRepository<SystemDocumentAttachment> _systemDocumentAttachmentRepository,
|
||||
IRepository<IdentityUser> _identityUserRepository,
|
||||
IRepository<SystemDocConfirmedIdentityUser> _systemDocConfirmedUserRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ISystemDocumentService
|
||||
@@ -156,6 +161,28 @@ namespace IRaCIS.Core.Application.Services
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发布系统文档
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> PublishSystemDocument(PublishSystemDocumentInDto inDto)
|
||||
{
|
||||
await _systemDocumentRepository.UpdatePartialFromQueryAsync(x => inDto.Ids.Contains(x.Id), x => new SystemDocument()
|
||||
{
|
||||
IsPublish = true,
|
||||
IsDeleted = false,
|
||||
});
|
||||
|
||||
|
||||
var result = await _systemDocumentRepository.SaveChangesAsync();
|
||||
|
||||
|
||||
await _mediatorScoped.Publish(new SystemDocumentPublishEvent() { Ids = inDto.Ids });
|
||||
|
||||
return ResponseOutput.Result(result);
|
||||
}
|
||||
|
||||
[HttpDelete("{systemDocumentId:guid}")]
|
||||
public async Task<IResponseOutput> AbandonSystemDocumentAsync(Guid systemDocumentId)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user