feat: 收敛AI资源发布审批生命周期
- 统一工作流、知识库、聊天助手的发布、重新发布、下线与删除链路 - 收敛审批编排、生命周期状态机与展示态,补齐审批管理和快照预览 - 调整审批管理权限模型为单入口页面加内部按钮权限
This commit is contained in:
@@ -11,11 +11,15 @@ import org.springframework.expression.ExpressionParser;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.stereotype.Component;
|
||||
import tech.easyflow.approval.annotation.ApprovalAction;
|
||||
import tech.easyflow.approval.entity.vo.ApprovalSubmitRequest;
|
||||
import tech.easyflow.approval.entity.vo.ApprovalActionResult;
|
||||
import tech.easyflow.approval.service.ApprovalSubjectHandler;
|
||||
import tech.easyflow.approval.service.ApprovalActionFacade;
|
||||
import tech.easyflow.common.satoken.util.SaTokenUtil;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 提审动作切面。
|
||||
@@ -25,11 +29,14 @@ import java.math.BigInteger;
|
||||
public class ApprovalActionAspect {
|
||||
|
||||
private final ApprovalActionFacade approvalActionFacade;
|
||||
private final List<ApprovalSubjectHandler> handlers;
|
||||
private final ExpressionParser expressionParser = new SpelExpressionParser();
|
||||
private final ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer();
|
||||
|
||||
public ApprovalActionAspect(ApprovalActionFacade approvalActionFacade) {
|
||||
public ApprovalActionAspect(ApprovalActionFacade approvalActionFacade,
|
||||
List<ApprovalSubjectHandler> handlers) {
|
||||
this.approvalActionFacade = approvalActionFacade;
|
||||
this.handlers = handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,7 +44,7 @@ public class ApprovalActionAspect {
|
||||
*
|
||||
* @param joinPoint 切点
|
||||
* @param approvalAction 注解
|
||||
* @return 审批实例 ID
|
||||
* @return 动作执行结果
|
||||
* @throws Throwable 执行异常
|
||||
*/
|
||||
@Around("@annotation(approvalAction)")
|
||||
@@ -45,12 +52,14 @@ public class ApprovalActionAspect {
|
||||
Object identifier = resolveIdentifier(joinPoint, approvalAction.idExpr());
|
||||
BigInteger resourceId = identifier == null ? null : new BigInteger(String.valueOf(identifier));
|
||||
joinPoint.proceed();
|
||||
return approvalActionFacade.submit(
|
||||
approvalAction.resourceType(),
|
||||
ApprovalSubjectHandler handler = getHandler(approvalAction.resourceType());
|
||||
ApprovalSubmitRequest request = handler.buildSubmitRequest(
|
||||
resourceId,
|
||||
approvalAction.actionType(),
|
||||
SaTokenUtil.getLoginAccount().getId()
|
||||
);
|
||||
ApprovalActionResult result = approvalActionFacade.submit(request);
|
||||
return result;
|
||||
}
|
||||
|
||||
private Object resolveIdentifier(ProceedingJoinPoint joinPoint, String idExpr) {
|
||||
@@ -63,4 +72,11 @@ public class ApprovalActionAspect {
|
||||
);
|
||||
return expressionParser.parseExpression(idExpr).getValue(context);
|
||||
}
|
||||
|
||||
private ApprovalSubjectHandler getHandler(String resourceType) {
|
||||
return handlers.stream()
|
||||
.filter(item -> item.resourceType().equals(resourceType))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new IllegalStateException("未找到审批处理器: " + resourceType));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user