Parcourir la source

报告试题知识点,修改学生得分

tags/正式版本
王宁 il y a 2 ans
Parent
révision
14578d1b18

+ 53
- 0
sexam/src/main/java/com/xhkjedu/sexam/controller/paperstudent/EPaperStudentQuestionHistoryController.java Voir le fichier

@@ -0,0 +1,53 @@
1
+package com.xhkjedu.sexam.controller.paperstudent;
2
+
3
+import com.github.pagehelper.PageHelper;
4
+import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.sexam.model.paperstudent.EPaperStudentQuestionHistory;
6
+import com.xhkjedu.sexam.service.paperstudent.EPaperStudentQuestionHistoryService;
7
+import com.xhkjedu.utils.N_Utils;
8
+import com.xhkjedu.utils.PageUtil;
9
+import com.xhkjedu.vo.PageResult;
10
+import com.xhkjedu.vo.ResultVo;
11
+import lombok.extern.slf4j.Slf4j;
12
+import org.springframework.web.bind.annotation.PostMapping;
13
+import org.springframework.web.bind.annotation.RequestBody;
14
+import org.springframework.web.bind.annotation.RequestMapping;
15
+import org.springframework.web.bind.annotation.RestController;
16
+
17
+import javax.annotation.Resource;
18
+import java.util.List;
19
+import java.util.Map;
20
+
21
+@RestController
22
+@RequestMapping("/psqh")
23
+@Slf4j
24
+public class EPaperStudentQuestionHistoryController {
25
+    @Resource
26
+    private EPaperStudentQuestionHistoryService ePaperStudentQuestionHistoryService;
27
+
28
+    //更改学生试题得分
29
+    @PostMapping("/upstus")
30
+    public ResultVo updateQuestionStuscore(@RequestBody EPaperStudentQuestionHistory psh) {
31
+        try {
32
+            N_Utils.validation(new Object[]{psh.getEpsqid(), "试题id", 1, psh.getTeacherid(),"教师id",1});
33
+            ePaperStudentQuestionHistoryService.updateQuestionStuscore(psh);
34
+            return new ResultVo(0, "成功保存学生试题得分");
35
+        } catch (Exception e) {
36
+            log.error("保存学生试题得分失败:" + e.getMessage());
37
+            return new ResultVo(1, "保存学生试题得分失败");
38
+        }
39
+    }
40
+
41
+    //修改分值历史
42
+    @PostMapping("/list")
43
+    public ResultVo listHistorys(@RequestBody EPaperStudentQuestionHistory psh) {
44
+        Integer page = psh.getPage();
45
+        Integer pageSize = psh.getPageSize();
46
+        N_Utils.validation(new Object[]{psh.getExamid(), "考试id", 1});
47
+        PageHelper.startPage(page, pageSize);
48
+        List<Map> rtnlst = ePaperStudentQuestionHistoryService.listExamStuQuestionHistory(psh.getExamid(),psh.getSubjectid());
49
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(rtnlst));
50
+        return new ResultVo(0, "成功获取修改分值历史信息",pageResult);
51
+    }
52
+
53
+}

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/paperstudent/EPaperStudentMapper.java Voir le fichier

@@ -57,4 +57,7 @@ public interface EPaperStudentMapper extends TkMapper<EPaperStudent> {
57 57
     EPaperStudent getPaperStudentByStuidAndEpid(@Param("epid") Integer epid, @Param("studentid") Integer studentid);
58 58
 
59 59
     List<ERstudent> listByExamId(@Param("examid") Integer examid);
60
+
61
+    //更改单个学生试卷分值
62
+    void updateStuPaperscoreEpsid(@Param("epsid")Integer epsid);
60 63
 }

+ 16
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/paperstudent/EPaperStudentQuestionHistoryMapper.java Voir le fichier

@@ -0,0 +1,16 @@
1
+package com.xhkjedu.sexam.mapper.paperstudent;
2
+
3
+import com.xhkjedu.sexam.base.TkMapper;
4
+import com.xhkjedu.sexam.model.paperstudent.EPaperStudentQuestionHistory;
5
+import io.lettuce.core.dynamic.annotation.Param;
6
+import org.springframework.stereotype.Repository;
7
+
8
+import java.util.List;
9
+import java.util.Map;
10
+
11
+@Repository
12
+public interface EPaperStudentQuestionHistoryMapper extends TkMapper<EPaperStudentQuestionHistory> {
13
+    //修改分值历史
14
+    List<Map> listExamStuQuestionHistory(@Param("examid")Integer examid, @Param("subjectid")String subjectid);
15
+
16
+}

