Ver Fonte

评价模块调整

dzx há 1 mês atrás
pai
commit
8348740c82

+ 32 - 33
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentAssessmentInspectionServiceImpl.java

@@ -331,24 +331,32 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
                     for(CalssQuantitativeAssessmentPageVo c: resultList){
                         Long classId = Long.parseLong(c.getClassId());
                         if(individualBehaviorMap.get(classId) != null){
-                            c.setStuPersonalBehaviorSubScore(individualBehaviorMap.get(classId).getSumScore()==null?"":individualBehaviorMap.get(classId).getSumScore().toString());
-                            double v = (100 + individualBehaviorMap.get(classId).getSumScore()) / 100 * 25;
-                            c.setStuPersonalBehaviorScore(v + "");
+                            Double sumScore = individualBehaviorMap.get(classId).getSumScore();
+                            if(sumScore != null){
+                                c.setStuPersonalBehaviorSubScore(sumScore.toString());
+                                double v = (100 + sumScore) / 100 * 25;
+                                c.setStuPersonalBehaviorScore(v + "");
+                            }
                         }
 
                         if(conventionalManagementMap.get(classId) != null){
-                            QuantitativeAssessmentSingleScoreVo scoreVo = conventionalManagementMap.get(classId);
-                            c.setClassConventionalManageSubScore(scoreVo.getSumScore() == null?"":scoreVo.getSumScore().toString());
-                            double v = (100 + scoreVo.getSumScore()) / 100 * 25;
-                            c.setClassConventionalManageScore(v + "");
+                            Double sumScore = conventionalManagementMap.get(classId).getSumScore();
+                            if(sumScore != null){
+                                c.setClassConventionalManageSubScore(sumScore.toString());
+                                double v = (100 + sumScore) / 100 * 25;
+                                c.setClassConventionalManageScore(v + "");
+                            }
                         }
 
                         if(awardsAndHonorableMap.get(classId) != null){
                             c.setHonorSumScore(awardsAndHonorableMap.get(classId).getSumScore()==null?"":awardsAndHonorableMap.get(classId).getSumScore().toString());
-                            if(awardsAndHonorableMap.get(classId).getSumScore() < 10){
-                                c.setHonorScore(awardsAndHonorableMap.get(classId).getSumScore()==null?"":awardsAndHonorableMap.get(classId).getSumScore().toString());
-                            }else {
-                                c.setHonorScore("10");
+                            Double sumScore = awardsAndHonorableMap.get(classId).getSumScore();
+                            if(sumScore != null){
+                                if(sumScore < 10){
+                                    c.setHonorScore(sumScore.toString());
+                                }else {
+                                    c.setHonorScore("10");
+                                }
                             }
                         }
 
@@ -369,7 +377,7 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
                             for (Long id : evaluateCategoryMap.keySet()) {
                                 List<TeaEvaluateClassListVo> evaluateList = evaluateCategoryMap.get(id);
                                 int allSorce = evaluateList.stream().mapToInt(TeaEvaluateClassListVo::getScore).sum();
-                                double avgScore = BigDecimal.valueOf(allSorce).divide(BigDecimal.valueOf(resultList.size())).setScale(2, RoundingMode.HALF_UP).doubleValue();
+                                double avgScore = BigDecimal.valueOf(allSorce).divide(BigDecimal.valueOf(resultList.size()),2, RoundingMode.HALF_UP).doubleValue();
                                 evaluateSocreList.add(avgScore);
                             }
 
@@ -503,31 +511,22 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
                     c.setStuPersonalBehaviorSubScore(individualBehaviorMap.get(classId).getSumScore()==null?"":individualBehaviorMap.get(classId).getSumScore().toString());
                     double v = (100 + individualBehaviorMap.get(classId).getSumScore()) / 100 * 25;
                     c.setStuPersonalBehaviorScore(v + "");
-                    /* ScriptEngine engine = new ScriptEngineManager().getEngineByName("js");
-                    String geRenXingWeiGongShi = "sumSubScore/itemCount";
-                    int totalScore = scoreBySubmitRecordId.get(mobileResultPageVo.getEvaluateSubmitRecordId()).getTotalScore();
-                    int itemCount = scoreBySubmitRecordId.get(mobileResultPageVo.getEvaluateSubmitRecordId()).getItemCount();
-                    double res = 0;
-                    String newStr1 = zonghezhishu.replace("totalScore", ""+totalScore);
-                    String newStr2 = newStr1.replace("itemCount", ""+itemCount);
-                    try{
-                        res = Double.parseDouble(engine.eval(newStr2).toString());
-                    }catch (ScriptException s){
-
-                    }
-                    // 创建一个DecimalFormat对象,指定小数位数为两位
-                    DecimalFormat decimalFormat = new DecimalFormat("#.00");
-                    // 格式化double值为字符串
-                    String formattedNumber = decimalFormat.format(res);*/
                 }
 
                 if(conventionalManagementMap.get(classId) != null){
-                    c.setClassConventionalManageSubScore(conventionalManagementMap.get(classId).getSumScore()==null?"":conventionalManagementMap.get(classId).getSumScore().toString());
-                    Double SumScore = 0D;
-                    if(conventionalManagementMap.get(classId).getSumScore() != null){
-                        SumScore = conventionalManagementMap.get(classId).getSumScore();
+                    Double sumScore = conventionalManagementMap.get(classId).getSumScore();
+                    if(sumScore == null){
+                        sumScore = 0D;
                     }
-                    c.setClassConventionalManageScore(((100 + SumScore)/100*25) + "");
+                    String scoreStr = sumScore.toString();
+//                    boolean isInteger = sumScore == Math.floor(sumScore);
+//                    if(isInteger){
+//                        scoreStr = sumScore.intValue() + "";
+//                    }
+                    c.setClassConventionalManageSubScore(scoreStr);
+
+                    double v = (100 + sumScore) / 100 * 25;
+                    c.setClassConventionalManageScore(v + "");
                 }
 
                 if(awardsAndHonorableMap.get(classId) != null){