xiangpei
2024-05-31 c9d04bc519b73f7fc4841c34e2f15fca9db7aad2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.ycl.jxkg.listener;
 
import com.ycl.jxkg.event.UserEvent;
import com.ycl.jxkg.service.UserEventLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
 
/**
 * @version 3.5.0
 * @description: The type User log listener.
 * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
 * @date 2021/12/25 9:45
 */
@Component
public class UserLogListener implements ApplicationListener<UserEvent> {
 
    private final UserEventLogService userEventLogService;
 
    /**
     * Instantiates a new User log listener.
     *
     * @param userEventLogService the user event log service
     */
    @Autowired
    public UserLogListener(UserEventLogService userEventLogService) {
        this.userEventLogService = userEventLogService;
    }
 
    @Override
    public void onApplicationEvent(UserEvent userEvent) {
        userEventLogService.save(userEvent.getUserEventLog());
    }
 
}