+ 6
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/paperstudent/EPaperStudentQuestionMapper.java Voir le fichier

@@ -51,4 +51,10 @@ public interface EPaperStudentQuestionMapper extends TkMapper<EPaperStudentQuest
51 51
     //报告生成-学生试卷
52 52
     List<EPaperStudentQuestion> listExamStudentsAnswer(@Param("examid")Integer examid);
53 53
 
54
+    //修改学生得分
55
+    void updateStuScoreByepsqid(@Param("stuscore")Double stuscore,@Param("epsqid")Integer epsqid);
56
+
57
+    //根据试题id获取考试信息
58
+    EPaperStudentQuestion getExamPaperStudntQuestionbyEpsqid(@Param("epsqid")Integer epsqid);
59
+
54 60
 }

+ 6
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paperstudent/EPaperStudentQuestion.java Voir le fichier

@@ -85,4 +85,10 @@ public class EPaperStudentQuestion extends BaseBean {
85 85
     @Transient
86 86
     private String stuname;//学生姓名
87 87
 
88
+    @Transient
89
+    private Integer examid;
90
+
91
+    @Transient
92
+    private String subjectid;
93
+
88 94
 }

+ 51
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paperstudent/EPaperStudentQuestionHistory.java Voir le fichier

@@ -0,0 +1,51 @@
1
+package com.xhkjedu.sexam.model.paperstudent;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+/**
10
+ * 修改学生试卷分值记录表
11
+ */
12
+@Data
13
+@Table(name = "e_paper_student_question_history")
14
+public class EPaperStudentQuestionHistory extends BaseBean {
15
+    //试卷学生分修改记录表
16
+    @Id
17
+    private Integer epsqhid;
18
+
19
+    //考试id
20
+    private Integer examid;
21
+
22
+    //试卷id
23
+    private Integer epid;
24
+
25
+    //科目id
26
+    private String subjectid;
27
+
28
+    //班级id
29
+    private Integer classid;
30
+
31
+    //学生id
32
+    private Integer studentid;
33
+
34
+    //学生作答试题id
35
+    private Integer epsqid;
36
+
37
+    //修改试题题号
38
+    private String qn;
39
+
40
+    //学生原得分
41
+    private Double stuscore;
42
+
43
+    //修改后分值
44
+    private Double upscore;
45
+
46
+    //修改考试
47
+    private Integer teacherid;
48
+
49
+    //修改时间
50
+    private Integer createtime;
51
+}

+ 5
- 2
sexam/src/main/java/com/xhkjedu/sexam/model/reportclass/ERclassQuestionPoint.java Voir le fichier

