题库导入新增难度必填校验

master
xiaochanghai 2 months ago
parent 642c5d4bd1
commit 8a24587c5e
  1. BIN
      Tiobon.Core.Api/wwwroot/files/ExcelTemplate/Ghrh_YearHumanSettings.xlsx
  2. 19
      Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs

@ -1,5 +1,4 @@
using NPOI.HSSF.UserModel;
using NPOI.SS.Formula.Functions;
using NPOI.SS.UserModel;
using NPOI.SS.Util;
using NPOI.XSSF.UserModel;
@ -949,15 +948,15 @@ public class Ghre_QuestionServices : BaseServices<Ghre_Question, Ghre_QuestionDt
}
}
}
difficultyLevel = dt.Rows[i]["难度"].ToString();
var correctAnswer = string.Empty;
if (questionType != "Completion" && questionType != "ShortAnswer")
correctAnswer = dt.Rows[i]["正确答案"].ToString();
if (string.IsNullOrWhiteSpace(correctAnswer) && questionType != "Completion" && questionType != "ShortAnswer")
comments.Add("正确答案未标记!");
var questionAnalysis = dt.Rows[i]["解析"].ToString();
//if (string.IsNullOrWhiteSpace(difficultyLevel))
// comments.Add("难易程度必填!");
if (string.IsNullOrWhiteSpace(difficultyLevel))
comments.Add("难易程度必填!");
if (string.IsNullOrWhiteSpace(questionAnalysis))
comments.Add("题目解析必填!");
@ -972,12 +971,12 @@ public class Ghre_QuestionServices : BaseServices<Ghre_Question, Ghre_QuestionDt
}
}
//if (isExistError)
//{
// NPOIHelper.ExportExcel(dt, null, x, physicsPath + errorFileName);
// data.filePath = "/Advanced" + errorFileName;
// continue;
//}
if (isExistError)
{
NPOIHelper.ExportExcel(dt, null, x, physicsPath + errorFileName);
data.filePath = "/Advanced" + errorFileName;
continue;
}
for (int i = 0; i < dt.Rows.Count; i++)
{

Loading…
Cancel
Save