导入模板修改

hehai
shijie 4 years ago
parent 38c044b1ee
commit f84c4e18a7
  1. 26
      src/main/java/com/msdw/tms/entity/request/QuestionsImportRequest.java
  2. BIN
      src/main/resources/excel-template/试题导入模板.xlsx
  3. 2
      src/test/java/com/msdw/tms/service/EvaluationRulesServiceTest.java
  4. 6
      src/test/java/com/msdw/tms/service/QuestionsServiceTest.java

@ -10,59 +10,55 @@ import lombok.Data;
*/
@Data
public class QuestionsImportRequest {
/**
* 试题科目
*/
@ExcelAttribute(sort = 0)
private String subjects;
/**
* 题干问题描述
*/
@ExcelAttribute(sort = 1)
@ExcelAttribute(sort = 0)
private String questionStem;
/**
* 题型
*/
@ExcelAttribute(sort = 2)
@ExcelAttribute(sort = 1)
private String questionType;
/**
* 选项A
*/
@ExcelAttribute(sort = 3)
@ExcelAttribute(sort = 2)
private String optionA;
/**
* 选项B
*/
@ExcelAttribute(sort = 4)
@ExcelAttribute(sort = 3)
private String optionB;
/**
* 选项C
*/
@ExcelAttribute(sort = 5)
@ExcelAttribute(sort = 4)
private String optionC;
/**
* 选项D
*/
@ExcelAttribute(sort = 6)
@ExcelAttribute(sort = 5)
private String optionD;
/**
* 选项E
*/
@ExcelAttribute(sort = 7)
@ExcelAttribute(sort = 6)
private String optionE;
/**
* 选项F
*/
@ExcelAttribute(sort = 8)
@ExcelAttribute(sort = 7)
private String optionF;
/**
* 正确答案
*/
@ExcelAttribute(sort = 9)
@ExcelAttribute(sort = 8)
private String answer;
/**
* 答案解析
*/
@ExcelAttribute(sort = 10)
@ExcelAttribute(sort = 9)
private String answerAnalysis;
}

@ -5,6 +5,7 @@ import com.msdw.tms.entity.vo.EvaluationRulesVO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.transaction.annotation.Transactional;
/**
* 测评规则信息记录只记录一条信息
@ -24,6 +25,7 @@ class EvaluationRulesServiceTest {
}
@Test
@Transactional
void updateEvaluationRulesById() {
EvaluationRulesEntity evaluationRules = new EvaluationRulesEntity();
boolean b = evaluationRulesService.updateEvaluationRulesById(evaluationRules);

@ -13,6 +13,7 @@ import org.apache.commons.io.IOUtils;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
@ -52,30 +53,35 @@ class QuestionsServiceTest {
}
@Test
@Transactional
void saveQuestion() {
QuestionsAddRequest questions = new QuestionsAddRequest();
System.out.println(questionsService.saveQuestion(questions));
}
@Test
@Transactional
void updateQuestionById() {
QuestionsUpdateRequest questions = new QuestionsUpdateRequest();
System.out.println(questionsService.updateQuestionById(questions));
}
@Test
@Transactional
void isnable() {
Integer id = 1;
System.out.println(questionsService.isnable(id));
}
@Test
@Transactional
void deleteByIds() {
List<Integer> asList = new ArrayList<>();
System.out.println(questionsService.deleteByIds(asList));
}
@Test
@Transactional
void importQuestion() throws IOException {
File file = new File("D:\\pic\\1.jpg");
FileItem fileItem = new DiskFileItem("file",

Loading…
Cancel
Save