Merge remote-tracking branch 'java-servse-yx/zcwy0912-llf' into zcwy0912-llf

This commit is contained in:
zhaolongfei
2024-10-21 11:07:47 +08:00
2 changed files with 23 additions and 18 deletions

View File

@@ -354,17 +354,17 @@ public class AloneExamApi extends ApiBaseController {
if(StringUtils.isBlank(paperJson)) { if(StringUtils.isBlank(paperJson)) {
return badRequest("此考试无试卷内容,考试已经过期或试卷已被删除"); return badRequest("此考试无试卷内容,考试已经过期或试卷已被删除");
} }
} try {
try { List<TestQuestionVo> qlist=this.randomQuestion(examTest, paperJson);
List<TestQuestionVo> qlist=this.randomQuestion(examTest, paperJson); ObjectMapper objectMapper = new ObjectMapper();
ObjectMapper objectMapper = new ObjectMapper(); paperJson=objectMapper.writeValueAsString(qlist);
paperJson=objectMapper.writeValueAsString(qlist); } catch (XaskException e) {
} catch (XaskException e) { log.error("生成试卷错误",e);
log.error("生成试卷错误",e); return error("生成考试试卷错误",e.getMessage(),map);
return error("生成考试试卷错误",e.getMessage(),map); } catch (JsonProcessingException e) {
} catch (JsonProcessingException e) { log.error("生成试卷解析生成json错误",e);
log.error("生成试卷解析生成json错误",e); return error("生成考试试卷解析错误",e.getMessage(),map);
return error("生成考试试卷解析错误",e.getMessage(),map); }
} }
map.put("paper", paperJson); map.put("paper", paperJson);
long end=System.currentTimeMillis(); long end=System.currentTimeMillis();

View File

@@ -312,14 +312,19 @@ public class ExamQuestionApi extends ApiBaseController {
if(row1.getCell(1).getStringCellValue().equals("多选题")){ if(row1.getCell(1).getStringCellValue().equals("多选题")){
examQuestion.setType(2); examQuestion.setType(2);
} }
if(row1.getCell(2).getStringCellValue().equals("")){ log.debug("row1.getCell(2) = " + row1.getCell(2));
examQuestion.setDifficulty(2f); if (row1.getCell(2)==null ||row1.getCell(2).getStringCellValue() == null || row1.getCell(2).getStringCellValue().equals("")){
}else if(row1.getCell(2).getStringCellValue().equals("")){
examQuestion.setDifficulty(3f);
} else if(row1.getCell(2).getStringCellValue().equals("")){
examQuestion.setDifficulty(1f);
}else if(row1.getCell(2).getStringCellValue().equals("")){
examQuestion.setDifficulty(null); examQuestion.setDifficulty(null);
}else{
if( row1.getCell(2).getStringCellValue().equals("")){
examQuestion.setDifficulty(2f);
}else if(row1.getCell(2).getStringCellValue().equals("")){
examQuestion.setDifficulty(3f);
} else if(row1.getCell(2).getStringCellValue().equals("")){
examQuestion.setDifficulty(1f);
}else if(row1.getCell(2).getStringCellValue().equals("")){
examQuestion.setDifficulty(null);
}
} }
Cell cell = row1.getCell(3); Cell cell = row1.getCell(3);
cell.setCellType(CellType.STRING); cell.setCellType(CellType.STRING);