Browse Source

更改作业考试集合sum时精度问题

tags/正式版本
王宁 2 years ago
parent
commit
7bda347588

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperQtypeService.java View File

@@ -339,6 +339,7 @@ public class EPaperQtypeService {
339 339
             for(Map.Entry<String, List<QuestionOrderVo>> entry : complxmap.entrySet()){
340 340
                 List<QuestionOrderVo> pgblist = entry.getValue();
341 341
                 Double score = pgblist.stream().mapToDouble(s -> s.getScore()).sum();
342
+                score = N_Utils.formatDouble(score,1);
342 343
                 Double srate = N_Utils.getDoubleDivideAndMulitiply(score,ePaper.getPscore());
343 344
                 Map prate = new TreeMap();
344 345
                 prate.put("level",Integer.parseInt(entry.getKey()));
@@ -358,6 +359,7 @@ public class EPaperQtypeService {
358 359
                 List<QuestionOrderVo> pgblist = entry.getValue();
359 360
                 //获取知识点的总分
360 361
                 Double score = pgblist.stream().mapToDouble(s -> s.getScore()).sum();
362
+                score = N_Utils.formatDouble(score,1);
361 363
                 Double srate = N_Utils.getDoubleDivideAndMulitiply(score,ePaper.getPscore());
362 364
                 Map prate = new TreeMap();
363 365
                 prate.put("pointid",entry.getKey());
@@ -615,6 +617,7 @@ public class EPaperQtypeService {
615 617
             List<EPaperQtype> aq = entry.getValue();
616 618
             int num = aq.stream().mapToInt(EPaperQtype::getEptnum).sum();
617 619
             double tscore = aq.stream().collect(Collectors.summingDouble(EPaperQtype:: getEptscore));
620
+            tscore = N_Utils.formatDouble(tscore,1);
618 621
             double storerate = N_Utils.getDoubleDivideAndMulitiply(tscore, ePaper.getPscore());
619 622
             //获取小题题号
620 623
 

+ 20
- 0
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportGenerateService.java View File

@@ -1841,7 +1841,9 @@ public class EReportGenerateService {
1841 1841
                 gstunum = qgstulist.size();
1842 1842
                 EPaperStudentQuestion qgmaxstu = qgstulist.stream().max(Comparator.comparing(EPaperStudentQuestion::getStuscore)).get();
1843 1843
                 Double qgscore = qgstulist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();
1844
+                qgscore = N_Utils.formatDouble(qgscore,1);
1844 1845
                 Double qgstuscore = qgstulist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
1846
+                qgstuscore = N_Utils.formatDouble(qgstuscore,1);
1845 1847
                 Double qgavgscore = N_Utils.getDoubleDivideForAvg(qgstuscore, gstunum);//年级平均分
1846 1848
                 Double qgsrate = N_Utils.getDoubleDivideAndMulitiply(qgstuscore, qgscore);
1847 1849
                 tgscore = ExamUtil.add(tgscore, qgscore);
@@ -1855,7 +1857,9 @@ public class EReportGenerateService {
1855 1857
                         int cstunum = qcstulist.size();//班级下试题作答学生数量
1856 1858
                         EPaperStudentQuestion qcmaxstu = qcstulist.stream().max(Comparator.comparing(EPaperStudentQuestion::getStuscore)).get();
1857 1859
                         Double qcscore = qcstulist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();
1860
+                        qcscore = N_Utils.formatDouble(qcscore,1);
1858 1861
                         Double qcstuscore = qcstulist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
1862
+                        qcstuscore = N_Utils.formatDouble(qcstuscore,1);
1859 1863
                         Double qcavgscore = N_Utils.getDoubleDivideForAvg(qcstuscore, cstunum);
1860 1864
                         Double qcsrate = N_Utils.getDoubleDivideAndMulitiply(qcstuscore, qcscore);
1861 1865
 
@@ -2013,7 +2017,9 @@ public class EReportGenerateService {
2013 2017
                         pstq.setStudentid(entry.getKey());
2014 2018
 
2015 2019
                         Double qstuscore = stuqueslist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
2020
+                        qstuscore = N_Utils.formatDouble(qstuscore,1);
2016 2021
                         Double qscore = stuqueslist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();
2022
+                        qscore = N_Utils.formatDouble(qscore,1);
2017 2023
                         pstq.setQscore(qscore);
2018 2024
                         pstq.setStuscore(qstuscore);
2019 2025
                         pstq.setCtype(11);//母子题关系的均设置为复合题,不再进行选项区分
@@ -2039,7 +2045,9 @@ public class EReportGenerateService {
2039 2045
 
2040 2046
                 gstunum = qgstulist.size();
2041 2047
                 Double qgscore = qgstulist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();
2048
+                qgscore = N_Utils.formatDouble(qgscore,1);
2042 2049
                 Double qgstuscore = qgstulist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
2050
+                qgstuscore = N_Utils.formatDouble(qgstuscore,1);
2043 2051
                 EPaperStudentQuestion qgmaxscore = qgstulist.stream().max(Comparator.comparing(EPaperStudentQuestion::getStuscore)).get();
2044 2052
                 tgscore = ExamUtil.add(tgscore, qgscore);
2045 2053
                 tgstuscore = ExamUtil.add(tgstuscore, qgstuscore);
@@ -2050,7 +2058,9 @@ public class EReportGenerateService {
2050 2058
                     if(N_Utils.isListNotEmpty(qcstulist)){
2051 2059
                         int cstunum = qcstulist.size();//班级下试题作答学生数量
2052 2060
                         Double qcscore = qcstulist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();
2061
+                        qcscore = N_Utils.formatDouble(qcscore,1);
2053 2062
                         Double qcstuscore = qcstulist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
2063
+                        qcstuscore = N_Utils.formatDouble(qcstuscore,1);
2054 2064
                         Double qcavgscore = N_Utils.getDoubleDivideForAvg(qcstuscore,cstunum);
2055 2065
                         EPaperStudentQuestion maxscore = qcstulist.stream().max(Comparator.comparing(EPaperStudentQuestion::getStuscore)).get();
2056 2066
 
@@ -2188,6 +2198,7 @@ public class EReportGenerateService {
2188 2198
                     for (Map.Entry<Integer, List<EPaperStudentQuestion>> entry : stuquesmap.entrySet()) {
2189 2199
                         List<EPaperStudentQuestion> stuques = entry.getValue();
2190 2200
                         Double stuscore = stuques.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
2201
+                        stuscore = N_Utils.formatDouble(stuscore,1);
2191 2202
                         EPaperStudentQuestion sqfirst = stuques.get(0);
2192 2203
                         EPaperStudentQuestion sq = new EPaperStudentQuestion();
2193 2204
                         sq.setStudentid(entry.getKey());
@@ -2216,6 +2227,7 @@ public class EReportGenerateService {
2216 2227
             for (Map.Entry<Integer, List<ERPointStuScoreVo>> entry : pointstuscoremap.entrySet()) {
2217 2228
                 List<ERPointStuScoreVo> stuscorelist = entry.getValue();
2218 2229
                 Double stuscore = stuscorelist.stream().mapToDouble(ERPointStuScoreVo::getStuscore).sum();
2230
+                stuscore = N_Utils.formatDouble(stuscore,1);
2219 2231
                 ERPointStuScoreVo sscorevofirst = stuscorelist.get(0);
2220 2232
                 ERPointStuScoreVo sscorevo = new ERPointStuScoreVo();
2221 2233
                 sscorevo.setStudentid(sscorevofirst.getStudentid());
@@ -2225,6 +2237,7 @@ public class EReportGenerateService {
2225 2237
             }
2226 2238
 
2227 2239
             Double gstuscore = pointstuscorelist.stream().mapToDouble(ERPointStuScoreVo::getStuscore).sum();
2240
+            gstuscore = N_Utils.formatDouble(gstuscore,1);
2228 2241
             Double gavgscore = N_Utils.getDoubleDivideForAvg(gstuscore, pointstuscorelist.size());
2229 2242
             Double gsrate = N_Utils.getDoubleDivideAndMulitiply(gstuscore, pointscore * pointstuscorelist.size());
2230 2243
 
@@ -2233,6 +2246,7 @@ public class EReportGenerateService {
2233 2246
                 List<ERPointStuScoreVo> classpointstulist = pointstuscorelist.stream().filter(s -> s.getClassid().equals(classid)).collect(Collectors.toList());
2234 2247
                 if(N_Utils.isListNotEmpty(classpointstulist)){
2235 2248
                     Double cstuscore = classpointstulist.stream().mapToDouble(ERPointStuScoreVo::getStuscore).sum();
2249
+                    cstuscore = N_Utils.formatDouble(cstuscore,1);
2236 2250
 //                Double cscore = classpointstulist.stream().mapToDouble(ERPointStuScoreVo::getScore).sum();
2237 2251
                     Double cavgscore = N_Utils.getDoubleDivideForAvg(cstuscore, classpointstulist.size());
2238 2252
                     Double csrate = N_Utils.getDoubleDivideAndMulitiply(cstuscore, pointscore * classpointstulist.size());
@@ -2343,7 +2357,9 @@ public class EReportGenerateService {
2343 2357
                 pstq.setStudentid(entry.getKey());
2344 2358
                 pstq.setClassid(pfirst.getClassid());
2345 2359
                 Double qstuscore = stuqueslist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
2360
+                qstuscore = N_Utils.formatDouble(qstuscore,1);
2346 2361
                 Double qscore = stuqueslist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();
2362
+                qscore = N_Utils.formatDouble(qscore,1);
2347 2363
                 pstq.setQscore(qscore);
2348 2364
                 pstq.setStuscore(qstuscore);
2349 2365
                 qgstulist.add(pstq);
@@ -2361,7 +2377,9 @@ public class EReportGenerateService {
2361 2377
             }
2362 2378
 
2363 2379
             Double tgstuscore = qgstulist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();//难易度下学生得分
2380
+            tgstuscore = N_Utils.formatDouble(tgstuscore,1);
2364 2381
             Double tgscore = qgstulist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();//难易度下试题总分
2382
+            tgscore = N_Utils.formatDouble(tgscore,1);
2365 2383
             Double tgsrate = N_Utils.getDoubleDivideAndMulitiply(tgstuscore, tgscore);//年级得分率
2366 2384
             Double tgavgscore = N_Utils.getDoubleDivideForAvg(tgstuscore,qgstulist.size());
2367 2385
 
@@ -2371,7 +2389,9 @@ public class EReportGenerateService {
2371 2389
                 List<EPaperStudentQuestion> qcstulist = qgstulist.stream().filter(s -> s.getClassid().equals(classid)).collect(Collectors.toList());
2372 2390
                 if(N_Utils.isListNotEmpty(qcstulist)){
2373 2391
                     Double qcscore = qcstulist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();
2392
+                    qcscore = N_Utils.formatDouble(qcscore,1);
2374 2393
                     Double qcstuscore = qcstulist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
2394
+                    qcstuscore = N_Utils.formatDouble(qcstuscore,1);
2375 2395
                     Double qcavgscore = N_Utils.getDoubleDivideForAvg(qcstuscore,qcstulist.size());
2376 2396
 
2377 2397
                     ERclassComplexity erc = new ERclassComplexity();

+ 2
- 2
sstudy/src/main/java/com/xhkjedu/sstudy/controller/paper/PaperController.java View File

@@ -304,8 +304,8 @@ public class PaperController {
304 304
 
305 305
     //该方法用于重新生成之前的作业报告
306 306
     @GetMapping("/hpa")
307
-    public ResultVo handlePaperAnalyze() {
308
-        paperService.listPapersForAnalyze();
307
+    public ResultVo handlePaperAnalyze(Integer paperid) {
308
+        paperService.listPapersForAnalyze(paperid);
309 309
         return new ResultVo(0, "成功处理作业分析");
310 310
     }
311 311
 }

+ 1
- 1
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/paper/PaperMapper.java View File

@@ -149,5 +149,5 @@ public interface PaperMapper extends TkMapper<TPaper> {
149 149
     String getSubjectIdByPid(@Param("paperid") Long paperid);
150 150
 
151 151
     //获取所有试卷用于重新生成分析
152
-    List<TPaper> listPapersForAnalyze();
152
+    List<TPaper> listPapersForAnalyze(@Param("paperid") Integer paperid);
153 153
 }

+ 6
- 2
sstudy/src/main/java/com/xhkjedu/sstudy/service/paper/PaperService.java View File

@@ -267,6 +267,7 @@ public class PaperService {
267 267
             List<TPaperScantronQtype> aq = entry.getValue();
268 268
             int num = aq.stream().mapToInt(TPaperScantronQtype::getPstnum).sum();
269 269
             double tscore = aq.stream().collect(Collectors.summingDouble(TPaperScantronQtype:: getPstscore));
270
+            tscore = N_Utils.formatDouble(tscore,1);
270 271
             double storerate = N_Utils.getDoubleDivideAndMulitiply(tscore, paper.getPaperscore());
271 272
             //获取小题题号
272 273
             List<Integer> orderlist = new ArrayList<>();
@@ -592,6 +593,7 @@ public class PaperService {
592 593
         List<PaperQtypeQuesVo> ktlst = mquestions.stream().filter(q->q.getMctype() == 111).collect(Collectors.toList());
593 594
         int ktnum = ktlst.size();
594 595
         double ktscore = ktlst.stream().collect(Collectors.summingDouble(PaperQtypeQuesVo:: getPtqscore));
596
+        ktscore = N_Utils.formatDouble(ktscore,1);
595 597
         double ktnrate = N_Utils.getIntegerDivideAndMulitiply(ktnum, paper.getPapernum());
596 598
         double ktsrate = N_Utils.getDoubleDivideAndMulitiply(ktscore, paper.getPaperscore());
597 599
         List<PaperQsVo> ranglist = new ArrayList<>();
@@ -615,6 +617,7 @@ public class PaperService {
615 617
             for(Map.Entry<String, List<QuestionOrderVo>> entry : complxmap.entrySet()){
616 618
                 List<QuestionOrderVo> pgblist = entry.getValue();
617 619
                 Double score = pgblist.stream().mapToDouble(s -> s.getScore()).sum();
620
+                score = N_Utils.formatDouble(score,1);
618 621
                 Double srate = N_Utils.getDoubleDivideAndMulitiply(score,paper.getPaperscore());
619 622
                 Map prate = new TreeMap();
620 623
                 prate.put("level",Integer.parseInt(entry.getKey()));
@@ -634,6 +637,7 @@ public class PaperService {
634 637
                 List<QuestionOrderVo> pgblist = entry.getValue();
635 638
                 //获取知识点的总分
636 639
                 Double score = pgblist.stream().mapToDouble(s -> s.getScore()).sum();
640
+                score = N_Utils.formatDouble(score,1);
637 641
                 Double srate = N_Utils.getDoubleDivideAndMulitiply(score,paper.getPaperscore());
638 642
                 Map prate = new TreeMap();
639 643
                 prate.put("pointid",entry.getKey());
@@ -1206,8 +1210,8 @@ public class PaperService {
1206 1210
     }
1207 1211
 
1208 1212
     //处理作业分析
1209
-    public void listPapersForAnalyze(){
1210
-        List<TPaper> papers = paperMapper.listPapersForAnalyze();
1213
+    public void listPapersForAnalyze(Integer paperid){
1214
+        List<TPaper> papers = paperMapper.listPapersForAnalyze(paperid);
1211 1215
         for(TPaper p : papers){
1212 1216
             if(p.getPapertype() == 1){
1213 1217
                 //题库

+ 5
- 1
sstudy/src/main/resources/mapper/paper/PaperMapper.xml View File

@@ -299,6 +299,10 @@
299 299
 
300 300
     <!--获取所有试卷用于重新生成分析-->
301 301
     <select id="listPapersForAnalyze" resultType="com.xhkjedu.sstudy.model.paper.TPaper">
302
-        select * from t_paper order by paperid
302
+        select * from t_paper
303
+        <if test="paperid!=null and paperid!=''">
304
+            where paperid=#{paperid}
305
+        </if>
306
+        order by paperid
303 307
     </select>
304 308
 </mapper>

Loading…
Cancel
Save