Browse Source

Merge remote-tracking branch 'origin/ywx' into wn

ywx
王宁 1 week ago
parent
commit
d49914a8cf

+ 5
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/stupaper/MsPaperStudentQuestionMapper.java View File

@@ -5,6 +5,8 @@ import com.xhkjedu.smarking.model.paper.MsPaperQtypeQuestion;
5 5
 import com.xhkjedu.smarking.model.stupaper.MsPaperStudentBlock;
6 6
 import com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestion;
7 7
 import com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestionScore;
8
+import com.xhkjedu.smarking.vo.paper.SQScoreVo;
9
+import com.xhkjedu.smarking.vo.paper.SQuestionVo;
8 10
 import com.xhkjedu.smarking.vo.stupaper.QuestionAnswerVo;
9 11
 import org.apache.ibatis.annotations.Param;
10 12
 
@@ -65,4 +67,7 @@ public interface MsPaperStudentQuestionMapper extends TkMapper<MsPaperStudentQue
65 67
 
66 68
     //获取考试所有参考学生作答情况
67 69
     List<MsPaperStudentQuestion> listAllStuQuesByExamid(@Param("examid") Integer examid);
70
+
71
+    //获取参与统计科目单题得分情况
72
+    List<SQScoreVo> listByMpIds(@Param("mpids") List<Integer> mpids);
68 73
 }

+ 8
- 2
smarking/src/main/java/com/xhkjedu/smarking/model/report/reportsubject/MsrSubject.java View File

@@ -3,8 +3,8 @@ package com.xhkjedu.smarking.model.report.reportsubject;
3 3
 import com.xhkjedu.model.BaseBean;
4 4
 import lombok.Data;
5 5
 
6
-import javax.persistence.Id;
7
-import javax.persistence.Table;
6
+import javax.persistence.*;
7
+import java.util.List;
8 8
 