@@ -19,6 +19,9 @@ public class ERclassQuestionPoint extends BaseBean {
19 19
     //班级id
20 20
     private Integer classid;
21 21
 
22
+    //试卷id
23
+    private Integer epid;
24
+
22 25
     //科目id
23 26
     private String subjectid;
24 27
 
@@ -35,13 +38,13 @@ public class ERclassQuestionPoint extends BaseBean {
35 38
     private Double gradeavgscore;
36 39
 
37 40
     //年级得分率占比
38
-    private Double gradeavgrate;
41
+    private Double gradesrate;
39 42
 
40 43
     //班级平均分
41 44
     private Double classavgscore;
42 45
 
43 46
     //平均分占比
44
-    private Double classavgrate;
47
+    private Double classsrate;
45 48
 
46 49
     //知识点关联试题题号
47 50
     private String qns;

+ 2
- 1
sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperQtypeService.java Voir le fichier

@@ -315,10 +315,11 @@ public class EPaperQtypeService {
315 315
             double cscore = pvo.stream().collect(Collectors.summingDouble(EPaperQPointVo:: getScore));
316 316
             double scorerate = N_Utils.getDoubleDivideAndMulitiply(cscore, ePaper.getPscore());
317 317
             List<Integer> thlist = pvo.stream().map(EPaperQPointVo :: getQorder).collect(Collectors.toList());
318
+            thlist = thlist.stream().distinct().collect(Collectors.toList());
318 319
             pm.put("pointname",pvo.get(0).getPointname());
319 320
             pm.put("score",cscore);
320 321
             pm.put("srate",scorerate);
321
-            pm.put("order",thlist.stream().distinct().collect(Collectors.toList()));
322
+            pm.put("order",JSON.toJSONString(thlist));
322 323
             pointlist.add(pm);
323 324
         }
324 325
 

+ 65
- 0
sexam/src/main/java/com/xhkjedu/sexam/service/paperstudent/EPaperStudentQuestionHistoryService.java Voir le fichier

@@ -0,0 +1,65 @@
1
+package com.xhkjedu.sexam.service.paperstudent;
2
+
3
+import com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentMapper;
4
+import com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentQuestionHistoryMapper;
5
+import com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentQuestionMapper;
6
+import com.xhkjedu.sexam.model.paperstudent.EPaperStudentQuestion;
7
+import com.xhkjedu.sexam.model.paperstudent.EPaperStudentQuestionHistory;
8
+import com.xhkjedu.utils.N_Utils;
9
+import org.springframework.stereotype.Service;
10
+import org.springframework.transaction.annotation.Transactional;
11
+
12
+import javax.annotation.Resource;
13
+import java.util.List;
14
+import java.util.Map;
15
+
16
+@Service
17
+public class EPaperStudentQuestionHistoryService {
18
+
19
+    @Resource
20
+    private EPaperStudentMapper ePaperStudentMapper;
21
+    @Resource
22
+    private EPaperStudentQuestionMapper ePaperStudentQuestionMapper;
23
+    @Resource
24
+    private EPaperStudentQuestionHistoryMapper ePaperStudentQuestionHistoryMapper;
25
+
26
+
27
+    /**
28
+     * @Description 更改学生试题得分
29
+     * @Param [sqh]
30
+     * @Return void
31
+     * @Author wn
32
+     * @Date 2022/8/10 16:17
33
+     **/
34
+    @Transactional(rollbackFor = Exception.class)
35
+    public void updateQuestionStuscore(EPaperStudentQuestionHistory sqh){
36
+        //学生试题详情
37
+        EPaperStudentQuestion q = ePaperStudentQuestionMapper.getExamPaperStudntQuestionbyEpsqid(sqh.getEpsqid());
38
+        sqh.setExamid(q.getExamid());
39
+        sqh.setSubjectid(q.getSubjectid());
40
+        sqh.setEpid(q.getEpid());
41
+        sqh.setClassid(q.getClassid());
42
+        sqh.setStudentid(q.getStudentid());
43
+        sqh.setCreatetime(N_Utils.getSecondTimestamp());
44
+        sqh.setStuscore(q.getStuscore());
45
+        sqh.setQn(q.getQn());
46
+
47
+        //修改学生单个试题得分
48
+        ePaperStudentQuestionMapper.updateStuScoreByepsqid(sqh.getUpscore(),sqh.getEpsqid());
49
+        //修改学生试卷分值
50
+        ePaperStudentMapper.updateStuPaperscoreEpsid(q.getEpsid());
51
+        //保存更改学生分值记录
52
+        ePaperStudentQuestionHistoryMapper.insertSelective(sqh);
53
+    }
54
+
55
+    /**
56
+     * @Description 更改学生试题得分
57
+     * @Param [sqh]
58
+     * @Return void
59
+     * @Author wn
60
+     * @Date 2022/8/10 15:07
61
+     **/
62
+    public List<Map> listExamStuQuestionHistory(Integer examid, String subjectid){
63
+        return ePaperStudentQuestionHistoryMapper.listExamStuQuestionHistory(examid,subjectid);
64
+    }
65
+}

+ 56
- 4
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportGenerateService.java Voir le fichier

@@ -2,6 +2,7 @@ package com.xhkjedu.sexam.service.report;
2 2
 
3 3
 import com.alibaba.fastjson.JSON;
4 4
 import com.xhkjedu.sexam.mapper.exam.EClassMapper;
5
+import com.xhkjedu.sexam.mapper.paper.EPaperAnalyzeMapper;
5 6
 import com.xhkjedu.sexam.mapper.paper.EPaperQtypeMapper;
6 7
 import com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentMapper;
7 8
 import com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentQuestionMapper;
@@ -19,6 +20,7 @@ import com.xhkjedu.sexam.model.report.ERsubject;
19 20
 import com.xhkjedu.sexam.model.reportclass.ERclass;
20 21
 import com.xhkjedu.sexam.model.reportclass.ERclassQtype;
21 22
 import com.xhkjedu.sexam.model.reportclass.ERclassQuestion;
23
+import com.xhkjedu.sexam.model.reportclass.ERclassQuestionPoint;
22 24
 import com.xhkjedu.sexam.model.reportstu.ERstudent;
23 25
 import com.xhkjedu.sexam.utils.ExamUtil;
24 26
 import com.xhkjedu.sexam.vo.paper.EPaperQPointVo;
@@ -27,6 +29,7 @@ import com.xhkjedu.sexam.vo.paper.EPaperQtypeVo;
27 29
 import com.xhkjedu.sexam.vo.report.ERClassScoreVo;
28 30
 import com.xhkjedu.sexam.vo.report.ERPaperVo;
29 31
 import com.xhkjedu.utils.N_Utils;
32
+import org.bouncycastle.operator.AADProcessor;
30 33
 import org.springframework.beans.BeanUtils;
31 34
 import org.springframework.stereotype.Service;
32 35
 import org.springframework.transaction.annotation.Transactional;
@@ -58,6 +61,8 @@ public class EReportGenerateService {
58 61
     private EPaperQtypeMapper ePaperQtypeMapper;
59 62
     @Resource
60 63
     private EPaperStudentQuestionMapper ePaperStudentQuestionMapper;
64
+    @Resource
65
+    private EPaperAnalyzeMapper ePaperAnalyzeMapper;
61 66
 
62 67
 
63 68
     @Resource
@@ -335,13 +340,14 @@ public class EReportGenerateService {
335 340
         }
336 341
     }
337 342
 
338
-    //题型试题
343
+    //题型试题、知识点
339 344
     private void setClassQuestion(Integer examid,List<Map> subjects,List<Map> classes){
340 345
         //考试所有学生提交试卷情况
341 346
         List<EPaperStudentQuestion> stulist = ePaperStudentQuestionMapper.listExamStudentsAnswer(examid);
342 347
 
343 348
         List<ERclassQtype> rtypelist = new ArrayList<>();
344 349
         List<ERclassQuestion> rqlist = new ArrayList<>();
350
+        List<ERclassQuestionPoint> rpointlist = new ArrayList<>();
345 351
 
346 352
         for(Map map : subjects){
347 353
             String subjectid = map.get("subjectid").toString();
@@ -431,12 +437,9 @@ public class EReportGenerateService {
431 437
                             erClassScoreVo.setTcscore(ExamUtil.add(erClassScoreVo.getTcscore(), qallstu));
432 438
                             tcmap.put(classid,erClassScoreVo);
433 439
                         }
434
-
435 440
                     }
436
-
437 441
                 }
438 442
 
439
-
440 443
                 Double tgavescore = N_Utils.getDoubleDivideAndMulitiply(tgscore,stunum);//题型下年级平均分
441 444
                 Double tgsrate = N_Utils.getDoubleDivideAndMulitiply(tgscore,eptscore * stunum);//年级得分率
442 445
 
@@ -461,9 +464,58 @@ public class EReportGenerateService {
461 464
                     rtypelist.add(eRclassQtype);
462 465
                 }
463 466
             }
467
+
468
+            //仅有题库试卷有知识点
469
+            if(ptype == 1){
470
+                //获取试卷只是分析
471
+                Map epa = ePaperAnalyzeMapper.getPaperAnalzyeByEpid(epid);
472
+                String pointjson = epa.get("pointjson").toString();
473
+                List<Map> pointlist = JSON.parseArray(pointjson,Map.class);
474
+                //遍历知识点处理年级班级知识点情况
475
+                for(int j=0;j<pointlist.size();j++){
476
+                    Map pointmap = pointlist.get(j);
477
+                    String pointname = pointmap.get("pointname").toString();
478
+                    Double score = Double.parseDouble(pointmap.get("score").toString());
479
+                    Double scorerate = Double.parseDouble(pointmap.get("scorerate").toString());
480
+                    String qnstr = pointmap.get("order").toString();
481
+
482
+                    List<String> qnlst = JSON.parseArray(qnstr,String.class);//题号集合
483
+                    List<EPaperStudentQuestion> gstus = stulist.stream().filter(o -> o.getEpid().equals(epid) && qnlst.contains(o.getQn())).collect(Collectors.toList());
484
+                    Double gstuscore = gstus.stream().mapToDouble(EPaperStudentQuestion :: getStuscore).sum();
485
+                    Double gscore = gstus.stream().mapToDouble(EPaperStudentQuestion :: getQscore).sum();
486
+                    Double gavgscore = N_Utils.getDoubleDivideAndMulitiply(gstuscore,gstus.size());//平均分分
487
+                    Double gsrate = N_Utils.getDoubleDivideAndMulitiply(gstuscore,gscore);//得分率
488
+                    for(Map classm : classes){
489
+                        Integer classid = Integer.parseInt(classm.get("classid").toString());
490
+                        List<EPaperStudentQuestion> cstus = gstus.stream().filter( o -> o.getClassid().equals(classid)).collect(Collectors.toList());
491
+                        Double cstuscore = cstus.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
492
+                        Double cscore = cstus.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();
493
+                        Double cavgscore = N_Utils.getDoubleDivideAndMulitiply(cstuscore,cstus.size());//平均分分
494
+                        Double csrate = N_Utils.getDoubleDivideAndMulitiply(cstuscore,cscore);//得分率
495
+
496
+                        ERclassQuestionPoint pointvo = new ERclassQuestionPoint();
497
+                        pointvo.setExamid(examid);
498
+                        pointvo.setClassid(classid);
499
+                        pointvo.setEpid(epid);
500
+                        pointvo.setSubjectid(subjectid);
501
+                        pointvo.setPointname(pointname);
502
+                        pointvo.setScore(score);
503
+                        pointvo.setSrate(scorerate);
504
+                        pointvo.setQns(qnstr);
505
+                        pointvo.setGradeavgscore(gavgscore);
506
+                        pointvo.setGradesrate(gsrate);
507
+                        pointvo.setClassavgscore(cavgscore);
508
+                        pointvo.setClasssrate(csrate);
509
+                        rpointlist.add(pointvo);
510
+                    }
511
+
512
+                }
513
+
514
+            }
464 515
         }
