Spring Boot 流程引擎服务:流程定义/实例/任务、审批人解析、 回调分发、oapi 接口及单元测试。 保留远程 .gitea/workflows/build.yml 与 docker/Dockerfile, 新增 .gitignore 排除 target/ 构建产物。
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
package com.yunhai.flowcenter.controller.oapi;
|
||||
|
||||
import com.yunhai.flowcenter.model.OapiModels;
|
||||
import com.yunhai.flowcenter.service.OapiFlowService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 托管接入件(/oapi/flow/**,appKey 签名强制,V2.0 Part D #5 前置 M1)。
|
||||
* 出入参逐字对齐 svc-hall FlowCenterClient(《流程中心M1开工说明.md》§5 契约锚点):
|
||||
* - GET /oapi/flow/list?schId= → data=[{flowGuid,name,version,nodeSummary}]
|
||||
* - GET /oapi/flow/{flowGuid}?schId= → data={flowGuid,name,version,nodeSummary}
|
||||
* - POST /oapi/flow/apply → data={instanceId,duplicated}
|
||||
* - GET /oapi/flow/instance?bizType=&bizId=&schId= → data={status,version,instanceId,nodeSummary,traceJson,…}
|
||||
* - POST /oapi/flow/callback/reg?schId= → data={secret}
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/oapi/flow")
|
||||
@RequiredArgsConstructor
|
||||
public class OapiFlowController {
|
||||
|
||||
private final OapiFlowService flowService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public List<OapiModels.FlowSummaryVo> list(@RequestParam("schId") Long schId) {
|
||||
return flowService.listFlows(schId);
|
||||
}
|
||||
|
||||
@GetMapping("/{flowGuid}")
|
||||
public OapiModels.FlowSummaryVo getFlow(@PathVariable("flowGuid") String flowGuid,
|
||||
@RequestParam("schId") Long schId) {
|
||||
return flowService.getFlow(schId, flowGuid);
|
||||
}
|
||||
|
||||
@PostMapping("/apply")
|
||||
public OapiModels.ApplyResultVo apply(@RequestParam("schId") Long schId,
|
||||
@RequestBody OapiModels.ApplyBody body) {
|
||||
return flowService.apply(schId, body);
|
||||
}
|
||||
|
||||
@GetMapping("/instance")
|
||||
public OapiModels.InstanceVo instance(@RequestParam("bizType") String bizType,
|
||||
@RequestParam("bizId") String bizId,
|
||||
@RequestParam("schId") Long schId) {
|
||||
return flowService.instanceByBiz(schId, bizType, bizId);
|
||||
}
|
||||
|
||||
@PostMapping("/callback/reg")
|
||||
public OapiModels.CallbackRegResultVo registerCallback(
|
||||
@RequestParam("schId") Long schId,
|
||||
@RequestAttribute(value = "yh.app.auth", required = false) String appKey,
|
||||
@RequestBody OapiModels.CallbackRegBody body) {
|
||||
return flowService.registerCallback(schId, appKey, body);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user