commit
This commit is contained in:
+67
@@ -0,0 +1,67 @@
|
||||
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.sys.services.SysRoleService;
|
||||
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 FlowCommonDelegationByArgsAssignmentHandler
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/9/13 11:13
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
public class FlowGeneralDelegationByArgsAssignmentHandler implements AssignmentHandler {
|
||||
|
||||
@Override
|
||||
public List<String> assign(TaskModel model, Execution execution) {
|
||||
String sessionId = execution.getArgs().getStr("sessionId");
|
||||
String delegationId = execution.getArgs().getStr("delegationId");
|
||||
|
||||
if (StrUtil.isBlank(sessionId)) {
|
||||
throw new BaseException("参数 sessionId 不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(delegationId)) {
|
||||
throw new BaseException("参数 delegationId 不能为空");
|
||||
}
|
||||
|
||||
SysRoleService sysRoleService = ServiceContext.find(SysRoleService.class);
|
||||
Sys_role role = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_DELEGATION_HEAD);
|
||||
|
||||
List<Sys_user_role> roles = ServiceContext.find(Dao.class).query(
|
||||
Sys_user_role.class,
|
||||
Cnd.where(Sys_user_role::getRoleId, "=", role.getId())
|
||||
.and(Sys_user_role::getTcDelegationId, "=", delegationId)
|
||||
.and(Sys_user_role::getTcSessionId, "=", sessionId)
|
||||
);
|
||||
|
||||
if (Lang.isEmpty(roles)) {
|
||||
throw new RuntimeException("您所在的代表团没有设置团长,无法流转到下一步,请联系校工会进行设置。");
|
||||
}
|
||||
return roles.stream().map(Sys_user_role::getUserId).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "获取代表团团长(通用版本,根据args中的sessionId和delegationId)";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return AssignmentHandler.super.getOrder();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user