Commit 87ec6d46c18c81b9f3d9d388cb37951a594e24d0

Authored by 陈杰
1 parent 1a3e7aca
Exists in master

第一章信息

src/main/java/com/jevon/controller/LearnController.java
... ... @@ -58,6 +58,9 @@ public class LearnController {
58 58 @Autowired
59 59 LeagueService leagueService;
60 60  
  61 + @Autowired
  62 + ChapterService chapterService;
  63 +
61 64 @Value("${remoting.url}")
62 65 private String url ;
63 66 @Value("${remoting.prefixFile}")
... ... @@ -107,7 +110,14 @@ public class LearnController {
107 110 @RequestMapping(value = "initAnalyse", method = RequestMethod.POST)
108 111 public BaseVo initAnalyse(@RequestBody InitAnalyseReqVo initAnalyseReqVo){
109 112 BaseVo baseVo = new BaseVo();
110   - analysisExcel(initAnalyseReqVo);
  113 + Analyse analyse = analyseService.selectById(initAnalyseReqVo.getAnalyseId());
  114 + List<AnalyseDetail> analyseDetails = analyseDetailService.selectByAnalyseId(analyse.getId());
  115 + if(analyseDetails != null & analyseDetails.size() > 0){
  116 + baseVo.setMessage("已经导入");
  117 + baseVo.setSuccess(false);
  118 + }else {
  119 + analysisExcel(initAnalyseReqVo);
  120 + }
111 121 return baseVo;
112 122 }
113 123  
... ... @@ -206,21 +216,23 @@ public class LearnController {
206 216 @RequestMapping(value = "initScore", method = RequestMethod.POST)
207 217 public BaseVo initScore(@RequestBody InitScoreReqVo initScoreReqVo){
208 218 BaseVo baseVo = new BaseVo();
209   - String schoolName = analysisScoreExcel(initScoreReqVo);
210   - leagueService.initLeagueSchool(initScoreReqVo.getLeagueId(),schoolName);
  219 + boolean success = analysisScoreExcel(initScoreReqVo);
  220 + if(!success){
  221 + baseVo.setSuccess(false);
  222 + baseVo.setMessage("一个学校不能在两个联盟下");
  223 + }
211 224 return baseVo;
212 225 }
213 226  
214   - private String analysisScoreExcel(InitAnalyseReqVo initAnalyseReqVo){
  227 + private boolean analysisScoreExcel(InitScoreReqVo initScoreReqVo){
215 228 try{
216   - String schoolName = "";
217   - Analyse analyse = analyseService.selectById(initAnalyseReqVo.getAnalyseId());
  229 + Analyse analyse = analyseService.selectById(initScoreReqVo.getAnalyseId());
218 230 List<AnalyseDetail> analyseDetails = analyseDetailService.selectByAnalyseId(analyse.getId());
219 231 Map<String , Double> scoreMap = new HashMap<>();
220 232 for(AnalyseDetail analyseDetail : analyseDetails){
221 233 scoreMap.put(analyseDetail.getQuestionNumber(),analyseDetail.getScore());
222 234 }
223   - String fileUrl = initAnalyseReqVo.getUrl();
  235 + String fileUrl = initScoreReqVo.getUrl();
224 236 fileUrl = fileUrl.replace(url, staticUrl);
225 237 File excelFile = new File(fileUrl);
226 238 // 获得工作簿
... ... @@ -281,15 +293,20 @@ public class LearnController {
281 293 }
282 294 }
283 295 }
284   - studentService.insertBatch(students);
285   - studentDetailService.insertBatch(studentDetails);
286   - return students.get(0).getSchoolName();
  296 + int i = leagueService.initLeagueSchool(initScoreReqVo.getLeagueId(),students.get(0).getSchoolName());
  297 + if(i > 0){
  298 + studentService.insertBatch(students);
  299 + studentDetailService.insertBatch(studentDetails);
  300 + return true ;
  301 + }else {
  302 + return false ;
  303 + }
287 304 }
288 305 }catch (Exception e){
289 306 e.printStackTrace();
290 307 System.out.println(e.toString());
291 308 }
292   - return null ;
  309 + return false ;
293 310 }
294 311  
295 312 @ApiOperation("获取该次考试联盟学校信息")
... ... @@ -333,4 +350,22 @@ public class LearnController {
333 350 baseVo.setMessage(league.getId() +"");
334 351 return baseVo;
335 352 }
  353 +
  354 + @ApiOperation("基础信息输入")
  355 + @RequestMapping(value = "createChapter", method = RequestMethod.POST)
  356 + public BaseVo createChapter(@RequestBody ChapterReqVo chapterReqVo){
  357 + BaseVo baseVo = new BaseVo();
  358 + analyseService.updateChapter(chapterReqVo.getAnalyseId(),chapterReqVo.getExamTime(),chapterReqVo.getExamScope());
  359 + List<Chapter> list = new ArrayList<>();
  360 + for(ChapterReq chapterReq :chapterReqVo.getList()){
  361 + Chapter chapter = new Chapter();
  362 + chapter.setAnalyseId(chapterReqVo.getAnalyseId());
  363 + chapter.setChapterNumber(chapterReq.getChapterNumber());
  364 + chapter.setChapterName(chapterReq.getChapterName());
  365 + chapter.setChapterScore(chapterReq.getScore());
  366 + list.add(chapter);
  367 + }
  368 + chapterService.insertBatch(list);
  369 + return baseVo;
  370 + }
336 371 }
... ...
src/main/java/com/jevon/controller/LearnStatController.java
... ... @@ -9,7 +9,6 @@ import com.jevon.vo.req.GetLearnReqVo;
9 9 import com.jevon.wordDTO.*;
10 10 import io.swagger.annotations.Api;
11 11 import io.swagger.annotations.ApiOperation;
12   -import io.swagger.models.auth.In;
13 12 import org.springframework.beans.factory.annotation.Autowired;
14 13 import org.springframework.web.bind.annotation.RequestBody;
15 14 import org.springframework.web.bind.annotation.RequestMapping;
... ... @@ -52,25 +51,44 @@ public class LearnStatController {
52 51 @Autowired
53 52 LeagueService leagueService;
54 53  
55   -// @ApiOperation("getForm1_1")
56   -// @RequestMapping(value = "getForm1_1", method = RequestMethod.POST)
57   -// public List<Form7> getForm1_1(@RequestBody GetLearnReqVo getLearnReqVo){
58   -// Analyse analyse = analyseService.selectById(getLearnReqVo.getAnalyseId());
59   -// List<Form7> list = new ArrayList<>();
60   -// Form7 form7 = new Form7();
61   -// form7.setName(DifficultEnums.easy.getDifficultName());
62   -// form7.setPercent(analyseDetailService.selectDifficult(analyse.getId(),DifficultEnums.easy.getDifficultType())/analyse.getMaxScore()*100);
63   -// list.add(form7);
64   -// Form7 form = new Form7();
65   -// form.setName(DifficultEnums.medium.getDifficultName());
66   -// form.setPercent(analyseDetailService.selectDifficult(analyse.getId(),DifficultEnums.medium.getDifficultType())/analyse.getMaxScore()*100);
67   -// list.add(form);
68   -// Form7 form2 = new Form7();
69   -// form2.setName(DifficultEnums.difficult.getDifficultName());
70   -// form2.setPercent(analyseDetailService.selectDifficult(analyse.getId(),DifficultEnums.difficult.getDifficultType())/analyse.getMaxScore()*100);
71   -// list.add(form2);
72   -// return list;
73   -// }
  54 + @Autowired
  55 + ChapterService chapterService;
  56 +
  57 + @ApiOperation("getForm1_1")
  58 + @RequestMapping(value = "getForm1_1", method = RequestMethod.POST)
  59 + public Form7RepVO getForm1_1(@RequestBody GetLearnReqVo getLearnReqVo){
  60 + Form7RepVO form7RepVO = new Form7RepVO();
  61 + Analyse analyse = analyseService.selectById(getLearnReqVo.getAnalyseId());
  62 + form7RepVO.setExamScope(analyse.getExamScope());
  63 + form7RepVO.setCourseName(analyse.getCourseName());
  64 +
  65 + List<Chapter> chapters = chapterService.selectByAnalyse(analyse.getId());
  66 + for(Chapter chapter : chapters){
  67 + chapter.setPercent(chapter.getChapterScore() / analyse.getMaxScore() * 100);
  68 + }
  69 + form7RepVO.setList(chapters);
  70 + List<Form7> difficultList = new ArrayList<>();
  71 + for (DifficultEnums difficultEnums : DifficultEnums.values()){
  72 + Form7 form7 = new Form7();
  73 + form7.setName(difficultEnums.getDifficultShow());
  74 + form7.setPercent(analyseDetailService.selectDifficult(analyse.getId(),difficultEnums.getDifficultType())/analyse.getMaxScore()*100);
  75 + difficultList.add(form7);
  76 + }
  77 + form7RepVO.setDifficultList(difficultList);
  78 +
  79 + List<Form7> typeList = new ArrayList<>();
  80 + List<String> list = analyseDetailService.selectQuestionType(analyse.getId());
  81 + for(String type : list){
  82 + Form7 form7 = new Form7();
  83 + form7.setName(type);
  84 + Double score = analyseDetailService.selectSumType(analyse.getId(),type);
  85 + form7.setScore(score);
  86 + form7.setPercent(score / analyse.getMaxScore() * 100);
  87 + typeList.add(form7);
  88 + }
  89 + form7RepVO.setTypeList(typeList);
  90 + return form7RepVO;
  91 + }
74 92  
75 93 @ApiOperation("getForm2_1_1")
76 94 @RequestMapping(value = "getForm2_1_1", method = RequestMethod.POST)
... ... @@ -516,30 +534,30 @@ public class LearnStatController {
516 534  
517 535 @ApiOperation("getForm3_1")
518 536 @RequestMapping(value = "getForm3_1", method = RequestMethod.POST)
519   - public Form6RepVo getForm3_1(@RequestBody GetLearnReqVo getLearnReqVo){
  537 + public Form6RepVO getForm3_1(@RequestBody GetLearnReqVo getLearnReqVo){
520 538 return initDimensional(getLearnReqVo,DimensionalEnums.knowledge.getDimensionalType());
521 539 }
522 540  
523 541 @ApiOperation("getForm3_2")
524 542 @RequestMapping(value = "getForm3_2", method = RequestMethod.POST)
525   - public Form6RepVo getForm3_2(@RequestBody GetLearnReqVo getLearnReqVo){
  543 + public Form6RepVO getForm3_2(@RequestBody GetLearnReqVo getLearnReqVo){
526 544 return initDimensional(getLearnReqVo,DimensionalEnums.skill.getDimensionalType());
527 545 }
528 546  
529 547 @ApiOperation("getForm3_3")
530 548 @RequestMapping(value = "getForm3_3", method = RequestMethod.POST)
531   - public Form6RepVo getForm3_3(@RequestBody GetLearnReqVo getLearnReqVo){
  549 + public Form6RepVO getForm3_3(@RequestBody GetLearnReqVo getLearnReqVo){
532 550 return initDimensional(getLearnReqVo,DimensionalEnums.ability.getDimensionalType());
533 551 }
534 552  
535 553 @ApiOperation("getForm3_4")
536 554 @RequestMapping(value = "getForm3_4", method = RequestMethod.POST)
537   - public Form6RepVo getForm3_4(@RequestBody GetLearnReqVo getLearnReqVo){
  555 + public Form6RepVO getForm3_4(@RequestBody GetLearnReqVo getLearnReqVo){
538 556 return initDimensional(getLearnReqVo,DimensionalEnums.think.getDimensionalType());
539 557 }
540 558  
541   - private Form6RepVo initDimensional(GetLearnReqVo getLearnReqVo , int dimensionalType){
542   - Form6RepVo repVO = new Form6RepVo();
  559 + private Form6RepVO initDimensional(GetLearnReqVo getLearnReqVo , int dimensionalType){
  560 + Form6RepVO repVO = new Form6RepVO();
543 561 Analyse analyse = analyseService.selectById(getLearnReqVo.getAnalyseId());
544 562 if(analyse == null){
545 563 repVO.setSuccess(false);
... ... @@ -638,8 +656,8 @@ public class LearnStatController {
638 656 return repVO;
639 657 }
640 658  
641   - private Form6RepVo initSchoolDimensional(GetLearnReqVo getLearnReqVo , int dimensionalType){
642   - Form6RepVo repVO = new Form6RepVo();
  659 + private Form6RepVO initSchoolDimensional(GetLearnReqVo getLearnReqVo , int dimensionalType){
  660 + Form6RepVO repVO = new Form6RepVO();
643 661 Analyse analyse = analyseService.selectById(getLearnReqVo.getAnalyseId());
644 662 if(analyse == null){
645 663 repVO.setSuccess(false);
... ... @@ -736,7 +754,7 @@ public class LearnStatController {
736 754 suggestRepVo.setDifficultyDegree(avgStr);
737 755 suggestRepVo.setExcellentRate(aStr);
738 756 suggestRepVo.setErrorList(getErrorRate(getLearnReqVo.getAnalyseId(),getLearnReqVo.getSchoolName(),students.size()));
739   - Form6RepVo knowledge = initSchoolDimensional(getLearnReqVo,DimensionalEnums.knowledge.getDimensionalType());
  757 + Form6RepVO knowledge = initSchoolDimensional(getLearnReqVo,DimensionalEnums.knowledge.getDimensionalType());
740 758 List<String> lessKnowledgeList = new ArrayList<>(); //不足50%
741 759 List<String> midKnowledgeList = new ArrayList<>(); //50-70%
742 760 for(Form6 form6 :knowledge.getData()){
... ... @@ -748,7 +766,7 @@ public class LearnStatController {
748 766 }
749 767 suggestRepVo.setLessKnowledgeList(lessKnowledgeList);
750 768 suggestRepVo.setMidKnowledgeList(midKnowledgeList);
751   - Form6RepVo ability = initSchoolDimensional(getLearnReqVo,DimensionalEnums.ability.getDimensionalType());
  769 + Form6RepVO ability = initSchoolDimensional(getLearnReqVo,DimensionalEnums.ability.getDimensionalType());
752 770 List<String> lessAbilityList = new ArrayList<>(); //不足70%
753 771 List<String> midAbilityList = new ArrayList<>(); //70-80%
754 772 List<String> highAbilityList = new ArrayList<>(); //大于80%
... ... @@ -764,7 +782,7 @@ public class LearnStatController {
764 782 suggestRepVo.setLessAbilityList(lessAbilityList);
765 783 suggestRepVo.setMidAbilityList(midAbilityList);
766 784 suggestRepVo.setHighAbilityList(highAbilityList);
767   - Form6RepVo skill = initSchoolDimensional(getLearnReqVo,DimensionalEnums.skill.getDimensionalType());
  785 + Form6RepVO skill = initSchoolDimensional(getLearnReqVo,DimensionalEnums.skill.getDimensionalType());
768 786 List<String> lessSkillList = new ArrayList<>(); //不足70%
769 787 List<String> midSkillList = new ArrayList<>(); //70-80%
770 788 List<String> highSkillList = new ArrayList<>(); //大于80%
... ...
src/main/java/com/jevon/enums/DifficultEnums.java
... ... @@ -7,16 +7,26 @@ package com.jevon.enums;
7 7 */
8 8 public enum DifficultEnums {
9 9  
10   - easy(1,"易"),
11   - medium(2,"中"),
12   - difficult(3,"难");
  10 + easy(1,"易","认知"),
  11 + medium(2,"中","理解"),
  12 + difficult(3,"难","应用");
13 13  
14 14 private int difficultType ;
15 15 private String difficultName ;
  16 + private String difficultShow ;
16 17  
17   - DifficultEnums(int difficultType, String difficultName) {
  18 + DifficultEnums(int difficultType, String difficultName, String difficultShow) {
18 19 this.difficultType = difficultType;
19 20 this.difficultName = difficultName;
  21 + this.difficultShow = difficultShow;
  22 + }
  23 +
  24 + public String getDifficultShow() {
  25 + return difficultShow;
  26 + }
  27 +
  28 + public void setDifficultShow(String difficultShow) {
  29 + this.difficultShow = difficultShow;
20 30 }
21 31  
22 32 public int getDifficultType() {
... ...
src/main/java/com/jevon/mapper/AnalyseDetailMapper.java
... ... @@ -17,6 +17,8 @@ public interface AnalyseDetailMapper {
17 17  
18 18 Double selectDifficult(AnalyseDetail analyseDetail);
19 19  
  20 + Double selectSumType(AnalyseDetail analyseDetail);
  21 +
20 22 List<AnalyseDetail> selectDifficultDetail(AnalyseDetail analyseDetail);
21 23  
22 24 List<String> selectQuestionType(int analyseId);
... ...
src/main/java/com/jevon/mapper/AnalyseMapper.java
... ... @@ -18,4 +18,6 @@ public interface AnalyseMapper {
18 18 Analyse selectById(int id);
19 19  
20 20 int update(Analyse analyse);
  21 +
  22 + int updateChapter(Analyse analyse);
21 23 }
... ...
src/main/java/com/jevon/mapper/ChapterMapper.java 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +package com.jevon.mapper;
  2 +
  3 +import com.jevon.model.Chapter;
  4 +
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * @author chen
  9 + * @version 1.0
  10 + * @date 2019/10/24 0024 9:04
  11 + */
  12 +public interface ChapterMapper {
  13 +
  14 + int insertBatch(List<Chapter> list);
  15 +
  16 + List<Chapter> selectByAnalyse(int analyseId);
  17 +}
... ...
src/main/java/com/jevon/model/Analyse.java
... ... @@ -16,6 +16,7 @@ public class Analyse {
16 16 private Date createTime ;
17 17 private Double maxScore ;
18 18 private String grade ;
  19 + private String examScope ;
19 20  
20 21 public int getId() {
21 22 return id;
... ... @@ -72,4 +73,12 @@ public class Analyse {
72 73 public void setGrade(String grade) {
73 74 this.grade = grade;
74 75 }
  76 +
  77 + public String getExamScope() {
  78 + return examScope;
  79 + }
  80 +
  81 + public void setExamScope(String examScope) {
  82 + this.examScope = examScope;
  83 + }
75 84 }
... ...
src/main/java/com/jevon/model/Chapter.java 0 → 100644
... ... @@ -0,0 +1,65 @@
  1 +package com.jevon.model;
  2 +
  3 +/**
  4 + * @author chen
  5 + * @version 1.0
  6 + * @date 2019/10/24 0024 9:03
  7 + */
  8 +public class Chapter {
  9 +
  10 + private int id ;
  11 + private int analyseId ;
  12 + private int chapterNumber ;
  13 + private String chapterName ;
  14 + private Double chapterScore ;
  15 +
  16 + private Double percent ;
  17 +
  18 + public int getId() {
  19 + return id;
  20 + }
  21 +
  22 + public void setId(int id) {
  23 + this.id = id;
  24 + }
  25 +
  26 + public int getAnalyseId() {
  27 + return analyseId;
  28 + }
  29 +
  30 + public void setAnalyseId(int analyseId) {
  31 + this.analyseId = analyseId;
  32 + }
  33 +
  34 + public int getChapterNumber() {
  35 + return chapterNumber;
  36 + }
  37 +
  38 + public void setChapterNumber(int chapterNumber) {
  39 + this.chapterNumber = chapterNumber;
  40 + }
  41 +
  42 + public String getChapterName() {
  43 + return chapterName;
  44 + }
  45 +
  46 + public void setChapterName(String chapterName) {
  47 + this.chapterName = chapterName;
  48 + }
  49 +
  50 + public Double getChapterScore() {
  51 + return chapterScore;
  52 + }
  53 +
  54 + public void setChapterScore(Double chapterScore) {
  55 + this.chapterScore = chapterScore;
  56 + }
  57 +
  58 + public Double getPercent() {
  59 + return percent;
  60 + }
  61 +
  62 + public void setPercent(Double percent) {
  63 + this.percent = percent;
  64 + }
  65 +}
... ...
src/main/java/com/jevon/service/AnalyseDetailService.java
... ... @@ -17,6 +17,8 @@ public interface AnalyseDetailService {
17 17  
18 18 Double selectDifficult(int analyseId , int difficult);
19 19  
  20 + Double selectSumType(int analyseId , String questionType);
  21 +
20 22 List<AnalyseDetail> selectDifficultDetail(int analyseId , int difficult);
21 23  
22 24 List<String> selectQuestionType(int analyseId);
... ...
src/main/java/com/jevon/service/AnalyseService.java
... ... @@ -18,4 +18,6 @@ public interface AnalyseService {
18 18 Analyse selectById(int id);
19 19  
20 20 int update(Analyse analyse);
  21 +
  22 + int updateChapter(int id , String examTime , String examScope);
21 23 }
... ...
src/main/java/com/jevon/service/ChapterService.java 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +package com.jevon.service;
  2 +
  3 +import com.jevon.model.Chapter;
  4 +
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * @author chen
  9 + * @version 1.0
  10 + * @date 2019/10/24 0024 9:09
  11 + */
  12 +public interface ChapterService {
  13 +
  14 + int insertBatch(List<Chapter> list);
  15 +
  16 + List<Chapter> selectByAnalyse(int analyseId);
  17 +}
... ...
src/main/java/com/jevon/service/impl/AnalyseDetailServiceImpl.java
... ... @@ -50,6 +50,14 @@ public class AnalyseDetailServiceImpl implements AnalyseDetailService {
50 50 }
51 51  
52 52 @Override
  53 + public Double selectSumType(int analyseId, String questionType) {
  54 + AnalyseDetail analyseDetail = new AnalyseDetail();
  55 + analyseDetail.setQuestionType(questionType);
  56 + analyseDetail.setAnalyseId(analyseId);
  57 + return analyseDetailMapper.selectSumType(analyseDetail);
  58 + }
  59 +
  60 + @Override
53 61 public List<AnalyseDetail> selectDifficultDetail(int analyseId, int difficult) {
54 62 AnalyseDetail analyseDetail = new AnalyseDetail();
55 63 analyseDetail.setDifficult(difficult);
... ...
src/main/java/com/jevon/service/impl/AnalyseServiceImpl.java
... ... @@ -38,4 +38,13 @@ public class AnalyseServiceImpl implements AnalyseService {
38 38 public int update(Analyse analyse) {
39 39 return analyseMapper.update(analyse);
40 40 }
  41 +
  42 + @Override
  43 + public int updateChapter(int id, String examTime, String examScope) {
  44 + Analyse analyse = new Analyse();
  45 + analyse.setId(id);
  46 + analyse.setExamTime(examTime);
  47 + analyse.setExamScope(examScope);
  48 + return analyseMapper.updateChapter(analyse);
  49 + }
41 50 }
... ...
src/main/java/com/jevon/service/impl/ChapterServiceImpl.java 0 → 100644
... ... @@ -0,0 +1,31 @@
  1 +package com.jevon.service.impl;
  2 +
  3 +import com.jevon.mapper.ChapterMapper;
  4 +import com.jevon.model.Chapter;
  5 +import com.jevon.service.ChapterService;
  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/24 0024 9:09
  15 + */
  16 +@Service
  17 +public class ChapterServiceImpl implements ChapterService {
  18 +
  19 + @Autowired
  20 + ChapterMapper chapterMapper;
  21 +
  22 + @Override
  23 + public int insertBatch(List<Chapter> list) {
  24 + return chapterMapper.insertBatch(list);
  25 + }
  26 +
  27 + @Override
  28 + public List<Chapter> selectByAnalyse(int analyseId) {
  29 + return chapterMapper.selectByAnalyse(analyseId);
  30 + }
  31 +}
... ...
src/main/java/com/jevon/service/impl/LeagueServiceImpl.java
... ... @@ -44,25 +44,32 @@ public class LeagueServiceImpl implements LeagueService {
44 44 League result = leagueMapper.selectById(id) ;
45 45 League search = new League();
46 46 search.setAnalyseId(result.getAnalyseId());
47   - search.setLeague(result.getLeague());
48   - List<League> list = leagueMapper.selectByLeague(search);
49   - boolean isCreate = true ;
50   - for(League temp : list){
51   - if(StringUtils.isBlank(temp.getSchoolName())){
52   - temp.setSchoolName(schoolName);
53   - leagueMapper.update(temp);
54   - isCreate = false;
55   - break;
  47 + search.setSchoolName(schoolName);
  48 + List<League> leagues = leagueMapper.selectByLeague(search) ;
  49 + if(leagues != null & leagues.size() >0){
  50 + return 0 ;
  51 + }else {
  52 + search.setLeague(result.getLeague());
  53 + search.setSchoolName(null);
  54 + List<League> list = leagueMapper.selectByLeague(search);
  55 + boolean isCreate = true ;
  56 + for(League temp : list){
  57 + if(StringUtils.isBlank(temp.getSchoolName())){
  58 + temp.setSchoolName(schoolName);
  59 + leagueMapper.update(temp);
  60 + isCreate = false;
  61 + break;
  62 + }
56 63 }
  64 + if(isCreate){
  65 + League createLeague = new League();
  66 + createLeague.setAnalyseId(result.getAnalyseId());
  67 + createLeague.setLeague(result.getLeague());
  68 + createLeague.setSchoolName(schoolName);
  69 + leagueMapper.insert(createLeague);
  70 + }
  71 + return 1;
57 72 }
58   - if(isCreate){
59   - League createLeague = new League();
60   - createLeague.setAnalyseId(result.getAnalyseId());
61   - createLeague.setLeague(result.getLeague());
62   - createLeague.setSchoolName(schoolName);
63   - leagueMapper.insert(createLeague);
64   - }
65   - return 1;
66 73 }
67 74  
68 75 @Override
... ...
src/main/java/com/jevon/vo/req/ChapterReq.java 0 → 100644
... ... @@ -0,0 +1,37 @@
  1 +package com.jevon.vo.req;
  2 +
  3 +/**
  4 + * @author chen
  5 + * @version 1.0
  6 + * @date 2019/10/24 0024 8:55
  7 + */
  8 +public class ChapterReq {
  9 +
  10 + private int chapterNumber ;
  11 + private String chapterName ;
  12 + private Double score ;
  13 +
  14 + public int getChapterNumber() {
  15 + return chapterNumber;
  16 + }
  17 +
  18 + public void setChapterNumber(int chapterNumber) {
  19 + this.chapterNumber = chapterNumber;
  20 + }
  21 +
  22 + public String getChapterName() {
  23 + return chapterName;
  24 + }
  25 +
  26 + public void setChapterName(String chapterName) {
  27 + this.chapterName = chapterName;
  28 + }
  29 +
  30 + public Double getScore() {
  31 + return score;
  32 + }
  33 +
  34 + public void setScore(Double score) {
  35 + this.score = score;
  36 + }
  37 +}
... ...
src/main/java/com/jevon/vo/req/ChapterReqVo.java 0 → 100644
... ... @@ -0,0 +1,48 @@
  1 +package com.jevon.vo.req;
  2 +
  3 +import java.util.List;
  4 +
  5 +/**
  6 + * @author chen
  7 + * @version 1.0
  8 + * @date 2019/10/24 0024 8:53
  9 + */
  10 +public class ChapterReqVo {
  11 +
  12 + private int analyseId ;
  13 + private String examTime ;
  14 + private String examScope ;
  15 + private List<ChapterReq> list ;
  16 +
  17 + public int getAnalyseId() {
  18 + return analyseId;
  19 + }
  20 +
  21 + public void setAnalyseId(int analyseId) {
  22 + this.analyseId = analyseId;
  23 + }
  24 +
  25 + public String getExamTime() {
  26 + return examTime;
  27 + }
  28 +
  29 + public void setExamTime(String examTime) {
  30 + this.examTime = examTime;
  31 + }
  32 +
  33 + public String getExamScope() {
  34 + return examScope;
  35 + }
  36 +
  37 + public void setExamScope(String examScope) {
  38 + this.examScope = examScope;
  39 + }
  40 +
  41 + public List<ChapterReq> getList() {
  42 + return list;
  43 + }
  44 +
  45 + public void setList(List<ChapterReq> list) {
  46 + this.list = list;
  47 + }
  48 +}
... ...
src/main/java/com/jevon/wordDTO/Form6RepVO.java 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +package com.jevon.wordDTO;
  2 +
  3 +import com.jevon.vo.BaseVo;
  4 +import io.swagger.annotations.ApiModel;
  5 +
  6 +import java.util.List;
  7 +
  8 +/**
  9 + * @author chen
  10 + * @version 1.0
  11 + * @date 2019/10/22 0022 10:51
  12 + */
  13 +@ApiModel
  14 +public class Form6RepVO extends BaseVo {
  15 +
  16 + private List<Form6> data ;
  17 +
  18 + public List<Form6> getData() {
  19 + return data;
  20 + }
  21 +
  22 + public void setData(List<Form6> data) {
  23 + this.data = data;
  24 + }
  25 +}
... ...
src/main/java/com/jevon/wordDTO/Form6RepVo.java
... ... @@ -1,25 +0,0 @@
1   -package com.jevon.wordDTO;
2   -
3   -import com.jevon.vo.BaseVo;
4   -import io.swagger.annotations.ApiModel;
5   -
6   -import java.util.List;
7   -
8   -/**
9   - * @author chen
10   - * @version 1.0
11   - * @date 2019/10/22 0022 10:51
12   - */
13   -@ApiModel
14   -public class Form6RepVo extends BaseVo {
15   -
16   - private List<Form6> data ;
17   -
18   - public List<Form6> getData() {
19   - return data;
20   - }
21   -
22   - public void setData(List<Form6> data) {
23   - this.data = data;
24   - }
25   -}
src/main/java/com/jevon/wordDTO/Form7.java
... ... @@ -11,8 +11,17 @@ import io.swagger.annotations.ApiModel;
11 11 public class Form7 {
12 12  
13 13 private String name ;
  14 + private Double score ;
14 15 private Double percent ;
15 16  
  17 + public Double getScore() {
  18 + return score;
  19 + }
  20 +
  21 + public void setScore(Double score) {
  22 + this.score = score;
  23 + }
  24 +
16 25 public String getName() {
17 26 return name;
18 27 }
... ...
src/main/java/com/jevon/wordDTO/Form7RepVO.java 0 → 100644
... ... @@ -0,0 +1,67 @@
  1 +package com.jevon.wordDTO;
  2 +
  3 +import com.jevon.model.Chapter;
  4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +
  7 +import java.util.List;
  8 +
  9 +/**
  10 + * @author chen
  11 + * @version 1.0
  12 + * @date 2019/10/24 0024 9:20
  13 + */
  14 +@ApiModel
  15 +public class Form7RepVO {
  16 +
  17 + @ApiModelProperty(value = "举例七年级上册")
  18 + private String examScope ;
  19 + @ApiModelProperty(value = "科目")
  20 + private String courseName ;
  21 + @ApiModelProperty(value = "章节列表对应分值")
  22 + private List<Chapter> list ;
  23 + @ApiModelProperty(value = "难度列表对应分值")
  24 + private List<Form7> difficultList ;
  25 + @ApiModelProperty(value = "题型类型对应分值")
  26 + private List<Form7> typeList ;
  27 +
  28 + public String getExamScope() {
  29 + return examScope;
  30 + }
  31 +
  32 + public void setExamScope(String examScope) {
  33 + this.examScope = examScope;
  34 + }
  35 +
  36 + public String getCourseName() {
  37 + return courseName;
  38 + }
  39 +
  40 + public void setCourseName(String courseName) {
  41 + this.courseName = courseName;
  42 + }
  43 +
  44 + public List<Chapter> getList() {
  45 + return list;
  46 + }
  47 +
  48 + public void setList(List<Chapter> list) {
  49 + this.list = list;
  50 + }
  51 +
  52 + public List<Form7> getDifficultList() {
  53 + return difficultList;
  54 + }
  55 +
  56 + public void setDifficultList(List<Form7> difficultList) {
  57 + this.difficultList = difficultList;
  58 + }
  59 +
  60 + public List<Form7> getTypeList() {
  61 + return typeList;
  62 + }
  63 +
  64 + public void setTypeList(List<Form7> typeList) {
  65 + this.typeList = typeList;
  66 + }
  67 +}
... ...
src/main/resources/mapping/AnalyseDetailMapper.xml
... ... @@ -32,7 +32,10 @@
32 32 </select>
33 33  
34 34 <select id="selectQuestionType" parameterType="java.lang.Integer" resultType="java.lang.String">
35   - select DISTINCT questionType from sz_learn_analyse_detail where analyse_id = #{analyseId}
  35 + select DISTINCT question_type from sz_learn_analyse_detail where analyse_id = #{analyseId}
  36 + </select>
  37 +
  38 + <select id="selectSumType" parameterType="com.jevon.model.AnalyseDetail" resultType="java.lang.Double">
  39 + select sum(score) from sz_learn_analyse_detail where analyse_id = #{analyseId} and question_type =#{questionType}
36 40 </select>
37   -
38 41 </mapper>
39 42 \ No newline at end of file
... ...
src/main/resources/mapping/AnalyseMapper.xml
... ... @@ -9,6 +9,7 @@
9 9 <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
10 10 <result column="max_score" property="maxScore" jdbcType="FLOAT" />
11 11 <result column="grade" property="grade" jdbcType="VARCHAR" />
  12 + <result column="exam_scope" property="examScope" jdbcType="VARCHAR" />
12 13 </resultMap>
13 14  
14 15 <insert id="insert" parameterType="com.jevon.model.Analyse" useGeneratedKeys="true" keyProperty="id">
... ... @@ -50,4 +51,8 @@
50 51 <select id="selectById" parameterType="java.lang.Integer" resultMap="BaseResultMap">
51 52 select * from sz_learn_analyse where id = #{id}
52 53 </select>
  54 +
  55 + <update id="updateChapter" parameterType="com.jevon.model.Analyse" >
  56 + update sz_learn_analyse set exam_time = #{examTime} , exam_scope = #{examScope} where id = #{id}
  57 + </update>
53 58 </mapper>
54 59 \ No newline at end of file
... ...
src/main/resources/mapping/ChapterMapper.xml 0 → 100644
... ... @@ -0,0 +1,24 @@
  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.ChapterMapper" >
  4 + <resultMap id="BaseResultMap" type="com.jevon.model.Chapter" >
  5 + <id column="id" property="id" jdbcType="INTEGER" />
  6 + <result column="analyse_id" property="analyseId" jdbcType="INTEGER" />
  7 + <result column="chapter_number" property="chapterNumber" jdbcType="INTEGER" />
  8 + <result column="chapter_name" property="chapterName" jdbcType="VARCHAR" />
  9 + <result column="chapter_score" property="chapterScore" jdbcType="FLOAT" />
  10 + </resultMap>
  11 +
  12 + <insert id="insertBatch" parameterType="com.jevon.model.Chapter" useGeneratedKeys="true" keyProperty="id">
  13 + insert into sz_learn_analyse_chapter (analyse_id, chapter_number,chapter_name,chapter_score)
  14 + values
  15 + <foreach collection="list" item="emp" separator=",">
  16 + (#{emp.analyseId}, #{emp.chapterNumber}, #{emp.chapterName}, #{emp.chapterScore})
  17 + </foreach>
  18 + </insert>
  19 +
  20 + <select id="selectByAnalyse" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  21 + select * from sz_learn_analyse_chapter where analyse_id = #{analyseId}
  22 + </select>
  23 +
  24 +</mapper>
0 25 \ No newline at end of file
... ...