package com.sptg.estate.biz.event;

import com.sptg.estate.biz.service.ApplyUserInterface;
import lombok.AllArgsConstructor;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@AllArgsConstructor
public class ApplyUserAddListener implements ApplicationListener<ApplyUserAddEvent> {

    private final ApplyUserInterface applyUserInterface;

    @Override
    @Async  //异步
    public void onApplicationEvent(ApplyUserAddEvent event) {
        System.out.println(Thread.currentThread() + "...监听到用户认证申请记录..." + event.getApplyUserList().toString() + "......" + event.getSource());
        this.applyUserInterface.addApplyUsers(event.getApplyUserList());
    }
}
