修改一版

This commit is contained in:
he
2022-07-20 16:24:54 +08:00
parent 4c015e29b6
commit 48bbefebf9
3 changed files with 50 additions and 8 deletions
@@ -76,6 +76,17 @@ namespace IRaCIS.Application.Services
[HttpPost]
public async Task<IResponseOutput> SetTrialJudgyInfo(SetTrialJudgyInfoInDto inDto)
{
var trialCriterion = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == inDto.TrialId && x.IsConfirm).FirstOrDefaultAsync();
var judgeCount = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialCriterion.Id && x.IsJudgeQuestion)
.WhereIf(trialCriterion.FormType == FormType.SinglePage, x => x.ReadingCriterionPageId == null)
.WhereIf(trialCriterion.FormType == FormType.MultiplePage, x => x.ReadingCriterionPageId != null).CountAsync();
if (judgeCount == 0&&(inDto.ArbitrationRule== ArbitrationRule.Visit|| inDto.ArbitrationRule == ArbitrationRule.Reading))
{
throw new BusinessValidationFailedException("无裁判问题却有仲裁对象,操作失败");
}
await _trialRepository.UpdatePartialFromQueryAsync(inDto.TrialId, x => new Trial()
{
ArbitrationRule = inDto.ArbitrationRule,
@@ -54,6 +54,18 @@ namespace IRaCIS.Core.Application
[NonDynamicMethod]
public async Task<IResponseOutput> TrialReadingInfoSign(TrialReadingInfoSignInDto inDto)
{
var trialCriterion = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == inDto.TrialId && x.IsConfirm).FirstOrDefaultAsync();
var existsJudge = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialCriterion.Id && x.IsJudgeQuestion && x.JudgeType == JudgeTypeEnum.None)
.WhereIf(trialCriterion.FormType == FormType.SinglePage, x => x.ReadingCriterionPageId == null)
.WhereIf(trialCriterion.FormType == FormType.MultiplePage, x => x.ReadingCriterionPageId != null)
.AnyAsync();
if (existsJudge)
{
throw new BusinessValidationFailedException("配置了裁判问题但未配置裁判规则,操作失败");
}
await _trialRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.TrialId, x => new Trial()
{
ReadingInfoSignTime = DateTime.Now