feat: 归档L03与L09审批发布能力

- 新增统一审批中心与审批管理页面,支持流程配置、审批详情与角色/用户审批对象

- 接入聊天助手、知识库、工作流的发布与删除审批,并补齐发布态校验与快照展示
This commit is contained in:
2026-04-07 14:41:52 +08:00
parent 7e7c236c2a
commit 3f128e977a
138 changed files with 13035 additions and 346 deletions

View File

@@ -7,6 +7,7 @@ import jakarta.validation.constraints.NotBlank;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import tech.easyflow.approval.annotation.RequirePublishedAccess;
import tech.easyflow.ai.entity.Bot;
import tech.easyflow.ai.entity.ChatRequestParams;
import tech.easyflow.ai.service.BotService;
@@ -37,8 +38,9 @@ public class PublicBotController {
* 根据id或别名获取bot详情
*/
@GetMapping("/getByIdOrAlias")
@RequirePublishedAccess(resourceType = "BOT", idExpr = "#key", denyMessage = "聊天助手尚未发布")
public Result<Bot> getByIdOrAlias(@NotBlank(message = "key不能为空") String key) {
return Result.ok(botService.getDetail(key));
return Result.ok(botService.getPublishedDetail(key));
}
/**
@@ -47,6 +49,7 @@ public class PublicBotController {
* @return 返回SseEmitter对象用于服务器向客户端推送聊天响应数据
*/
@PostMapping("chat")
@RequirePublishedAccess(resourceType = "BOT", idExpr = "#chatRequestParams.botId", denyMessage = "聊天助手尚未发布")
public SseEmitter chat(@RequestBody ChatRequestParams chatRequestParams, HttpServletRequest request) {
String apikey = request.getHeader(SysApiKey.KEY_Apikey);
String requestURI = request.getRequestURI();

View File

@@ -8,6 +8,8 @@ import com.easyagents.flow.core.parser.ChainParser;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotBlank;
import org.springframework.web.bind.annotation.*;
import tech.easyflow.approval.annotation.RequirePublishedAccess;
import tech.easyflow.ai.easyagentsflow.support.PublishedWorkflowDefinitionIds;
import tech.easyflow.ai.easyagentsflow.entity.ChainInfo;
import tech.easyflow.ai.easyagentsflow.entity.NodeInfo;
import tech.easyflow.ai.easyagentsflow.entity.WorkflowCheckStage;
@@ -51,10 +53,11 @@ public class PublicWorkflowController {
* @return 工作流详情
*/
@GetMapping(value = "/getByIdOrAlias")
@RequirePublishedAccess(resourceType = "WORKFLOW", idExpr = "#key", denyMessage = "工作流尚未发布")
public Result<Workflow> getByIdOrAlias(
@RequestParam
@NotBlank(message = "key不能为空") String key) {
Workflow workflow = workflowService.getDetail(key);
Workflow workflow = workflowService.getPublishedDetail(key);
return Result.ok(workflow);
}
@@ -81,17 +84,18 @@ public class PublicWorkflowController {
*/
@PostMapping("/runAsync")
@SaCheckPermission("/api/v1/workflow/save")
@RequirePublishedAccess(resourceType = "WORKFLOW", idExpr = "#id", denyMessage = "工作流尚未发布")
public Result<String> runAsync(@JsonBody(value = "id", required = true) BigInteger id,
@JsonBody("variables") Map<String, Object> variables) {
if (variables == null) {
variables = new HashMap<>();
}
Workflow workflow = workflowService.getById(id);
Workflow workflow = workflowService.getPublishedById(id);
if (workflow == null) {
throw new RuntimeException("工作流不存在");
}
workflowCheckService.checkOrThrow(workflow.getContent(), WorkflowCheckStage.PRE_EXECUTE, workflow.getId());
String executeId = chainExecutor.executeAsync(id.toString(), variables);
String executeId = chainExecutor.executeAsync(PublishedWorkflowDefinitionIds.published(id.toString()), variables);
return Result.ok(executeId);
}
@@ -118,8 +122,9 @@ public class PublicWorkflowController {
@GetMapping("getRunningParameters")
@SaCheckPermission("/api/v1/workflow/query")
@RequirePublishedAccess(resourceType = "WORKFLOW", idExpr = "#id", denyMessage = "工作流尚未发布")
public Result<?> getRunningParameters(@RequestParam BigInteger id) {
Workflow workflow = workflowService.getById(id);
Workflow workflow = workflowService.getPublishedById(id);
if (workflow == null) {
return Result.fail(1, "can not find the workflow by id: " + id);