| | |
| | | |
| | | @Override |
| | | public int computeTotalIntegral(List<String> studyIds, Integer type, Integer accuracy) { |
| | | int sum; |
| | | int sum = 0; |
| | | if (Constants.ONE.equals(type)) { |
| | | List<TStudyListen> list = studyListenService.lambdaQuery().in(TStudyListen::getId, studyIds) |
| | | .eq(TStudyListen::getDisabled, 0).list(); |
| | | Optional<TStudyListen> any = list.stream().findAny(); |
| | | if (any.isPresent()) { |
| | | sum = any.get().getIntegral(); |
| | | } else { |
| | | sum = 0; |
| | | } |
| | | } else if (Constants.TWO.equals(type)) { |
| | | List<TStudyLook> list = studyLookService.lambdaQuery().in(TStudyLook::getId, studyIds) |
| | |
| | | Optional<TStudyLook> any = list.stream().findAny(); |
| | | if (any.isPresent()) { |
| | | sum = any.get().getIntegral(); |
| | | } else { |
| | | sum = 0; |
| | | } |
| | | } else if (Constants.THREE.equals(type)) { |
| | | List<TStudyInduction> list = studyInductionService.lambdaQuery().in(TStudyInduction::getId, studyIds) |
| | |
| | | Optional<TStudyInduction> any = list.stream().findAny(); |
| | | if (any.isPresent()) { |
| | | sum = any.get().getIntegral(); |
| | | } else { |
| | | sum = 0; |
| | | } |
| | | } else if (Constants.FOUR.equals(type)) { |
| | | List<TStudyAnswer> list = studyAnswerService.lambdaQuery().in(TStudyAnswer::getId, studyIds) |
| | |
| | | Optional<TStudyAnswer> any = list.stream().findAny(); |
| | | if (any.isPresent()) { |
| | | sum = any.get().getIntegral(); |
| | | } else { |
| | | sum = 0; |
| | | } |
| | | } else if (Constants.FIVE.equals(type)) { |
| | | List<TStudyPair> list = studyPairService.lambdaQuery().in(TStudyPair::getId, studyIds) |
| | |
| | | Optional<TStudyPair> any = list.stream().findAny(); |
| | | if (any.isPresent()) { |
| | | sum = any.get().getIntegral(); |
| | | } else { |
| | | sum = 0; |
| | | } |
| | | } else { |
| | | throw new GlobalException("题目信息异常!"); |