|
@@ -83,14 +83,14 @@ public class ApplicationTest {
|
|
@Test
|
|
@Test
|
|
public void testGridFs() throws FileNotFoundException {
|
|
public void testGridFs() throws FileNotFoundException {
|
|
String fileName = "testXml";
|
|
String fileName = "testXml";
|
|
- String filePath = "/Users/songyue/Desktop/"+fileName+".xml";
|
|
|
|
|
|
+ String filePath = "/Users/songyue/Desktop/" + fileName + ".xml";
|
|
FileInputStream fileInputStream = new FileInputStream(new File(filePath));
|
|
FileInputStream fileInputStream = new FileInputStream(new File(filePath));
|
|
// gridFSUtil.save(fileInputStream,fileName);
|
|
// gridFSUtil.save(fileInputStream,fileName);
|
|
// gridFSUtil.getByFileName(fileName);
|
|
// gridFSUtil.getByFileName(fileName);
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
- public void testQuestion(){
|
|
|
|
|
|
+ public void testQuestion() {
|
|
Question question = new Question();
|
|
Question question = new Question();
|
|
question.setQuesBody("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /><style>.wordTd_disabled{border:solid windowtext 1pt;padding:0cm 5.4pt 0cm 5.4pt;} p{white-space:sWrap;word-wrap:break-word;} span{white-space:sWrap;word-wrap:break-word;}</style></head><body><p style=\"text-align:both;\"><span style=\"color:#000000;font-size:10pt;font-family:Times New Roman;\"><span style=\"font-style:normal;\"><span style=\"font-weight:normal;\">\n" +
|
|
question.setQuesBody("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /><style>.wordTd_disabled{border:solid windowtext 1pt;padding:0cm 5.4pt 0cm 5.4pt;} p{white-space:sWrap;word-wrap:break-word;} span{white-space:sWrap;word-wrap:break-word;}</style></head><body><p style=\"text-align:both;\"><span style=\"color:#000000;font-size:10pt;font-family:Times New Roman;\"><span style=\"font-style:normal;\"><span style=\"font-weight:normal;\">\n" +
|
|
"材料在外力作用下发生形变(套题题干)。\n" +
|
|
"材料在外力作用下发生形变(套题题干)。\n" +
|
|
@@ -100,11 +100,11 @@ public class ApplicationTest {
|
|
questionType.setQuesType(QuesStructType.NESTED_ANSWER_QUESTION);
|
|
questionType.setQuesType(QuesStructType.NESTED_ANSWER_QUESTION);
|
|
question.setQuestionType(QuesStructType.NESTED_ANSWER_QUESTION);
|
|
question.setQuestionType(QuesStructType.NESTED_ANSWER_QUESTION);
|
|
List<Question> subquestionList = new ArrayList<Question>();
|
|
List<Question> subquestionList = new ArrayList<Question>();
|
|
-
|
|
|
|
- for(int i=0;i < 10;i++){
|
|
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < 10; i++) {
|
|
Question subquestion = new Question();
|
|
Question subquestion = new Question();
|
|
subquestion.setQuesBody("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /><style>.wordTd_disabled{border:solid windowtext 1pt;padding:0cm 5.4pt 0cm 5.4pt;} p{white-space:sWrap;word-wrap:break-word;} span{white-space:sWrap;word-wrap:break-word;}</style></head><body><p style=\"text-align:both;\"><span style=\"color:#000000;font-size:10pt;font-family:Times New Roman;\"><span style=\"font-style:normal;\"><span style=\"font-weight:normal;\">\n" +
|
|
subquestion.setQuesBody("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /><style>.wordTd_disabled{border:solid windowtext 1pt;padding:0cm 5.4pt 0cm 5.4pt;} p{white-space:sWrap;word-wrap:break-word;} span{white-space:sWrap;word-wrap:break-word;}</style></head><body><p style=\"text-align:both;\"><span style=\"color:#000000;font-size:10pt;font-family:Times New Roman;\"><span style=\"font-style:normal;\"><span style=\"font-weight:normal;\">\n" +
|
|
- "材料在外力作用下发生形变,当外力撤消后能恢复原来大小和形状的性质称为(小题题干"+i+")。\n" +
|
|
|
|
|
|
+ "材料在外力作用下发生形变,当外力撤消后能恢复原来大小和形状的性质称为(小题题干" + i + ")。\n" +
|
|
"</span></span></span></p></body></html>");
|
|
"</span></span></span></p></body></html>");
|
|
subquestion.setQuesAnswer("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /><style>.wordTd_disabled{border:solid windowtext 1pt;padding:0cm 5.4pt 0cm 5.4pt;} p{white-space:sWrap;word-wrap:break-word;} span{white-space:sWrap;word-wrap:break-word;}</style></head><body><p style=\"text-align:both;\"><span style=\"color:#000000;font-size:10pt;font-family:Times New Roman;\"><span style=\"font-style:normal;\"><span style=\"font-weight:normal;\">\n" +
|
|
subquestion.setQuesAnswer("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /><style>.wordTd_disabled{border:solid windowtext 1pt;padding:0cm 5.4pt 0cm 5.4pt;} p{white-space:sWrap;word-wrap:break-word;} span{white-space:sWrap;word-wrap:break-word;}</style></head><body><p style=\"text-align:both;\"><span style=\"color:#000000;font-size:10pt;font-family:Times New Roman;\"><span style=\"font-style:normal;\"><span style=\"font-weight:normal;\">\n" +
|
|
"B\n" +
|
|
"B\n" +
|
|
@@ -127,18 +127,18 @@ public class ApplicationTest {
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
- public void testPaper(){
|
|
|
|
|
|
+ public void testPaper() {
|
|
paperRepo.deleteAll();
|
|
paperRepo.deleteAll();
|
|
paperDetailRepo.deleteAll();
|
|
paperDetailRepo.deleteAll();
|
|
paperDetailUnitRepo.deleteAll();
|
|
paperDetailUnitRepo.deleteAll();
|
|
|
|
|
|
- Paper paper = new Paper();
|
|
|
|
|
|
+ Paper paper = new Paper();
|
|
paper.setName("测试试卷");
|
|
paper.setName("测试试卷");
|
|
paper.setPaperDetailCount(1);
|
|
paper.setPaperDetailCount(1);
|
|
paper.setTitle("测试试卷");
|
|
paper.setTitle("测试试卷");
|
|
PaperDetail paperDetail = new PaperDetail();
|
|
PaperDetail paperDetail = new PaperDetail();
|
|
paperDetail.setName("选择题");
|
|
paperDetail.setName("选择题");
|
|
- paperDetail.setScore((double)20);
|
|
|
|
|
|
+ paperDetail.setScore((double) 20);
|
|
paperDetail.setNumber(1);
|
|
paperDetail.setNumber(1);
|
|
paperDetail.setPaper(paper);
|
|
paperDetail.setPaper(paper);
|
|
QuestionType questionType1 = new QuestionType();
|
|
QuestionType questionType1 = new QuestionType();
|
|
@@ -152,13 +152,13 @@ public class ApplicationTest {
|
|
|
|
|
|
List<Question> questionList = quesRepo.findAll();
|
|
List<Question> questionList = quesRepo.findAll();
|
|
int i = 0;
|
|
int i = 0;
|
|
- for(Question ques:questionList){
|
|
|
|
|
|
+ for (Question ques : questionList) {
|
|
PaperDetailUnit paperDetailUnit = new PaperDetailUnit();
|
|
PaperDetailUnit paperDetailUnit = new PaperDetailUnit();
|
|
paperDetailUnit.setQuestionType(ques.getQuestionType());
|
|
paperDetailUnit.setQuestionType(ques.getQuestionType());
|
|
paperDetailUnit.setNumber(i);
|
|
paperDetailUnit.setNumber(i);
|
|
paperDetailUnit.setPaper(paper);
|
|
paperDetailUnit.setPaper(paper);
|
|
paperDetailUnit.setPaperDetail(paperDetail);
|
|
paperDetailUnit.setPaperDetail(paperDetail);
|
|
- paperDetailUnit.setScore((double)10);
|
|
|
|
|
|
+ paperDetailUnit.setScore((double) 10);
|
|
paperDetailUnit.setQuestion(ques);
|
|
paperDetailUnit.setQuestion(ques);
|
|
i++;
|
|
i++;
|
|
paperDetailUnitRepo.save(paperDetailUnit);
|
|
paperDetailUnitRepo.save(paperDetailUnit);
|
|
@@ -166,11 +166,11 @@ public class ApplicationTest {
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
- public void testExtract(){
|
|
|
|
|
|
+ public void testExtract() {
|
|
extractConfigRepo.deleteAll();
|
|
extractConfigRepo.deleteAll();
|
|
examPaperRepo.deleteAll();
|
|
examPaperRepo.deleteAll();
|
|
ExamPaper examPaper = new ExamPaper();
|
|
ExamPaper examPaper = new ExamPaper();
|
|
- examPaper.setExamId((long)1);
|
|
|
|
|
|
+ examPaper.setExamId((long) 1);
|
|
examPaper.setCourseCode("1");
|
|
examPaper.setCourseCode("1");
|
|
examPaper.setExtractCount(1);
|
|
examPaper.setExtractCount(1);
|
|
examPaper.setGroupCode("1");
|
|
examPaper.setGroupCode("1");
|
|
@@ -178,14 +178,14 @@ public class ApplicationTest {
|
|
examPaperRepo.save(examPaper);
|
|
examPaperRepo.save(examPaper);
|
|
|
|
|
|
ExtractConfig extractConfig = new ExtractConfig();
|
|
ExtractConfig extractConfig = new ExtractConfig();
|
|
- extractConfig.setExamId((long)1);
|
|
|
|
|
|
+ extractConfig.setExamId((long) 1);
|
|
extractConfig.setCourseCode("1");
|
|
extractConfig.setCourseCode("1");
|
|
extractConfig.setPolicy(ExtractPolicy.RANDOM_POLICY);
|
|
extractConfig.setPolicy(ExtractPolicy.RANDOM_POLICY);
|
|
extractConfigRepo.save(extractConfig);
|
|
extractConfigRepo.save(extractConfig);
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
- public void testImport(){
|
|
|
|
|
|
+ public void testImport() {
|
|
paperRepo.deleteAll();
|
|
paperRepo.deleteAll();
|
|
paperDetailRepo.deleteAll();
|
|
paperDetailRepo.deleteAll();
|
|
quesRepo.deleteAll();
|
|
quesRepo.deleteAll();
|
|
@@ -221,9 +221,9 @@ public class ApplicationTest {
|
|
// System.out.println("程序运行时间:" + (endTime - startTime)/1000 + "s"); //输出程序运行时间
|
|
// System.out.println("程序运行时间:" + (endTime - startTime)/1000 + "s"); //输出程序运行时间
|
|
// }
|
|
// }
|
|
|
|
|
|
- @SuppressWarnings({ "unused", "resource" })
|
|
|
|
- @Test
|
|
|
|
- public void testImport1(){
|
|
|
|
|
|
+ @SuppressWarnings({"unused", "resource"})
|
|
|
|
+ @Test
|
|
|
|
+ public void testImport1() {
|
|
String inputFilePath = "/Users/songyue/docxImport/ceshi2.docx";
|
|
String inputFilePath = "/Users/songyue/docxImport/ceshi2.docx";
|
|
String outFilePath = "/Users/songyue/docxImport/ceshi11111.docx";
|
|
String outFilePath = "/Users/songyue/docxImport/ceshi11111.docx";
|
|
try {
|
|
try {
|
|
@@ -232,33 +232,33 @@ public class ApplicationTest {
|
|
System.out.println(inputFilePath);
|
|
System.out.println(inputFilePath);
|
|
WordprocessingMLPackage wordMLPackage = Docx4J.load(inputFile);
|
|
WordprocessingMLPackage wordMLPackage = Docx4J.load(inputFile);
|
|
DocxProcessUtil.initPkgImage(wordMLPackage);
|
|
DocxProcessUtil.initPkgImage(wordMLPackage);
|
|
- Docx4J.save(wordMLPackage,new FileOutputStream(outFilePath));
|
|
|
|
|
|
+ Docx4J.save(wordMLPackage, new FileOutputStream(outFilePath));
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
- public void testCourse(){
|
|
|
|
- Map<String,String> params = new HashMap<String,String>();
|
|
|
|
- params.put("courseNo","03013750");
|
|
|
|
- params.put("courseName","专升本《合同法》");
|
|
|
|
|
|
+ public void testCourse() {
|
|
|
|
+ Map<String, String> params = new HashMap<String, String>();
|
|
|
|
+ params.put("courseNo", "03013750");
|
|
|
|
+ params.put("courseName", "专升本《合同法》");
|
|
// List<Paper> papers = paperRepo.findByParams(params);
|
|
// List<Paper> papers = paperRepo.findByParams(params);
|
|
- Page<Paper> papers = paperRepo.findByPaperType(PaperType.IMPORT,new PageRequest(0,10));
|
|
|
|
|
|
+ Page<Paper> papers = paperRepo.findByPaperType(PaperType.IMPORT, new PageRequest(0, 10));
|
|
System.out.println(papers.getTotalElements());
|
|
System.out.println(papers.getTotalElements());
|
|
// System.out.println(gson.toJson(papers));
|
|
// System.out.println(gson.toJson(papers));
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
- public void testCourse1(){
|
|
|
|
|
|
+ public void testCourse1() {
|
|
List<Question> questions = quesRepo.findAll();
|
|
List<Question> questions = quesRepo.findAll();
|
|
List<Question> saveQues = new ArrayList<>();
|
|
List<Question> saveQues = new ArrayList<>();
|
|
- for(Question question:questions){
|
|
|
|
|
|
+ for (Question question : questions) {
|
|
//Course course = courseRepo.findFirstByCodeAndOrgId(question.getCourseNo(),question.getOrgId());
|
|
//Course course = courseRepo.findFirstByCodeAndOrgId(question.getCourseNo(),question.getOrgId());
|
|
- Course course = courseService.getCourse(Long.valueOf(question.getOrgId()),question.getCourseNo());
|
|
|
|
- if(course != null){
|
|
|
|
|
|
+ Course course = courseService.getCourse(Long.valueOf(question.getOrgId()), question.getCourseNo());
|
|
|
|
+ if (course != null) {
|
|
question.setCourseLevel(course.getLevel());
|
|
question.setCourseLevel(course.getLevel());
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
question.setCourseLevel(CourseLevel.ALL.name());
|
|
question.setCourseLevel(CourseLevel.ALL.name());
|
|
}
|
|
}
|
|
saveQues.add(question);
|
|
saveQues.add(question);
|
|
@@ -267,40 +267,40 @@ public class ApplicationTest {
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
- public void testCourse2(){
|
|
|
|
|
|
+ public void testCourse2() {
|
|
List<Question> questions = quesRepo.findAll();
|
|
List<Question> questions = quesRepo.findAll();
|
|
List<Question> saveQues = new ArrayList<>();
|
|
List<Question> saveQues = new ArrayList<>();
|
|
- for(Question question:questions){
|
|
|
|
|
|
+ for (Question question : questions) {
|
|
//Course course = courseRepo.findFirstByCodeAndOrgId(question.getCourseNo(),question.getOrgId());
|
|
//Course course = courseRepo.findFirstByCodeAndOrgId(question.getCourseNo(),question.getOrgId());
|
|
- Course course = courseService.getCourse(Long.valueOf(question.getOrgId()),question.getCourseNo());
|
|
|
|
- question.setCourse(course);
|
|
|
|
|
|
+ Course course = courseService.getCourse(Long.valueOf(question.getOrgId()), question.getCourseNo());
|
|
|
|
+ question.setCourse(course);
|
|
saveQues.add(question);
|
|
saveQues.add(question);
|
|
}
|
|
}
|
|
quesRepo.saveAll(saveQues);
|
|
quesRepo.saveAll(saveQues);
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
- public void testCourse3(){
|
|
|
|
|
|
+ public void testCourse3() {
|
|
List<Paper> papers = paperRepo.findAll();
|
|
List<Paper> papers = paperRepo.findAll();
|
|
List<Paper> savePaper = new ArrayList<>();
|
|
List<Paper> savePaper = new ArrayList<>();
|
|
- for(Paper paper:papers){
|
|
|
|
|
|
+ for (Paper paper : papers) {
|
|
//Course course = courseRepo.findFirstByCodeAndOrgId(paper.getCourseNo(),paper.getOrgId());
|
|
//Course course = courseRepo.findFirstByCodeAndOrgId(paper.getCourseNo(),paper.getOrgId());
|
|
- Course course = courseService.getCourse(Long.valueOf(paper.getOrgId()),paper.getCourseNo());
|
|
|
|
- paper.setCourse(course);
|
|
|
|
|
|
+ Course course = courseService.getCourse(Long.valueOf(paper.getOrgId()), paper.getCourseNo());
|
|
|
|
+ paper.setCourse(course);
|
|
savePaper.add(paper);
|
|
savePaper.add(paper);
|
|
}
|
|
}
|
|
paperRepo.saveAll(savePaper);
|
|
paperRepo.saveAll(savePaper);
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
- public void testCourse7(){
|
|
|
|
|
|
+ public void testCourse7() {
|
|
List<Course> courses = new ArrayList<Course>();
|
|
List<Course> courses = new ArrayList<Course>();
|
|
- for(Course course:courses){
|
|
|
|
- if(course != null){
|
|
|
|
- if(course.getEnable().equals("1")){
|
|
|
|
|
|
+ for (Course course : courses) {
|
|
|
|
+ if (course != null) {
|
|
|
|
+ if (course.getEnable().equals("1")) {
|
|
course.setEnable("true");
|
|
course.setEnable("true");
|
|
}
|
|
}
|
|
- if(course.getEnable().equals("0")){
|
|
|
|
|
|
+ if (course.getEnable().equals("0")) {
|
|
course.setEnable("false");
|
|
course.setEnable("false");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -309,38 +309,38 @@ public class ApplicationTest {
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
- public void testCourse6(){
|
|
|
|
|
|
+ public void testCourse6() {
|
|
List<ExtractConfig> configs = extractConfigRepo.findAll();
|
|
List<ExtractConfig> configs = extractConfigRepo.findAll();
|
|
- for(ExtractConfig config:configs){
|
|
|
|
|
|
+ for (ExtractConfig config : configs) {
|
|
//Course course = courseRepo.findFirstByCodeAndOrgId(config.getCourseCode(),config.getOrgId());
|
|
//Course course = courseRepo.findFirstByCodeAndOrgId(config.getCourseCode(),config.getOrgId());
|
|
- Course course = courseService.getCourse(Long.valueOf(config.getOrgId()),config.getCourseCode());
|
|
|
|
|
|
+ Course course = courseService.getCourse(Long.valueOf(config.getOrgId()), config.getCourseCode());
|
|
config.setCourse(course);
|
|
config.setCourse(course);
|
|
}
|
|
}
|
|
extractConfigRepo.saveAll(configs);
|
|
extractConfigRepo.saveAll(configs);
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
- public void testCourse5(){
|
|
|
|
|
|
+ public void testCourse5() {
|
|
List<Question> questions = quesRepo.findAll();
|
|
List<Question> questions = quesRepo.findAll();
|
|
List<Paper> papers = paperRepo.findAll();
|
|
List<Paper> papers = paperRepo.findAll();
|
|
- for(Question question:questions){
|
|
|
|
|
|
+ for (Question question : questions) {
|
|
Course course = question.getCourse();
|
|
Course course = question.getCourse();
|
|
- if(course != null){
|
|
|
|
- if(course.getEnable().equals("1")){
|
|
|
|
|
|
+ if (course != null) {
|
|
|
|
+ if (course.getEnable().equals("1")) {
|
|
course.setEnable("true");
|
|
course.setEnable("true");
|
|
}
|
|
}
|
|
- if(course.getEnable().equals("0")){
|
|
|
|
|
|
+ if (course.getEnable().equals("0")) {
|
|
course.setEnable("false");
|
|
course.setEnable("false");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- for(Paper paper:papers){
|
|
|
|
|
|
+ for (Paper paper : papers) {
|
|
Course course = paper.getCourse();
|
|
Course course = paper.getCourse();
|
|
- if(course != null){
|
|
|
|
- if(course.getEnable().equals("1")){
|
|
|
|
|
|
+ if (course != null) {
|
|
|
|
+ if (course.getEnable().equals("1")) {
|
|
course.setEnable("true");
|
|
course.setEnable("true");
|
|
}
|
|
}
|
|
- if(course.getEnable().equals("0")){
|
|
|
|
|
|
+ if (course.getEnable().equals("0")) {
|
|
course.setEnable("false");
|
|
course.setEnable("false");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -350,10 +350,10 @@ public class ApplicationTest {
|
|
}
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unused")
|
|
@SuppressWarnings("unused")
|
|
- @Test
|
|
|
|
- public void testCourse4(){
|
|
|
|
|
|
+ @Test
|
|
|
|
+ public void testCourse4() {
|
|
//Course course = courseRepo.findFirstByCodeAndOrgId("010048","1");
|
|
//Course course = courseRepo.findFirstByCodeAndOrgId("010048","1");
|
|
- Course course = courseService.getCourse(Long.valueOf("010048"),"1");
|
|
|
|
|
|
+ Course course = courseService.getCourse(Long.valueOf("010048"), "1");
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|