Browse Source

Merge remote-tracking branch 'origin/prod-5.1.3' into prod-5.1.3

zhongwei
yang_shj 4 months ago
parent
commit
a9d5521efc
  1. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java

4
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java

@ -135,10 +135,10 @@ public class TestScoreServiceImpl extends ServiceImpl<TestScoreMapper, TestScore
QueryWrapper<TestScoreEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<TestScoreEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(TestScoreEntity::getTestId, testId); queryWrapper.lambda().eq(TestScoreEntity::getTestId, testId);
List<TestScoreEntity> list = this.list(queryWrapper); List<TestScoreEntity> list = this.list(queryWrapper);
list= list.stream().filter(s -> s.getScore() != null).collect(Collectors.toList()); list = list.stream().filter(s -> s.getScore() != null).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
testScoreSumVO.setActualPeopleNum(list.size()); testScoreSumVO.setActualPeopleNum(list.size());
List<TestScoreEntity> passCollect = list.stream().filter(s -> s.getScore() > testEntity.getPassingScore()).collect(Collectors.toList()); List<TestScoreEntity> passCollect = list.stream().filter(s -> s.getScore() >= testEntity.getPassingScore()).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(list)&&CollectionUtils.isNotEmpty(passCollect)) { if (CollectionUtils.isNotEmpty(list)&&CollectionUtils.isNotEmpty(passCollect)) {
double result = BigDecimal.valueOf(passCollect.size()).divide(BigDecimal.valueOf(list.size()),2, RoundingMode.UP).doubleValue(); double result = BigDecimal.valueOf(passCollect.size()).divide(BigDecimal.valueOf(list.size()),2, RoundingMode.UP).doubleValue();
testScoreSumVO.setPercentage(result); testScoreSumVO.setPercentage(result);

Loading…
Cancel
Save