修改设置文档浏览时间
parent
440a3f0554
commit
7403a853f7
|
@ -4,6 +4,7 @@
|
|||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Infra.EFCore;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
@ -24,8 +25,8 @@ namespace IRaCIS.Core.Application.Services
|
|||
private readonly IRepository<TrialDocument> _trialDocumentRepository;
|
||||
private readonly IRepository<SystemDocument> _systemDocumentRepository;
|
||||
|
||||
public TrialDocumentService( IRepository<TrialDocument> trialDocumentRepository
|
||||
, IRepository<SystemDocument> systemDocumentRepository)
|
||||
public TrialDocumentService(IRepository<TrialDocument> trialDocumentRepository
|
||||
, IRepository<SystemDocument> systemDocumentRepository)
|
||||
{
|
||||
_trialDocumentRepository = trialDocumentRepository;
|
||||
_systemDocumentRepository = systemDocumentRepository;
|
||||
|
@ -290,10 +291,10 @@ namespace IRaCIS.Core.Application.Services
|
|||
var trialFininshedTime = await _repository.Where<Trial>(t => t.Id == querySystemDocument.TrialId).Select(t => t.TrialFinishedTime).FirstOrDefaultAsync();
|
||||
|
||||
var trialDocQuery = from trialDocumentNeedConfirmedUserType in _repository.Where<TrialDocNeedConfirmedUserType>(t => t.TrialDocument.TrialId == querySystemDocument.TrialId)
|
||||
join trialUser in _repository.Where<TrialUser>(t => t.TrialId == querySystemDocument.TrialId)
|
||||
.WhereIf(querySystemDocument.UserId != null, t => t.UserId == querySystemDocument.UserId)
|
||||
.WhereIf(querySystemDocument.UserTypeId != null, t => t.User.UserTypeId == querySystemDocument.UserTypeId)
|
||||
on trialDocumentNeedConfirmedUserType.NeedConfirmUserTypeId equals trialUser.User.UserTypeId
|
||||
join trialUser in _repository.Where<TrialUser>(t => t.TrialId == querySystemDocument.TrialId)
|
||||
.WhereIf(querySystemDocument.UserId != null, t => t.UserId == querySystemDocument.UserId)
|
||||
.WhereIf(querySystemDocument.UserTypeId != null, t => t.User.UserTypeId == querySystemDocument.UserTypeId)
|
||||
on trialDocumentNeedConfirmedUserType.NeedConfirmUserTypeId equals trialUser.User.UserTypeId
|
||||
|
||||
join confirm in _repository.Where<TrialDocUserTypeConfirmedUser>(t => t.TrialDocument.TrialId == querySystemDocument.TrialId) on
|
||||
new { trialUser.UserId, TrialDocumentId = trialDocumentNeedConfirmedUserType.TrialDocumentId } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
||||
|
@ -384,13 +385,13 @@ namespace IRaCIS.Core.Application.Services
|
|||
/// <param name="trialId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{trialId:guid}")]
|
||||
public async Task<IResponseOutput> GetTrialDocAndSystemDocType(Guid trialId)
|
||||
public async Task<IResponseOutput> GetTrialDocAndSystemDocType(Guid trialId)
|
||||
{
|
||||
var result = await _trialDocumentRepository.Where(t => t.TrialId == trialId).Select(t => new { FileType = t.FileType.Value, t.FileTypeId })
|
||||
.Union(_systemDocumentRepository.Select(t => new { FileType = t.FileType.Value, t.FileTypeId }))
|
||||
.ToListAsync();
|
||||
|
||||
return ResponseOutput.Ok(result);
|
||||
return ResponseOutput.Ok(result);
|
||||
}
|
||||
|
||||
public async Task<IResponseOutput> AddOrUpdateTrialDocument(AddOrEditTrialDocument addOrEditTrialDocument)
|
||||
|
@ -497,6 +498,24 @@ namespace IRaCIS.Core.Application.Services
|
|||
return ResponseOutput.Result(success);
|
||||
}
|
||||
|
||||
[HttpPut("{documentId:guid}")]
|
||||
public async Task<IResponseOutput> SetSystemDocFirstViewTime(Guid documentId)
|
||||
{
|
||||
await _repository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, SignFirstViewTime = DateTime.Now });
|
||||
var success = await _repository.SaveChangesAsync();
|
||||
|
||||
return ResponseOutput.Result(success);
|
||||
}
|
||||
|
||||
[HttpPut("{trialId:guid}/{documentId:guid}")]
|
||||
public async Task<IResponseOutput> SetTrialDocFirstViewTime(Guid documentId)
|
||||
{
|
||||
await _repository.AddAsync(new TrialDocUserTypeConfirmedUser() { TrialDocumentId = documentId, SignFirstViewTime = DateTime.Now });
|
||||
var success = await _repository.SaveChangesAsync();
|
||||
|
||||
return ResponseOutput.Result(success);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用户 签名某个文档
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue