This commit is contained in:
Paidax
2025-09-25 16:45:16 +08:00
parent cdf4341397
commit 2ffbddad58
16 changed files with 189 additions and 42 deletions
@@ -1,13 +0,0 @@
package com.budwk.app.base.event.user;
import org.nutz.ioc.loader.annotation.IocBean;
@IocBean
public class Test2SysUserEventListener implements SysUserEventListener{
@Override
public void onEvent(SysUserEvent event) {
System.out.println("-----------------------------------");
System.out.println(event);
}
}
@@ -1,13 +0,0 @@
package com.budwk.app.base.event.user;
import org.nutz.ioc.loader.annotation.IocBean;
@IocBean
public class TestSysUserEventListener implements SysUserEventListener{
@Override
public void onEvent(SysUserEvent event) {
System.out.println("-----------------------------------");
System.out.println(event);
}
}
@@ -0,0 +1,13 @@
package com.budwk.app.base.event.user;
/**
* @version 1.0
* @Author zzr
* @nameUserChangeEventListener
* @Date 2025/8/13 14:18
* @注释
*/
public interface UserChangeEventListener {
void receive(UserChangeMsg message);
}
@@ -0,0 +1,70 @@
package com.budwk.app.base.event.user;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @version 1.0
* @Author zzr
* @nameUserChangeMsg
* @Date 2025/8/13 11:51
* @注释
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserChangeMsg {
/**
* 变更资源,用户Id
*/
private List<String> userIds;
/**
* 操作类型
*/
private Integer operationType;
/**
* 变更前的单位Id,当operationType值为1时,该字段有效
*/
private String sourceUnitId;
/**
* 变更后的单位Id,当operationType值为1时,该字段有效
*/
private String targetUnitId;
/**
* 单位变动
*/
public final static int UNIT_CHANGE_OPERATION = 1;
/**
* 退休
*/
public final static int RETIRE_OPERATION = 2;
/**
* 入会
*/
public final static int RESTORE_OPERATION = 3;
public UserChangeMsg(List<String> userIds, Integer operationType) {
super();
this.userIds = userIds;
this.operationType = operationType;
}
public UserChangeMsg(List<String> userIds, Integer operationType, String sourceUnitId) {
super();
this.userIds = userIds;
this.operationType = operationType;
this.sourceUnitId = sourceUnitId;
}
}
@@ -0,0 +1,25 @@
package com.budwk.app.base.event.user;
import io.v.nutz.base.utils.AppIocUtil;
import org.nutz.ioc.Ioc;
/**
* @version 1.0
* @Author zzr
* @nameUserChangePublisher
* @Date 2025/8/13 14:23
* @注释
*/
public class UserChangePublisher {
// 发送消息给所有订阅者
public static void broadcast(UserChangeMsg msg) {
Ioc ioc = AppIocUtil.get();
String[] names = ioc.getNamesByType(UserChangeEventListener.class);
for (String listener : names) {
UserChangeEventListener listenerBean = ioc.get(UserChangeEventListener.class, listener);
listenerBean.receive(msg);
}
}
}
@@ -0,0 +1,27 @@
package com.budwk.app.base.utils;
import org.nutz.ioc.Ioc;
/**
* @version 1.0
* @Author zzr
* @nameAppIocUtil
* @Date 2025/8/26 17:40
* @注释
*/
public class AppIocUtil {
private static Ioc ioc;
public static void setIoc(Ioc ioc) {
AppIocUtil.ioc = ioc;
}
public static Ioc get() {
if (ioc == null) {
throw new IllegalStateException("Ioc not initialized yet!");
}
return ioc;
}
}
@@ -292,7 +292,7 @@ public class SysUnitController {
for (int i = 0; i < list.size(); i++) {
nodeList.add(new TreeNode<>(list.get(i).getId(), list.get(i).getParentId(), list.get(i).getName(), i));
}
List<Tree<String>> treeList = TreeUtil.build(nodeList, StrUtil.blankToDefault(pid, "1"));
List<Tree<String>> treeList = TreeUtil.build(nodeList, StrUtil.blankToDefault(pid, "0000"));
// NutMap menuMap = NutMap.NEW();
// for (Sys_unit unit : list) {
@@ -92,7 +92,7 @@ public class MemberChangeApplyController {
// 开启流程实例
Dict args = Dict.create();
args.set("origin", "personType");
args.set("origin", "person");
args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode());
args.set(FlowConst.FORM_DATA, memberChangeRecord);
ProcessInstance instance = flowEngine.startProcessInstanceByKey("HYBG", memberChangeRecord.getId(), SecurityUtil.getUserId(), args);
@@ -120,7 +120,7 @@ public class MemberBatchMakeController {
}
dao.update(Sys_user.class, Chain.make("member", true)
.addSpecial("memberTime", DateUtil.now()),
.add("memberTime", DateUtil.now()),
Cnd.where("id", "in", userIds));
// 添加会员角色