From 87ec6d46c18c81b9f3d9d388cb37951a594e24d0 Mon Sep 17 00:00:00 2001 From: 陈杰 <504987307@qq.com> Date: Thu, 24 Oct 2019 09:39:36 +0800 Subject: [PATCH] 第一章信息 --- src/main/java/com/jevon/controller/LearnController.java | 57 ++++++++++++++++++++++++++++++++++++++++++++++----------- src/main/java/com/jevon/controller/LearnStatController.java | 80 +++++++++++++++++++++++++++++++++++++++++++++++++------------------------------- src/main/java/com/jevon/enums/DifficultEnums.java | 18 ++++++++++++++---- src/main/java/com/jevon/mapper/AnalyseDetailMapper.java | 2 ++ src/main/java/com/jevon/mapper/AnalyseMapper.java | 2 ++ src/main/java/com/jevon/mapper/ChapterMapper.java | 17 +++++++++++++++++ src/main/java/com/jevon/model/Analyse.java | 9 +++++++++ src/main/java/com/jevon/model/Chapter.java | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/jevon/service/AnalyseDetailService.java | 2 ++ src/main/java/com/jevon/service/AnalyseService.java | 2 ++ src/main/java/com/jevon/service/ChapterService.java | 17 +++++++++++++++++ src/main/java/com/jevon/service/impl/AnalyseDetailServiceImpl.java | 8 ++++++++ src/main/java/com/jevon/service/impl/AnalyseServiceImpl.java | 9 +++++++++ src/main/java/com/jevon/service/impl/ChapterServiceImpl.java | 31 +++++++++++++++++++++++++++++++ src/main/java/com/jevon/service/impl/LeagueServiceImpl.java | 41 ++++++++++++++++++++++++----------------- src/main/java/com/jevon/vo/req/ChapterReq.java | 37 +++++++++++++++++++++++++++++++++++++ src/main/java/com/jevon/vo/req/ChapterReqVo.java | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/jevon/wordDTO/Form6RepVO.java | 25 +++++++++++++++++++++++++ src/main/java/com/jevon/wordDTO/Form6RepVo.java | 25 ------------------------- src/main/java/com/jevon/wordDTO/Form7.java | 9 +++++++++ src/main/java/com/jevon/wordDTO/Form7RepVO.java | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/resources/mapping/AnalyseDetailMapper.xml | 7 +++++-- src/main/resources/mapping/AnalyseMapper.xml | 5 +++++ src/main/resources/mapping/ChapterMapper.xml | 24 ++++++++++++++++++++++++ 24 files changed, 517 insertions(+), 90 deletions(-) create mode 100644 src/main/java/com/jevon/mapper/ChapterMapper.java create mode 100644 src/main/java/com/jevon/model/Chapter.java create mode 100644 src/main/java/com/jevon/service/ChapterService.java create mode 100644 src/main/java/com/jevon/service/impl/ChapterServiceImpl.java create mode 100644 src/main/java/com/jevon/vo/req/ChapterReq.java create mode 100644 src/main/java/com/jevon/vo/req/ChapterReqVo.java create mode 100644 src/main/java/com/jevon/wordDTO/Form6RepVO.java delete mode 100644 src/main/java/com/jevon/wordDTO/Form6RepVo.java create mode 100644 src/main/java/com/jevon/wordDTO/Form7RepVO.java create mode 100644 src/main/resources/mapping/ChapterMapper.xml diff --git a/src/main/java/com/jevon/controller/LearnController.java b/src/main/java/com/jevon/controller/LearnController.java index b5f0906..c574dbe 100644 --- a/src/main/java/com/jevon/controller/LearnController.java +++ b/src/main/java/com/jevon/controller/LearnController.java @@ -58,6 +58,9 @@ public class LearnController { @Autowired LeagueService leagueService; + @Autowired + ChapterService chapterService; + @Value("${remoting.url}") private String url ; @Value("${remoting.prefixFile}") @@ -107,7 +110,14 @@ public class LearnController { @RequestMapping(value = "initAnalyse", method = RequestMethod.POST) public BaseVo initAnalyse(@RequestBody InitAnalyseReqVo initAnalyseReqVo){ BaseVo baseVo = new BaseVo(); - analysisExcel(initAnalyseReqVo); + Analyse analyse = analyseService.selectById(initAnalyseReqVo.getAnalyseId()); + List analyseDetails = analyseDetailService.selectByAnalyseId(analyse.getId()); + if(analyseDetails != null & analyseDetails.size() > 0){ + baseVo.setMessage("已经导入"); + baseVo.setSuccess(false); + }else { + analysisExcel(initAnalyseReqVo); + } return baseVo; } @@ -206,21 +216,23 @@ public class LearnController { @RequestMapping(value = "initScore", method = RequestMethod.POST) public BaseVo initScore(@RequestBody InitScoreReqVo initScoreReqVo){ BaseVo baseVo = new BaseVo(); - String schoolName = analysisScoreExcel(initScoreReqVo); - leagueService.initLeagueSchool(initScoreReqVo.getLeagueId(),schoolName); + boolean success = analysisScoreExcel(initScoreReqVo); + if(!success){ + baseVo.setSuccess(false); + baseVo.setMessage("一个学校不能在两个联盟下"); + } return baseVo; } - private String analysisScoreExcel(InitAnalyseReqVo initAnalyseReqVo){ + private boolean analysisScoreExcel(InitScoreReqVo initScoreReqVo){ try{ - String schoolName = ""; - Analyse analyse = analyseService.selectById(initAnalyseReqVo.getAnalyseId()); + Analyse analyse = analyseService.selectById(initScoreReqVo.getAnalyseId()); List analyseDetails = analyseDetailService.selectByAnalyseId(analyse.getId()); Map scoreMap = new HashMap<>(); for(AnalyseDetail analyseDetail : analyseDetails){ scoreMap.put(analyseDetail.getQuestionNumber(),analyseDetail.getScore()); } - String fileUrl = initAnalyseReqVo.getUrl(); + String fileUrl = initScoreReqVo.getUrl(); fileUrl = fileUrl.replace(url, staticUrl); File excelFile = new File(fileUrl); // 获得工作簿 @@ -281,15 +293,20 @@ public class LearnController { } } } - studentService.insertBatch(students); - studentDetailService.insertBatch(studentDetails); - return students.get(0).getSchoolName(); + int i = leagueService.initLeagueSchool(initScoreReqVo.getLeagueId(),students.get(0).getSchoolName()); + if(i > 0){ + studentService.insertBatch(students); + studentDetailService.insertBatch(studentDetails); + return true ; + }else { + return false ; + } } }catch (Exception e){ e.printStackTrace(); System.out.println(e.toString()); } - return null ; + return false ; } @ApiOperation("获取该次考试联盟学校信息") @@ -333,4 +350,22 @@ public class LearnController { baseVo.setMessage(league.getId() +""); return baseVo; } + + @ApiOperation("基础信息输入") + @RequestMapping(value = "createChapter", method = RequestMethod.POST) + public BaseVo createChapter(@RequestBody ChapterReqVo chapterReqVo){ + BaseVo baseVo = new BaseVo(); + analyseService.updateChapter(chapterReqVo.getAnalyseId(),chapterReqVo.getExamTime(),chapterReqVo.getExamScope()); + List list = new ArrayList<>(); + for(ChapterReq chapterReq :chapterReqVo.getList()){ + Chapter chapter = new Chapter(); + chapter.setAnalyseId(chapterReqVo.getAnalyseId()); + chapter.setChapterNumber(chapterReq.getChapterNumber()); + chapter.setChapterName(chapterReq.getChapterName()); + chapter.setChapterScore(chapterReq.getScore()); + list.add(chapter); + } + chapterService.insertBatch(list); + return baseVo; + } } diff --git a/src/main/java/com/jevon/controller/LearnStatController.java b/src/main/java/com/jevon/controller/LearnStatController.java index d8b06ec..4b6c9f7 100644 --- a/src/main/java/com/jevon/controller/LearnStatController.java +++ b/src/main/java/com/jevon/controller/LearnStatController.java @@ -9,7 +9,6 @@ import com.jevon.vo.req.GetLearnReqVo; import com.jevon.wordDTO.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import io.swagger.models.auth.In; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -52,25 +51,44 @@ public class LearnStatController { @Autowired LeagueService leagueService; -// @ApiOperation("getForm1_1") -// @RequestMapping(value = "getForm1_1", method = RequestMethod.POST) -// public List getForm1_1(@RequestBody GetLearnReqVo getLearnReqVo){ -// Analyse analyse = analyseService.selectById(getLearnReqVo.getAnalyseId()); -// List list = new ArrayList<>(); -// Form7 form7 = new Form7(); -// form7.setName(DifficultEnums.easy.getDifficultName()); -// form7.setPercent(analyseDetailService.selectDifficult(analyse.getId(),DifficultEnums.easy.getDifficultType())/analyse.getMaxScore()*100); -// list.add(form7); -// Form7 form = new Form7(); -// form.setName(DifficultEnums.medium.getDifficultName()); -// form.setPercent(analyseDetailService.selectDifficult(analyse.getId(),DifficultEnums.medium.getDifficultType())/analyse.getMaxScore()*100); -// list.add(form); -// Form7 form2 = new Form7(); -// form2.setName(DifficultEnums.difficult.getDifficultName()); -// form2.setPercent(analyseDetailService.selectDifficult(analyse.getId(),DifficultEnums.difficult.getDifficultType())/analyse.getMaxScore()*100); -// list.add(form2); -// return list; -// } + @Autowired + ChapterService chapterService; + + @ApiOperation("getForm1_1") + @RequestMapping(value = "getForm1_1", method = RequestMethod.POST) + public Form7RepVO getForm1_1(@RequestBody GetLearnReqVo getLearnReqVo){ + Form7RepVO form7RepVO = new Form7RepVO(); + Analyse analyse = analyseService.selectById(getLearnReqVo.getAnalyseId()); + form7RepVO.setExamScope(analyse.getExamScope()); + form7RepVO.setCourseName(analyse.getCourseName()); + + List chapters = chapterService.selectByAnalyse(analyse.getId()); + for(Chapter chapter : chapters){ + chapter.setPercent(chapter.getChapterScore() / analyse.getMaxScore() * 100); + } + form7RepVO.setList(chapters); + List difficultList = new ArrayList<>(); + for (DifficultEnums difficultEnums : DifficultEnums.values()){ + Form7 form7 = new Form7(); + form7.setName(difficultEnums.getDifficultShow()); + form7.setPercent(analyseDetailService.selectDifficult(analyse.getId(),difficultEnums.getDifficultType())/analyse.getMaxScore()*100); + difficultList.add(form7); + } + form7RepVO.setDifficultList(difficultList); + + List typeList = new ArrayList<>(); + List list = analyseDetailService.selectQuestionType(analyse.getId()); + for(String type : list){ + Form7 form7 = new Form7(); + form7.setName(type); + Double score = analyseDetailService.selectSumType(analyse.getId(),type); + form7.setScore(score); + form7.setPercent(score / analyse.getMaxScore() * 100); + typeList.add(form7); + } + form7RepVO.setTypeList(typeList); + return form7RepVO; + } @ApiOperation("getForm2_1_1") @RequestMapping(value = "getForm2_1_1", method = RequestMethod.POST) @@ -516,30 +534,30 @@ public class LearnStatController { @ApiOperation("getForm3_1") @RequestMapping(value = "getForm3_1", method = RequestMethod.POST) - public Form6RepVo getForm3_1(@RequestBody GetLearnReqVo getLearnReqVo){ + public Form6RepVO getForm3_1(@RequestBody GetLearnReqVo getLearnReqVo){ return initDimensional(getLearnReqVo,DimensionalEnums.knowledge.getDimensionalType()); } @ApiOperation("getForm3_2") @RequestMapping(value = "getForm3_2", method = RequestMethod.POST) - public Form6RepVo getForm3_2(@RequestBody GetLearnReqVo getLearnReqVo){ + public Form6RepVO getForm3_2(@RequestBody GetLearnReqVo getLearnReqVo){ return initDimensional(getLearnReqVo,DimensionalEnums.skill.getDimensionalType()); } @ApiOperation("getForm3_3") @RequestMapping(value = "getForm3_3", method = RequestMethod.POST) - public Form6RepVo getForm3_3(@RequestBody GetLearnReqVo getLearnReqVo){ + public Form6RepVO getForm3_3(@RequestBody GetLearnReqVo getLearnReqVo){ return initDimensional(getLearnReqVo,DimensionalEnums.ability.getDimensionalType()); } @ApiOperation("getForm3_4") @RequestMapping(value = "getForm3_4", method = RequestMethod.POST) - public Form6RepVo getForm3_4(@RequestBody GetLearnReqVo getLearnReqVo){ + public Form6RepVO getForm3_4(@RequestBody GetLearnReqVo getLearnReqVo){ return initDimensional(getLearnReqVo,DimensionalEnums.think.getDimensionalType()); } - private Form6RepVo initDimensional(GetLearnReqVo getLearnReqVo , int dimensionalType){ - Form6RepVo repVO = new Form6RepVo(); + private Form6RepVO initDimensional(GetLearnReqVo getLearnReqVo , int dimensionalType){ + Form6RepVO repVO = new Form6RepVO(); Analyse analyse = analyseService.selectById(getLearnReqVo.getAnalyseId()); if(analyse == null){ repVO.setSuccess(false); @@ -638,8 +656,8 @@ public class LearnStatController { return repVO; } - private Form6RepVo initSchoolDimensional(GetLearnReqVo getLearnReqVo , int dimensionalType){ - Form6RepVo repVO = new Form6RepVo(); + private Form6RepVO initSchoolDimensional(GetLearnReqVo getLearnReqVo , int dimensionalType){ + Form6RepVO repVO = new Form6RepVO(); Analyse analyse = analyseService.selectById(getLearnReqVo.getAnalyseId()); if(analyse == null){ repVO.setSuccess(false); @@ -736,7 +754,7 @@ public class LearnStatController { suggestRepVo.setDifficultyDegree(avgStr); suggestRepVo.setExcellentRate(aStr); suggestRepVo.setErrorList(getErrorRate(getLearnReqVo.getAnalyseId(),getLearnReqVo.getSchoolName(),students.size())); - Form6RepVo knowledge = initSchoolDimensional(getLearnReqVo,DimensionalEnums.knowledge.getDimensionalType()); + Form6RepVO knowledge = initSchoolDimensional(getLearnReqVo,DimensionalEnums.knowledge.getDimensionalType()); List lessKnowledgeList = new ArrayList<>(); //不足50% List midKnowledgeList = new ArrayList<>(); //50-70% for(Form6 form6 :knowledge.getData()){ @@ -748,7 +766,7 @@ public class LearnStatController { } suggestRepVo.setLessKnowledgeList(lessKnowledgeList); suggestRepVo.setMidKnowledgeList(midKnowledgeList); - Form6RepVo ability = initSchoolDimensional(getLearnReqVo,DimensionalEnums.ability.getDimensionalType()); + Form6RepVO ability = initSchoolDimensional(getLearnReqVo,DimensionalEnums.ability.getDimensionalType()); List lessAbilityList = new ArrayList<>(); //不足70% List midAbilityList = new ArrayList<>(); //70-80% List highAbilityList = new ArrayList<>(); //大于80% @@ -764,7 +782,7 @@ public class LearnStatController { suggestRepVo.setLessAbilityList(lessAbilityList); suggestRepVo.setMidAbilityList(midAbilityList); suggestRepVo.setHighAbilityList(highAbilityList); - Form6RepVo skill = initSchoolDimensional(getLearnReqVo,DimensionalEnums.skill.getDimensionalType()); + Form6RepVO skill = initSchoolDimensional(getLearnReqVo,DimensionalEnums.skill.getDimensionalType()); List lessSkillList = new ArrayList<>(); //不足70% List midSkillList = new ArrayList<>(); //70-80% List highSkillList = new ArrayList<>(); //大于80% diff --git a/src/main/java/com/jevon/enums/DifficultEnums.java b/src/main/java/com/jevon/enums/DifficultEnums.java index 774d8d8..d3ae8c1 100644 --- a/src/main/java/com/jevon/enums/DifficultEnums.java +++ b/src/main/java/com/jevon/enums/DifficultEnums.java @@ -7,16 +7,26 @@ package com.jevon.enums; */ public enum DifficultEnums { - easy(1,"易"), - medium(2,"中"), - difficult(3,"难"); + easy(1,"易","认知"), + medium(2,"中","理解"), + difficult(3,"难","应用"); private int difficultType ; private String difficultName ; + private String difficultShow ; - DifficultEnums(int difficultType, String difficultName) { + DifficultEnums(int difficultType, String difficultName, String difficultShow) { this.difficultType = difficultType; this.difficultName = difficultName; + this.difficultShow = difficultShow; + } + + public String getDifficultShow() { + return difficultShow; + } + + public void setDifficultShow(String difficultShow) { + this.difficultShow = difficultShow; } public int getDifficultType() { diff --git a/src/main/java/com/jevon/mapper/AnalyseDetailMapper.java b/src/main/java/com/jevon/mapper/AnalyseDetailMapper.java index a243f28..85c49ce 100644 --- a/src/main/java/com/jevon/mapper/AnalyseDetailMapper.java +++ b/src/main/java/com/jevon/mapper/AnalyseDetailMapper.java @@ -17,6 +17,8 @@ public interface AnalyseDetailMapper { Double selectDifficult(AnalyseDetail analyseDetail); + Double selectSumType(AnalyseDetail analyseDetail); + List selectDifficultDetail(AnalyseDetail analyseDetail); List selectQuestionType(int analyseId); diff --git a/src/main/java/com/jevon/mapper/AnalyseMapper.java b/src/main/java/com/jevon/mapper/AnalyseMapper.java index 1711604..f3f5eae 100644 --- a/src/main/java/com/jevon/mapper/AnalyseMapper.java +++ b/src/main/java/com/jevon/mapper/AnalyseMapper.java @@ -18,4 +18,6 @@ public interface AnalyseMapper { Analyse selectById(int id); int update(Analyse analyse); + + int updateChapter(Analyse analyse); } diff --git a/src/main/java/com/jevon/mapper/ChapterMapper.java b/src/main/java/com/jevon/mapper/ChapterMapper.java new file mode 100644 index 0000000..aefe54f --- /dev/null +++ b/src/main/java/com/jevon/mapper/ChapterMapper.java @@ -0,0 +1,17 @@ +package com.jevon.mapper; + +import com.jevon.model.Chapter; + +import java.util.List; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/24 0024 9:04 + */ +public interface ChapterMapper { + + int insertBatch(List list); + + List selectByAnalyse(int analyseId); +} diff --git a/src/main/java/com/jevon/model/Analyse.java b/src/main/java/com/jevon/model/Analyse.java index d36c4f1..4c118e7 100644 --- a/src/main/java/com/jevon/model/Analyse.java +++ b/src/main/java/com/jevon/model/Analyse.java @@ -16,6 +16,7 @@ public class Analyse { private Date createTime ; private Double maxScore ; private String grade ; + private String examScope ; public int getId() { return id; @@ -72,4 +73,12 @@ public class Analyse { public void setGrade(String grade) { this.grade = grade; } + + public String getExamScope() { + return examScope; + } + + public void setExamScope(String examScope) { + this.examScope = examScope; + } } diff --git a/src/main/java/com/jevon/model/Chapter.java b/src/main/java/com/jevon/model/Chapter.java new file mode 100644 index 0000000..6abad4c --- /dev/null +++ b/src/main/java/com/jevon/model/Chapter.java @@ -0,0 +1,65 @@ +package com.jevon.model; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/24 0024 9:03 + */ +public class Chapter { + + private int id ; + private int analyseId ; + private int chapterNumber ; + private String chapterName ; + private Double chapterScore ; + + private Double percent ; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getAnalyseId() { + return analyseId; + } + + public void setAnalyseId(int analyseId) { + this.analyseId = analyseId; + } + + public int getChapterNumber() { + return chapterNumber; + } + + public void setChapterNumber(int chapterNumber) { + this.chapterNumber = chapterNumber; + } + + public String getChapterName() { + return chapterName; + } + + public void setChapterName(String chapterName) { + this.chapterName = chapterName; + } + + public Double getChapterScore() { + return chapterScore; + } + + public void setChapterScore(Double chapterScore) { + this.chapterScore = chapterScore; + } + + public Double getPercent() { + return percent; + } + + public void setPercent(Double percent) { + this.percent = percent; + } +} diff --git a/src/main/java/com/jevon/service/AnalyseDetailService.java b/src/main/java/com/jevon/service/AnalyseDetailService.java index fb184ec..2848485 100644 --- a/src/main/java/com/jevon/service/AnalyseDetailService.java +++ b/src/main/java/com/jevon/service/AnalyseDetailService.java @@ -17,6 +17,8 @@ public interface AnalyseDetailService { Double selectDifficult(int analyseId , int difficult); + Double selectSumType(int analyseId , String questionType); + List selectDifficultDetail(int analyseId , int difficult); List selectQuestionType(int analyseId); diff --git a/src/main/java/com/jevon/service/AnalyseService.java b/src/main/java/com/jevon/service/AnalyseService.java index b62125c..6371b06 100644 --- a/src/main/java/com/jevon/service/AnalyseService.java +++ b/src/main/java/com/jevon/service/AnalyseService.java @@ -18,4 +18,6 @@ public interface AnalyseService { Analyse selectById(int id); int update(Analyse analyse); + + int updateChapter(int id , String examTime , String examScope); } diff --git a/src/main/java/com/jevon/service/ChapterService.java b/src/main/java/com/jevon/service/ChapterService.java new file mode 100644 index 0000000..ae518cd --- /dev/null +++ b/src/main/java/com/jevon/service/ChapterService.java @@ -0,0 +1,17 @@ +package com.jevon.service; + +import com.jevon.model.Chapter; + +import java.util.List; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/24 0024 9:09 + */ +public interface ChapterService { + + int insertBatch(List list); + + List selectByAnalyse(int analyseId); +} diff --git a/src/main/java/com/jevon/service/impl/AnalyseDetailServiceImpl.java b/src/main/java/com/jevon/service/impl/AnalyseDetailServiceImpl.java index caef638..e81b54e 100644 --- a/src/main/java/com/jevon/service/impl/AnalyseDetailServiceImpl.java +++ b/src/main/java/com/jevon/service/impl/AnalyseDetailServiceImpl.java @@ -50,6 +50,14 @@ public class AnalyseDetailServiceImpl implements AnalyseDetailService { } @Override + public Double selectSumType(int analyseId, String questionType) { + AnalyseDetail analyseDetail = new AnalyseDetail(); + analyseDetail.setQuestionType(questionType); + analyseDetail.setAnalyseId(analyseId); + return analyseDetailMapper.selectSumType(analyseDetail); + } + + @Override public List selectDifficultDetail(int analyseId, int difficult) { AnalyseDetail analyseDetail = new AnalyseDetail(); analyseDetail.setDifficult(difficult); diff --git a/src/main/java/com/jevon/service/impl/AnalyseServiceImpl.java b/src/main/java/com/jevon/service/impl/AnalyseServiceImpl.java index d60c697..c906f17 100644 --- a/src/main/java/com/jevon/service/impl/AnalyseServiceImpl.java +++ b/src/main/java/com/jevon/service/impl/AnalyseServiceImpl.java @@ -38,4 +38,13 @@ public class AnalyseServiceImpl implements AnalyseService { public int update(Analyse analyse) { return analyseMapper.update(analyse); } + + @Override + public int updateChapter(int id, String examTime, String examScope) { + Analyse analyse = new Analyse(); + analyse.setId(id); + analyse.setExamTime(examTime); + analyse.setExamScope(examScope); + return analyseMapper.updateChapter(analyse); + } } diff --git a/src/main/java/com/jevon/service/impl/ChapterServiceImpl.java b/src/main/java/com/jevon/service/impl/ChapterServiceImpl.java new file mode 100644 index 0000000..99a4db3 --- /dev/null +++ b/src/main/java/com/jevon/service/impl/ChapterServiceImpl.java @@ -0,0 +1,31 @@ +package com.jevon.service.impl; + +import com.jevon.mapper.ChapterMapper; +import com.jevon.model.Chapter; +import com.jevon.service.ChapterService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/24 0024 9:09 + */ +@Service +public class ChapterServiceImpl implements ChapterService { + + @Autowired + ChapterMapper chapterMapper; + + @Override + public int insertBatch(List list) { + return chapterMapper.insertBatch(list); + } + + @Override + public List selectByAnalyse(int analyseId) { + return chapterMapper.selectByAnalyse(analyseId); + } +} diff --git a/src/main/java/com/jevon/service/impl/LeagueServiceImpl.java b/src/main/java/com/jevon/service/impl/LeagueServiceImpl.java index 3343002..7623051 100644 --- a/src/main/java/com/jevon/service/impl/LeagueServiceImpl.java +++ b/src/main/java/com/jevon/service/impl/LeagueServiceImpl.java @@ -44,25 +44,32 @@ public class LeagueServiceImpl implements LeagueService { League result = leagueMapper.selectById(id) ; League search = new League(); search.setAnalyseId(result.getAnalyseId()); - search.setLeague(result.getLeague()); - List list = leagueMapper.selectByLeague(search); - boolean isCreate = true ; - for(League temp : list){ - if(StringUtils.isBlank(temp.getSchoolName())){ - temp.setSchoolName(schoolName); - leagueMapper.update(temp); - isCreate = false; - break; + search.setSchoolName(schoolName); + List leagues = leagueMapper.selectByLeague(search) ; + if(leagues != null & leagues.size() >0){ + return 0 ; + }else { + search.setLeague(result.getLeague()); + search.setSchoolName(null); + List list = leagueMapper.selectByLeague(search); + boolean isCreate = true ; + for(League temp : list){ + if(StringUtils.isBlank(temp.getSchoolName())){ + temp.setSchoolName(schoolName); + leagueMapper.update(temp); + isCreate = false; + break; + } } + if(isCreate){ + League createLeague = new League(); + createLeague.setAnalyseId(result.getAnalyseId()); + createLeague.setLeague(result.getLeague()); + createLeague.setSchoolName(schoolName); + leagueMapper.insert(createLeague); + } + return 1; } - if(isCreate){ - League createLeague = new League(); - createLeague.setAnalyseId(result.getAnalyseId()); - createLeague.setLeague(result.getLeague()); - createLeague.setSchoolName(schoolName); - leagueMapper.insert(createLeague); - } - return 1; } @Override diff --git a/src/main/java/com/jevon/vo/req/ChapterReq.java b/src/main/java/com/jevon/vo/req/ChapterReq.java new file mode 100644 index 0000000..5b6c911 --- /dev/null +++ b/src/main/java/com/jevon/vo/req/ChapterReq.java @@ -0,0 +1,37 @@ +package com.jevon.vo.req; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/24 0024 8:55 + */ +public class ChapterReq { + + private int chapterNumber ; + private String chapterName ; + private Double score ; + + public int getChapterNumber() { + return chapterNumber; + } + + public void setChapterNumber(int chapterNumber) { + this.chapterNumber = chapterNumber; + } + + public String getChapterName() { + return chapterName; + } + + public void setChapterName(String chapterName) { + this.chapterName = chapterName; + } + + public Double getScore() { + return score; + } + + public void setScore(Double score) { + this.score = score; + } +} diff --git a/src/main/java/com/jevon/vo/req/ChapterReqVo.java b/src/main/java/com/jevon/vo/req/ChapterReqVo.java new file mode 100644 index 0000000..cdfbdb1 --- /dev/null +++ b/src/main/java/com/jevon/vo/req/ChapterReqVo.java @@ -0,0 +1,48 @@ +package com.jevon.vo.req; + +import java.util.List; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/24 0024 8:53 + */ +public class ChapterReqVo { + + private int analyseId ; + private String examTime ; + private String examScope ; + private List list ; + + public int getAnalyseId() { + return analyseId; + } + + public void setAnalyseId(int analyseId) { + this.analyseId = analyseId; + } + + public String getExamTime() { + return examTime; + } + + public void setExamTime(String examTime) { + this.examTime = examTime; + } + + public String getExamScope() { + return examScope; + } + + public void setExamScope(String examScope) { + this.examScope = examScope; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } +} diff --git a/src/main/java/com/jevon/wordDTO/Form6RepVO.java b/src/main/java/com/jevon/wordDTO/Form6RepVO.java new file mode 100644 index 0000000..e745428 --- /dev/null +++ b/src/main/java/com/jevon/wordDTO/Form6RepVO.java @@ -0,0 +1,25 @@ +package com.jevon.wordDTO; + +import com.jevon.vo.BaseVo; +import io.swagger.annotations.ApiModel; + +import java.util.List; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/22 0022 10:51 + */ +@ApiModel +public class Form6RepVO extends BaseVo { + + private List data ; + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } +} diff --git a/src/main/java/com/jevon/wordDTO/Form6RepVo.java b/src/main/java/com/jevon/wordDTO/Form6RepVo.java deleted file mode 100644 index 2386b46..0000000 --- a/src/main/java/com/jevon/wordDTO/Form6RepVo.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.jevon.wordDTO; - -import com.jevon.vo.BaseVo; -import io.swagger.annotations.ApiModel; - -import java.util.List; - -/** - * @author chen - * @version 1.0 - * @date 2019/10/22 0022 10:51 - */ -@ApiModel -public class Form6RepVo extends BaseVo { - - private List data ; - - public List getData() { - return data; - } - - public void setData(List data) { - this.data = data; - } -} diff --git a/src/main/java/com/jevon/wordDTO/Form7.java b/src/main/java/com/jevon/wordDTO/Form7.java index 2d0ba67..22dbdb5 100644 --- a/src/main/java/com/jevon/wordDTO/Form7.java +++ b/src/main/java/com/jevon/wordDTO/Form7.java @@ -11,8 +11,17 @@ import io.swagger.annotations.ApiModel; public class Form7 { private String name ; + private Double score ; private Double percent ; + public Double getScore() { + return score; + } + + public void setScore(Double score) { + this.score = score; + } + public String getName() { return name; } diff --git a/src/main/java/com/jevon/wordDTO/Form7RepVO.java b/src/main/java/com/jevon/wordDTO/Form7RepVO.java new file mode 100644 index 0000000..ffa9821 --- /dev/null +++ b/src/main/java/com/jevon/wordDTO/Form7RepVO.java @@ -0,0 +1,67 @@ +package com.jevon.wordDTO; + +import com.jevon.model.Chapter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.List; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/24 0024 9:20 + */ +@ApiModel +public class Form7RepVO { + + @ApiModelProperty(value = "举例七年级上册") + private String examScope ; + @ApiModelProperty(value = "科目") + private String courseName ; + @ApiModelProperty(value = "章节列表对应分值") + private List list ; + @ApiModelProperty(value = "难度列表对应分值") + private List difficultList ; + @ApiModelProperty(value = "题型类型对应分值") + private List typeList ; + + public String getExamScope() { + return examScope; + } + + public void setExamScope(String examScope) { + this.examScope = examScope; + } + + public String getCourseName() { + return courseName; + } + + public void setCourseName(String courseName) { + this.courseName = courseName; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + public List getDifficultList() { + return difficultList; + } + + public void setDifficultList(List difficultList) { + this.difficultList = difficultList; + } + + public List getTypeList() { + return typeList; + } + + public void setTypeList(List typeList) { + this.typeList = typeList; + } +} diff --git a/src/main/resources/mapping/AnalyseDetailMapper.xml b/src/main/resources/mapping/AnalyseDetailMapper.xml index fea5781..ef962ec 100644 --- a/src/main/resources/mapping/AnalyseDetailMapper.xml +++ b/src/main/resources/mapping/AnalyseDetailMapper.xml @@ -32,7 +32,10 @@ + + - \ No newline at end of file diff --git a/src/main/resources/mapping/AnalyseMapper.xml b/src/main/resources/mapping/AnalyseMapper.xml index 1e9b24c..88917a7 100644 --- a/src/main/resources/mapping/AnalyseMapper.xml +++ b/src/main/resources/mapping/AnalyseMapper.xml @@ -9,6 +9,7 @@ + @@ -50,4 +51,8 @@ + + + update sz_learn_analyse set exam_time = #{examTime} , exam_scope = #{examScope} where id = #{id} + \ No newline at end of file diff --git a/src/main/resources/mapping/ChapterMapper.xml b/src/main/resources/mapping/ChapterMapper.xml new file mode 100644 index 0000000..139e34f --- /dev/null +++ b/src/main/resources/mapping/ChapterMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + insert into sz_learn_analyse_chapter (analyse_id, chapter_number,chapter_name,chapter_score) + values + + (#{emp.analyseId}, #{emp.chapterNumber}, #{emp.chapterName}, #{emp.chapterScore}) + + + + + + \ No newline at end of file -- libgit2 0.21.0