|
|
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+import space.anyi.client.OpenAPIClient;
|
|
|
import space.anyi.openAPI.model.PageVO;
|
|
|
import space.anyi.openAPI.model.ResponseResult;
|
|
|
import space.anyi.openAPI.model.commom.RequestID;
|
|
|
@@ -14,13 +15,14 @@ import space.anyi.openAPI.model.interfaceInfo.dto.RequestAddInterfaceInfo;
|
|
|
import space.anyi.openAPI.model.interfaceInfo.dto.RequestPageInterfaceInfo;
|
|
|
import space.anyi.openAPI.model.interfaceInfo.dto.RequestUpdateInterfaceInfo;
|
|
|
import space.anyi.openAPI.model.interfaceInfo.vo.InterfaceInfoVO;
|
|
|
+import space.anyi.openAPI.model.interfaceParam.dto.RequestOnlineDebugParam;
|
|
|
import space.anyi.openAPI.service.InterfaceInfoService;
|
|
|
import space.anyi.openAPI.util.BeanCopyUtil;
|
|
|
import space.anyi.openAPI.util.SecurityUtils;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
+import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
|
|
/**
|
|
|
* @ProjectName: yangyi-open-api-platform
|
|
|
@@ -32,8 +34,14 @@ import java.util.Objects;
|
|
|
@RestController
|
|
|
@RequestMapping("/interfaceInfo")
|
|
|
public class InterfaceInfoController {
|
|
|
- @Resource
|
|
|
- private InterfaceInfoService interfaceInfoService;
|
|
|
+ private final InterfaceInfoService interfaceInfoService;
|
|
|
+ private final OpenAPIClient openAPIClient;
|
|
|
+
|
|
|
+ public InterfaceInfoController(InterfaceInfoService interfaceInfoService, OpenAPIClient openAPIClient) {
|
|
|
+ this.interfaceInfoService = interfaceInfoService;
|
|
|
+ this.openAPIClient = openAPIClient;
|
|
|
+ }
|
|
|
+
|
|
|
@PostMapping
|
|
|
@PreAuthorize("@ps.hasRole('管理员')")
|
|
|
public ResponseResult add(@RequestBody RequestAddInterfaceInfo requestAddInterfaceInfo){
|
|
|
@@ -114,4 +122,17 @@ public class InterfaceInfoController {
|
|
|
InterfaceInfoVO vo = BeanCopyUtil.copyBean(interfaceInfo, InterfaceInfoVO.class);
|
|
|
return ResponseResult.okResult(vo);
|
|
|
}
|
|
|
+ @PostMapping("/onlineDebug")
|
|
|
+ public ResponseResult onlineDebug(@RequestBody RequestOnlineDebugParam requestOnlineDebugParam){
|
|
|
+ //校验
|
|
|
+ //模拟参数构建
|
|
|
+ AtomicReference<String> name = new AtomicReference<>("");
|
|
|
+ requestOnlineDebugParam.getParams().stream().forEach(debugParam -> {
|
|
|
+ if ("name".equals(debugParam.getName())) {
|
|
|
+ name.set(debugParam.getValue());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //是sdk通过的对象进行接口调用操作
|
|
|
+ return ResponseResult.okResult(openAPIClient.handler(requestOnlineDebugParam.getPath(),name.get()));
|
|
|
+ }
|
|
|
}
|