9 9
 /**
10 10
  * @Description 阅卷报告-科目分析表
@@ -65,4 +65,10 @@ public class MsrSubject extends BaseBean {
65 65
     private Double lsscore;
66 66
     //处于年级80%得分
67 67
     private Double bsscore;
68
+    @Transient
69
+    //每题方差
70
+    private List<Double> mtfc;
71
+    @Transient
72
+    //总分方差
73
+    private Double zffc;
68 74
 }

+ 31
- 2
smarking/src/main/java/com/xhkjedu/smarking/service/report/reportother/MsrExamService.java View File

@@ -9,6 +9,7 @@ import com.xhkjedu.smarking.mapper.report.reportstu.MsrStudentMapper;
9 9
 import com.xhkjedu.smarking.mapper.report.reportsubject.MsrSubjectClassMapper;
10 10
 import com.xhkjedu.smarking.mapper.report.reportsubject.MsrSubjectMapper;
11 11
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentMapper;
12
+import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentQuestionMapper;
12 13
 import com.xhkjedu.smarking.model.exam.*;
13 14
 import com.xhkjedu.smarking.model.paper.MsPaper;
14 15
 import com.xhkjedu.smarking.model.report.reportclass.*;
@@ -18,6 +19,8 @@ import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
18 19
 import com.xhkjedu.smarking.model.report.reportsubject.MsrSubject;
19 20
 import com.xhkjedu.smarking.model.report.reportsubject.MsrSubjectClass;
20 21
 import com.xhkjedu.smarking.utils.MarkingUtil;
22
+import com.xhkjedu.smarking.vo.paper.SQScoreVo;
23
+import com.xhkjedu.smarking.vo.paper.SQuestionVo;
21 24
 import com.xhkjedu.smarking.vo.report.reportclass.ClassTopVo;
22 25
 import com.xhkjedu.smarking.vo.report.reportclass.RankRateGroupVo;
23 26
 import com.xhkjedu.smarking.vo.report.reportother.*;
@@ -49,6 +52,8 @@ public class MsrExamService {
49 52
     @Resource
50 53
     private MsPaperStudentMapper paperStudentMapper;
51 54
     @Resource
55
+    private MsPaperStudentQuestionMapper paperStudentQuestionMapper;
56
+    @Resource
52 57
     private MsrSubjectMapper msrSubjectMapper;
53 58
     @Resource
54 59
     private MsrStudentMapper msrStudentMapper;
@@ -101,7 +106,7 @@ public class MsrExamService {
101 106
         Integer classnum = N_Utils.obj2Int(classes.stream().map(MsClass::getClassid).distinct().count());
102 107
 
103 108
         //科目分析
104
-        Map<String, MsrSubject> subjectMap = saveSubject(examid, paperStudents, subjects);
109
+        Map<String, MsrSubject> subjectMap = saveSubject(examid, paperStudents, subjects, mpids);
105 110
 
106 111
         //学生成绩分析
107 112
         List<MsrStudent> msrStudents = saveStudent(examid, subjects, paperStudents, students, subjectMap);
@@ -265,7 +270,7 @@ public class MsrExamService {
265 270
 
266 271
     //保存科目分析
267 272
     public Map<String, MsrSubject> saveSubject(Integer examid, List<MsrStudent> paperStudents
268
-            , List<MsPaper> subjects) {
273
+            , List<MsPaper> subjects, List<Integer> mpids) {
269 274
         double fullscore = subjects.stream().mapToDouble(MsPaper::getPscore).sum();
270 275
         String subjectid;
271 276
         //科目分析
@@ -293,6 +298,20 @@ public class MsrExamService {
293 298
             student.setSstate(sstate);
294 299
             studentList.add(student);
295 300
         }
301
+        List<SQScoreVo> questionScores = paperStudentQuestionMapper.listByMpIds(mpids);//获取参与统计科目单题得分情况
302
+        List<Double> zfmtfc = new ArrayList<>();
303
+        Map<String, List<Double>> dkMtfc = new HashMap<>();
304
+        for (SQScoreVo s : questionScores) {
305
+            List<Double> mtfc = new ArrayList<>();
306
+            List<SQuestionVo> questions = s.getQuestions();
307
+            for (SQuestionVo question : questions) {
308
+                double fc = MarkingUtil.fc(question.getStuscores());
309
+                zfmtfc.add(fc);
310
+                mtfc.add(fc);
311
+            }
312
+            dkMtfc.put(s.getSubjectid(), mtfc);
313
+        }
314
+        msrSubject.setMtfc(zfmtfc);
296 315
         setSubject(msrSubject, studentList);
297 316
         msrSubjects.add(msrSubject);
298 317
         subjectMap.put(subjectid, msrSubject);
@@ -308,6 +327,7 @@ public class MsrExamService {
308 327
             msrSubject.setSubjectname(subject.getSubjectname());
309 328
             msrSubject.setFullscore(subject.getPscore());
310 329
             studentList = subjectCollect.get(subjectid);
330
+            msrSubject.setMtfc(dkMtfc.get(subjectid));
311 331
             setSubject(msrSubject, studentList);
312 332
             msrSubjects.add(msrSubject);
313 333
             subjectMap.put(subjectid, msrSubject);
@@ -317,6 +337,14 @@ public class MsrExamService {
317 337
         for (MsrSubject subject : msrSubjects) {
318 338
             subject.setAvgrank(fspm.get(subject.getAvgscore()));
319 339
             subject.setAvgrankrate(MarkingUtil.div(subject.getAvgrank(), subject.getTotalnum()));
340
+            String subjectid1 = subject.getSubjectid();
341
+            int pnum;//试卷中的题目总数
342
+            if ("zf".equals(subjectid1)) {
343
+                pnum = subjects.stream().mapToInt(MsPaper::getPnum).sum();
344
+            } else {
345
+                pnum = subjects.stream().filter(s -> s.getSubjectid().equals(subjectid1)).findFirst().get().getPnum();
346
+            }
347
+            subject.setAxdxs(MarkingUtil.axdxs(pnum, subject.getMtfc(), subject.getZffc()));
320 348
         }
321 349
         msrSubjectMapper.insertList(msrSubjects);
322 350
         return subjectMap;
@@ -1382,6 +1410,7 @@ public class MsrExamService {
1382 1410
         List<Double> scores = studentList.stream().map(MsrStudent::getStuscore).sorted().collect(Collectors.toList());
1383 1411
         double bzc = MarkingUtil.bzc(scores);
1384 1412
         msrSubject.setBzc(bzc);
1413
+        msrSubject.setZffc(MarkingUtil.fc(scores));
1385 1414
         msrSubject.setCyxs(N_Utils.getDoubleDivideAndMulitiply(bzc, avgscore));
1386 1415
         msrSubject.setNd(MarkingUtil.div(avgscore, fullscore));
1387 1416
         msrSubject.setQfd(MarkingUtil.qfd(scores));

+ 14
- 0
smarking/src/main/java/com/xhkjedu/smarking/utils/MarkingUtil.java View File

@@ -785,6 +785,20 @@ public class MarkingUtil {
785 785
         }
786 786
     }
787 787
 
788
+    //α信度系数=(k/(k-1))*(1-(∑Si²)/ST²
789
+    public static double axdxs(int k, List<Double> a, double b) {
790
+        if (k <= 1 || b == 0) {
791
+            throw new ArithmeticException("Division by zero is not allowed.");
792
+        }
793
+
794
+        double sumA = 0;
795
+        for (double value : a) {
796
+            sumA = MarkingUtil.add(sumA, value);
797
+        }
798
+
799
+        return N_Utils.formatDouble((k / (k - 1)) * (1 - (sumA / b)), 2);
800
+    }
801
+
788 802
     public static void main(String[] args) {
789 803
        List<RankGroupVo> list = fdScore(1.0,5);
790 804
        for (RankGroupVo rgvo : list) {

+ 18
- 0
smarking/src/main/java/com/xhkjedu/smarking/vo/paper/SQScoreVo.java View File

@@ -0,0 +1,18 @@
1
+package com.xhkjedu.smarking.vo.paper;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.List;
6
+
7
+/**
8
+ *@Description
9
+ *@Author ywx
10
+ *Date 2025/1/2 15:19
11
+ **/
12
+@Data
13
+public class SQScoreVo {
14
+    //科目ID
15
+    private String subjectid;
16
+    private List<SQuestionVo> questions;
17
+}
18
+

