diff --git a/src/main/java/com/sztzjy/resource_center/controller/api/ObjectiveApi.java b/src/main/java/com/sztzjy/resource_center/controller/api/ObjectiveApi.java index 0ae3662..5e12fb7 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/api/ObjectiveApi.java +++ b/src/main/java/com/sztzjy/resource_center/controller/api/ObjectiveApi.java @@ -300,25 +300,16 @@ public class ObjectiveApi { Cell cell10 = row.getCell(10); Cell cell11 = row.getCell(11); Cell cell12 = row.getCell(12); - if (cell0 == null) { - return false; - } - - String type = this.getCellValue(cell0);//题型 - if (type.equals("0") || type.equals("1")) { - if (cell1 == null || cell2 == null) { - return false; - } - } //判断题的BCDE选项和解析可能为空 - if (cell7 == null || cell8 == null || cell10 == null || cell11 == null || cell12 == null) { + if (cell0 == null || cell2 == null || cell3 == null || cell7 == null || cell8 == null || cell10 == null || cell11 == null || cell12 == null) { return false; } + String type = this.getCellValue(cell0);//题型 String content = this.getCellValue(cell1);//题干 - String a = cell2 != null ? this.getCellValue(cell2) : null; //选项A - String b = cell3 != null ? this.getCellValue(cell3) : null;//选项B + String a = this.getCellValue(cell2); //选项A + String b = this.getCellValue(cell3);//选项B String answer = this.getCellValue(cell7);//答案 String score = this.getCellValue(cell8);//分值 String oneName = this.getCellValue(cell10);//一级目录名称 @@ -334,38 +325,37 @@ public class ObjectiveApi { String topicId = IdUtil.randomUUID(); obj.setObjectiveId(topicId); obj.setContent(content); + obj.setAnswer(answer); + if (type.equals("单选题") || type.equals("单选")) { obj.setType("0"); } if (type.equals("多选题") || type.equals("多选")) { obj.setType("1"); } - - obj.setSource(schoolId); - obj.setQuestionA(a); - obj.setQuestionB(b); - obj.setQuestionC(c); - obj.setQuestionD(d); - obj.setQuestionE(e); - - obj.setAnswer(answer); if (type.equals("判断题") || type.equals("判断")) { obj.setType("2"); - if (answer.equals("A")){ + if (answer.equals("A")) { obj.setAnswer("对"); } - if (answer.equals("B")){ + if (answer.equals("B")) { obj.setAnswer("错"); } } + + obj.setSource(schoolId); + obj.setQuestionA(a); + obj.setQuestionB(b); + obj.setQuestionC(c); + obj.setQuestionD(d); + obj.setQuestionE(e); obj.setAnalysis(analyze); obj.setScore(BigDecimal.valueOf(Integer.parseInt(score))); obj.setCreateTime(new Date()); obj.setIsDelete(false); objectiveQuestionList.add(obj); - //判断名称是否被查出来过 String oneId = oneIdMap.get(oneName); if (oneId == null) {