导入模板修改

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

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

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

Loading…
Cancel
Save