From 233ab439e38d3040d556f3f6d04492be2a3a6c8d Mon Sep 17 00:00:00 2001
From: hjl <1657978663@qq.com>
Date: 星期三, 19 六月 2024 18:17:14 +0800
Subject: [PATCH] fix: 学习端bug

---
 ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/service/impl/TStudyServiceImpl.java |   16 +---------------
 1 files changed, 1 insertions(+), 15 deletions(-)

diff --git a/ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/service/impl/TStudyServiceImpl.java b/ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/service/impl/TStudyServiceImpl.java
index 1e3f7f7..69e982b 100644
--- a/ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/service/impl/TStudyServiceImpl.java
+++ b/ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/service/impl/TStudyServiceImpl.java
@@ -177,7 +177,6 @@
         List<List<TSubject>> subjectList = new ArrayList<>();
         for (TStudyListen studyListen : studyListens) {
             List<String> subjectIds = Arrays.stream(studyListen.getSubject().split(",")).collect(Collectors.toList());
-            Collections.shuffle(subjectIds);
             List<TSubject> list = new ArrayList<>();
             // 图片及语音集合
             for (String id : subjectIds) {
@@ -211,7 +210,6 @@
         List<List<TSubject>> subjectList = new ArrayList<>();
         for (TStudyLook studyLook : lookList) {
             List<String> subjectIds = Arrays.stream(studyLook.getSubject().split(",")).collect(Collectors.toList());
-            Collections.shuffle(subjectIds);
             List<TSubject> list = new ArrayList<>();
             // 图片及语音集合
             for (String id : subjectIds) {
@@ -245,7 +243,6 @@
         List<List<TSubject>> subjectList = new ArrayList<>();
         for (TStudyInduction data : inductionList) {
             List<String> subjectIds = Arrays.stream(data.getSubject().split(",")).collect(Collectors.toList());
-            Collections.shuffle(subjectIds);
             List<TSubject> subjectLists = new ArrayList<>();
             for (String id : subjectIds) {
                 if (id.startsWith("-")) {
@@ -336,7 +333,6 @@
         List<List<TSubject>> subjectList = new ArrayList<>();
         for (TStudyPair data : pair) {
             List<String> subjectIds = Arrays.stream(data.getSubject().split(",")).collect(Collectors.toList());
-            Collections.shuffle(subjectIds);
             List<TSubject> subjectLists = new ArrayList<>();
             for (String id : subjectIds) {
                 if (id.startsWith("-")) {
@@ -400,15 +396,13 @@
 
     @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)
@@ -416,8 +410,6 @@
             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)
@@ -425,8 +417,6 @@
             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)
@@ -434,8 +424,6 @@
             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)
@@ -443,8 +431,6 @@
             Optional<TStudyPair> any = list.stream().findAny();
             if (any.isPresent()) {
                 sum = any.get().getIntegral();
-            } else {
-                sum = 0;
             }
         } else {
             throw new GlobalException("题目信息异常!");

--
Gitblit v1.7.1