微服务版后端初始化
This commit is contained in:
76
xjrsoft-service-api/xjrsoft-service-magicapi-api/pom.xml
Normal file
76
xjrsoft-service-api/xjrsoft-service-magicapi-api/pom.xml
Normal file
@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>xjrsoft-cloud</artifactId>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>xjrsoft-service-magicapi-api</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!--引入MyBatisPlus依赖-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!--引入knife4j依赖-->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!--引入Lombok依赖-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!--引入hutool依赖-->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.ssssssss</groupId>
|
||||
<artifactId>magic-api-spring-boot-starter</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-common-core</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-common-satoken</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@ -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