|  | @@ -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.getTenantId(), ""));
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return succeed(PageUtil.pageInfo(pages));
 | 
	
		
			
				|  |  |      }
 |