相除时控制小数个数
This commit is contained in:
@@ -1120,7 +1120,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
BigDecimal examScore = new BigDecimal(map.get("examScore").toString());
|
||||
BigDecimal totalExamScore = new BigDecimal(Integer.parseInt(classModel.getExamProportion().split(":")[0])
|
||||
+Integer.parseInt(classModel.getExamProportion().split(":")[1]));
|
||||
examScore = examScore.divide(totalExamScore);
|
||||
examScore = examScore.divide(totalExamScore,2, RoundingMode.HALF_UP);
|
||||
examScore = examScore.multiply(new BigDecimal(classModel.getExamScore()));
|
||||
examScore = examScore.setScale(2,RoundingMode.HALF_UP);
|
||||
map.put("examScore",examScore);
|
||||
@@ -1136,7 +1136,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
wrapper.ne(CourseCatalogueChapterEntity::getQuestions,"");
|
||||
int count = courseCatalogueChapterDao.selectCount(wrapper);
|
||||
BigDecimal totalScore = new BigDecimal(staticScore*count);
|
||||
questionScore = questionScore.divide(totalScore);
|
||||
questionScore = questionScore.divide(totalScore,2, RoundingMode.HALF_UP);
|
||||
questionScore = questionScore.multiply(new BigDecimal(classModel.getQuestionScore()));
|
||||
questionScore = questionScore.setScale(2,RoundingMode.HALF_UP);
|
||||
map.put("questionScore",questionScore);
|
||||
@@ -1152,7 +1152,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
wrapper.eq(ClassTask::getType,"0");
|
||||
int count = classTaskDao.selectCount(wrapper);
|
||||
BigDecimal totalScore = new BigDecimal(staticScore*count);
|
||||
task0Score = task0Score.divide(totalScore);
|
||||
task0Score = task0Score.divide(totalScore,2, RoundingMode.HALF_UP);
|
||||
task0Score = task0Score.multiply(new BigDecimal(classModel.getTaskScore()));
|
||||
task0Score = task0Score.setScale(2,RoundingMode.HALF_UP);
|
||||
map.put("task0Score",task0Score);
|
||||
@@ -1168,7 +1168,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
wrapper.eq(ClassTask::getType,"1");
|
||||
int count = classTaskDao.selectCount(wrapper);
|
||||
BigDecimal totalScore = new BigDecimal(staticScore*count);
|
||||
task1Score = task1Score.divide(totalScore);
|
||||
task1Score = task1Score.divide(totalScore,2, RoundingMode.HALF_UP);
|
||||
task1Score = task1Score.multiply(new BigDecimal(classModel.getMedicalcaseScore()));
|
||||
task1Score = task1Score.setScale(2,RoundingMode.HALF_UP);
|
||||
map.put("task1Score",task1Score);
|
||||
|
||||
Reference in New Issue
Block a user