【修改】 选择题文件非空判断
This commit is contained in:
@@ -184,33 +184,35 @@ public class AutoToolsServiceImpl implements AutoToolsService{
|
||||
stuPaperFileDO = stuPaperFileDOs;
|
||||
}
|
||||
}
|
||||
// 1-1、 穿插选择题判分
|
||||
// 1-1-1、下载选择题文件
|
||||
String select_qu = downloadStudentFile(noZipFileDO.getUrl(), config.getValue());
|
||||
File select_file = new File(select_qu);
|
||||
// 1-1-2、读取内容转换成json
|
||||
String select_string = readFileAsString(select_file.getPath());
|
||||
Stu stu = stringToJson(select_string);
|
||||
// 1-1-3、进行选择题判分
|
||||
for (String key : stu.getQuestionResultMap().keySet()) {
|
||||
// 查询该题的成绩
|
||||
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuId, paperId, key);
|
||||
// 判断是否做过该题
|
||||
boolean isNull = false;
|
||||
if (stuPaperScoreDO == null) {
|
||||
stuPaperScoreDO = new StuPaperScoreDO();
|
||||
stuPaperScoreDO.setStuId(stuId);
|
||||
stuPaperScoreDO.setQuId(key);
|
||||
stuPaperScoreDO.setPaperId(paperId);
|
||||
isNull = true;
|
||||
// 判断选择题文件是否存在
|
||||
if (noZipFileDO != null) {
|
||||
// 1-1、 穿插选择题判分
|
||||
// 1-1-1、下载选择题文件
|
||||
String select_qu = downloadStudentFile(noZipFileDO.getUrl(), config.getValue());
|
||||
File select_file = new File(select_qu);
|
||||
// 1-1-2、读取内容转换成json
|
||||
String select_string = readFileAsString(select_file.getPath());
|
||||
Stu stu = stringToJson(select_string);
|
||||
// 1-1-3、进行选择题判分
|
||||
for (String key : stu.getQuestionResultMap().keySet()) {
|
||||
// 查询该题的成绩
|
||||
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuId, paperId, key);
|
||||
// 判断是否做过该题
|
||||
boolean isNull = false;
|
||||
if (stuPaperScoreDO == null) {
|
||||
stuPaperScoreDO = new StuPaperScoreDO();
|
||||
stuPaperScoreDO.setStuId(stuId);
|
||||
stuPaperScoreDO.setQuId(key);
|
||||
stuPaperScoreDO.setPaperId(paperId);
|
||||
isNull = true;
|
||||
}
|
||||
String value = stu.getQuestionResultMap().get(key);
|
||||
double selectScore = judgementChoiceService.programmingChoice(2.0, key, value, stuPaperScoreDO, isNull);
|
||||
score += selectScore;
|
||||
}
|
||||
String value = stu.getQuestionResultMap().get(key);
|
||||
double selectScore = judgementChoiceService.programmingChoice(2.0, key, value, stuPaperScoreDO, isNull);
|
||||
score += selectScore;
|
||||
// 1-1-4、删除文件
|
||||
select_file.delete();
|
||||
}
|
||||
// 1-1-4、删除文件
|
||||
select_file.delete();
|
||||
|
||||
// 2、判断文件路径是否存在
|
||||
if (stuPaperFileDO == null) {
|
||||
// return CommonResult.error(100031, "试题文件没有上传,无法判分!");
|
||||
|
Reference in New Issue
Block a user