|
|
|
@ -1,5 +1,4 @@ |
|
|
|
|
|
|
|
|
|
using Tiobon.Core.IServices; |
|
|
|
|
using Tiobon.Core.IServices; |
|
|
|
|
using Tiobon.Core.Model.Models; |
|
|
|
|
using Tiobon.Core.Services.BASE; |
|
|
|
|
using Tiobon.Core.IRepository.Base; |
|
|
|
@ -9,6 +8,7 @@ using Tiobon.Core.Common; |
|
|
|
|
using Tiobon.Core.Model; |
|
|
|
|
using Newtonsoft.Json; |
|
|
|
|
using System.Text.RegularExpressions; |
|
|
|
|
using System.Net; |
|
|
|
|
|
|
|
|
|
namespace Tiobon.Core.Services; |
|
|
|
|
|
|
|
|
@ -155,4 +155,73 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
|
|
|
|
|
|
//return await QueryFilterPage(body, $"ExamId='{examId}'"); |
|
|
|
|
} |
|
|
|
|
public async Task<ServiceResult<Ghre_ExamRecordExtend>> ExtendAsync(string examRecordId) |
|
|
|
|
{ |
|
|
|
|
var extend = new Ghre_ExamRecordExtend(); |
|
|
|
|
var entity = await QuerySingle(examRecordId); |
|
|
|
|
|
|
|
|
|
var exampaper = await Db.Queryable<Ghre_ExamPaper>().FirstAsync(x => x.Id == entity.ExamPaperId); |
|
|
|
|
var baseData = new DefaultGhre_ExamPaperBaseData(); |
|
|
|
|
baseData.PaperNo = exampaper.PaperNo; |
|
|
|
|
baseData.PaperName = exampaper.PaperName; |
|
|
|
|
baseData.AnswerTime = exampaper.AnswerTime; |
|
|
|
|
baseData.ScoreMethod = exampaper.ScoreMethod; |
|
|
|
|
baseData.TotalScore = exampaper.TotalScore; |
|
|
|
|
baseData.PassScore = exampaper.PassScore; |
|
|
|
|
baseData.RetakeTimes = exampaper.RetakeTimes; |
|
|
|
|
baseData.RemarkSz = exampaper.RemarkSz; |
|
|
|
|
baseData.LinkType = exampaper.LinkType; |
|
|
|
|
baseData.CourseId = exampaper.LinkType == "CourseId" ? exampaper.LinkId : null; |
|
|
|
|
baseData.CourseSceneId = exampaper.LinkType == "CourseSceneId" ? exampaper.LinkId : null; |
|
|
|
|
extend.baseData = baseData; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extend.styleInfo.coverImage = exampaper.CoverUrl; |
|
|
|
|
extend.styleInfo.paperStyle = exampaper.Style; |
|
|
|
|
extend.styleInfo.coverBackGround = exampaper.CoverBackGround; |
|
|
|
|
|
|
|
|
|
var questions = await Db.Queryable<Ghre_ExamPaperQuestion>().Where(x => x.ExamPaperId == exampaper.Id).OrderBy(x => x.TaxisNo).ToListAsync(); |
|
|
|
|
var previews = questions.Where(x => x.QuestionId != null).Select(x => new DefaultGhre_ExamPaperPreview() |
|
|
|
|
{ |
|
|
|
|
Id = x.Id, |
|
|
|
|
ConfigId = x.ConfigId, |
|
|
|
|
parentId = x.ConfigId, |
|
|
|
|
QuestionId = x.QuestionId.Value, |
|
|
|
|
ExamPaperId = x.ExamPaperId |
|
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
|
|
var questionIds = previews.Select(x => x.QuestionId).Distinct().ToList(); |
|
|
|
|
|
|
|
|
|
var questions1 = await Db.Queryable<Ghre_Question>().Where(x => questionIds.Contains(x.Id)).ToListAsync(); |
|
|
|
|
var answers = await Db.Queryable<Ghre_QuestionAnswer>().Where(x => x.QuestionId != null && questionIds.Contains(x.QuestionId.Value)).OrderBy(x => x.TaxisNo).ToListAsync(); ; |
|
|
|
|
|
|
|
|
|
previews.ForEach(x => |
|
|
|
|
{ |
|
|
|
|
var answers1 = answers.Where(y => y.QuestionId == x.QuestionId).ToList(); |
|
|
|
|
x.QuestionType = questions1.FirstOrDefault(a => a.Id == x.QuestionId)?.QuestionType; |
|
|
|
|
x.QuestionContent = questions1.FirstOrDefault(a => a.Id == x.QuestionId)?.QuestionContent; |
|
|
|
|
if (!string.IsNullOrEmpty(x.QuestionContent)) |
|
|
|
|
x.QuestionContent = WebUtility.HtmlDecode(x.QuestionContent); |
|
|
|
|
|
|
|
|
|
var detail = new FromGhre_QuestionQuestionTypeDetail(); |
|
|
|
|
detail.content = x.QuestionContent; |
|
|
|
|
detail.difficulty = questions1.FirstOrDefault(a => a.Id == x.QuestionId)?.DifficultyLevel; |
|
|
|
|
detail.answer = answers1.Where(x => x.IsCorrect == true).FirstOrDefault()?.QuestionNo; |
|
|
|
|
detail.answer1 = answers1.Where(x => x.IsCorrect == true).Select(x => x.QuestionNo).ToList(); |
|
|
|
|
detail.answerList = answers1.Select(x => new FromGhre_QuestionQuestionAnswerList() |
|
|
|
|
{ |
|
|
|
|
No = x.QuestionNo, |
|
|
|
|
label = x.AnswerContent, |
|
|
|
|
imageUrl = x.ImageUrl, |
|
|
|
|
imgWidthPc = x.ImageWidthPc, |
|
|
|
|
imgWidthApp = x.ImageWidthApp, |
|
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
|
|
x.detail = detail; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
extend.previewList = previews; |
|
|
|
|
|
|
|
|
|
return ServiceResult<Ghre_ExamRecordExtend>.OprateSuccess("查询成功!", extend); |
|
|
|
|
} |
|
|
|
|
} |