From cf8524f0eeb0e897e31077695a410fc97633c3f5 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期五, 15 三月 2024 20:35:36 +0800
Subject: [PATCH] 添加方法

---
 cloud-server-account/src/main/java/com/dsh/account/service/impl/StudentHonorServiceImpl.java |   76 +++++++++++++-------------------------
 1 files changed, 26 insertions(+), 50 deletions(-)

diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/StudentHonorServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/StudentHonorServiceImpl.java
index 85aca28..22af474 100644
--- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/StudentHonorServiceImpl.java
+++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/StudentHonorServiceImpl.java
@@ -70,59 +70,35 @@
     @Override
     public List<GongVo> queryStuOfMedalData(Integer stuId, Integer appUserId) {
         List<GongVo> voList = new ArrayList<>();
-        TStudent student = studentService.getById(stuId);
-        Integer count1 = coursePackageClient.counts(stuId);
-        if (count1 > 0) {
+        List<StudentHonor> list = studentHonorService.list(new QueryWrapper<StudentHonor>()
+                .eq("appUserId", appUserId));
+        for (StudentHonor studentHonor : list) {
             GongVo vo = new GongVo();
-            vo.setMedalType(1);
-            vo.setMedalName("俱乐部之星");
+            vo.setMedalType(studentHonor.getHonorType());
+            switch (studentHonor.getHonorType()){
+                case 1:
+                    vo.setMedalName("俱乐部之星");
+                    break;
+                case 2:
+                    vo.setMedalName("运动达人");
+                    break;
+                case 3:
+                    vo.setMedalName("社区之王");
+                    break;
+                case 4:
+                    vo.setMedalName("深度玩家");
+                    break;
+                case 5:
+                    vo.setMedalName("常胜将军");
+                    break;
+                case 6:
+                    vo.setMedalName("越战越勇");
+                    break;
+                    default:
+                        break;
+            }
             voList.add(vo);
         }
-
-        Integer count2 = participantClient.counts(stuId);
-        if (count2 > 0) {
-            GongVo vo = new GongVo();
-            vo.setMedalType(2);
-            vo.setMedalName("运动达人");
-            voList.add(vo);
-        }
-
-        Integer count3 = siteClient.counts(student.getAppUserId());
-        if (count3 > 0) {
-            GongVo vo = new GongVo();
-            vo.setMedalType(3);
-            vo.setMedalName("社区之王");
-            voList.add(vo);
-        }
-
-
-        Integer count4 = coursePackageClient.counts1(stuId);
-        if (count4 > 0) {
-            GongVo vo = new GongVo();
-            vo.setMedalType(4);
-            vo.setMedalName("深度玩家");
-            voList.add(vo);
-        }
-
-        Integer count5 = worldCupCompetitorClient.winCount(stuId);
-
-        StudentHonor one = studentHonorService.getOne(new QueryWrapper<StudentHonor>()
-                .eq("appUserId", appUserId).eq("honorType", 5));
-        if (null != one) {
-            GongVo vo = new GongVo();
-            vo.setMedalType(5);
-            vo.setMedalName("常胜将军");
-            voList.add(vo);
-        }
-        one = studentHonorService.getOne(new QueryWrapper<StudentHonor>()
-                .eq("appUserId", appUserId).eq("honorType", 6));
-        if (null != one) {
-            GongVo vo = new GongVo();
-            vo.setMedalType(6);
-            vo.setMedalName("越战越勇");
-            voList.add(vo);
-        }
-
         return voList;
     }
 

--
Gitblit v1.7.1