mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-06-21 19:32:41 +08:00
update
This commit is contained in:
parent
c8182447ba
commit
c6edf48fb0
@ -3,7 +3,6 @@ package xyz.playedu.api.listener;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.core.annotation.Order;
|
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import xyz.playedu.api.constant.BackendLogConstant;
|
import xyz.playedu.api.constant.BackendLogConstant;
|
||||||
@ -26,7 +25,6 @@ public class AdminUserLoginListener {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private AdminLogService adminLogService;
|
private AdminLogService adminLogService;
|
||||||
|
|
||||||
@Order(1)
|
|
||||||
@EventListener
|
@EventListener
|
||||||
public void updateLoginInfo(AdminUserLoginEvent event) {
|
public void updateLoginInfo(AdminUserLoginEvent event) {
|
||||||
AdminUser adminUser = new AdminUser();
|
AdminUser adminUser = new AdminUser();
|
||||||
@ -39,9 +37,8 @@ public class AdminUserLoginListener {
|
|||||||
adminUserService.updateById(adminUser);
|
adminUserService.updateById(adminUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Order(10)
|
|
||||||
@EventListener
|
|
||||||
@Async
|
@Async
|
||||||
|
@EventListener
|
||||||
public void log(AdminUserLoginEvent event) {
|
public void log(AdminUserLoginEvent event) {
|
||||||
String area = IpUtil.getRealAddressByIP(event.getIp());
|
String area = IpUtil.getRealAddressByIP(event.getIp());
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ public class UserCourseHourFinishedListener {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CourseHourService hourService;
|
private CourseHourService hourService;
|
||||||
|
|
||||||
@EventListener
|
|
||||||
@Async
|
@Async
|
||||||
|
@EventListener
|
||||||
public void userCourseProgressUpdate(UserCourseHourFinishedEvent evt) {
|
public void userCourseProgressUpdate(UserCourseHourFinishedEvent evt) {
|
||||||
Integer hourCount = hourService.getCountByCourseId(evt.getCourseId());
|
Integer hourCount = hourService.getCountByCourseId(evt.getCourseId());
|
||||||
Integer finishedCount = userCourseHourRecordService.getFinishedHourCount(evt.getUserId(), evt.getCourseId());
|
Integer finishedCount = userCourseHourRecordService.getFinishedHourCount(evt.getUserId(), evt.getCourseId());
|
||||||
|
@ -19,7 +19,6 @@ public class UserDestroyListener {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
@Order(1)
|
|
||||||
@EventListener
|
@EventListener
|
||||||
public void updateLoginInfo(UserDestroyEvent event) {
|
public void updateLoginInfo(UserDestroyEvent event) {
|
||||||
userService.removeRelateDepartmentsByUserId(event.getUserId());
|
userService.removeRelateDepartmentsByUserId(event.getUserId());
|
||||||
|
@ -27,8 +27,8 @@ public class UserLoginListener {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private JWTService jwtService;
|
private JWTService jwtService;
|
||||||
|
|
||||||
@EventListener
|
|
||||||
@Async
|
@Async
|
||||||
|
@EventListener
|
||||||
public void updateLoginInfo(UserLoginEvent event) throws JwtLogoutException {
|
public void updateLoginInfo(UserLoginEvent event) throws JwtLogoutException {
|
||||||
String ipArea = IpUtil.getRealAddressByIP(event.getIp());
|
String ipArea = IpUtil.getRealAddressByIP(event.getIp());
|
||||||
JWTPayload payload = jwtService.parse(event.getToken(), SystemConstant.JWT_PRV_USER);
|
JWTPayload payload = jwtService.parse(event.getToken(), SystemConstant.JWT_PRV_USER);
|
||||||
|
@ -19,8 +19,8 @@ public class UserLogoutListener {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private UserLoginRecordService userLoginRecordService;
|
private UserLoginRecordService userLoginRecordService;
|
||||||
|
|
||||||
@EventListener
|
|
||||||
@Async
|
@Async
|
||||||
|
@EventListener
|
||||||
public void updateLoginRecord(UserLogoutEvent event) {
|
public void updateLoginRecord(UserLogoutEvent event) {
|
||||||
userLoginRecordService.logout(event.getUserId(), event.getJti());
|
userLoginRecordService.logout(event.getUserId(), event.getJti());
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package xyz.playedu.api.service.impl;
|
package xyz.playedu.api.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import xyz.playedu.api.domain.UserCourseHourRecord;
|
import xyz.playedu.api.domain.UserCourseHourRecord;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user