+ 18
- 0
smarking/src/main/java/com/xhkjedu/smarking/vo/paper/SQuestionVo.java View File

@@ -0,0 +1,18 @@
1
+package com.xhkjedu.smarking.vo.paper;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.List;
6
+
7
+/**
8
+ *@Description
9
+ *@Author ywx
10
+ *Date 2025/1/2 15:23
11
+ **/
12
+@Data
13
+public class SQuestionVo {
14
+    //考试试题表id
15
+    private Integer mptqid;
16
+    //学生分值
17
+    private List<Double> stuscores;
18
+}

+ 14
- 0
smarking/src/main/resources/mapper/stupaper/MsPaperStudentQuestionMapper.xml View File

@@ -331,4 +331,18 @@
331 331
         left join ms_paper_student ps on sq.mpsid=ps.mpsid
332 332
         where sq.examid=#{examid} and ps.sstate=2 order by sq.mpid,sq.studentid
333 333
     </select>
334
+    <!--获取参与统计科目单题得分情况-->
335
+    <resultMap id="subjectScore" type="com.xhkjedu.smarking.vo.paper.SQScoreVo">
336
+        <result column="subjectid" property="subjectid"/>
337
+        <collection property="questions" ofType="com.xhkjedu.smarking.vo.paper.SQuestionVo" javaType="java.util.List">
338
+            <result column="mptqid" property="mptqid"/>
339
+            <collection property="stuscores" ofType="java.lang.Double" javaType="java.util.List">
340
+                <result column="stuscore" property="stuscore"/>
341
+            </collection>
342
+        </collection>
343
+    </resultMap>
344
+    <select id="listByMpIds" resultMap="subjectScore">
345
+        select subjectid,mptqid,stuscore from ms_paper_student_question where mpid in
346
+        <foreach collection="mpids" item="mpid" separator="," open="(" close=")">#{mpid}</foreach>
347
+    </select>
334 348
 </mapper>

Loading…
Cancel
Save