465 516
         eRclassQtypeMapper.insertList(rtypelist);
466 517
         eRclassQuestionMapper.insertList(rqlist);
518
+        eRclassQuestionPointMapper.insertList(rpointlist);
467 519
     }
468 520
     //处理题库试卷中子母题
469 521
     private void setEPaperQtypeForQues(List<EPaperQtypeVo> fjtypelist){

+ 6
- 0
sexam/src/main/resources/mapper/paperstudent/EPaperStudentMapper.xml Voir le fichier

@@ -192,4 +192,10 @@
192 192
         select classid,examid,subjectid,studentid,stuscore score,sstate
193 193
         from e_paper_student where examid=#{examid} and sstate!=0
194 194
     </select>
195
+
196
+    <!--更改单个学生试卷分值-->
197
+    <update id="updateStuPaperscoreEpsid">
198
+        update e_paper_student ps set ps.stuscore=(SELECT SUM(IFNULL(q.stuscore,0)) FROM e_paper_student_question q
199
+          WHERE q.epsid=#{epsid} ) where ps.epsid=#{epsid}
200
+    </update>
195 201
 </mapper>

+ 17
- 0
sexam/src/main/resources/mapper/paperstudent/EPaperStudentQuestionHistoryMapper.xml Voir le fichier

@@ -0,0 +1,17 @@
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.xhkjedu.sexam.mapper.paperstudent.EPaperStudentQuestionHistoryMapper">
4
+
5
+    <!--修改历史-->
6
+    <select id="listExamStuQuestionHistory" resultType="java.util.Map">
7
+        select h.*,u.username stuname,u.loginname,s.subjectname
8
+        from e_paper_student_question_history h left join t_user u on h.studentid=u.userid
9
+                                                left join t_subject s on h.subjectid=s.subjectid
10
+        where h.examid=#{examid}
11
+        <if test="subjectid!=null and subjectid!='' and subjectid!='0'">
12
+            and h.subjectid=#{subjectid}
13
+        </if>
14
+        order by h.createtime desc
15
+    </select>
16
+
17
+</mapper>

+ 10
- 0
sexam/src/main/resources/mapper/paperstudent/EPaperStudentQuestionMapper.xml Voir le fichier

@@ -142,4 +142,14 @@
142 142
         left join t_user u on q.studentid=u.userid where s.examid=#{examid} and s.sstate=2 group by q.epsqid
143 143
     </select>
144 144
 
145
+    <!--修改学生得分-->
146
+    <update id="updateStuScoreByepsqid">
147
+        update e_paper_student_question set stuscore=#{stuscore} where epsqid=#{epsqid}
148
+    </update>
149
+    <!---根据试题id获取考试信息-->
150
+    <select id="getExamPaperStudntQuestionbyEpsqid" resultType="com.xhkjedu.sexam.model.paperstudent.EPaperStudentQuestion">
151
+        select q.*,s.examid,s.subjectid from e_paper_student_question q left join e_paper_student s on s.epsid=q.epsid
152
+        where q.epsqid=#{epsqid}
153
+    </select>
154
+
145 155
 </mapper>

Chargement…
Annuler
Enregistrer