commit
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package com.budwk.app.flow.handler;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.flow.engine.AssignmentHandler;
|
||||
import com.budwk.app.flow.engine.core.Execution;
|
||||
import com.budwk.app.flow.engine.core.ServiceContext;
|
||||
import com.budwk.app.flow.engine.model.TaskModel;
|
||||
import com.budwk.app.sys.models.Sys_role;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.sys.models.Sys_user_role;
|
||||
import com.budwk.app.web.controllers.open.commons.service.CommonService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.lang.Lang;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName FlowRoleHandler
|
||||
* @Author JyuHsin
|
||||
* @Date 2026/1/15 15:56
|
||||
* @Version 1.0
|
||||
* @Description 根据传入的角色获取审核人
|
||||
*/
|
||||
public class FlowRoleHandler implements AssignmentHandler {
|
||||
@Override
|
||||
public List<String> assign(TaskModel model, Execution execution) {
|
||||
String roleCode = execution.getArgs().getStr("roleCode");
|
||||
|
||||
if (StrUtil.isBlank(roleCode)) {
|
||||
throw new BaseException("参数 roleCode 不能为空");
|
||||
}
|
||||
|
||||
CommonService commonService = ServiceContext.find(CommonService.class);
|
||||
List<Sys_user> users = commonService.findUserInfoByRoleCode(roleCode);
|
||||
|
||||
if(Lang.isEmpty(users)) {
|
||||
throw new BaseException("未查询到相关审批人");
|
||||
}
|
||||
|
||||
return users.stream().map(Sys_user::getId).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "根据传入的角色获取审核人(通用版本,根据args中的roleCode)";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return AssignmentHandler.super.getOrder();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user