This commit is contained in:
Paidax
2025-09-04 09:14:02 +08:00
parent 43fd3c07fd
commit 558885d624
24 changed files with 408 additions and 118 deletions
@@ -0,0 +1,13 @@
package com.budwk.app.base.event.role;
/**
* @version 1.0
* @Author zzr
* @nameRoleEventListener
* @Date 2025/9/3 17:13
* @注释
*/
public interface RoleEventListener {
void receive(RoleEventMsg message);
}
@@ -0,0 +1,67 @@
package com.budwk.app.base.event.role;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @version 1.0
* @Author zzr
* @nameRoleEventMsg
* @Date 2025/9/3 17:14
* @注释
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class RoleEventMsg {
/**
* 用户id
*/
private List<String> userIds;
/**
* 角色code
*/
private String roleCode;
/**
* 单位id
*/
private String unitId;
/**
* 操作类型
*/
private Integer operationType;
/**
* 添加角色
*/
public static final int ADD_ROLE = 1;
/**
* 删除角色
*/
public static final int REMOVE_ROLE = 2;
/**
* 更新角色
*/
public static final int RENEW_ROLE = 3;
public RoleEventMsg(String unitId, String roleCode, Integer operationType){
this.unitId = unitId;
this.operationType = operationType;
}
public RoleEventMsg(List<String> userIds, String roleCode, Integer operationType){
this.userIds = userIds;
this.roleCode = roleCode;
this.operationType = operationType;
}
}
@@ -0,0 +1,21 @@
package com.budwk.app.base.event.role;
import org.nutz.mvc.Mvcs;
/**
* @version 1.0
* @Author zzr
* @nameRoleEventPublisher
* @Date 2025/9/3 17:14
* @注释
*/
public class RoleEventPublisher {
public static void broadcast(RoleEventMsg event){
String[] names = Mvcs.getIoc().getNamesByType(RoleEventListener.class);
for (String name : names) {
RoleEventListener listener = Mvcs.getIoc().get(RoleEventListener.class, name);
listener.receive(event);
}
}
}