|
|
@ -7,6 +7,7 @@ import com.sztzjy.resource_center.entity.*;
|
|
|
|
import com.sztzjy.resource_center.entity.dto.SysObjectiveQuestionsDto;
|
|
|
|
import com.sztzjy.resource_center.entity.dto.SysObjectiveQuestionsDto;
|
|
|
|
import com.sztzjy.resource_center.mapper.*;
|
|
|
|
import com.sztzjy.resource_center.mapper.*;
|
|
|
|
import com.sztzjy.resource_center.util.PageUtil;
|
|
|
|
import com.sztzjy.resource_center.util.PageUtil;
|
|
|
|
|
|
|
|
import com.sztzjy.resource_center.util.ResultEntity;
|
|
|
|
import com.sztzjy.resource_center.util.file.IFileUtil;
|
|
|
|
import com.sztzjy.resource_center.util.file.IFileUtil;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
@ -17,6 +18,7 @@ import org.apache.poi.ss.usermodel.*;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
@ -298,60 +300,97 @@ public class ObjectiveApi {
|
|
|
|
Cell cell10 = row.getCell(10);
|
|
|
|
Cell cell10 = row.getCell(10);
|
|
|
|
Cell cell11 = row.getCell(11);
|
|
|
|
Cell cell11 = row.getCell(11);
|
|
|
|
Cell cell12 = row.getCell(12);
|
|
|
|
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选项和解析可能为空
|
|
|
|
//判断题的BCDE选项和解析可能为空
|
|
|
|
if (cell0 == null || cell1 == null || cell2 == null || cell6 == null || cell7 == null || cell9 == null) {
|
|
|
|
if (cell7 == null || cell8 == null || cell10 == null || cell11 == null || cell12 == null) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String content = this.getCellValue(cell0);//题干
|
|
|
|
String content = this.getCellValue(cell1);//题干
|
|
|
|
String a = this.getCellValue(cell1); //选项A
|
|
|
|
String a = cell2 != null ? this.getCellValue(cell2) : null; //选项A
|
|
|
|
String b = this.getCellValue(cell2);//选项B
|
|
|
|
String b = cell3 != null ? this.getCellValue(cell3) : null;//选项B
|
|
|
|
String type = this.getCellValue(cell6);//题型
|
|
|
|
|
|
|
|
String answer = this.getCellValue(cell7);//答案
|
|
|
|
String answer = this.getCellValue(cell7);//答案
|
|
|
|
String score = this.getCellValue(cell9);//分值
|
|
|
|
String score = this.getCellValue(cell8);//分值
|
|
|
|
String oneName = this.getCellValue(cell10);//一级目录名称
|
|
|
|
String oneName = this.getCellValue(cell10);//一级目录名称
|
|
|
|
String twoName = this.getCellValue(cell11);//二级目录名称
|
|
|
|
String twoName = this.getCellValue(cell11);//二级目录名称
|
|
|
|
String threeName = this.getCellValue(cell12);//三级目录名称
|
|
|
|
String threeName = this.getCellValue(cell12);//三级目录名称
|
|
|
|
String c = cell3 != null ? this.getCellValue(cell3) : null;
|
|
|
|
String c = cell4 != null ? this.getCellValue(cell4) : null;
|
|
|
|
String d = cell4 != null ? this.getCellValue(cell4) : null;
|
|
|
|
String d = cell5 != null ? this.getCellValue(cell5) : null;
|
|
|
|
String e = cell5 != null ? this.getCellValue(cell5) : null;
|
|
|
|
String e = cell6 != null ? this.getCellValue(cell6) : null;
|
|
|
|
String analyze = cell8 != null ? this.getCellValue(cell8) : null;
|
|
|
|
String analyze = cell9 != null ? this.getCellValue(cell9) : null; //答案解析
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SysObjectiveQuestions obj = new SysObjectiveQuestions();
|
|
|
|
SysObjectiveQuestions obj = new SysObjectiveQuestions();
|
|
|
|
String topicId = IdUtil.randomUUID();
|
|
|
|
String topicId = IdUtil.randomUUID();
|
|
|
|
obj.setObjectiveId(topicId);
|
|
|
|
obj.setObjectiveId(topicId);
|
|
|
|
obj.setContent(content);
|
|
|
|
obj.setContent(content);
|
|
|
|
obj.setType(type);
|
|
|
|
if (type.equals("单选题") || type.equals("单选")) {
|
|
|
|
|
|
|
|
obj.setType("0");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type.equals("多选题") || type.equals("多选")) {
|
|
|
|
|
|
|
|
obj.setType("1");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
obj.setSource(schoolId);
|
|
|
|
obj.setSource(schoolId);
|
|
|
|
obj.setQuestionA(a);
|
|
|
|
obj.setQuestionA(a);
|
|
|
|
obj.setQuestionB(b);
|
|
|
|
obj.setQuestionB(b);
|
|
|
|
obj.setQuestionC(c);
|
|
|
|
obj.setQuestionC(c);
|
|
|
|
obj.setQuestionD(d);
|
|
|
|
obj.setQuestionD(d);
|
|
|
|
obj.setQuestionE(e);
|
|
|
|
obj.setQuestionE(e);
|
|
|
|
|
|
|
|
|
|
|
|
obj.setAnswer(answer);
|
|
|
|
obj.setAnswer(answer);
|
|
|
|
|
|
|
|
if (type.equals("判断题") || type.equals("判断")) {
|
|
|
|
|
|
|
|
obj.setType("2");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (answer.equals("A")){
|
|
|
|
|
|
|
|
obj.setAnswer("对");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (answer.equals("B")){
|
|
|
|
|
|
|
|
obj.setAnswer("错");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
obj.setAnalysis(analyze);
|
|
|
|
obj.setAnalysis(analyze);
|
|
|
|
obj.setScore(BigDecimal.valueOf(Integer.parseInt(score)));
|
|
|
|
obj.setScore(BigDecimal.valueOf(Integer.parseInt(score)));
|
|
|
|
obj.setCreateTime(new Date());
|
|
|
|
obj.setCreateTime(new Date());
|
|
|
|
obj.setIsDelete(false);
|
|
|
|
obj.setIsDelete(false);
|
|
|
|
objectiveQuestionList.add(obj);
|
|
|
|
objectiveQuestionList.add(obj);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断名称是否被查出来过
|
|
|
|
//判断名称是否被查出来过
|
|
|
|
String oneId = oneIdMap.get(oneName);
|
|
|
|
String oneId = oneIdMap.get(oneName);
|
|
|
|
if (oneId == null) {
|
|
|
|
if (oneId == null) {
|
|
|
|
oneId = oneCatalogMapper.getIdByName(oneName);
|
|
|
|
oneId = oneCatalogMapper.getIdByName(oneName);
|
|
|
|
|
|
|
|
if (oneId == null) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
oneIdMap.put(oneName, oneId);
|
|
|
|
oneIdMap.put(oneName, oneId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String twoId = twoIdMap.get(twoName);
|
|
|
|
String twoId = twoIdMap.get(twoName);
|
|
|
|
if (twoId == null) {
|
|
|
|
if (twoId == null) {
|
|
|
|
twoId = sysTwoCatalogMapper.getIdByName(twoName);
|
|
|
|
twoId = sysTwoCatalogMapper.getIdByName(twoName);
|
|
|
|
|
|
|
|
if (twoId == null) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
twoIdMap.put(twoName, twoId);
|
|
|
|
twoIdMap.put(twoName, twoId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String threeId = threeIdMap.get(threeName);
|
|
|
|
String threeId = threeIdMap.get(threeName);
|
|
|
|
if (threeId == null) {
|
|
|
|
if (threeId == null) {
|
|
|
|
threeId = sysThreeCatalogMapper.getIdByName(threeName,twoName);
|
|
|
|
threeId = sysThreeCatalogMapper.getIdByName(oneId, twoId, threeName);
|
|
|
|
|
|
|
|
if (threeId == null) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
threeIdMap.put(threeName, threeId);
|
|
|
|
threeIdMap.put(threeName, threeId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|