@ -2,7 +2,9 @@ package com.ibeetl.jlw.service.api.student;
import cn.hutool.core.bean.BeanUtil ;
import cn.hutool.core.bean.BeanUtil ;
import cn.hutool.core.lang.Assert ;
import cn.hutool.core.lang.Assert ;
import cn.hutool.core.util.ObjectUtil ;
import com.ibeetl.admin.core.conf.PasswordConfig ;
import com.ibeetl.admin.core.conf.PasswordConfig ;
import com.ibeetl.admin.core.entity.CoreUser ;
import com.ibeetl.admin.core.service.CoreUserService ;
import com.ibeetl.admin.core.service.CoreUserService ;
import com.ibeetl.jlw.dao.StudentDao ;
import com.ibeetl.jlw.dao.StudentDao ;
import com.ibeetl.jlw.dao.TeacherOpenCourseMergeStudentDao ;
import com.ibeetl.jlw.dao.TeacherOpenCourseMergeStudentDao ;
@ -10,12 +12,10 @@ import com.ibeetl.jlw.entity.*;
import com.ibeetl.jlw.entity.api.CurrentUserInfo ;
import com.ibeetl.jlw.entity.api.CurrentUserInfo ;
import com.ibeetl.jlw.entity.api.student.StudentActiveInfo ;
import com.ibeetl.jlw.entity.api.student.StudentActiveInfo ;
import com.ibeetl.jlw.entity.api.student.StudentIndexData ;
import com.ibeetl.jlw.entity.api.student.StudentIndexData ;
import com.ibeetl.jlw.entity.api.student.StudentUserCenterData ;
import com.ibeetl.jlw.entity.dto.StudentEditPasswordDTO ;
import com.ibeetl.jlw.entity.dto.StudentEditPasswordDTO ;
import com.ibeetl.jlw.entity.dto.StudentRegisterDTO ;
import com.ibeetl.jlw.entity.dto.StudentRegisterDTO ;
import com.ibeetl.jlw.service.ResourcesApplicationService ;
import com.ibeetl.jlw.service.* ;
import com.ibeetl.jlw.service.StudentService ;
import com.ibeetl.jlw.service.TeacherOpenCourseNoticeService ;
import com.ibeetl.jlw.service.UniversitiesCollegesService ;
import com.ibeetl.jlw.service.api.ApiIndexBaseService ;
import com.ibeetl.jlw.service.api.ApiIndexBaseService ;
import com.ibeetl.jlw.web.query.TeacherOpenCourseMergeStudentQuery ;
import com.ibeetl.jlw.web.query.TeacherOpenCourseMergeStudentQuery ;
import com.ibeetl.jlw.web.query.TeacherOpenCourseNoticeQuery ;
import com.ibeetl.jlw.web.query.TeacherOpenCourseNoticeQuery ;
@ -30,6 +30,7 @@ import java.util.List;
import java.util.Map ;
import java.util.Map ;
import static cn.jlw.util.CacheUserUtil.getStudent ;
import static cn.jlw.util.CacheUserUtil.getStudent ;
import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser ;
/ * *
/ * *
* < p >
* < p >
@ -53,6 +54,8 @@ public class ApiStudentService {
@Autowired private UniversitiesCollegesService universitiesCollegesService ;
@Autowired private UniversitiesCollegesService universitiesCollegesService ;
@Autowired private PasswordConfig . PasswordEncryptService passwordEncryptService ;
@Autowired private PasswordConfig . PasswordEncryptService passwordEncryptService ;
@Autowired private CoreUserService coreUserService ;
@Autowired private CoreUserService coreUserService ;
@Autowired
private SysLogService sysLogService ;
/ * *
/ * *
* 教 师 端 - 首 页 数 据
* 教 师 端 - 首 页 数 据
@ -220,4 +223,29 @@ public class ApiStudentService {
Assert . notNull ( student , "该接口只能学生查看!" ) ;
Assert . notNull ( student , "该接口只能学生查看!" ) ;
return studentDao . studentActiveInfo ( student . getStudentId ( ) ) ;
return studentDao . studentActiveInfo ( student . getStudentId ( ) ) ;
}
}
public StudentUserCenterData userCenter ( ) {
CoreUser user = getUser ( ) ;
Assert . isTrue ( user . isStudent ( ) , "该接口只能学生访问!" ) ;
Long userId = user . getId ( ) ;
List < StudentExtendSchoolInfo > extendStudentList = studentDao . getStudentExtendSchoolInfoListByUserIds ( userId . toString ( ) ) ;
StudentExtendSchoolInfo studentExtendSchoolInfo = null ;
if ( ObjectUtil . isNotEmpty ( extendStudentList ) ) {
studentExtendSchoolInfo = extendStudentList . get ( 0 ) ;
}
CoreUser coreUser = coreUserService . getUserById ( userId ) ;
// 设置登录时间和最后登录时间
sysLogService . setLoginLogInfo ( userId , coreUser ) ;
// 活跃度
StudentActiveInfo studentActiveInfo = studentActiveInfo ( ) ;
return StudentUserCenterData . builder ( ) . userInfo ( coreUser )
. studentInfo ( studentExtendSchoolInfo ) . activeInfo ( studentActiveInfo )
. build ( ) ;
}
}
}