2026-06-30 24681c81c09022f584a57006f2534b5f74723414
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
package cn.iocoder.yudao.module.system.mq.producer.user;
 
import cn.iocoder.yudao.module.system.api.message.user.AdminUserProfileUpdateMessage;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
 
/**
 * 管理员用户 Producer
 *
 * @author 芋道源码
 */
@Slf4j
@Component
public class AdminUserProducer {
 
    @Resource
    private ApplicationContext applicationContext;
 
    /**
     * 发送 {@link AdminUserProfileUpdateMessage} 消息
     *
     * @param userId   用户编号
     * @param nickname 变更后的昵称(无变更传 null)
     * @param avatar   变更后的头像(无变更传 null)
     */
    public void sendUserProfileUpdateMessage(Long userId, String nickname, String avatar) {
        applicationContext.publishEvent(new AdminUserProfileUpdateMessage()
                .setUserId(userId).setNickname(nickname).setAvatar(avatar));
    }
 
}