@Override
  public StudentDTO queryStudentForAPP(String userId, String schoolId) {
    UserDTO mUsers = userService.getByUserId(userId);
    if (mUsers == null) {
      logger.debug("未找到学乐号为" + userId + "的学生用户");
      return null;
    }

    MStudent mStudent = studentMapper.selectByPrimaryKey(userId, schoolId);
    if (mStudent == null) {
      logger.debug("未找到学生id为" + userId + "的学生");
      throw new MemberException("未找到学生id为" + userId + "的学生");
    }
    // 学生信息
    StudentDTO studentDTO = new StudentDTO();
    studentDTO.setUserId(userId);
    studentDTO.setRealName(mUsers.getRealName());
    studentDTO.setSchoolId(mStudent.getSchoolId());
    studentDTO.setSchoolName(mStudent.getSchoolName());
    studentDTO.setClassId(mStudent.getClassId());
    studentDTO.setClassName(mStudent.getClassName());
    studentDTO.setMobile(mUsers.getMobile());
    studentDTO.setEmail(mUsers.getEmail());

    // 学校所在区域信息
    MSchool mSchool = mSchoolMapper.selectByPrimaryKey(mUsers.getSchoolId());
    if (mSchool == null) {
      logger.debug("未找到学乐号为" + userId + "的学生用户所在的学校");
      return null;
    }
    studentDTO.setAreaCode(mSchool.getArea());
    studentDTO.setAreaName(mSchool.getAreaName());

    // 班级信息
    MClass mClass = classMapper.selectByPrimaryKey(mStudent.getClassId(), schoolId);
    if (mClass == null) {
      logger.debug("未找到学乐号为" + userId + "的学生用户所在的班级");
      return null;
    }
    studentDTO.setGradeNum(getGradeNum(mClass.getYears()));
    studentDTO.setYear(mClass.getYears());
    return studentDTO;
  }
 /** 修改学生信息 */
 @Override
 public StudentManagerDTO updateStudentInfo(String userId, String realName, String classId) {
   String schoolId = userService.getSchoolId(userId);
   // 更换用户名称
   usersMapper.updateUserName(userId, realName, schoolId);
   // 更换班级
   MClass mClass = classMapper.selectByPrimaryKey(classId, schoolId);
   studentMapper.updateStudentMessage(userId, mClass);
   // 修改家庭关系表中用户名称
   familyRelationService.updateName(userId, realName);
   MStudentManager studentManager = studentMapper.selectStudentByUserId(userId, schoolId);
   StudentManagerDTO studentManagerDTO = new StudentManagerDTO();
   BeanUtils.copyProperties(studentManager, studentManagerDTO);
   studentManagerDTO.setClassAliasName(
       getGrade(mClass.getYears()) + studentManagerDTO.getClassAliasName());
   // 修改孩子名称,班级信息,删除缓存数据
   deleteRedisOfParent(userId, schoolId);
   cacheService.delete(MessageFormat.format(CacheConstants.KEY_USER, userId));
   return studentManagerDTO;
 }