mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-06 09:26:48 +08:00
试题管理模板修改
This commit is contained in:
@@ -170,7 +170,7 @@ public class ExamQuestionApi extends ApiBaseController {
|
|||||||
//从第二行开始获取数据
|
//从第二行开始获取数据
|
||||||
List<ExamQuestion> examQuestions1 = new ArrayList<>();
|
List<ExamQuestion> examQuestions1 = new ArrayList<>();
|
||||||
QuestionDto questionDto = new QuestionDto();
|
QuestionDto questionDto = new QuestionDto();
|
||||||
if(sheetAt.getRow(1).getCell(0).getStringCellValue().equals("标题(*)")){
|
if(sheetAt.getRow(1).getCell(0).getStringCellValue().equals("标题(*)") && !sheetAt.getRow(1).getCell(0).getStringCellValue().equals("")){
|
||||||
row = sheetAt.getRow(1);
|
row = sheetAt.getRow(1);
|
||||||
for (int i = 2;i<sheetAt.getPhysicalNumberOfRows();i++) {
|
for (int i = 2;i<sheetAt.getPhysicalNumberOfRows();i++) {
|
||||||
//获取每一行
|
//获取每一行
|
||||||
@@ -190,45 +190,56 @@ public class ExamQuestionApi extends ApiBaseController {
|
|||||||
if(row1.getCell(1).getStringCellValue().equals("多选题")){
|
if(row1.getCell(1).getStringCellValue().equals("多选题")){
|
||||||
examQuestion.setType(2);
|
examQuestion.setType(2);
|
||||||
}
|
}
|
||||||
examQuestion.setKnowledge(row1.getCell(2).getStringCellValue());
|
if(row1.getCell(2).getStringCellValue().equals("中")){
|
||||||
if(row1.getCell(3).getStringCellValue().equals("中")){
|
|
||||||
examQuestion.setDifficulty(2f);
|
examQuestion.setDifficulty(2f);
|
||||||
}
|
}else if(row1.getCell(2).getStringCellValue().equals("难")){
|
||||||
if(row1.getCell(3).getStringCellValue().equals("难")){
|
|
||||||
examQuestion.setDifficulty(3f);
|
examQuestion.setDifficulty(3f);
|
||||||
}
|
} else if(row1.getCell(2).getStringCellValue().equals("易")){
|
||||||
if(row1.getCell(3).getStringCellValue().equals("低")){
|
|
||||||
examQuestion.setDifficulty(1f);
|
examQuestion.setDifficulty(1f);
|
||||||
|
}else if(row1.getCell(2).getStringCellValue().equals("")){
|
||||||
|
examQuestion.setDifficulty(null);
|
||||||
}
|
}
|
||||||
Cell cell = row1.getCell(4);
|
Cell cell = row1.getCell(3);
|
||||||
cell.setCellType(CellType.STRING);
|
cell.setCellType(CellType.STRING);
|
||||||
|
|
||||||
// examQuestion.setDefaultScore(Float.valueOf(cell.getStringCellValue()));
|
// examQuestion.setDefaultScore(Float.valueOf(cell.getStringCellValue()));
|
||||||
|
|
||||||
//单选
|
//单选
|
||||||
if (!cell.getStringCellValue().contains(",")){
|
if (!cell.getStringCellValue().contains(",")){
|
||||||
examQuestion.setAnswer(row1.getCell(6).getStringCellValue());
|
examQuestion.setAnswer(row1.getCell(5).getStringCellValue());
|
||||||
examQuestion.setDefaultScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||||
Cell cell1 = row1.getCell(5, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
examQuestion.setDefaultScore(null);
|
||||||
|
}else {
|
||||||
|
examQuestion.setDefaultScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||||
|
}
|
||||||
|
Cell cell1 = row1.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
cell1.setCellType(CellType.STRING);
|
cell1.setCellType(CellType.STRING);
|
||||||
examQuestion.setAnalysis(cell1.getStringCellValue());
|
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||||
|
|
||||||
List<ExamOption> examOptions = new ArrayList<>();
|
List<ExamOption> examOptions = new ArrayList<>();
|
||||||
for (int j=7;j<=13;j++) {
|
for (int j=6;j<=12;j++) {
|
||||||
|
|
||||||
if(row1.getCell(j)!=null) {
|
if(row1.getCell(j)!=null) {
|
||||||
ExamOption examOption = new ExamOption();
|
ExamOption examOption = new ExamOption();
|
||||||
// 截取表头
|
// 截取表头
|
||||||
String substring = row.getCell(j).getStringCellValue().substring(3, 4);
|
String substring = row.getCell(j).getStringCellValue().substring(3, 4);
|
||||||
if (row1.getCell(6).getStringCellValue().contains(substring)) {
|
if (row1.getCell(5).getStringCellValue().contains(substring)) {
|
||||||
|
|
||||||
examOption.setIsAnswer(true);
|
examOption.setIsAnswer(true);
|
||||||
examOption.setScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||||
|
examOption.setScore(null);
|
||||||
|
}else {
|
||||||
|
examOption.setScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
examOption.setIsAnswer(false);
|
examOption.setIsAnswer(false);
|
||||||
}
|
}
|
||||||
if (examOption.getIsAnswer()) {
|
if (examOption.getIsAnswer()) {
|
||||||
examOption.setScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||||
|
examOption.setScore(null);
|
||||||
|
}else {
|
||||||
|
examOption.setScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
examOption.setOptions(row.getCell(j).getStringCellValue());
|
examOption.setOptions(row.getCell(j).getStringCellValue());
|
||||||
@@ -258,19 +269,19 @@ public class ExamQuestionApi extends ApiBaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
examQuestion.setDefaultScore(Float.valueOf(max));
|
examQuestion.setDefaultScore(Float.valueOf(max));
|
||||||
Cell cell1 = row1.getCell(5, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
Cell cell1 = row1.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
cell1.setCellType(CellType.STRING);
|
cell1.setCellType(CellType.STRING);
|
||||||
examQuestion.setAnalysis(cell1.getStringCellValue());
|
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||||
examQuestion.setAnswer(row1.getCell(6).getStringCellValue());
|
examQuestion.setAnswer(row1.getCell(5).getStringCellValue());
|
||||||
List<ExamOption> examOptions = new ArrayList<>();
|
List<ExamOption> examOptions = new ArrayList<>();
|
||||||
//A
|
//A
|
||||||
for (int j=7;j<=13;j++){
|
for (int j=6;j<=12;j++){
|
||||||
if(row1.getCell(j)!=null && StringUtil.isNotBlank(row1.getCell(j).getStringCellValue())){
|
if(row1.getCell(j)!=null && StringUtil.isNotBlank(row1.getCell(j).getStringCellValue())){
|
||||||
ExamOption examOption=new ExamOption();
|
ExamOption examOption=new ExamOption();
|
||||||
examOption.setOptions(row.getCell(j).getStringCellValue());
|
examOption.setOptions(row.getCell(j).getStringCellValue());
|
||||||
examOption.setContent(row1.getCell(j).getStringCellValue());
|
examOption.setContent(row1.getCell(j).getStringCellValue());
|
||||||
examOption.setIsAnswer(true);
|
examOption.setIsAnswer(true);
|
||||||
examOption.setScore(Float.valueOf(strings[j-7]));
|
examOption.setScore(Float.valueOf(strings[j-6]));
|
||||||
if(examOption!=null && StringUtil.isNotBlank(examOption.getContent())){
|
if(examOption!=null && StringUtil.isNotBlank(examOption.getContent())){
|
||||||
examOptions.add(examOption);
|
examOptions.add(examOption);
|
||||||
}
|
}
|
||||||
@@ -301,45 +312,56 @@ public class ExamQuestionApi extends ApiBaseController {
|
|||||||
if(row1.getCell(1).getStringCellValue().equals("多选题")){
|
if(row1.getCell(1).getStringCellValue().equals("多选题")){
|
||||||
examQuestion.setType(2);
|
examQuestion.setType(2);
|
||||||
}
|
}
|
||||||
examQuestion.setKnowledge(row1.getCell(2).getStringCellValue());
|
if(row1.getCell(2).getStringCellValue().equals("中")){
|
||||||
if(row1.getCell(3).getStringCellValue().equals("中")){
|
|
||||||
examQuestion.setDifficulty(2f);
|
examQuestion.setDifficulty(2f);
|
||||||
}
|
}else if(row1.getCell(2).getStringCellValue().equals("难")){
|
||||||
if(row1.getCell(3).getStringCellValue().equals("难")){
|
|
||||||
examQuestion.setDifficulty(3f);
|
examQuestion.setDifficulty(3f);
|
||||||
}
|
} else if(row1.getCell(2).getStringCellValue().equals("易")){
|
||||||
if(row1.getCell(3).getStringCellValue().equals("低")){
|
|
||||||
examQuestion.setDifficulty(1f);
|
examQuestion.setDifficulty(1f);
|
||||||
|
}else if(row1.getCell(2).getStringCellValue().equals("")){
|
||||||
|
examQuestion.setDifficulty(null);
|
||||||
}
|
}
|
||||||
Cell cell = row1.getCell(4);
|
Cell cell = row1.getCell(3);
|
||||||
cell.setCellType(CellType.STRING);
|
cell.setCellType(CellType.STRING);
|
||||||
|
|
||||||
// examQuestion.setDefaultScore(Float.valueOf(cell.getStringCellValue()));
|
// examQuestion.setDefaultScore(Float.valueOf(cell.getStringCellValue()));
|
||||||
|
|
||||||
//单选
|
//单选
|
||||||
if (!cell.getStringCellValue().contains(",")){
|
if (!cell.getStringCellValue().contains(",")){
|
||||||
examQuestion.setAnswer(row1.getCell(6).getStringCellValue());
|
examQuestion.setAnswer(row1.getCell(5).getStringCellValue());
|
||||||
examQuestion.setDefaultScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||||
Cell cell1 = row1.getCell(5, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
examQuestion.setDefaultScore(null);
|
||||||
|
}else {
|
||||||
|
examQuestion.setDefaultScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||||
|
}
|
||||||
|
Cell cell1 = row1.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
cell1.setCellType(CellType.STRING);
|
cell1.setCellType(CellType.STRING);
|
||||||
examQuestion.setAnalysis(cell1.getStringCellValue());
|
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||||
|
|
||||||
List<ExamOption> examOptions = new ArrayList<>();
|
List<ExamOption> examOptions = new ArrayList<>();
|
||||||
for (int j=7;j<=13;j++) {
|
for (int j=6;j<=12;j++) {
|
||||||
|
|
||||||
if(row1.getCell(j)!=null) {
|
if(row1.getCell(j)!=null) {
|
||||||
ExamOption examOption = new ExamOption();
|
ExamOption examOption = new ExamOption();
|
||||||
// 截取表头
|
// 截取表头
|
||||||
String substring = row.getCell(j).getStringCellValue().substring(3, 4);
|
String substring = row.getCell(j).getStringCellValue().substring(3, 4);
|
||||||
if (row1.getCell(6).getStringCellValue().contains(substring)) {
|
if (row1.getCell(5).getStringCellValue().contains(substring)) {
|
||||||
|
|
||||||
examOption.setIsAnswer(true);
|
examOption.setIsAnswer(true);
|
||||||
examOption.setScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||||
|
examOption.setScore(null);
|
||||||
|
}else {
|
||||||
|
examOption.setScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
examOption.setIsAnswer(false);
|
examOption.setIsAnswer(false);
|
||||||
}
|
}
|
||||||
if (examOption.getIsAnswer()) {
|
if (examOption.getIsAnswer()) {
|
||||||
examOption.setScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||||
|
examOption.setScore(null);
|
||||||
|
}else {
|
||||||
|
examOption.setScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
examOption.setOptions(row.getCell(j).getStringCellValue());
|
examOption.setOptions(row.getCell(j).getStringCellValue());
|
||||||
@@ -369,19 +391,19 @@ public class ExamQuestionApi extends ApiBaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
examQuestion.setDefaultScore(Float.valueOf(max));
|
examQuestion.setDefaultScore(Float.valueOf(max));
|
||||||
Cell cell1 = row1.getCell(5, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
Cell cell1 = row1.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
cell1.setCellType(CellType.STRING);
|
cell1.setCellType(CellType.STRING);
|
||||||
examQuestion.setAnalysis(cell1.getStringCellValue());
|
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||||
examQuestion.setAnswer(row1.getCell(6).getStringCellValue());
|
examQuestion.setAnswer(row1.getCell(5).getStringCellValue());
|
||||||
List<ExamOption> examOptions = new ArrayList<>();
|
List<ExamOption> examOptions = new ArrayList<>();
|
||||||
//A
|
//A
|
||||||
for (int j=7;j<=13;j++){
|
for (int j=6;j<=13;j++){
|
||||||
if(row1.getCell(j)!=null && StringUtil.isNotBlank(row1.getCell(j).getStringCellValue())){
|
if(row1.getCell(j)!=null && StringUtil.isNotBlank(row1.getCell(j).getStringCellValue())){
|
||||||
ExamOption examOption=new ExamOption();
|
ExamOption examOption=new ExamOption();
|
||||||
examOption.setOptions(row.getCell(j).getStringCellValue());
|
examOption.setOptions(row.getCell(j).getStringCellValue());
|
||||||
examOption.setContent(row1.getCell(j).getStringCellValue());
|
examOption.setContent(row1.getCell(j).getStringCellValue());
|
||||||
examOption.setIsAnswer(true);
|
examOption.setIsAnswer(true);
|
||||||
examOption.setScore(Float.valueOf(strings[j-7]));
|
examOption.setScore(Float.valueOf(strings[j-6]));
|
||||||
if(examOption!=null && StringUtil.isNotBlank(examOption.getContent())){
|
if(examOption!=null && StringUtil.isNotBlank(examOption.getContent())){
|
||||||
examOptions.add(examOption);
|
examOptions.add(examOption);
|
||||||
}
|
}
|
||||||
@@ -413,27 +435,30 @@ public class ExamQuestionApi extends ApiBaseController {
|
|||||||
ExamQuestion examQuestion1 = new ExamQuestion();
|
ExamQuestion examQuestion1 = new ExamQuestion();
|
||||||
examQuestion1.setTitle(row2.getCell(0).getStringCellValue());
|
examQuestion1.setTitle(row2.getCell(0).getStringCellValue());
|
||||||
examQuestion1.setType(3);
|
examQuestion1.setType(3);
|
||||||
examQuestion1.setKnowledge(row2.getCell(1).getStringCellValue());
|
System.out.println("1+++++++"+row2.getCell(1));
|
||||||
if(row2.getCell(2).getStringCellValue().equals("中")){
|
if(row2.getCell(1).getStringCellValue().equals("中")){
|
||||||
examQuestion1.setDifficulty(2f);
|
examQuestion1.setDifficulty(2f);
|
||||||
}
|
}else if(row2.getCell(1).getStringCellValue().equals("难")){
|
||||||
if(row2.getCell(2).getStringCellValue().equals("难")){
|
|
||||||
examQuestion1.setDifficulty(3f);
|
examQuestion1.setDifficulty(3f);
|
||||||
}
|
} else if(row2.getCell(1).getStringCellValue().equals("易")){
|
||||||
if(row2.getCell(2).getStringCellValue().equals("易")){
|
|
||||||
examQuestion1.setDifficulty(1f);
|
examQuestion1.setDifficulty(1f);
|
||||||
|
}else if(row2.getCell(1).getStringCellValue().equals("")){
|
||||||
|
examQuestion1.setDifficulty(null);
|
||||||
}
|
}
|
||||||
Cell cell1 = row2.getCell(3);
|
Cell cell1 = row2.getCell(2);
|
||||||
cell1.setCellType(CellType.STRING);
|
cell1.setCellType(CellType.STRING);
|
||||||
examQuestion1.setDefaultScore(Float.valueOf(cell1.getStringCellValue()));
|
if (row2.getCell(2).getStringCellValue().isEmpty()){
|
||||||
|
examQuestion1.setDefaultScore(null);
|
||||||
if(row2.getCell(4)!=null) {
|
}else {
|
||||||
examQuestion1.setAnalysis(row2.getCell(4).getStringCellValue());
|
examQuestion1.setDefaultScore(Float.valueOf(row2.getCell(2).getStringCellValue()));
|
||||||
|
}
|
||||||
|
if(row2.getCell(3)!=null) {
|
||||||
|
examQuestion1.setAnalysis(row2.getCell(3).getStringCellValue());
|
||||||
}else {
|
}else {
|
||||||
examQuestion1.setAnalysis("");
|
examQuestion1.setAnalysis("");
|
||||||
}
|
}
|
||||||
|
|
||||||
String cvalue=row2.getCell(5).getStringCellValue();
|
String cvalue=row2.getCell(4).getStringCellValue();
|
||||||
examQuestion1.setAnswer(cvalue.equals("正确")? "true":"false");
|
examQuestion1.setAnswer(cvalue.equals("正确")? "true":"false");
|
||||||
if(examQuestion1!=null){
|
if(examQuestion1!=null){
|
||||||
examQuestions2.add(examQuestion1);
|
examQuestions2.add(examQuestion1);
|
||||||
|
|||||||
Reference in New Issue
Block a user