微服务版后端初始化
This commit is contained in:
@ -0,0 +1,47 @@
|
||||
package com.xjrsoft.magicapi.client;
|
||||
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.magicapi.fallback.MagicApiClientFallBack;
|
||||
import com.xjrsoft.magicapi.vo.MagicApiExecuteResponseVo;
|
||||
import com.xjrsoft.magicapi.vo.MagicApiInfoFeighVo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/10 17:41
|
||||
*/
|
||||
@FeignClient(value = GlobalConstant.CLIENT_MAGICAPI_NAME,fallback = MagicApiClientFallBack.class)
|
||||
public interface IMagicApiClient {
|
||||
|
||||
/**
|
||||
* 执行API
|
||||
* @param id 接口id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_MAGICAPI_NAME + "/executeApiFeign")
|
||||
Object executeApiFeign(@RequestParam("id") String id);
|
||||
|
||||
/**
|
||||
* 获取magicapi info
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_MAGICAPI_NAME + "/getMagicApiInfoFeign")
|
||||
MagicApiInfoFeighVo getMagicApiInfoFeign(@RequestParam("id") String id);
|
||||
|
||||
|
||||
/**
|
||||
* 执行API
|
||||
* @param method
|
||||
* @param path
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_MAGICAPI_NAME + "/executeApiByParamFeign")
|
||||
MagicApiExecuteResponseVo executeApiByParamFeign(@RequestParam(value = "method", required = false) String method, @RequestParam(value = "path",required = false) String path, Map<String, Object> context);
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.xjrsoft.magicapi.fallback;
|
||||
|
||||
import com.xjrsoft.magicapi.client.IMagicApiClient;
|
||||
import com.xjrsoft.magicapi.vo.MagicApiExecuteResponseVo;
|
||||
import com.xjrsoft.magicapi.vo.MagicApiInfoFeighVo;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/10 17:41
|
||||
*/
|
||||
@Component
|
||||
public class MagicApiClientFallBack implements IMagicApiClient {
|
||||
|
||||
@Override
|
||||
public Object executeApiFeign(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MagicApiInfoFeighVo getMagicApiInfoFeign(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MagicApiExecuteResponseVo executeApiByParamFeign(String method, String path, Map<String, Object> context) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.xjrsoft.magicapi.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/30 14:25
|
||||
*/
|
||||
@Data
|
||||
public class MagicApiExecuteResponseVo {
|
||||
|
||||
private Object response;
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package com.xjrsoft.magicapi.vo;
|
||||
|
||||
import com.xjrsoft.common.core.domain.tree.ITreeNode;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author apple
|
||||
*/
|
||||
@Data
|
||||
public class MagicApiGroupTreeVo implements Serializable, ITreeNode<MagicApiGroupTreeVo,String> {
|
||||
|
||||
/**
|
||||
* 上级Id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 上级Id
|
||||
*/
|
||||
private String parentId;
|
||||
|
||||
|
||||
/**
|
||||
* 子集
|
||||
*/
|
||||
private List<MagicApiGroupTreeVo> children;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.xjrsoft.magicapi.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/29 16:09
|
||||
*/
|
||||
@Data
|
||||
public class MagicApiInfoFeighVo {
|
||||
|
||||
private String id;
|
||||
|
||||
private String method;
|
||||
|
||||
private String script;
|
||||
|
||||
private String groupId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String path;
|
||||
|
||||
private Long createTime;
|
||||
|
||||
private Long updateTime;
|
||||
|
||||
private String lock;
|
||||
|
||||
private String createBy;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
// private List<Parameter> parameters;
|
||||
//
|
||||
// private List<Header> headers;
|
||||
//
|
||||
// private List<Path> paths;
|
||||
//
|
||||
// private LinkedHashMap<String,Object> properties;
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package com.xjrsoft.magicapi.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import org.ssssssss.magicapi.core.model.BaseDefinition;
|
||||
import org.ssssssss.magicapi.core.model.Header;
|
||||
import org.ssssssss.magicapi.core.model.Parameter;
|
||||
import org.ssssssss.magicapi.core.model.Path;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* magic api 信息
|
||||
* @author tzx
|
||||
*/
|
||||
@Data
|
||||
public class MagicApiInfoVo {
|
||||
|
||||
private String id;
|
||||
|
||||
private String method;
|
||||
|
||||
private String script;
|
||||
|
||||
private String groupId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String path;
|
||||
|
||||
private Long createTime;
|
||||
|
||||
private Long updateTime;
|
||||
|
||||
private String lock;
|
||||
|
||||
private String createBy;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
private BaseDefinition requestBodyDefinition;
|
||||
|
||||
private List<Parameter> parameters;
|
||||
|
||||
private List<Header> headers;
|
||||
|
||||
private List<Path> paths;
|
||||
|
||||
private LinkedHashMap<String,Object> properties;
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package com.xjrsoft.magicapi.vo;
|
||||
|
||||
import com.xjrsoft.common.core.domain.tree.ITreeNode;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author apple
|
||||
*/
|
||||
@Data
|
||||
public class MagicApiTreeVo implements Serializable, ITreeNode<MagicApiTreeVo,String> {
|
||||
|
||||
/**
|
||||
* 上级Id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 上级Id
|
||||
*/
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String path;
|
||||
|
||||
|
||||
/**
|
||||
* 请求方式
|
||||
*/
|
||||
private String method;
|
||||
|
||||
/**
|
||||
* 子集
|
||||
*/
|
||||
private List<MagicApiTreeVo> children;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user