修改配置文件和提示
This commit is contained in:
@@ -11,7 +11,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
{
|
||||
Task<IResponseOutput> AddOrUpdateTrialQCQuestionConfigure(TrialQCQuestionAddOrEdit addOrEditTrialQCQuestionConfigure);
|
||||
Task<IResponseOutput> BatchAddTrialQCQuestionConfigure(List<TrialQCQuestionConfigureBatchAdd> batchList, Guid trialId);
|
||||
Task<IResponseOutput> DeleteTrialQCQuestionConfigure(Guid trialQCQuestionConfigureId);
|
||||
Task<IResponseOutput> DeleteTrialQCQuestionConfigure(Guid trialQCQuestionConfigureId, Guid trialId);
|
||||
//Task<List<TrialQCQuestionConfigureView>> GetTrialQCQuestionConfigureList(TrialQCQuestionQuery queryTrialQCQuestionConfigure);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
using IRaCIS.Core.Infra.EFCore;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace IRaCIS.Core.Application.Contracts
|
||||
@@ -39,9 +40,14 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
|
||||
var signInfo = await _repository.Where<Trial>(t => t.Id == queryTrialQCQuestionConfigure.TrialId)
|
||||
.Select(trial => new {trial.QCProcessEnum, trial.QCQuestionConfirmedTime, trial.QCQuestionConfirmedUserId,
|
||||
RealName = trial.QCQuestionConfirmedUser.FullName, trial.QCQuestionConfirmedUser.UserName,
|
||||
IsHaveQCQuestion= isHaveQCQuestion
|
||||
.Select(trial => new
|
||||
{
|
||||
trial.QCProcessEnum,
|
||||
trial.QCQuestionConfirmedTime,
|
||||
trial.QCQuestionConfirmedUserId,
|
||||
RealName = trial.QCQuestionConfirmedUser.FullName,
|
||||
trial.QCQuestionConfirmedUser.UserName,
|
||||
IsHaveQCQuestion = isHaveQCQuestion
|
||||
}).FirstOrDefaultAsync();
|
||||
|
||||
return (list, signInfo!);
|
||||
@@ -100,6 +106,15 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
return ids;
|
||||
}
|
||||
|
||||
|
||||
public async Task VerifyIsQCConfirmedAsync(Guid trialId)
|
||||
{
|
||||
if (!await _repository.AnyAsync<Trial>(t => t.Id == trialId && t.QCQuestionConfirmedUserId == null))
|
||||
{
|
||||
throw new BusinessValidationFailedException("QC已确认,不允许操作");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量添加 QC 问题
|
||||
/// </summary>
|
||||
@@ -109,10 +124,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
[HttpPost("{trialId:guid}")]
|
||||
public async Task<IResponseOutput> BatchAddTrialQCQuestionConfigure(List<TrialQCQuestionConfigureBatchAdd> batchList, Guid trialId)
|
||||
{
|
||||
if (!await _repository.AnyAsync<Trial>(t => t.Id == trialId && t.QCQuestionConfirmedUserId == null))
|
||||
{
|
||||
return ResponseOutput.NotOk("QC已确认,不允许操作");
|
||||
}
|
||||
|
||||
await VerifyIsQCConfirmedAsync(trialId);
|
||||
|
||||
var batchConfigList = _mapper.Map<List<TrialQCQuestion>>(batchList);
|
||||
batchConfigList.ForEach(t => t.TrialId = trialId);
|
||||
@@ -127,10 +140,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
public async Task<IResponseOutput> AddOrUpdateTrialQCQuestionConfigure(TrialQCQuestionAddOrEdit addOrEditTrialQCQuestionConfigure)
|
||||
{
|
||||
if (!await _repository.AnyAsync<Trial>(t => t.Id == addOrEditTrialQCQuestionConfigure.TrialId && t.QCQuestionConfirmedUserId == null))
|
||||
{
|
||||
return ResponseOutput.NotOk("QC已确认,不允许操作");
|
||||
}
|
||||
await VerifyIsQCConfirmedAsync(addOrEditTrialQCQuestionConfigure.TrialId);
|
||||
|
||||
var entity = await _trialQcQuestionRepository.InsertOrUpdateAsync(addOrEditTrialQCQuestionConfigure, true);
|
||||
|
||||
@@ -138,26 +148,23 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
}
|
||||
|
||||
|
||||
[HttpDelete("{trialQCQuestionConfigureId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteTrialQCQuestionConfigure(Guid trialQCQuestionConfigureId)
|
||||
[HttpDelete("{trialId:guid}/{trialQCQuestionConfigureId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteTrialQCQuestionConfigure(Guid trialQCQuestionConfigureId, Guid trialId)
|
||||
{
|
||||
await VerifyIsQCConfirmedAsync(trialId);
|
||||
|
||||
if (await _trialQcQuestionRepository.AnyAsync(t => t.ParentId == trialQCQuestionConfigureId))
|
||||
{
|
||||
return ResponseOutput.NotOk("请先清除子问题 再删除父问题");
|
||||
}
|
||||
|
||||
if (!await _trialQcQuestionRepository.AnyAsync(t => t.Id == trialQCQuestionConfigureId && t.Trial.QCQuestionConfirmedUserId == null))
|
||||
{
|
||||
return ResponseOutput.NotOk("QC已确认,不允许操作");
|
||||
}
|
||||
|
||||
if (await _repository.AnyAsync<TrialQCQuestionAnswer>(t => t.TrialQCQuestionConfigureId == trialQCQuestionConfigureId))
|
||||
{
|
||||
return ResponseOutput.NotOk("已有QC审核记录,不允许删除该问题项");
|
||||
}
|
||||
|
||||
var success = await _trialQcQuestionRepository.DeleteFromQueryAsync(t => t.Id == trialQCQuestionConfigureId,true);
|
||||
var success = await _trialQcQuestionRepository.DeleteFromQueryAsync(t => t.Id == trialQCQuestionConfigureId, true);
|
||||
return ResponseOutput.Result(true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user