Commit 583a03d5daf88bf4896bc78540a2820599937b9d

Authored by 陈杰
1 parent bf20ee21
Exists in master

临时微信入口

src/main/java/com/jevon/controller/LearnController.java
@@ -70,6 +70,34 @@ public class LearnController { @@ -70,6 +70,34 @@ public class LearnController {
70 return list; 70 return list;
71 } 71 }
72 72
  73 + @ApiOperation("获取详情,微信入口")
  74 + @RequestMapping(value = "getDetail", method = RequestMethod.GET)
  75 + public Analyse getAnalyseId(String grade , String schoolName){
  76 + Analyse result = null ;
  77 + Analyse search = new Analyse();
  78 + search.setGrade(grade);
  79 + List<Analyse> analyseList = analyseService.select(search);
  80 + if(analyseList != null && analyseList.size() > 0){
  81 + List<League> leagues = leagueService.selectByAnalyseId(analyseList.get(0).getId());
  82 + for(League league : leagues){
  83 + if(league.getSchoolName().equals(schoolName)){
  84 + result = analyseList.get(0);
  85 + break;
  86 + }
  87 + }
  88 + }
  89 + if(result == null){
  90 + Analyse searchAnalyse = new Analyse();
  91 + searchAnalyse.setExamName("顺治中学模板考试");
  92 + analyseList = analyseService.select(searchAnalyse);
  93 + if(analyseList != null && analyseList.size() > 0){
  94 + result = analyseList.get(0);
  95 + }
  96 + }
  97 +
  98 + return result ;
  99 + }
  100 +
73 @ApiOperation("创建考试") 101 @ApiOperation("创建考试")
74 @RequestMapping(value = "createExam", method = RequestMethod.POST) 102 @RequestMapping(value = "createExam", method = RequestMethod.POST)
75 public BaseVo createExam(@RequestBody CreateExamReqVo createExamReqVo){ 103 public BaseVo createExam(@RequestBody CreateExamReqVo createExamReqVo){
src/main/java/com/jevon/controller/LearnStatController.java
@@ -626,14 +626,44 @@ public class LearnStatController { @@ -626,14 +626,44 @@ public class LearnStatController {
626 table2List.add(table2); 626 table2List.add(table2);
627 } 627 }
628 } 628 }
629 - List<Table2> data = new ArrayList<>();  
630 - for(Table2 table2 : table2List){ 629 + List<Table2> data = sort(table2List);
  630 + table2RepVO.setData(data);
  631 + return table2RepVO;
  632 + }
  633 +
  634 + private List<Table2> sort(List<Table2> target){
  635 + List<Table2> course = new ArrayList<>();
  636 + for(Table2 table2 : target){
631 if(table2.getSchoolRate() < 0.75 && Double.valueOf(table2.getAvg()) >2){ 637 if(table2.getSchoolRate() < 0.75 && Double.valueOf(table2.getAvg()) >2){
632 - data.add(table2); 638 + course.add(table2);
633 } 639 }
634 } 640 }
635 - table2RepVO.setData(data);  
636 - return table2RepVO; 641 + if(course.size() == 0){
  642 + Double avg = new Double("0");
  643 + Table2 result = new Table2();
  644 + for(Table2 table2 : target){
  645 + if(avg < new Double(table2.getAvg())){
  646 + avg = new Double(table2.getAvg()) ;
  647 + result = table2 ;
  648 + }
  649 + }
  650 + course.add(result);
  651 + }
  652 +
  653 + if(course.size() > 5){
  654 + course = course.subList(0,5);
  655 + }
  656 + for (int i = 0; i < course.size() ; i++) {
  657 + Table2 temp = new Table2();
  658 + for (int j = 0; j < course.size() ; j++) {
  659 + if(new Double(course.get(i).getAvg()) > new Double(course.get(j).getAvg())){
  660 + temp = course.get(j);
  661 + course.set(j,course.get(i));
  662 + course.set(i,temp);
  663 + }
  664 + }
  665 + }
  666 + return course;
637 } 667 }
638 668
639 @ApiOperation("getForm3_2") 669 @ApiOperation("getForm3_2")
src/main/resources/mapping/AnalyseMapper.xml
@@ -45,6 +45,9 @@ @@ -45,6 +45,9 @@
45 <if test="examName != null"> 45 <if test="examName != null">
46 and exam_name = #{examName} 46 and exam_name = #{examName}
47 </if> 47 </if>
  48 + <if test="grade != null">
  49 + and grade = #{grade}
  50 + </if>
48 </where> 51 </where>
49 </select> 52 </select>
50 53
src/main/resources/mapping/KnowledgeMapper.xml
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 </select> 23 </select>
24 24
25 <select id="selectAll" resultMap="BaseResultMap"> 25 <select id="selectAll" resultMap="BaseResultMap">
26 - select * from sz_learn_knowledge 26 + select * from sz_learn_knowledge order by knowledge_avg desc
27 </select> 27 </select>
28 28
29 </mapper> 29 </mapper>
30 \ No newline at end of file 30 \ No newline at end of file