Commit c6a8c4095d3c4bc39b165fa8adf33d98a0b96c1c
1 parent
54c3da43
Exists in
master
试卷导入
Showing
25 changed files
with
978 additions
and
24 deletions
Show diff stats
src/main/java/com/jevon/controller/LearnController.java
1 | 1 | package com.jevon.controller; |
2 | 2 | |
3 | +import com.jevon.enums.DifficultEnums; | |
4 | +import com.jevon.enums.DimensionalEnums; | |
3 | 5 | import com.jevon.model.*; |
6 | +import com.jevon.service.AnalyseDetailService; | |
7 | +import com.jevon.service.AnalyseDimensionalService; | |
8 | +import com.jevon.service.AnalyseService; | |
9 | +import com.jevon.service.DimensionalService; | |
4 | 10 | import com.jevon.vo.BaseVo; |
11 | +import com.jevon.vo.excel.ExamExcelVo; | |
5 | 12 | import com.jevon.vo.req.InitAnalyseReqVo; |
6 | 13 | import io.swagger.annotations.Api; |
14 | +import io.swagger.annotations.ApiOperation; | |
7 | 15 | import org.apache.commons.lang3.StringUtils; |
8 | 16 | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
9 | 17 | import org.apache.poi.ss.usermodel.*; |
10 | 18 | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
19 | +import org.springframework.beans.factory.annotation.Autowired; | |
11 | 20 | import org.springframework.web.bind.annotation.RequestBody; |
12 | 21 | import org.springframework.web.bind.annotation.RequestMapping; |
22 | +import org.springframework.web.bind.annotation.RequestMethod; | |
13 | 23 | import org.springframework.web.bind.annotation.RestController; |
14 | 24 | |
15 | 25 | import java.io.File; |
... | ... | @@ -26,11 +36,31 @@ import java.util.*; |
26 | 36 | @Api(value = "学情分析") |
27 | 37 | public class LearnController { |
28 | 38 | |
39 | + @Autowired | |
40 | + AnalyseService analyseService; | |
29 | 41 | |
42 | + @Autowired | |
43 | + DimensionalService dimensionalService; | |
44 | + | |
45 | + @Autowired | |
46 | + AnalyseDimensionalService analyseDimensionalService; | |
47 | + | |
48 | + @Autowired | |
49 | + AnalyseDetailService analyseDetailService; | |
50 | + | |
51 | + @ApiOperation("试卷信息导入") | |
52 | + @RequestMapping(value = "initAnalyse", method = RequestMethod.POST) | |
30 | 53 | public BaseVo initAnalyse(@RequestBody InitAnalyseReqVo initAnalyseReqVo){ |
31 | 54 | BaseVo baseVo = new BaseVo(); |
32 | - Date date = new Date(); | |
55 | + analysisExcel(initAnalyseReqVo); | |
56 | + return baseVo; | |
57 | + } | |
58 | + | |
59 | + private void analysisExcel(InitAnalyseReqVo initAnalyseReqVo){ | |
33 | 60 | try{ |
61 | + List<AnalyseDetail> analyseDetails = new ArrayList<>(); | |
62 | + List<AnalyseDimensional> analyseDimensionals = new ArrayList<>(); | |
63 | + Analyse analyse = analyseService.selectById(initAnalyseReqVo.getAnalyseId()); | |
34 | 64 | String fileUrl = initAnalyseReqVo.getUrl(); |
35 | 65 | File excelFile = new File(fileUrl); |
36 | 66 | // 获得工作簿 |
... | ... | @@ -43,9 +73,8 @@ public class LearnController { |
43 | 73 | } |
44 | 74 | // 获得工作表 |
45 | 75 | Sheet sheet = workbook.getSheetAt(0); |
76 | + Date date = new Date(); | |
46 | 77 | int rows = sheet.getPhysicalNumberOfRows(); |
47 | - int column = 0 ; | |
48 | - int courseNumber = 0; | |
49 | 78 | for (int i = 0; i < rows; i++) { |
50 | 79 | // 获取第i行数据 |
51 | 80 | Row sheetRow = sheet.getRow(i); |
... | ... | @@ -54,24 +83,63 @@ public class LearnController { |
54 | 83 | String title = sheetRow.getCell(0).getStringCellValue().trim(); |
55 | 84 | }else if(i == 1){ |
56 | 85 | //获取表头 |
57 | - int j = 0 ; | |
58 | - while (sheetRow.getCell(j) != null && StringUtils.isNotBlank(sheetRow.getCell(j).getStringCellValue().trim())) { | |
59 | - j++ ; | |
60 | - } | |
61 | - column = j ; | |
62 | 86 | } else { |
63 | - for (int j = 0; j < column; j++) { | |
64 | - Cell cell = sheetRow.getCell(j); | |
65 | - if(cell != null){ | |
66 | - cell.setCellType(CellType.STRING); | |
67 | - } | |
87 | + ExamExcelVo examExcelVo = new ExamExcelVo(sheetRow); | |
88 | + AnalyseDetail analyseDetail = new AnalyseDetail(); | |
89 | + String questionNumber = null ; | |
90 | + if(StringUtils.isNotBlank(examExcelVo.getQuestionSmallNumber())){ | |
91 | + questionNumber = examExcelVo.getQuestionNumber()+"("+examExcelVo.getQuestionSmallNumber()+")"; | |
92 | + }else { | |
93 | + questionNumber = examExcelVo.getQuestionNumber() ; | |
68 | 94 | } |
95 | + analyseDetail.setQuestionNumber(questionNumber); | |
96 | + analyseDetail.setAnalyseId(analyse.getId()); | |
97 | + analyseDetail.setQuestionType(examExcelVo.getQuestionType()); | |
98 | + analyseDetail.setDifficult(DifficultEnums.getDifficultType(examExcelVo.getDifficult())); | |
99 | + analyseDetail.setScore(new Float(examExcelVo.getScore())); | |
100 | + analyseDetail.setCreateTime(date); | |
101 | + analyseDetails.add(analyseDetail); | |
102 | + initAnalyseDimensional(analyse,questionNumber,examExcelVo.getScore(),examExcelVo.getKnowledge(),DimensionalEnums.knowledge.getDimensionalType(),analyseDimensionals); | |
103 | + initAnalyseDimensional(analyse,questionNumber,examExcelVo.getScore(),examExcelVo.getAbility(),DimensionalEnums.ability.getDimensionalType(),analyseDimensionals); | |
104 | + initAnalyseDimensional(analyse,questionNumber,examExcelVo.getScore(),examExcelVo.getSkill(),DimensionalEnums.skill.getDimensionalType(),analyseDimensionals); | |
105 | + initAnalyseDimensional(analyse,questionNumber,examExcelVo.getScore(),examExcelVo.getThink(),DimensionalEnums.think.getDimensionalType(),analyseDimensionals); | |
69 | 106 | } |
70 | 107 | } |
108 | + analyseDetailService.insertBatch(analyseDetails); | |
109 | + analyseDimensionalService.insertBatch(analyseDimensionals); | |
71 | 110 | }catch (Exception e){ |
72 | 111 | System.out.println(e); |
73 | - baseVo.setSuccess(false); | |
74 | 112 | } |
75 | - return baseVo; | |
76 | 113 | } |
114 | + | |
115 | + private void initAnalyseDimensional(Analyse analyse ,String questionNumber , String score , String dimensionalMessage , int dimensionalType , List<AnalyseDimensional> analyseDimensionals){ | |
116 | + if(StringUtils.isNotBlank(dimensionalMessage)){ | |
117 | + String[] message =dimensionalMessage.split("、"); | |
118 | + for (int j = 0; j < message.length ; j++) { | |
119 | + if(StringUtils.isNotBlank(message[j])){ | |
120 | + Dimensional dimensional = new Dimensional(); | |
121 | + dimensional.setDimensionalType(dimensionalType); | |
122 | + dimensional.setDimensionalName(message[j]); | |
123 | + //查数据库是否已存在该四维诊断 不存在则导入 | |
124 | + Dimensional result = dimensionalService.selectByTypeAndName(dimensionalType,message[j]); | |
125 | + int dimensionalId = 0 ; | |
126 | + if(result == null || result.getId() == 0){ | |
127 | + dimensional.setCreateTime(new Date()); | |
128 | + dimensionalId = dimensionalService.insert(dimensional); | |
129 | + }else { | |
130 | + dimensionalId = result.getId(); | |
131 | + } | |
132 | + AnalyseDimensional analyseDimensional = new AnalyseDimensional(); | |
133 | + analyseDimensional.setAnalyseId(analyse.getId()); | |
134 | + analyseDimensional.setDimensionalId(dimensionalId); | |
135 | + analyseDimensional.setQuestionNumber(questionNumber); | |
136 | + analyseDimensional.setScore(new Float(score)); | |
137 | + analyseDimensional.setCreateTime(new Date()); | |
138 | + analyseDimensionals.add(analyseDimensional); | |
139 | + } | |
140 | + } | |
141 | + } | |
142 | + } | |
143 | + | |
144 | + | |
77 | 145 | } | ... | ... |
src/main/java/com/jevon/controller/ScheduleInitController.java
... | ... | @@ -314,7 +314,7 @@ public class ScheduleInitController { |
314 | 314 | teacher.setTeacherName(json.get("name").toString()); |
315 | 315 | teachers.add(teacher); |
316 | 316 | } |
317 | - initTeacher(teachers); | |
317 | + initTeacher(teachers,schoolId); | |
318 | 318 | JSONObject classList = HttpClientUtils.httpGet(url+"/api/EasyN/GetSchoolClass?SchoolId="+schoolId); |
319 | 319 | List<JSONObject> openClasses = (List<JSONObject>)classList.get("data"); |
320 | 320 | List<ClassModel> classModels = new ArrayList<>(); |
... | ... | @@ -326,7 +326,7 @@ public class ScheduleInitController { |
326 | 326 | classModel.setClassName(json.get("class_name").toString()); |
327 | 327 | classModels.add(classModel); |
328 | 328 | } |
329 | - initClass(classModels); | |
329 | + initClass(classModels,schoolId); | |
330 | 330 | JSONObject courseList = HttpClientUtils.httpGet(url+"/api/EasyN/GetSchoolSubject?SchoolId="+schoolId); |
331 | 331 | List<JSONObject> openCourses = (List<JSONObject>)courseList.get("data"); |
332 | 332 | List<Course> courses = new ArrayList<>(); |
... | ... | @@ -338,12 +338,12 @@ public class ScheduleInitController { |
338 | 338 | course.setCourseType(0); |
339 | 339 | courses.add(course); |
340 | 340 | } |
341 | - initCourse(courses); | |
341 | + initCourse(courses,schoolId); | |
342 | 342 | } |
343 | 343 | |
344 | - public BaseVo initCourse(List<Course> courseList){ | |
344 | + public BaseVo initCourse(List<Course> courseList ,int schoolId){ | |
345 | 345 | BaseVo baseVo = new BaseVo(); |
346 | - courseService.deleteSchoolId(courseList.get(0).getSchoolId()); | |
346 | + courseService.deleteSchoolId(schoolId); | |
347 | 347 | for(Course course : courseList){ |
348 | 348 | if(course.getCourseId() == 0 || StringUtils.isBlank(course.getCourseName())){ |
349 | 349 | baseVo.setSuccess(false); |
... | ... | @@ -360,9 +360,9 @@ public class ScheduleInitController { |
360 | 360 | } |
361 | 361 | } |
362 | 362 | |
363 | - public BaseVo initClass(List<ClassModel> classList){ | |
363 | + public BaseVo initClass(List<ClassModel> classList , int schoolId){ | |
364 | 364 | BaseVo baseVo = new BaseVo(); |
365 | - classModelService.deleteSchool(classList.get(0).getSchoolId()); | |
365 | + classModelService.deleteSchool(schoolId); | |
366 | 366 | for(ClassModel classModel : classList){ |
367 | 367 | if(classModel.getClassId() == 0 || StringUtils.isBlank(classModel.getClassName()) || |
368 | 368 | StringUtils.isBlank(classModel.getGrade()) || classModel.getSchoolId() == 0){ |
... | ... | @@ -380,7 +380,7 @@ public class ScheduleInitController { |
380 | 380 | } |
381 | 381 | } |
382 | 382 | |
383 | - public BaseVo initTeacher(List<Teacher> teacherList){ | |
383 | + public BaseVo initTeacher(List<Teacher> teacherList , int schoolId){ | |
384 | 384 | List<Teacher> result = new ArrayList<>(); |
385 | 385 | for(Teacher teacher : teacherList){ |
386 | 386 | boolean isExist = false; |
... | ... | @@ -394,7 +394,7 @@ public class ScheduleInitController { |
394 | 394 | } |
395 | 395 | } |
396 | 396 | BaseVo baseVo = new BaseVo(); |
397 | - teacherService.deleteSchool(result.get(0).getSchoolId()); | |
397 | + teacherService.deleteSchool(schoolId); | |
398 | 398 | for(Teacher teacher : result){ |
399 | 399 | if(teacher.getSchoolId() == 0 || StringUtils.isBlank(teacher.getTeacherName()) || |
400 | 400 | teacher.getTeacherId() == 0){ | ... | ... |
... | ... | @@ -0,0 +1,46 @@ |
1 | +package com.jevon.enums; | |
2 | + | |
3 | +/** | |
4 | + * @author chen | |
5 | + * @version 1.0 | |
6 | + * @date 2019/10/18 0018 8:40 | |
7 | + */ | |
8 | +public enum DifficultEnums { | |
9 | + | |
10 | + easy(1,"易"), | |
11 | + medium(2,"中"), | |
12 | + difficult(3,"难"); | |
13 | + | |
14 | + private int difficultType ; | |
15 | + private String difficultName ; | |
16 | + | |
17 | + DifficultEnums(int difficultType, String difficultName) { | |
18 | + this.difficultType = difficultType; | |
19 | + this.difficultName = difficultName; | |
20 | + } | |
21 | + | |
22 | + public int getDifficultType() { | |
23 | + return difficultType; | |
24 | + } | |
25 | + | |
26 | + public void setDifficultType(int difficultType) { | |
27 | + this.difficultType = difficultType; | |
28 | + } | |
29 | + | |
30 | + public String getDifficultName() { | |
31 | + return difficultName; | |
32 | + } | |
33 | + | |
34 | + public void setDifficultName(String difficultName) { | |
35 | + this.difficultName = difficultName; | |
36 | + } | |
37 | + | |
38 | + public static int getDifficultType(String difficultName){ | |
39 | + for (DifficultEnums difficultEnums : DifficultEnums.values()) { | |
40 | + if (difficultEnums.getDifficultName().equals(difficultName)) { | |
41 | + return difficultEnums.getDifficultType(); | |
42 | + } | |
43 | + } | |
44 | + return 0 ; | |
45 | + } | |
46 | +} | ... | ... |
... | ... | @@ -0,0 +1,37 @@ |
1 | +package com.jevon.enums; | |
2 | + | |
3 | +/** | |
4 | + * @author chen | |
5 | + * @version 1.0 | |
6 | + * @date 2019/10/18 0018 8:33 | |
7 | + */ | |
8 | +public enum DimensionalEnums { | |
9 | + knowledge(1,"知识点"), | |
10 | + ability(2,"能力"), | |
11 | + skill(3,"技能"), | |
12 | + think(4,"四维"); | |
13 | + | |
14 | + private int dimensionalType ; | |
15 | + private String dimensionalName ; | |
16 | + | |
17 | + DimensionalEnums(int dimensionalType, String dimensionalName) { | |
18 | + this.dimensionalType = dimensionalType; | |
19 | + this.dimensionalName = dimensionalName; | |
20 | + } | |
21 | + | |
22 | + public int getDimensionalType() { | |
23 | + return dimensionalType; | |
24 | + } | |
25 | + | |
26 | + public void setDimensionalType(int dimensionalType) { | |
27 | + this.dimensionalType = dimensionalType; | |
28 | + } | |
29 | + | |
30 | + public String getDimensionalName() { | |
31 | + return dimensionalName; | |
32 | + } | |
33 | + | |
34 | + public void setDimensionalName(String dimensionalName) { | |
35 | + this.dimensionalName = dimensionalName; | |
36 | + } | |
37 | +} | ... | ... |
... | ... | @@ -0,0 +1,15 @@ |
1 | +package com.jevon.mapper; | |
2 | + | |
3 | +import com.jevon.model.AnalyseDetail; | |
4 | + | |
5 | +import java.util.List; | |
6 | + | |
7 | +/** | |
8 | + * @author chen | |
9 | + * @version 1.0 | |
10 | + * @date 2019/10/18 0018 11:11 | |
11 | + */ | |
12 | +public interface AnalyseDetailMapper { | |
13 | + | |
14 | + int insertBatch(List<AnalyseDetail> list); | |
15 | +} | ... | ... |
src/main/java/com/jevon/mapper/AnalyseDimensionalMapper.java
0 → 100644
... | ... | @@ -0,0 +1,15 @@ |
1 | +package com.jevon.mapper; | |
2 | + | |
3 | +import com.jevon.model.AnalyseDimensional; | |
4 | + | |
5 | +import java.util.List; | |
6 | + | |
7 | +/** | |
8 | + * @author chen | |
9 | + * @version 1.0 | |
10 | + * @date 2019/10/18 0018 11:12 | |
11 | + */ | |
12 | +public interface AnalyseDimensionalMapper { | |
13 | + | |
14 | + int insertBatch(List<AnalyseDimensional> list); | |
15 | +} | ... | ... |
... | ... | @@ -0,0 +1,19 @@ |
1 | +package com.jevon.mapper; | |
2 | + | |
3 | +import com.jevon.model.Analyse; | |
4 | + | |
5 | +import java.util.List; | |
6 | + | |
7 | +/** | |
8 | + * @author chen | |
9 | + * @version 1.0 | |
10 | + * @date 2019/10/18 0018 10:56 | |
11 | + */ | |
12 | +public interface AnalyseMapper { | |
13 | + | |
14 | + int insert(Analyse analyse); | |
15 | + | |
16 | + List<Analyse> select(Analyse analyse); | |
17 | + | |
18 | + Analyse selectById(int id); | |
19 | +} | ... | ... |
... | ... | @@ -0,0 +1,17 @@ |
1 | +package com.jevon.mapper; | |
2 | + | |
3 | +import com.jevon.model.Dimensional; | |
4 | + | |
5 | +import java.util.List; | |
6 | + | |
7 | +/** | |
8 | + * @author chen | |
9 | + * @version 1.0 | |
10 | + * @date 2019/10/18 0018 10:11 | |
11 | + */ | |
12 | +public interface DimensionalMapper { | |
13 | + | |
14 | + int insert(Dimensional dimensional); | |
15 | + | |
16 | + List<Dimensional> select(Dimensional dimensional); | |
17 | +} | ... | ... |
... | ... | @@ -0,0 +1,57 @@ |
1 | +package com.jevon.model; | |
2 | + | |
3 | +import java.util.Date; | |
4 | + | |
5 | +/** | |
6 | + * @author chen | |
7 | + * @version 1.0 | |
8 | + * @date 2019/10/18 0018 10:55 | |
9 | + */ | |
10 | +public class Analyse { | |
11 | + | |
12 | + private int id ; | |
13 | + private String examName ; | |
14 | + private Date examTime ; | |
15 | + private String courseName ; | |
16 | + private Date createTime ; | |
17 | + | |
18 | + public int getId() { | |
19 | + return id; | |
20 | + } | |
21 | + | |
22 | + public void setId(int id) { | |
23 | + this.id = id; | |
24 | + } | |
25 | + | |
26 | + public String getExamName() { | |
27 | + return examName; | |
28 | + } | |
29 | + | |
30 | + public void setExamName(String examName) { | |
31 | + this.examName = examName; | |
32 | + } | |
33 | + | |
34 | + public Date getExamTime() { | |
35 | + return examTime; | |
36 | + } | |
37 | + | |
38 | + public void setExamTime(Date examTime) { | |
39 | + this.examTime = examTime; | |
40 | + } | |
41 | + | |
42 | + public String getCourseName() { | |
43 | + return courseName; | |
44 | + } | |
45 | + | |
46 | + public void setCourseName(String courseName) { | |
47 | + this.courseName = courseName; | |
48 | + } | |
49 | + | |
50 | + public Date getCreateTime() { | |
51 | + return createTime; | |
52 | + } | |
53 | + | |
54 | + public void setCreateTime(Date createTime) { | |
55 | + this.createTime = createTime; | |
56 | + } | |
57 | +} | ... | ... |
... | ... | @@ -0,0 +1,75 @@ |
1 | +package com.jevon.model; | |
2 | + | |
3 | +import java.util.Date; | |
4 | + | |
5 | +/** | |
6 | + * @author chen | |
7 | + * @version 1.0 | |
8 | + * @date 2019/10/18 0018 8:38 | |
9 | + */ | |
10 | +public class AnalyseDetail { | |
11 | + | |
12 | + private int id ; | |
13 | + private int analyseId ; | |
14 | + private String questionNumber ; | |
15 | + private String questionType ; | |
16 | + private int difficult ; | |
17 | + private float score ; | |
18 | + private Date createTime ; | |
19 | + | |
20 | + public int getId() { | |
21 | + return id; | |
22 | + } | |
23 | + | |
24 | + public void setId(int id) { | |
25 | + this.id = id; | |
26 | + } | |
27 | + | |
28 | + public int getAnalyseId() { | |
29 | + return analyseId; | |
30 | + } | |
31 | + | |
32 | + public void setAnalyseId(int analyseId) { | |
33 | + this.analyseId = analyseId; | |
34 | + } | |
35 | + | |
36 | + public String getQuestionNumber() { | |
37 | + return questionNumber; | |
38 | + } | |
39 | + | |
40 | + public void setQuestionNumber(String questionNumber) { | |
41 | + this.questionNumber = questionNumber; | |
42 | + } | |
43 | + | |
44 | + public int getDifficult() { | |
45 | + return difficult; | |
46 | + } | |
47 | + | |
48 | + public void setDifficult(int difficult) { | |
49 | + this.difficult = difficult; | |
50 | + } | |
51 | + | |
52 | + public float getScore() { | |
53 | + return score; | |
54 | + } | |
55 | + | |
56 | + public void setScore(float score) { | |
57 | + this.score = score; | |
58 | + } | |
59 | + | |
60 | + public Date getCreateTime() { | |
61 | + return createTime; | |
62 | + } | |
63 | + | |
64 | + public void setCreateTime(Date createTime) { | |
65 | + this.createTime = createTime; | |
66 | + } | |
67 | + | |
68 | + public String getQuestionType() { | |
69 | + return questionType; | |
70 | + } | |
71 | + | |
72 | + public void setQuestionType(String questionType) { | |
73 | + this.questionType = questionType; | |
74 | + } | |
75 | +} | ... | ... |
... | ... | @@ -0,0 +1,66 @@ |
1 | +package com.jevon.model; | |
2 | + | |
3 | +import java.util.Date; | |
4 | + | |
5 | +/** | |
6 | + * @author chen | |
7 | + * @version 1.0 | |
8 | + * @date 2019/10/18 0018 8:42 | |
9 | + */ | |
10 | +public class AnalyseDimensional { | |
11 | + | |
12 | + private int id ; | |
13 | + private int analyseId ; | |
14 | + private String questionNumber ; | |
15 | + private int dimensionalId ; | |
16 | + private float score ; | |
17 | + private Date createTime ; | |
18 | + | |
19 | + public int getId() { | |
20 | + return id; | |
21 | + } | |
22 | + | |
23 | + public void setId(int id) { | |
24 | + this.id = id; | |
25 | + } | |
26 | + | |
27 | + public int getAnalyseId() { | |
28 | + return analyseId; | |
29 | + } | |
30 | + | |
31 | + public void setAnalyseId(int analyseId) { | |
32 | + this.analyseId = analyseId; | |
33 | + } | |
34 | + | |
35 | + public String getQuestionNumber() { | |
36 | + return questionNumber; | |
37 | + } | |
38 | + | |
39 | + public void setQuestionNumber(String questionNumber) { | |
40 | + this.questionNumber = questionNumber; | |
41 | + } | |
42 | + | |
43 | + public int getDimensionalId() { | |
44 | + return dimensionalId; | |
45 | + } | |
46 | + | |
47 | + public void setDimensionalId(int dimensionalId) { | |
48 | + this.dimensionalId = dimensionalId; | |
49 | + } | |
50 | + | |
51 | + public float getScore() { | |
52 | + return score; | |
53 | + } | |
54 | + | |
55 | + public void setScore(float score) { | |
56 | + this.score = score; | |
57 | + } | |
58 | + | |
59 | + public Date getCreateTime() { | |
60 | + return createTime; | |
61 | + } | |
62 | + | |
63 | + public void setCreateTime(Date createTime) { | |
64 | + this.createTime = createTime; | |
65 | + } | |
66 | +} | ... | ... |
... | ... | @@ -0,0 +1,48 @@ |
1 | +package com.jevon.model; | |
2 | + | |
3 | +import java.util.Date; | |
4 | + | |
5 | +/** | |
6 | + * @author chen | |
7 | + * @version 1.0 | |
8 | + * @date 2019/10/18 0018 8:37 | |
9 | + */ | |
10 | +public class Dimensional { | |
11 | + | |
12 | + private int id ; | |
13 | + private int dimensionalType ; | |
14 | + private String dimensionalName; | |
15 | + private Date createTime ; | |
16 | + | |
17 | + public int getId() { | |
18 | + return id; | |
19 | + } | |
20 | + | |
21 | + public void setId(int id) { | |
22 | + this.id = id; | |
23 | + } | |
24 | + | |
25 | + public int getDimensionalType() { | |
26 | + return dimensionalType; | |
27 | + } | |
28 | + | |
29 | + public void setDimensionalType(int dimensionalType) { | |
30 | + this.dimensionalType = dimensionalType; | |
31 | + } | |
32 | + | |
33 | + public String getDimensionalName() { | |
34 | + return dimensionalName; | |
35 | + } | |
36 | + | |
37 | + public void setDimensionalName(String dimensionalName) { | |
38 | + this.dimensionalName = dimensionalName; | |
39 | + } | |
40 | + | |
41 | + public Date getCreateTime() { | |
42 | + return createTime; | |
43 | + } | |
44 | + | |
45 | + public void setCreateTime(Date createTime) { | |
46 | + this.createTime = createTime; | |
47 | + } | |
48 | +} | ... | ... |
src/main/java/com/jevon/service/AnalyseDetailService.java
0 → 100644
... | ... | @@ -0,0 +1,16 @@ |
1 | +package com.jevon.service; | |
2 | + | |
3 | +import com.jevon.model.AnalyseDetail; | |
4 | + | |
5 | +import java.util.List; | |
6 | + | |
7 | +/** | |
8 | + * @author chen | |
9 | + * @version 1.0 | |
10 | + * @date 2019/10/18 0018 11:25 | |
11 | + */ | |
12 | +public interface AnalyseDetailService { | |
13 | + | |
14 | + int insertBatch(List<AnalyseDetail> list); | |
15 | + | |
16 | +} | ... | ... |
src/main/java/com/jevon/service/AnalyseDimensionalService.java
0 → 100644
... | ... | @@ -0,0 +1,16 @@ |
1 | +package com.jevon.service; | |
2 | + | |
3 | +import com.jevon.model.AnalyseDimensional; | |
4 | + | |
5 | +import java.util.List; | |
6 | + | |
7 | +/** | |
8 | + * @author chen | |
9 | + * @version 1.0 | |
10 | + * @date 2019/10/18 0018 11:25 | |
11 | + */ | |
12 | +public interface AnalyseDimensionalService { | |
13 | + | |
14 | + int insertBatch(List<AnalyseDimensional> list); | |
15 | + | |
16 | +} | ... | ... |
... | ... | @@ -0,0 +1,20 @@ |
1 | +package com.jevon.service; | |
2 | + | |
3 | +import com.jevon.model.Analyse; | |
4 | + | |
5 | +import java.util.List; | |
6 | + | |
7 | +/** | |
8 | + * @author chen | |
9 | + * @version 1.0 | |
10 | + * @date 2019/10/18 0018 10:59 | |
11 | + */ | |
12 | +public interface AnalyseService { | |
13 | + | |
14 | + int insert(Analyse analyse); | |
15 | + | |
16 | + List<Analyse> select(Analyse analyse); | |
17 | + | |
18 | + Analyse selectById(int id); | |
19 | + | |
20 | +} | ... | ... |
... | ... | @@ -0,0 +1,19 @@ |
1 | +package com.jevon.service; | |
2 | + | |
3 | +import com.jevon.model.Dimensional; | |
4 | + | |
5 | +import java.util.List; | |
6 | + | |
7 | +/** | |
8 | + * @author chen | |
9 | + * @version 1.0 | |
10 | + * @date 2019/10/18 0018 10:24 | |
11 | + */ | |
12 | +public interface DimensionalService { | |
13 | + | |
14 | + int insert(Dimensional dimensional); | |
15 | + | |
16 | + List<Dimensional> select(Dimensional dimensional); | |
17 | + | |
18 | + Dimensional selectByTypeAndName(int type , String name); | |
19 | +} | ... | ... |
src/main/java/com/jevon/service/impl/AnalyseDetailServiceImpl.java
0 → 100644
... | ... | @@ -0,0 +1,38 @@ |
1 | +package com.jevon.service.impl; | |
2 | + | |
3 | +import com.jevon.mapper.AnalyseDetailMapper; | |
4 | +import com.jevon.model.AnalyseDetail; | |
5 | +import com.jevon.service.AnalyseDetailService; | |
6 | +import org.springframework.beans.factory.annotation.Autowired; | |
7 | +import org.springframework.stereotype.Service; | |
8 | + | |
9 | +import java.util.ArrayList; | |
10 | +import java.util.List; | |
11 | + | |
12 | +/** | |
13 | + * @author chen | |
14 | + * @version 1.0 | |
15 | + * @date 2019/10/18 0018 11:26 | |
16 | + */ | |
17 | +@Service | |
18 | +public class AnalyseDetailServiceImpl implements AnalyseDetailService { | |
19 | + | |
20 | + @Autowired | |
21 | + AnalyseDetailMapper analyseDetailMapper; | |
22 | + | |
23 | + @Override | |
24 | + public int insertBatch(List<AnalyseDetail> list) { | |
25 | + int i = 0 ; | |
26 | + List<AnalyseDetail> result = new ArrayList<>(); | |
27 | + for(AnalyseDetail analyseDetail :list){ | |
28 | + i++ ; | |
29 | + result.add(analyseDetail); | |
30 | + if(i % 100 == 0){ | |
31 | + analyseDetailMapper.insertBatch(result); | |
32 | + result = new ArrayList<>(); | |
33 | + } | |
34 | + } | |
35 | + analyseDetailMapper.insertBatch(result); | |
36 | + return 1 ; | |
37 | + } | |
38 | +} | ... | ... |
src/main/java/com/jevon/service/impl/AnalyseDimensionalServiceImpl.java
0 → 100644
... | ... | @@ -0,0 +1,38 @@ |
1 | +package com.jevon.service.impl; | |
2 | + | |
3 | +import com.jevon.mapper.AnalyseDimensionalMapper; | |
4 | +import com.jevon.model.AnalyseDimensional; | |
5 | +import com.jevon.service.AnalyseDimensionalService; | |
6 | +import org.springframework.beans.factory.annotation.Autowired; | |
7 | +import org.springframework.stereotype.Service; | |
8 | + | |
9 | +import java.util.ArrayList; | |
10 | +import java.util.List; | |
11 | + | |
12 | +/** | |
13 | + * @author chen | |
14 | + * @version 1.0 | |
15 | + * @date 2019/10/18 0018 11:27 | |
16 | + */ | |
17 | +@Service | |
18 | +public class AnalyseDimensionalServiceImpl implements AnalyseDimensionalService { | |
19 | + | |
20 | + @Autowired | |
21 | + AnalyseDimensionalMapper analyseDimensionalMapper; | |
22 | + | |
23 | + @Override | |
24 | + public int insertBatch(List<AnalyseDimensional> list) { | |
25 | + int i = 0 ; | |
26 | + List<AnalyseDimensional> result = new ArrayList<>(); | |
27 | + for(AnalyseDimensional analyseDetail :list){ | |
28 | + i++ ; | |
29 | + result.add(analyseDetail); | |
30 | + if(i % 100 == 0){ | |
31 | + analyseDimensionalMapper.insertBatch(result); | |
32 | + result = new ArrayList<>(); | |
33 | + } | |
34 | + } | |
35 | + analyseDimensionalMapper.insertBatch(result); | |
36 | + return 1 ; | |
37 | + } | |
38 | +} | ... | ... |
src/main/java/com/jevon/service/impl/AnalyseServiceImpl.java
0 → 100644
... | ... | @@ -0,0 +1,36 @@ |
1 | +package com.jevon.service.impl; | |
2 | + | |
3 | +import com.jevon.mapper.AnalyseMapper; | |
4 | +import com.jevon.model.Analyse; | |
5 | +import com.jevon.service.AnalyseService; | |
6 | +import org.springframework.beans.factory.annotation.Autowired; | |
7 | +import org.springframework.stereotype.Service; | |
8 | + | |
9 | +import java.util.List; | |
10 | + | |
11 | +/** | |
12 | + * @author chen | |
13 | + * @version 1.0 | |
14 | + * @date 2019/10/18 0018 10:59 | |
15 | + */ | |
16 | +@Service | |
17 | +public class AnalyseServiceImpl implements AnalyseService { | |
18 | + | |
19 | + @Autowired | |
20 | + AnalyseMapper analyseMapper; | |
21 | + | |
22 | + @Override | |
23 | + public int insert(Analyse analyse) { | |
24 | + return analyseMapper.insert(analyse); | |
25 | + } | |
26 | + | |
27 | + @Override | |
28 | + public List<Analyse> select(Analyse analyse) { | |
29 | + return analyseMapper.select(analyse); | |
30 | + } | |
31 | + | |
32 | + @Override | |
33 | + public Analyse selectById(int id) { | |
34 | + return analyseMapper.selectById(id); | |
35 | + } | |
36 | +} | ... | ... |
src/main/java/com/jevon/service/impl/DimensionalServiceImpl.java
0 → 100644
... | ... | @@ -0,0 +1,44 @@ |
1 | +package com.jevon.service.impl; | |
2 | + | |
3 | +import com.jevon.mapper.DimensionalMapper; | |
4 | +import com.jevon.model.Dimensional; | |
5 | +import com.jevon.service.DimensionalService; | |
6 | +import org.springframework.beans.factory.annotation.Autowired; | |
7 | +import org.springframework.stereotype.Service; | |
8 | + | |
9 | +import java.util.ArrayList; | |
10 | +import java.util.List; | |
11 | + | |
12 | +/** | |
13 | + * @author chen | |
14 | + * @version 1.0 | |
15 | + * @date 2019/10/18 0018 10:25 | |
16 | + */ | |
17 | +@Service | |
18 | +public class DimensionalServiceImpl implements DimensionalService { | |
19 | + | |
20 | + @Autowired | |
21 | + DimensionalMapper dimensionalMapper; | |
22 | + | |
23 | + @Override | |
24 | + public int insert(Dimensional dimensional) { | |
25 | + return dimensionalMapper.insert(dimensional); | |
26 | + } | |
27 | + | |
28 | + @Override | |
29 | + public List<Dimensional> select(Dimensional dimensional) { | |
30 | + return dimensionalMapper.select(dimensional); | |
31 | + } | |
32 | + | |
33 | + @Override | |
34 | + public Dimensional selectByTypeAndName(int type, String name) { | |
35 | + Dimensional dimensional = new Dimensional(); | |
36 | + dimensional.setDimensionalType(type); | |
37 | + dimensional.setDimensionalName(name); | |
38 | + List<Dimensional> list = dimensionalMapper.select(dimensional); | |
39 | + if(list != null &&list.size() > 0){ | |
40 | + return list.get(0); | |
41 | + } | |
42 | + return null; | |
43 | + } | |
44 | +} | ... | ... |
... | ... | @@ -0,0 +1,168 @@ |
1 | +package com.jevon.vo.excel; | |
2 | + | |
3 | +import org.apache.poi.ss.usermodel.Cell; | |
4 | +import org.apache.poi.ss.usermodel.CellType; | |
5 | +import org.apache.poi.ss.usermodel.Row; | |
6 | + | |
7 | +/** | |
8 | + * @author chen | |
9 | + * @version 1.0 | |
10 | + * @date 2019/10/18 0018 8:51 | |
11 | + */ | |
12 | +public class ExamExcelVo { | |
13 | + | |
14 | + private String questionNumber ; | |
15 | + private String questionSmallNumber ; | |
16 | + private String questionType ; | |
17 | + private String difficult ; | |
18 | + private String score ; | |
19 | + private String knowledge ; | |
20 | + private String ability ; | |
21 | + private String skill ; | |
22 | + private String think ; | |
23 | + | |
24 | + public String getQuestionNumber() { | |
25 | + return questionNumber; | |
26 | + } | |
27 | + | |
28 | + public void setQuestionNumber(String questionNumber) { | |
29 | + this.questionNumber = questionNumber; | |
30 | + } | |
31 | + | |
32 | + public String getQuestionSmallNumber() { | |
33 | + return questionSmallNumber; | |
34 | + } | |
35 | + | |
36 | + public void setQuestionSmallNumber(String questionSmallNumber) { | |
37 | + this.questionSmallNumber = questionSmallNumber; | |
38 | + } | |
39 | + | |
40 | + public String getQuestionType() { | |
41 | + return questionType; | |
42 | + } | |
43 | + | |
44 | + public void setQuestionType(String questionType) { | |
45 | + this.questionType = questionType; | |
46 | + } | |
47 | + | |
48 | + public String getDifficult() { | |
49 | + return difficult; | |
50 | + } | |
51 | + | |
52 | + public void setDifficult(String difficult) { | |
53 | + this.difficult = difficult; | |
54 | + } | |
55 | + | |
56 | + public String getScore() { | |
57 | + return score; | |
58 | + } | |
59 | + | |
60 | + public void setScore(String score) { | |
61 | + this.score = score; | |
62 | + } | |
63 | + | |
64 | + public String getKnowledge() { | |
65 | + return knowledge; | |
66 | + } | |
67 | + | |
68 | + public void setKnowledge(String knowledge) { | |
69 | + this.knowledge = knowledge; | |
70 | + } | |
71 | + | |
72 | + public String getAbility() { | |
73 | + return ability; | |
74 | + } | |
75 | + | |
76 | + public void setAbility(String ability) { | |
77 | + this.ability = ability; | |
78 | + } | |
79 | + | |
80 | + public String getSkill() { | |
81 | + return skill; | |
82 | + } | |
83 | + | |
84 | + public void setSkill(String skill) { | |
85 | + this.skill = skill; | |
86 | + } | |
87 | + | |
88 | + public String getThink() { | |
89 | + return think; | |
90 | + } | |
91 | + | |
92 | + public void setThink(String think) { | |
93 | + this.think = think; | |
94 | + } | |
95 | + | |
96 | + public ExamExcelVo(Row sheetRow) { | |
97 | + Cell cell1 = sheetRow.getCell(0); | |
98 | + if(cell1 != null){ | |
99 | + cell1.setCellType(CellType.STRING); | |
100 | + this.questionNumber = cell1.getStringCellValue().trim(); | |
101 | + } | |
102 | + | |
103 | + Cell cell2 = sheetRow.getCell(1); | |
104 | + if(cell2 != null){ | |
105 | + cell2.setCellType(CellType.STRING); | |
106 | + this.questionSmallNumber = cell2.getStringCellValue().trim(); | |
107 | + }else { | |
108 | + this.questionSmallNumber = null ; | |
109 | + } | |
110 | + | |
111 | + | |
112 | + Cell cell3 = sheetRow.getCell(2); | |
113 | + if(cell3 != null){ | |
114 | + cell3.setCellType(CellType.STRING); | |
115 | + this.questionType = cell3.getStringCellValue().trim(); | |
116 | + }else { | |
117 | + this.questionType = null ; | |
118 | + } | |
119 | + | |
120 | + Cell cell4 = sheetRow.getCell(3); | |
121 | + if(cell4 != null){ | |
122 | + cell4.setCellType(CellType.STRING); | |
123 | + this.difficult = cell4.getStringCellValue().trim(); | |
124 | + }else { | |
125 | + this.difficult = null ; | |
126 | + } | |
127 | + | |
128 | + Cell cell5 = sheetRow.getCell(4); | |
129 | + if(cell5 != null){ | |
130 | + cell5.setCellType(CellType.STRING); | |
131 | + this.score = cell5.getStringCellValue().trim(); | |
132 | + }else { | |
133 | + this.score = null ; | |
134 | + } | |
135 | + | |
136 | + Cell cell6 = sheetRow.getCell(5); | |
137 | + if(cell6 != null){ | |
138 | + cell6.setCellType(CellType.STRING); | |
139 | + this.knowledge = cell6.getStringCellValue().trim(); | |
140 | + }else { | |
141 | + this.knowledge = null ; | |
142 | + } | |
143 | + | |
144 | + Cell cell7 = sheetRow.getCell(6); | |
145 | + if(cell7 != null){ | |
146 | + cell7.setCellType(CellType.STRING); | |
147 | + this.ability = cell7.getStringCellValue().trim(); | |
148 | + }else { | |
149 | + this.ability = null ; | |
150 | + } | |
151 | + | |
152 | + Cell cell8 = sheetRow.getCell(7); | |
153 | + if(cell8 != null){ | |
154 | + cell8.setCellType(CellType.STRING); | |
155 | + this.skill = cell8.getStringCellValue().trim(); | |
156 | + }else { | |
157 | + this.skill = null ; | |
158 | + } | |
159 | + | |
160 | + Cell cell9 = sheetRow.getCell(8); | |
161 | + if(cell9 != null){ | |
162 | + cell9.setCellType(CellType.STRING); | |
163 | + this.think = cell9.getStringCellValue().trim(); | |
164 | + }else { | |
165 | + this.think = null ; | |
166 | + } | |
167 | + } | |
168 | +} | ... | ... |
... | ... | @@ -0,0 +1,21 @@ |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | |
3 | +<mapper namespace="com.jevon.mapper.AnalyseDetailMapper" > | |
4 | + <resultMap id="BaseResultMap" type="com.jevon.model.AnalyseDetail" > | |
5 | + <id column="id" property="id" jdbcType="INTEGER" /> | |
6 | + <result column="analyse_id" property="analyseId" jdbcType="INTEGER" /> | |
7 | + <result column="question_number" property="questionNumber" jdbcType="VARCHAR" /> | |
8 | + <result column="question_type" property="questionType" jdbcType="INTEGER" /> | |
9 | + <result column="difficult" property="difficult" jdbcType="INTEGER" /> | |
10 | + <result column="score" property="score" jdbcType="FLOAT" /> | |
11 | + <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> | |
12 | + </resultMap> | |
13 | + | |
14 | + <insert id="insertBatch" parameterType="java.util.List"> | |
15 | + insert into sz_learn_analyse_detail (analyse_id, question_number,question_type,difficult,score,create_time) | |
16 | + values | |
17 | + <foreach collection="list" item="emp" separator=","> | |
18 | + (#{emp.analyseId},#{emp.questionNumber},#{emp.questionType},#{emp.difficult},#{emp.score},#{emp.createTime}) | |
19 | + </foreach> | |
20 | + </insert> | |
21 | +</mapper> | |
0 | 22 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,20 @@ |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | |
3 | +<mapper namespace="com.jevon.mapper.AnalyseDimensionalMapper" > | |
4 | + <resultMap id="BaseResultMap" type="com.jevon.model.AnalyseDimensional" > | |
5 | + <id column="id" property="id" jdbcType="INTEGER" /> | |
6 | + <result column="analyse_id" property="analyseId" jdbcType="INTEGER" /> | |
7 | + <result column="question_number" property="questionNumber" jdbcType="VARCHAR" /> | |
8 | + <result column="dimensional_id" property="questionType" jdbcType="INTEGER" /> | |
9 | + <result column="score" property="score" jdbcType="FLOAT" /> | |
10 | + <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> | |
11 | + </resultMap> | |
12 | + | |
13 | + <insert id="insertBatch" parameterType="java.util.List"> | |
14 | + insert into sz_learn_analyse_dimensional (analyse_id, question_number,dimensional_id,score,create_time) | |
15 | + values | |
16 | + <foreach collection="list" item="emp" separator=","> | |
17 | + (#{emp.analyseId},#{emp.questionNumber},#{emp.dimensionalId},#{emp.score},#{emp.createTime}) | |
18 | + </foreach> | |
19 | + </insert> | |
20 | +</mapper> | |
0 | 21 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,30 @@ |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | |
3 | +<mapper namespace="com.jevon.mapper.AnalyseMapper" > | |
4 | + <resultMap id="BaseResultMap" type="com.jevon.model.Analyse" > | |
5 | + <id column="id" property="id" jdbcType="INTEGER" /> | |
6 | + <result column="exam_name" property="examName" jdbcType="VARCHAR" /> | |
7 | + <result column="exam_time" property="examTime" jdbcType="TIMESTAMP" /> | |
8 | + <result column="course_name" property="courseName" jdbcType="VARCHAR" /> | |
9 | + <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> | |
10 | + </resultMap> | |
11 | + | |
12 | + <insert id="insert" parameterType="com.jevon.model.Analyse" useGeneratedKeys="true" keyColumn="id" keyProperty="id"> | |
13 | + insert into sz_learn_analyse (exam_name, exam_time,course_name,create_time) | |
14 | + values (#{examName},#{examTime},#{courseName},#{createTime}) | |
15 | + </insert> | |
16 | + | |
17 | + <select id="select" parameterType="com.jevon.model.Analyse" resultMap="BaseResultMap"> | |
18 | + select * from sz_learn_analyse where 1=1 | |
19 | + <if test="courseName != 0"> | |
20 | + and course_name = #{courseName} | |
21 | + </if> | |
22 | + <if test="examName != null"> | |
23 | + and exam_name = #{examName} | |
24 | + </if> | |
25 | + </select> | |
26 | + | |
27 | + <select id="selectById" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | |
28 | + select * from sz_learn_analyse where id = #{id} | |
29 | + </select> | |
30 | +</mapper> | |
0 | 31 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,25 @@ |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | |
3 | +<mapper namespace="com.jevon.mapper.DimensionalMapper" > | |
4 | + <resultMap id="BaseResultMap" type="com.jevon.model.Dimensional" > | |
5 | + <id column="id" property="id" jdbcType="INTEGER" /> | |
6 | + <result column="dimensional_type" property="dimensionalType" jdbcType="INTEGER" /> | |
7 | + <result column="dimensional_name" property="dimensionalName" jdbcType="VARCHAR" /> | |
8 | + <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> | |
9 | + </resultMap> | |
10 | + | |
11 | + <insert id="insert" parameterType="com.jevon.model.Dimensional" useGeneratedKeys="true" keyColumn="id" keyProperty="id"> | |
12 | + insert into sz_learn_dimensional (dimensional_type, dimensional_name,create_time) | |
13 | + values (#{dimensionalType},#{dimensionalName},#{createTime}) | |
14 | + </insert> | |
15 | + | |
16 | + <select id="select" parameterType="com.jevon.model.Dimensional" resultMap="BaseResultMap"> | |
17 | + select * from sz_learn_dimensional where 1=1 | |
18 | + <if test="dimensionalType != 0"> | |
19 | + and dimensional_type = #{dimensionalType} | |
20 | + </if> | |
21 | + <if test="dimensionalName != null"> | |
22 | + and dimensional_name = #{dimensionalName} | |
23 | + </if> | |
24 | + </select> | |
25 | +</mapper> | |
0 | 26 | \ No newline at end of file | ... | ... |