瀏覽代碼

Merge branch 'test' of http://git.dayaedu.com/yonge/cooleshow into test

liujc 1 年之前
父節點
當前提交
63f384983d

+ 23 - 1
cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/StudentController.java

@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.dto.search.StudentSearch;
+import com.yonge.cooleshow.biz.dal.entity.Student;
+import com.yonge.cooleshow.biz.dal.entity.TenantGroup;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.service.ImGroupService;
 import com.yonge.cooleshow.biz.dal.service.StudentService;
+import com.yonge.cooleshow.biz.dal.service.TenantGroupService;
 import com.yonge.cooleshow.biz.dal.vo.StudentVo;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
@@ -29,7 +32,10 @@ import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 @RestController
 @RequestMapping("${app-config.url.teacher:}/student")
@@ -41,9 +47,13 @@ public class StudentController extends BaseController {
     @Resource
     private SysUserFeignService sysUserFeignService;
 
-
     @Autowired
     private ImGroupService imGroupService;
+
+    @Autowired
+    private TenantGroupService tenantGroupService;
+
+
     @ApiOperation(value = "查询指定学员信息-融云token")
     @GetMapping("/queryUserById")
     public HttpResponseResult<StudentVo> queryUserById(String rongCloudUserId) {
@@ -106,6 +116,17 @@ public class StudentController extends BaseController {
         IPage<StudentVo> pages = studentService.selectPage(PageUtil.getPage(query), query);
         List<StudentVo> rows = pages.getRecords();
 
+        List<Long> tenantGroupIds = rows.stream().map(Student::getTenantGroupId)
+                .filter(next -> next != null && next != -1L).distinct().collect(Collectors.toList());
+        Map<Long, String> tenantGroupIdNameMap = new HashMap<>();
+        if (!tenantGroupIds.isEmpty()) {
+            Map<Long, String> tenantGroupMap = tenantGroupService.lambdaQuery()
+                    .eq(TenantGroup::getTenantId, tenantId)
+                    .in(TenantGroup::getId, tenantGroupIds)
+                    .list().stream().collect(Collectors.toMap(TenantGroup::getId, TenantGroup::getName));
+            tenantGroupIdNameMap.putAll(tenantGroupMap);
+        }
+
         for (StudentVo vo : rows) {
             if (vo.getDelFlag() == YesOrNoEnum.YES) {
                 vo.setUserStatus(UserStatusEnum.CLOSED);
@@ -117,6 +138,7 @@ public class StudentController extends BaseController {
                 }
             }
             vo.setImUserId(imGroupService.getImUserId(vo.getUserId(), ClientEnum.STUDENT));
+            vo.setTenantGroupName(tenantGroupIdNameMap.getOrDefault(vo.getTenantGroupId(), ""));
         }
         return succeed(PageUtil.pageInfo(pages));
     }

+ 1 - 1
cooleshow-app/src/main/java/com/yonge/cooleshow/tenant/controller/IndexController.java

@@ -92,7 +92,7 @@ public class IndexController extends BaseController {
 
         String format = new SimpleDateFormat("yyyyMMddHHmm").format(new Date());
         OssFileWrapper.ExportFile exportFile = ossFileService.uploadFile(templates,
-                TeacherWrapper.ExportTeacherTemplate.class, format, "练习统计列表");
+                SysMusicCompareRecordQueryInfo.WechatCompareRecordExportDto.class, format, "练习统计列表");
         return succeed(exportFile);
     }
 

+ 21 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/tenant/controller/StudentController.java

@@ -7,6 +7,7 @@ import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.dto.search.StudentSearch;
 import com.yonge.cooleshow.biz.dal.entity.Student;
 import com.yonge.cooleshow.biz.dal.entity.TenantActivationCode;
+import com.yonge.cooleshow.biz.dal.entity.TenantGroup;
 import com.yonge.cooleshow.biz.dal.entity.TenantInfo;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.service.ImUserFriendService;
@@ -14,6 +15,7 @@ import com.yonge.cooleshow.biz.dal.service.OssFileService;
 import com.yonge.cooleshow.biz.dal.service.StudentService;
 import com.yonge.cooleshow.biz.dal.service.TeacherService;
 import com.yonge.cooleshow.biz.dal.service.TenantActivationCodeService;
+import com.yonge.cooleshow.biz.dal.service.TenantGroupService;
 import com.yonge.cooleshow.biz.dal.service.TenantInfoService;
 import com.yonge.cooleshow.biz.dal.vo.StudentVo;
 import com.yonge.cooleshow.biz.dal.wrapper.OssFileWrapper;
@@ -74,6 +76,9 @@ public class StudentController extends BaseController {
     @Autowired
     private OssFileService ossFileService;
 
+    @Autowired
+    private TenantGroupService tenantGroupService;
+
     @GetMapping("/detail/{id}")
     @ApiOperation(value = "详情", notes = "传入id")
     public HttpResponseResult<StudentVo> detail(@PathVariable("id") Long id) {
@@ -93,6 +98,10 @@ public class StudentController extends BaseController {
         IPage<StudentVo> pages = studentService.selectPage(PageUtil.getPage(query), query);
         List<StudentVo> rows = pages.getRecords();
 
+        if (rows.isEmpty()) {
+            return succeed(PageUtil.pageInfo(pages));
+        }
+
         //如果真实姓名字段为空 把真实姓名赋值给昵称
         rows.stream().forEach(r->{
             if (StringUtils.isEmpty(r.getRealName())){
@@ -111,6 +120,17 @@ public class StudentController extends BaseController {
                     .in(TenantActivationCode::getActivationPhone, studentPhones)
                     .list().stream().collect(Collectors.groupingBy(TenantActivationCode::getActivationPhone));
         }
+        List<Long> tenantGroupIds = rows.stream().map(Student::getTenantGroupId)
+                .filter(next -> next != null && next != -1L).distinct().collect(Collectors.toList());
+        Map<Long, String> tenantGroupIdNameMap = new HashMap<>();
+        if(!tenantGroupIds.isEmpty()){
+            Map<Long, String> tenantGroupMap = tenantGroupService.lambdaQuery()
+                    .eq(TenantGroup::getTenantId, tenantInfo.getId())
+                    .in(TenantGroup::getId, tenantGroupIds)
+                    .list().stream().collect(Collectors.toMap(TenantGroup::getId, TenantGroup::getName));
+            tenantGroupIdNameMap.putAll(tenantGroupMap);
+        }
+
 
         for (StudentVo vo : rows) {
             vo.setSendActiveCodeNum(groupByPhone.getOrDefault(vo.getPhone(), new ArrayList<>()).size());
@@ -126,6 +146,7 @@ public class StudentController extends BaseController {
                     vo.setUserStatus(UserStatusEnum.NORMAL);
                 }
             }
+            vo.setTenantGroupName(tenantGroupIdNameMap.getOrDefault(vo.getTenantGroupId(), ""));
         }
         return succeed(PageUtil.pageInfo(pages));
     }

+ 10 - 3
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/StudentServiceImpl.java

@@ -211,11 +211,18 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
                     studentHomeVo.setTenantAlbumStatus(1);
                 }
             }
-            UserTenantAlbumRecord record =
-                    userTenantAlbumRecordService.getNewestByTenantIdAndUserId(tenantInfo.getId(), detail.getUserId(),
-                            ClientEnum.STUDENT);
+            UserTenantAlbumRecord record = userTenantAlbumRecordService.lambdaQuery()
+                    .eq(UserTenantAlbumRecord::getTenantId, tenantInfo.getId())
+                    .eq(UserTenantAlbumRecord::getUserId, detail.getUserId())
+                    .eq(UserTenantAlbumRecord::getClientType, ClientEnum.STUDENT)
+                    .orderByDesc(UserTenantAlbumRecord::getEndTime)
+                    .last("limit 1").one();
             if (record == null || record.getEndTime().getTime() < System.currentTimeMillis()) {
                 studentHomeVo.setTenantAlbumFlag(YesOrNoEnum.NO);
+                if (record != null) {
+                    studentHomeVo.setTenantAlbumStartTime(record.getStartTime());
+                    studentHomeVo.setTenantAlbumEndTime(record.getEndTime());
+                }
             } else {
                 studentHomeVo.setTenantAlbumStatus(2);
                 studentHomeVo.setTenantAlbumFlag(YesOrNoEnum.YES);

+ 52 - 13
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantAlbumMusicServiceImpl.java

@@ -1,28 +1,44 @@
 package com.yonge.cooleshow.biz.dal.service.impl;
 
+import cn.hutool.core.util.NumberUtil;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
-import com.yonge.cooleshow.biz.dal.dao.MusicFavoriteDao;
-import com.yonge.cooleshow.biz.dal.entity.*;
+import com.yonge.cooleshow.biz.dal.entity.MusicFavorite;
+import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
+import com.yonge.cooleshow.biz.dal.entity.MusicTag;
+import com.yonge.cooleshow.biz.dal.entity.Subject;
+import com.yonge.cooleshow.biz.dal.entity.SysUser;
+import com.yonge.cooleshow.biz.dal.entity.TenantAlbumCategory;
+import com.yonge.cooleshow.biz.dal.entity.TenantAlbumCategoryDetail;
+import com.yonge.cooleshow.biz.dal.entity.TenantAlbumMusic;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.enums.SubjectTypeEnum;
 import com.yonge.cooleshow.biz.dal.mapper.SysUserMapper;
-import com.yonge.cooleshow.biz.dal.service.*;
+import com.yonge.cooleshow.biz.dal.mapper.TenantAlbumMusicMapper;
+import com.yonge.cooleshow.biz.dal.service.MusicFavoriteService;
+import com.yonge.cooleshow.biz.dal.service.MusicSheetService;
+import com.yonge.cooleshow.biz.dal.service.MusicTagService;
+import com.yonge.cooleshow.biz.dal.service.SubjectService;
+import com.yonge.cooleshow.biz.dal.service.TenantAlbumCategoryDetailService;
+import com.yonge.cooleshow.biz.dal.service.TenantAlbumCategoryService;
+import com.yonge.cooleshow.biz.dal.service.TenantAlbumMusicService;
+import com.yonge.cooleshow.biz.dal.service.UserTenantAlbumRecordService;
+import com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumMusicWrapper;
 import com.yonge.toolset.base.exception.BizException;
 import jodd.util.StringUtil;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.beans.BeanUtils;
-import lombok.extern.slf4j.Slf4j;
-import com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumMusicWrapper;
-import com.yonge.cooleshow.biz.dal.mapper.TenantAlbumMusicMapper;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -64,6 +80,9 @@ public class TenantAlbumMusicServiceImpl extends ServiceImpl<TenantAlbumMusicMap
     @Autowired
     private  SysUserFeignService sysUserFeignService;
 
+    @Autowired
+    private TenantAlbumCategoryDetailService tenantAlbumCategoryDetailService;
+
     /**
      * 查询详情
      * @param id 详情ID
@@ -215,11 +234,31 @@ public class TenantAlbumMusicServiceImpl extends ServiceImpl<TenantAlbumMusicMap
         }
 
         // 类型
-        List<String> types = list.stream().map(TenantAlbumMusic::getType).distinct().filter(StringUtils::isNotBlank).collect(Collectors.toList());
-        data.setTypes(types);
+        List<Long> typeIds =list.stream().map(TenantAlbumMusic::getType).distinct().filter(StringUtils::isNotBlank)
+                .filter(NumberUtil::isNumber).map(Long::valueOf).collect(Collectors.toList());
+        if (!typeIds.isEmpty()) {
+            List<TenantAlbumCategoryDetail> typeList = tenantAlbumCategoryDetailService.lambdaQuery()
+                    .in(TenantAlbumCategoryDetail::getId, typeIds).list();
+            List<String> typeNameList = typeList.stream()
+                    .map(TenantAlbumCategoryDetail::getValue).collect(Collectors.toList());
+            data.setTypes(typeNameList);
+            data.setTypeList(typeList);
+        } else {
+            data.setTypes(new ArrayList<>());
+        }
         // 级别
-        List<String> levels = list.stream().map(TenantAlbumMusic::getLevel).distinct().filter(StringUtils::isNotBlank).collect(Collectors.toList());
-        data.setLevels(levels);
+        List<Long> levelIds =list.stream().map(TenantAlbumMusic::getLevel).distinct().filter(StringUtils::isNotBlank)
+                .filter(NumberUtil::isNumber).map(Long::valueOf).collect(Collectors.toList());
+        if (!typeIds.isEmpty()) {
+            List<TenantAlbumCategoryDetail> levelList = tenantAlbumCategoryDetailService.lambdaQuery()
+                    .in(TenantAlbumCategoryDetail::getId, levelIds).list();
+            List<String> levelNameList = levelList.stream()
+                    .map(TenantAlbumCategoryDetail::getValue).collect(Collectors.toList());
+            data.setLevels(levelNameList);
+            data.setLevelList(levelList);
+        } else {
+            data.setLevels(new ArrayList<>());
+        }
 
         // 声部
         List<Long> subjectIds = musicSheets.stream()

+ 4 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantGroupServiceImpl.java

@@ -409,10 +409,13 @@ public class TenantGroupServiceImpl extends ServiceImpl<TenantGroupMapper, Tenan
                     }
                 }
                 this.lambdaUpdate()
-                        .set(TenantGroup::getAdminId, toTeacher)
+                        .set(TenantGroup::getAdminId, null)
                         .set(TenantGroup::getImGroupId, null)
                         .eq(TenantGroup::getId, detail.getTenantGroupId())
                         .update();
+                studentDao.update(null, Wrappers.<Student>lambdaUpdate()
+                        .eq(Student::getTenantGroupId, detail.getTenantGroupId())
+                        .set(Student::getTenantGroupId, null));
             }
         }
         return true;

+ 9 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/TenantAlbumMusicWrapper.java

@@ -5,11 +5,13 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.microsvc.toolkit.common.response.paging.QueryInfo;
 import com.yonge.cooleshow.biz.dal.entity.MusicTag;
 import com.yonge.cooleshow.biz.dal.entity.Subject;
+import com.yonge.cooleshow.biz.dal.entity.TenantAlbumCategoryDetail;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.enums.SubjectTypeEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 
@@ -102,9 +104,16 @@ public class TenantAlbumMusicWrapper {
         @ApiModelProperty("级别集合")
         private List<String> levels;
 
+        @ApiModelProperty("级别集合")
+        private List<TenantAlbumCategoryDetail> levelList = new ArrayList<>();
+
         @ApiModelProperty("类型集合")
         private List<String> types;
 
+        @ApiModelProperty("类型集合")
+        private List<TenantAlbumCategoryDetail> typeList = new ArrayList<>();
+
+
         @ApiModelProperty("标签集合")
         private List<MusicTag> tags;
 

+ 21 - 2
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/StudentController.java

@@ -4,16 +4,18 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.dto.search.StudentSearch;
+import com.yonge.cooleshow.biz.dal.entity.Student;
+import com.yonge.cooleshow.biz.dal.entity.TenantGroup;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.service.ImGroupService;
 import com.yonge.cooleshow.biz.dal.service.StudentService;
+import com.yonge.cooleshow.biz.dal.service.TenantGroupService;
 import com.yonge.cooleshow.biz.dal.vo.StudentVo;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.enums.UserLockFlag;
 import com.yonge.cooleshow.common.enums.UserStatusEnum;
 import com.yonge.cooleshow.common.enums.YesOrNoEnum;
-import com.yonge.toolset.base.exception.BizException;
 import com.yonge.toolset.base.page.PageInfo;
 import com.yonge.toolset.base.util.StringUtil;
 import com.yonge.toolset.mybatis.support.PageUtil;
@@ -22,7 +24,6 @@ import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -31,7 +32,10 @@ import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 @RestController
 @RequestMapping("/student")
@@ -46,6 +50,9 @@ public class StudentController extends BaseController {
     @Autowired
     private ImGroupService imGroupService;
 
+    @Autowired
+    private TenantGroupService tenantGroupService;
+
 
     @ApiOperation(value = "查询指定学员信息-融云token")
     @GetMapping("/queryUserById")
@@ -109,6 +116,17 @@ public class StudentController extends BaseController {
         IPage<StudentVo> pages = studentService.selectPage(PageUtil.getPage(query), query);
         List<StudentVo> rows = pages.getRecords();
 
+        List<Long> tenantGroupIds = rows.stream().map(Student::getTenantGroupId)
+                .filter(next -> next != null && next != -1L).distinct().collect(Collectors.toList());
+        Map<Long, String> tenantGroupIdNameMap = new HashMap<>();
+        if (!tenantGroupIds.isEmpty()) {
+            Map<Long, String> tenantGroupMap = tenantGroupService.lambdaQuery()
+                    .eq(TenantGroup::getTenantId, tenantId)
+                    .in(TenantGroup::getId, tenantGroupIds)
+                    .list().stream().collect(Collectors.toMap(TenantGroup::getId, TenantGroup::getName));
+            tenantGroupIdNameMap.putAll(tenantGroupMap);
+        }
+
         for (StudentVo vo : rows) {
             if (vo.getDelFlag() == YesOrNoEnum.YES) {
                 vo.setUserStatus(UserStatusEnum.CLOSED);
@@ -120,6 +138,7 @@ public class StudentController extends BaseController {
                 }
             }
             vo.setImUserId(imGroupService.getImUserId(vo.getUserId(), ClientEnum.STUDENT));
+            vo.setTenantGroupName(tenantGroupIdNameMap.getOrDefault(vo.getTenantGroupId(), ""));
         }
         return succeed(PageUtil.pageInfo(pages));
     }

+ 21 - 9
cooleshow-user/user-tenant/src/main/java/com/yonge/cooleshow/tenant/controller/StudentController.java

@@ -2,30 +2,24 @@ package com.yonge.cooleshow.tenant.controller;
 
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.google.common.collect.ImmutableList;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.dto.search.StudentSearch;
-import com.yonge.cooleshow.biz.dal.dto.search.TeacherSearch;
 import com.yonge.cooleshow.biz.dal.entity.Student;
-import com.yonge.cooleshow.biz.dal.entity.Teacher;
 import com.yonge.cooleshow.biz.dal.entity.TenantActivationCode;
+import com.yonge.cooleshow.biz.dal.entity.TenantGroup;
 import com.yonge.cooleshow.biz.dal.entity.TenantInfo;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
-import com.yonge.cooleshow.biz.dal.service.ImUserFriendService;
 import com.yonge.cooleshow.biz.dal.service.OssFileService;
 import com.yonge.cooleshow.biz.dal.service.StudentService;
-import com.yonge.cooleshow.biz.dal.service.TeacherService;
 import com.yonge.cooleshow.biz.dal.service.TenantActivationCodeService;
+import com.yonge.cooleshow.biz.dal.service.TenantGroupService;
 import com.yonge.cooleshow.biz.dal.service.TenantInfoService;
 import com.yonge.cooleshow.biz.dal.vo.StudentVo;
-import com.yonge.cooleshow.biz.dal.vo.TeacherVo;
 import com.yonge.cooleshow.biz.dal.wrapper.OssFileWrapper;
 import com.yonge.cooleshow.biz.dal.wrapper.StudentWrapper;
-import com.yonge.cooleshow.biz.dal.wrapper.teacher.TeacherWrapper;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
-import com.yonge.cooleshow.common.enums.BizHttpStatus;
 import com.yonge.cooleshow.common.enums.UserLockFlag;
 import com.yonge.cooleshow.common.enums.UserStatusEnum;
 import com.yonge.cooleshow.common.enums.YesOrNoEnum;
@@ -57,7 +51,6 @@ import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -81,6 +74,9 @@ public class StudentController extends BaseController {
     @Autowired
     private OssFileService ossFileService;
 
+    @Autowired
+    private TenantGroupService tenantGroupService;
+
     @GetMapping("/detail/{id}")
     @ApiOperation(value = "详情", notes = "传入id")
     public HttpResponseResult<StudentVo> detail(@PathVariable("id") Long id) {
@@ -100,6 +96,10 @@ public class StudentController extends BaseController {
         IPage<StudentVo> pages = studentService.selectPage(PageUtil.getPage(query), query);
         List<StudentVo> rows = pages.getRecords();
 
+        if (rows.isEmpty()) {
+            return succeed(PageUtil.pageInfo(pages));
+        }
+
         //如果真实姓名字段为空 把真实姓名赋值给昵称
         rows.stream().forEach(r->{
             if (StringUtils.isEmpty(r.getRealName())){
@@ -118,6 +118,17 @@ public class StudentController extends BaseController {
                     .in(TenantActivationCode::getActivationPhone, studentPhones)
                     .list().stream().collect(Collectors.groupingBy(TenantActivationCode::getActivationPhone));
         }
+        List<Long> tenantGroupIds = rows.stream().map(Student::getTenantGroupId)
+                .filter(next -> next != null && next != -1L).distinct().collect(Collectors.toList());
+        Map<Long, String> tenantGroupIdNameMap = new HashMap<>();
+        if(!tenantGroupIds.isEmpty()){
+            Map<Long, String> tenantGroupMap = tenantGroupService.lambdaQuery()
+                    .eq(TenantGroup::getTenantId, tenantInfo.getId())
+                    .in(TenantGroup::getId, tenantGroupIds)
+                    .list().stream().collect(Collectors.toMap(TenantGroup::getId, TenantGroup::getName));
+            tenantGroupIdNameMap.putAll(tenantGroupMap);
+        }
+
 
         for (StudentVo vo : rows) {
             vo.setSendActiveCodeNum(groupByPhone.getOrDefault(vo.getPhone(), new ArrayList<>()).size());
@@ -133,6 +144,7 @@ public class StudentController extends BaseController {
                     vo.setUserStatus(UserStatusEnum.NORMAL);
                 }
             }
+            vo.setTenantGroupName(tenantGroupIdNameMap.getOrDefault(vo.getTenantGroupId(), ""));
         }
         return succeed(PageUtil.pageInfo(pages));
     }