mirror of https://github.com/jeecgboot/jeecg-boot
全流程跑通
parent
f7f6d0ff88
commit
ee382c0a5b
|
@ -1,15 +1,10 @@
|
|||
package org.jeecg.modules.openapi.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fasterxml.classmate.ResolvedType;
|
||||
import com.fasterxml.classmate.TypeBindings;
|
||||
import com.fasterxml.classmate.TypeResolver;
|
||||
import com.fasterxml.classmate.types.ResolvedObjectType;
|
||||
import com.fasterxml.jackson.databind.type.ArrayType;
|
||||
import com.fasterxml.jackson.databind.type.TypeFactory;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
|
@ -179,7 +174,7 @@ public class OpenApiController extends JeecgController<OpenApi, OpenApiService>
|
|||
|
||||
HttpHeaders httpHeaders = new HttpHeaders();
|
||||
for (OpenApiHeader header : headers) {
|
||||
httpHeaders.put(header.getKey(), Lists.newArrayList(request.getHeader(header.getKey())));
|
||||
httpHeaders.put(header.getHeaderKey(), Lists.newArrayList(request.getHeader(header.getHeaderKey())));
|
||||
}
|
||||
|
||||
HttpEntity<String> httpEntity = new HttpEntity<>(json, httpHeaders);
|
||||
|
@ -379,10 +374,10 @@ public class OpenApiController extends JeecgController<OpenApi, OpenApiService>
|
|||
// body-->请求参数的获取:@RequestBody()
|
||||
// form(不常用)
|
||||
for (OpenApiHeader openApiHeader : openapi.getHeaders()) {
|
||||
Parameter parameter = new Parameter(openApiHeader.getKey(),
|
||||
Parameter parameter = new Parameter(openApiHeader.getHeaderKey(),
|
||||
openApiHeader.getNote(),
|
||||
openApiHeader.getDefaultValue(),
|
||||
openApiHeader.getIsBlank() == 1,
|
||||
openApiHeader.getRequired() == 1,
|
||||
false,
|
||||
true,
|
||||
stringModelRef,
|
||||
|
@ -401,10 +396,10 @@ public class OpenApiController extends JeecgController<OpenApi, OpenApiService>
|
|||
}
|
||||
|
||||
for (OpenApiParam openApiParam : openapi.getParams()) {
|
||||
Parameter parameter = new Parameter(openApiParam.getKey(),
|
||||
Parameter parameter = new Parameter(openApiParam.getParamKey(),
|
||||
openApiParam.getNote(),
|
||||
openApiParam.getDefaultValue(),
|
||||
openApiParam.getIsBlank() == 1,
|
||||
openApiParam.getRequired() == 1,
|
||||
false,
|
||||
true,
|
||||
stringModelRef,
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package org.jeecg.modules.openapi.controller;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.modules.openapi.entity.OpenApiPermission;
|
||||
import org.jeecg.modules.openapi.service.OpenApiPermissionService;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/openapi/permission")
|
||||
public class OpenApiPermissionController extends JeecgController<OpenApiPermission, OpenApiPermissionService> {
|
||||
|
||||
@PostMapping("add")
|
||||
public Result add(@RequestBody OpenApiPermission openApiPermission) {
|
||||
return Result.ok(service.save(openApiPermission));
|
||||
}
|
||||
}
|
|
@ -32,12 +32,12 @@ public class OpenApiHeader implements Serializable {
|
|||
/**
|
||||
* key
|
||||
*/
|
||||
private String key;
|
||||
private String headerKey;
|
||||
|
||||
/**
|
||||
* 是否必填(0:否,1:是)
|
||||
*/
|
||||
private Integer isBlank;
|
||||
private Integer required;
|
||||
|
||||
/**
|
||||
* 默认值
|
||||
|
|
|
@ -31,12 +31,12 @@ public class OpenApiParam implements Serializable {
|
|||
/**
|
||||
* key
|
||||
*/
|
||||
private String key;
|
||||
private String paramKey;
|
||||
|
||||
/**
|
||||
* 是否必填(0:否,1:是)
|
||||
*/
|
||||
private Integer isBlank;
|
||||
private Integer required;
|
||||
|
||||
/**
|
||||
* 默认值
|
||||
|
|
|
@ -195,4 +195,10 @@ public class ApiAuthFilter implements Filter {
|
|||
String path = uri.substring(uri.lastIndexOf("/") + 1);
|
||||
return openApiService.findByPath(path);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
long timestamp = System.currentTimeMillis();
|
||||
System.out.println("timestamp:" + timestamp);
|
||||
System.out.println("signature:" + md5("ak-eAU25mrMxhtaZsyS" + "rjxMqB6YyUXpSHAz4DCIz8vZ5aozQQiV" + timestamp));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
INSERT INTO `open_api` (`id`, `name`, `request_method`, `request_url`, `black_list`, `body`, `origin_url`, `status`, `del_flag`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES ('1870486348755324929', '示例接口', 'GET', 'UrTk8CTk', NULL, NULL, 'http://localhost:8080/jeecg-boot/openapi/demo/index', 1, 0, NULL, '2024-12-21 23:07:52', NULL, NULL);
|
|
@ -0,0 +1 @@
|
|||
INSERT INTO `open_api_auth` (`id`, `name`, `ak`, `sk`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES ('1870484839812517890', 'openuser', 'ak-eAU25mrMxhtaZsyS', 'rjxMqB6YyUXpSHAz4DCIz8vZ5aozQQiV', NULL, '2024-12-21 23:01:52', NULL, NULL);
|
|
@ -0,0 +1 @@
|
|||
INSERT INTO `open_api_permission` (`id`, `api_id`, `api_auth_id`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES ('1870491556923179010', '1870486348755324929', '1870484839812517890', NULL, '2024-12-21 23:28:34', NULL, NULL);
|
|
@ -0,0 +1,4 @@
|
|||
INSERT INTO `open_api_record` (`id`, `api_id`, `call_auth_id`, `call_time`, `used_time`, `response_time`) VALUES ('1870491654130368513', '1870486348755324929', '1870484839812517890', '2024-12-21 23:28:57', 184, '2024-12-21 23:28:57');
|
||||
INSERT INTO `open_api_record` (`id`, `api_id`, `call_auth_id`, `call_time`, `used_time`, `response_time`) VALUES ('1870492694183542786', '1870486348755324929', '1870484839812517890', '2024-12-21 23:31:04', 120717, '2024-12-21 23:33:05');
|
||||
INSERT INTO `open_api_record` (`id`, `api_id`, `call_auth_id`, `call_time`, `used_time`, `response_time`) VALUES ('1870493301040680961', '1870486348755324929', '1870484839812517890', '2024-12-21 23:35:26', 3865, '2024-12-21 23:35:30');
|
||||
INSERT INTO `open_api_record` (`id`, `api_id`, `call_auth_id`, `call_time`, `used_time`, `response_time`) VALUES ('1870493334939045889', '1870486348755324929', '1870484839812517890', '2024-12-21 23:35:38', 82, '2024-12-21 23:35:38');
|
|
@ -163,9 +163,9 @@ spring:
|
|||
slow-sql-millis: 5000
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://172.16.10.227:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: root@2023
|
||||
password: root
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 多数据源配置
|
||||
#multi-datasource1:
|
||||
|
@ -176,9 +176,9 @@ spring:
|
|||
#redis 配置
|
||||
redis:
|
||||
database: 0
|
||||
host: 172.16.10.227
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password: 'Whdsj@redis0523'
|
||||
password:
|
||||
#mybatis plus 设置
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:org/jeecg/**/xml/*Mapper.xml
|
||||
|
|
Loading…
Reference in New Issue