1、优化日志记录功能;

2、增加kong shell的支持
This commit is contained in:
raoxiaoyan 2020-11-18 18:04:22 +08:00
parent 39462dddb7
commit 8301d84f5e
55 changed files with 388 additions and 256 deletions

View File

@ -3,7 +3,7 @@
kongx(最新版本2.0.0)是网关kong的可视化界面管理平台(参考konga的部分界面布局方式),能够集中化管理应用不同环境的网关配置,提供同步各环境的网关配置功能,并且具备规范的权限管理、参数配置、环境管理及日志审计等特性。
基于Spring Boot和Spring Cloud开发打包后可以直接运行不需要额外安装Tomcat等应用容器
基于Spring Boot和Spring Cloud开发打包后可以直接运行不需要额外安装Tomcat等应用容器支持在线Shell。
Kongx 使用指南请参考:[Wiki](https://www.kancloud.cn/raoxiaoyan/kongx/1984321)
@ -17,6 +17,8 @@ Docker部署(2.0.0+支持)请参见[Docker Quick Start](./docker-quick-start/rea
## Screenshots
![](./docs/screen.png)
![](./docs/kong%20shell.png)
![](./docs/services.png)
![](./docs/service1.png)
@ -27,7 +29,6 @@ Docker部署(2.0.0+支持)请参见[Docker Quick Start](./docker-quick-start/rea
![](./docs/certificate.png)
![](./docs/kong%20shell.png)
## Features
@ -54,9 +55,11 @@ Docker部署(2.0.0+支持)请参见[Docker Quick Start](./docker-quick-start/rea
## RoadMap
1、初步计划kongx自适应kong后续所有版本;(已完成自动适配至2.1.x版本)
1、初步计划kongx自适应kong后续所有版本;(2.0.0版本,已完成自动适配至2.1.x版本)
2、增加shell界面和可视化管理界面
2、增加shell界面和可视化管理界面(2.0.1版本支持, 2020/11/18 已完成)
2、增加网关流水线的图形化界面设计
## 技术支持
<table>

View File

@ -2,7 +2,7 @@ FROM openjdk:8-jre-alpine
ENV KONGX_RUN_MODE "Docker"
ENV VERSION 2.0.0
ENV VERSION 2.0.1
ENV SERVER_PORT 8095
RUN \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 KiB

After

Width:  |  Height:  |  Size: 31 KiB

8
docs/kong_performance.md Normal file
View File

@ -0,0 +1,8 @@
# kong的压测报告(基于1.2.1版本)
## 1. 压测环境
kong服务器16c32G
后台服务3台nginx16c,32g
操作系统Centos 7.6
## 2.

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>kongx</artifactId>
<groupId>com.kongx</groupId>
<version>2.0.0</version>
<version>2.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,17 +5,13 @@ import com.kongx.common.utils.JWTTokenUtils;
import com.kongx.common.utils.Jackson2Helper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
public class LoginValidateInterceptor implements HandlerInterceptor {
static Logger log = LoggerFactory.getLogger(LoginValidateInterceptor.class);
@ -24,7 +20,6 @@ public class LoginValidateInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
log.info("LoginValidateInterceptor preHandle " + request.getRequestURL());
log.debug("start try fetch user info...");
Object dLoginUser = request.getSession().getAttribute("USER_INFO");
String token = request.getHeader("Authorization");
if (token == null || dLoginUser == null || !JWTTokenUtils.verify(token.replaceAll("Bearer ", ""))) {
@ -39,34 +34,6 @@ public class LoginValidateInterceptor implements HandlerInterceptor {
writer.print(Jackson2Helper.toJsonString(baseDTO));
return false;
}
HandlerMethod method = (HandlerMethod) handler;
Method method1 = method.getMethod();
Class[] classes = method1.getParameterTypes();
for (Class aClass : classes) {
aClass.getAnnotation(PreAuthorize.class);
}
PreAuthorize preAuthorize = method.getMethodAnnotation(PreAuthorize.class);
if (Optional.ofNullable(preAuthorize).isPresent()) {
String value = preAuthorize.value();
if ("".equals(value)) {
return true;
}
Object list = request.getSession().getAttribute("PERMISSIONS");
if (list != null) {
Set<String> strings = (Set<String>) list;
boolean authorize = strings.stream().filter((s) -> value.equalsIgnoreCase(s)).count() > 0;
if (!authorize) {
JsonHeaderWrapper baseDTO = new JsonHeaderWrapper<>();
response.setCharacterEncoding("utf-8");
response.setContentType("text/html; charset=utf-8");
PrintWriter writer = response.getWriter();
baseDTO.setErrmsg("拒绝访问");
baseDTO.setStatus(403);
writer.print(Jackson2Helper.toJsonString(baseDTO));
}
return authorize;
}
}
return true;
}
}

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>kongx</artifactId>
<groupId>com.kongx</groupId>
<version>2.0.0</version>
<version>2.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -14,7 +14,7 @@
<dependency>
<groupId>com.kongx</groupId>
<artifactId>kongx-common</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</dependency>
<dependency>

View File

@ -1,7 +1,7 @@
package com.kongx.serve;
import com.kongx.common.KongxBanner;
import com.kongx.common.config.KongxConfig;
import com.kongx.serve.config.KongxConfig;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.boot.SpringApplication;

View File

@ -1,4 +1,4 @@
package com.kongx.common.aop;
package com.kongx.serve.annotation;
import java.lang.annotation.*;
@ -6,6 +6,6 @@ import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface PreAuthorize {
public @interface Authorize {
String value();
}

View File

@ -0,0 +1,20 @@
package com.kongx.serve.annotation;
import java.lang.annotation.*;
import static com.kongx.serve.entity.system.OperationLog.OperationTarget;
import static com.kongx.serve.entity.system.OperationLog.OperationType;
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface KongLog {
OperationType operation() default OperationType.OPERATION_DEFAULT;
OperationTarget target();
String content() default "";
}

View File

@ -0,0 +1,91 @@
package com.kongx.serve.aop;
import com.kongx.common.core.entity.UserInfo;
import com.kongx.common.utils.JWTTokenUtils;
import com.kongx.common.utils.WebUtil;
import com.kongx.serve.annotation.KongLog;
import com.kongx.serve.entity.system.OperationLog;
import com.kongx.serve.entity.system.SystemProfile;
import com.kongx.serve.service.system.LogService;
import com.kongx.serve.service.system.SystemProfileService;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.DefaultParameterNameDiscoverer;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
@Component
@Aspect
public class KongLogAspect {
@Autowired
private LogService logService;
@Autowired
private SystemProfileService systemProfileService;
private SpelExpressionParser parserSpel = new SpelExpressionParser();
private DefaultParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer();
@Pointcut("@annotation(com.kongx.serve.annotation.KongLog)")
public void annotationPointCut() {
}
@Before("annotationPointCut()")
public void log(JoinPoint joinPoint) {
try {
MethodSignature sign = (MethodSignature) joinPoint.getSignature();
Method method = sign.getMethod();
method.getName();
KongLog kongLog = method.getAnnotation(KongLog.class);
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = requestAttributes.getRequest();
String token = request.getHeader("Authorization");
UserInfo userInfo = JWTTokenUtils.decode(token.replaceAll("Bearer ", ""));
SystemProfile systemProfile = systemProfileService.getClientByName(userInfo.getUserId());
OperationLog operationLog = new OperationLog();
OperationLog.OperationType operationType = kongLog.operation();
if (kongLog.operation() == OperationLog.OperationType.OPERATION_DEFAULT) {
operationType = OperationLog.OperationType.mapping(method.getName());
}
operationLog.setUserId(userInfo.getUserId());
operationLog.setProfile(systemProfile.getProfile());
operationLog.setCreator(userInfo.getName());
operationLog.setOperation(operationType.getRemark());
operationLog.setTarget(kongLog.target().getTarget());
operationLog.setRemark(String.format("%s %s %s", operationLog.getCreator(), operationType.getRemark(), kongLog.target().getTarget()));
operationLog.setIp(WebUtil.getClientIp(request));
operationLog.setContent(getValueBykey(kongLog.content(), joinPoint));
logService.log(systemProfile, operationLog);
} catch (Exception e) {
e.printStackTrace();
}
}
public Object getValueBykey(String spELString, JoinPoint pjp) {
Expression expression = parserSpel.parseExpression(spELString);
EvaluationContext context = new StandardEvaluationContext();
MethodSignature methodSignature = (MethodSignature) pjp.getSignature();
Object[] args = pjp.getArgs();
String[] paramNames = parameterNameDiscoverer.getParameterNames(methodSignature.getMethod());
for (int i = 0; i < args.length; i++) {
context.setVariable(paramNames[i], args[i]);
}
return expression.getValue(context);
}
}

View File

@ -1,4 +1,4 @@
package com.kongx.common.config;
package com.kongx.serve.config;
import com.kongx.common.aop.LoginValidateInterceptor;
import com.kongx.common.aop.UserArgumentResolver;
@ -13,10 +13,11 @@ import java.util.List;
@Configurable
public class KongxConfig implements WebMvcConfigurer {
@Value("${portal.exclude.paths:/index,/authorize/login.do,/inner/monitor/ping,/health/check,/authorize/getUserInfo.do,/authorize/logout.do," +
"/authorize/errorTimes.do,/index.html,/cdn/**,/css/**,/img/**,/js/**,/svg/**,/util/**,/favicon.ico}")
@Value("${portal.exclude.paths:/shell,/index,/authorize/login.do,/inner/monitor/ping,/health/check,/authorize/getUserInfo.do,/authorize/logout.do," +
"/index.html,/cdn/**,/css/**,/img/**,/js/**,/svg/**,/util/**,/favicon.ico}")
private String excludePaths;
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
argumentResolvers.add(new ServletWebArgumentResolverAdapter(new UserArgumentResolver()));

View File

@ -49,7 +49,7 @@ public class AuthorizeController extends BaseController {
try {
UserInfo userInfo = userInfoService.login(request.getParameter("username"), request.getParameter("password"));
jsonHeaderWrapper.setData(JWTTokenUtils.getToken(userInfo));
this.log(userInfo, OperationLog.OperationType.OPERATION_LOGIN, OperationLog.OperationTarget.SYSTEM, userInfo);
this.log(userInfo, OperationLog.OperationType.OPERATION_LOGIN, OperationLog.OperationTarget.SYSTEM, userInfo, request);
} catch (Exception e) {
jsonHeaderWrapper.setStatus(500);
jsonHeaderWrapper.setErrmsg(e.getMessage());

View File

@ -2,6 +2,7 @@ package com.kongx.serve.controller;
import com.kongx.common.core.entity.UserInfo;
import com.kongx.common.jsonwrapper.JsonHeaderWrapper;
import com.kongx.common.utils.WebUtil;
import com.kongx.serve.entity.system.OperationLog;
import com.kongx.serve.entity.system.SystemProfile;
import com.kongx.serve.service.system.LogService;
@ -10,6 +11,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
public abstract class BaseController<T> {
@Autowired
@ -29,12 +32,12 @@ public abstract class BaseController<T> {
return this.systemProfileService.getClientByName(userInfo.getUserId());
}
protected void log(UserInfo userInfo, OperationLog.OperationType operationType, OperationLog.OperationTarget operationTarget, Object content) {
OperationLog operationLog = to(userInfo, operationType, operationTarget, content);
protected void log(UserInfo userInfo, OperationLog.OperationType operationType, OperationLog.OperationTarget operationTarget, Object content, HttpServletRequest request) {
OperationLog operationLog = to(userInfo, operationType, operationTarget, content, WebUtil.getClientIp(request));
this.logService.log(systemProfile(userInfo), operationLog);
}
private OperationLog to(UserInfo userInfo, OperationLog.OperationType operationType, OperationLog.OperationTarget operationTarget, Object content) {
private OperationLog to(UserInfo userInfo, OperationLog.OperationType operationType, OperationLog.OperationTarget operationTarget, Object content, String ip) {
OperationLog operationLog = new OperationLog();
SystemProfile systemProfile = this.systemProfile(userInfo);
operationLog.setUserId(userInfo.getUserId());
@ -42,13 +45,16 @@ public abstract class BaseController<T> {
operationLog.setTarget(operationTarget.getType());
operationLog.setOperation(operationType.getType());
operationLog.setProfile(systemProfile.getProfile());
operationLog.setIp(ip);
operationLog.setContent(content);
operationLog.setRemark(String.format("%s %s %s", operationLog.getCreator(), operationType.getRemark(), operationTarget.getTarget()));
return operationLog;
}
protected void log(UserInfo userInfo, OperationLog.OperationType operationType, OperationLog.OperationTarget operationTarget, Object content, String remark) {
OperationLog operationLog = to(userInfo, operationType, operationTarget, content);
protected void log(UserInfo userInfo, OperationLog.OperationType operationType, OperationLog.OperationTarget operationTarget, Object content, String remark
, HttpServletRequest request) {
OperationLog operationLog = to(userInfo, operationType, operationTarget, content, WebUtil.getClientIp(request));
operationLog.setRemark(String.format("%s %s %s %s", operationLog.getCreator(), operationType.getRemark(), operationTarget.getTarget(), remark));
this.logService.log(systemProfile(userInfo), operationLog);
}

View File

@ -2,6 +2,7 @@ package com.kongx.serve.controller.gateway;
import com.kongx.common.core.entity.UserInfo;
import com.kongx.common.jsonwrapper.JsonHeaderWrapper;
import com.kongx.serve.annotation.KongLog;
import com.kongx.serve.controller.BaseController;
import com.kongx.serve.entity.gateway.CaCertificate;
import com.kongx.serve.entity.gateway.KongEntity;
@ -49,12 +50,12 @@ public class CaCertificateController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = CERTIFICATES_URI, method = RequestMethod.POST)
public JsonHeaderWrapper addUpstream(UserInfo userInfo, @RequestBody CaCertificate sni) {
@KongLog(target = OperationLog.OperationTarget.CaCertificate, content = "#sni")
public JsonHeaderWrapper add(UserInfo userInfo, @RequestBody CaCertificate sni) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
CaCertificate results = this.caCertificateService.add(systemProfile(userInfo), sni.trim());
jsonHeaderWrapper.setData(results);
this.log(userInfo, OperationLog.OperationType.OPERATION_ADD, OperationLog.OperationTarget.CaCertificate, sni);
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());
@ -71,12 +72,12 @@ public class CaCertificateController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = CERTIFICATES_URI_ID, method = RequestMethod.POST)
@KongLog(target = OperationLog.OperationTarget.CaCertificate, content = "#sni")
public JsonHeaderWrapper update(UserInfo userInfo, @PathVariable String id, @RequestBody CaCertificate sni) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
CaCertificate results = this.caCertificateService.update(systemProfile(userInfo), id, sni.trim());
jsonHeaderWrapper.setData(results);
this.log(userInfo, OperationLog.OperationType.OPERATION_UPDATE, OperationLog.OperationTarget.CaCertificate, sni, sni.getId());
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());
@ -92,12 +93,11 @@ public class CaCertificateController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = CERTIFICATES_URI_ID, method = RequestMethod.DELETE)
@KongLog(target = OperationLog.OperationTarget.CaCertificate, content = "#id")
public JsonHeaderWrapper remove(UserInfo userInfo, @PathVariable String id) throws Exception {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
CaCertificate sni = this.caCertificateService.findEntity(systemProfile(userInfo), id);
KongEntity<CaCertificate> upstreamKongEntity = this.caCertificateService.remove(systemProfile(userInfo), id);
this.log(userInfo, OperationLog.OperationType.OPERATION_DELETE, OperationLog.OperationTarget.CaCertificate, sni);
jsonHeaderWrapper.setData(upstreamKongEntity.getData());
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());

View File

@ -2,6 +2,7 @@ package com.kongx.serve.controller.gateway;
import com.kongx.common.core.entity.UserInfo;
import com.kongx.common.jsonwrapper.JsonHeaderWrapper;
import com.kongx.serve.annotation.KongLog;
import com.kongx.serve.controller.BaseController;
import com.kongx.serve.entity.gateway.Certificate;
import com.kongx.serve.entity.gateway.KongEntity;
@ -49,12 +50,12 @@ public class CertificateController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = CERTIFICATES_URI, method = RequestMethod.POST)
public JsonHeaderWrapper addUpstream(UserInfo userInfo, @RequestBody Certificate sni) {
@KongLog(target = OperationLog.OperationTarget.Certificate, content = "#sni")
public JsonHeaderWrapper add(UserInfo userInfo, @RequestBody Certificate sni) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
Certificate results = this.certificateService.add(systemProfile(userInfo), sni.trim());
jsonHeaderWrapper.setData(results);
this.log(userInfo, OperationLog.OperationType.OPERATION_ADD, OperationLog.OperationTarget.Certificate, sni);
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());
@ -71,12 +72,12 @@ public class CertificateController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = CERTIFICATES_URI_ID, method = RequestMethod.POST)
@KongLog(target = OperationLog.OperationTarget.Certificate, content = "#sni")
public JsonHeaderWrapper update(UserInfo userInfo, @PathVariable String id, @RequestBody Certificate sni) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
Certificate results = this.certificateService.update(systemProfile(userInfo), id, sni.trim());
jsonHeaderWrapper.setData(results);
this.log(userInfo, OperationLog.OperationType.OPERATION_UPDATE, OperationLog.OperationTarget.Certificate, sni, sni.getKey());
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());
@ -92,12 +93,11 @@ public class CertificateController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = CERTIFICATES_URI_ID, method = RequestMethod.DELETE)
@KongLog(target = OperationLog.OperationTarget.Certificate, content = "#id")
public JsonHeaderWrapper remove(UserInfo userInfo, @PathVariable String id) throws Exception {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
Certificate sni = this.certificateService.findEntity(systemProfile(userInfo), id);
KongEntity<Certificate> upstreamKongEntity = this.certificateService.remove(systemProfile(userInfo), id);
this.log(userInfo, OperationLog.OperationType.OPERATION_DELETE, OperationLog.OperationTarget.Certificate, sni);
jsonHeaderWrapper.setData(upstreamKongEntity.getData());
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());

View File

@ -2,6 +2,7 @@ package com.kongx.serve.controller.gateway;
import com.kongx.common.core.entity.UserInfo;
import com.kongx.common.jsonwrapper.JsonHeaderWrapper;
import com.kongx.serve.annotation.KongLog;
import com.kongx.serve.controller.BaseController;
import com.kongx.serve.entity.gateway.Consumer;
import com.kongx.serve.entity.gateway.KongEntity;
@ -80,12 +81,12 @@ public class ConsumerController extends BaseController {
}
@RequestMapping(value = CREDENTIALS_URI, method = RequestMethod.POST)
@KongLog(target = OperationLog.OperationTarget.CONSUMERS_CERTIFICATE, content = "#map")
public JsonHeaderWrapper addCredentials(UserInfo userInfo, @RequestBody Map map, @PathVariable String customerId, @PathVariable String entityName) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
Map results = this.consumerService.addCredentials(systemProfile(userInfo), map, customerId, entityName);
jsonHeaderWrapper.setData(results);
this.log(userInfo, OperationLog.OperationType.OPERATION_ADD, OperationLog.OperationTarget.CONSUMERS, map);
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());
@ -101,12 +102,12 @@ public class ConsumerController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = CONSUMER_URI, method = RequestMethod.POST)
@KongLog(target = OperationLog.OperationTarget.CONSUMERS, content = "#consumer")
public JsonHeaderWrapper add(UserInfo userInfo, @RequestBody Consumer consumer) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
Consumer results = this.consumerService.add(systemProfile(userInfo), consumer.trim());
jsonHeaderWrapper.setData(results);
this.log(userInfo, OperationLog.OperationType.OPERATION_ADD, OperationLog.OperationTarget.CONSUMERS, consumer.getUsername());
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());
@ -123,12 +124,12 @@ public class ConsumerController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = CONSUMER_URI_ID, method = RequestMethod.POST)
@KongLog(target = OperationLog.OperationTarget.CONSUMERS, content = "#consumer")
public JsonHeaderWrapper update(UserInfo userInfo, @PathVariable String id, @RequestBody Consumer consumer) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
Consumer results = this.consumerService.update(systemProfile(userInfo), id, consumer.trim());
jsonHeaderWrapper.setData(results);
this.log(userInfo, OperationLog.OperationType.OPERATION_UPDATE, OperationLog.OperationTarget.CONSUMERS, consumer, consumer.getUsername());
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());
@ -143,13 +144,13 @@ public class ConsumerController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = CREDENTIALS_URI_ID, method = RequestMethod.DELETE)
@KongLog(target = OperationLog.OperationTarget.CONSUMERS_CERTIFICATE, content = "#entityId")
public JsonHeaderWrapper removeCredential(UserInfo userInfo, @PathVariable String customerId, @PathVariable String entityName,
@PathVariable String entityId) throws Exception {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
KongEntity<Map> upstreamKongEntity =
this.consumerService.removeCredentials(systemProfile(userInfo), customerId, entityName, entityId);
this.log(userInfo, OperationLog.OperationType.OPERATION_DELETE, OperationLog.OperationTarget.CONSUMERS, entityId);
jsonHeaderWrapper.setData(upstreamKongEntity.getData());
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
@ -159,12 +160,12 @@ public class ConsumerController extends BaseController {
}
@RequestMapping(value = CONSUMER_URI_ID, method = RequestMethod.DELETE)
@KongLog(target = OperationLog.OperationTarget.CONSUMERS, content = "#id")
public JsonHeaderWrapper remove(UserInfo userInfo, @PathVariable String id) throws Exception {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
Consumer consumer = this.consumerService.findConsumer(systemProfile(userInfo), id);
KongEntity<Consumer> upstreamKongEntity = this.consumerService.remove(systemProfile(userInfo), id);
this.log(userInfo, OperationLog.OperationType.OPERATION_DELETE, OperationLog.OperationTarget.CONSUMERS, consumer);
jsonHeaderWrapper.setData(upstreamKongEntity.getData());
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());

View File

@ -0,0 +1,59 @@
package com.kongx.serve.controller.gateway;
import com.kongx.common.core.entity.UserInfo;
import com.kongx.common.jsonwrapper.JsonHeaderWrapper;
import com.kongx.serve.controller.BaseController;
import com.kongx.serve.entity.system.SystemProfile;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
@RequestMapping
@RestController
public class PingController extends BaseController {
@Value("${kongx.shell.port:8900}")
private int port;
@RequestMapping(value = "/kong/api/ping/shell", method = RequestMethod.GET)
public JsonHeaderWrapper ping(UserInfo userInfo) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
SystemProfile systemProfile = this.systemProfile(userInfo);
HttpStatus status = HttpStatus.OK;
if (systemProfile.IS_NULL()) {
status = HttpStatus.UNAUTHORIZED;
}
String url = systemProfile.getUrl();
String host = url.substring(url.indexOf("//") + 2, url.lastIndexOf(":"));
if (!this.isHostConnectable(host)) {
status = HttpStatus.GATEWAY_TIMEOUT;
}
jsonHeaderWrapper.setData(status.value());
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());
}
return jsonHeaderWrapper;
}
private boolean isHostConnectable(String host) {
Socket socket = new Socket();
try {
socket.connect(new InetSocketAddress(host, port), 2000);
} catch (IOException e) {
return false;
} finally {
try {
socket.close();
} catch (IOException e) {
}
}
return true;
}
}

View File

@ -2,12 +2,13 @@ package com.kongx.serve.controller.gateway;
import com.kongx.common.core.entity.UserInfo;
import com.kongx.common.jsonwrapper.JsonHeaderWrapper;
import com.kongx.serve.annotation.KongLog;
import com.kongx.serve.controller.BaseController;
import com.kongx.serve.entity.gateway.*;
import com.kongx.serve.entity.gateway.KongEntity;
import com.kongx.serve.entity.gateway.Plugin;
import com.kongx.serve.entity.gateway.PluginVO;
import com.kongx.serve.entity.system.OperationLog;
import com.kongx.serve.service.gateway.PluginService;
import com.kongx.serve.service.gateway.RouteService;
import com.kongx.serve.service.gateway.ServiceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FeignClientsConfiguration;
import org.springframework.context.annotation.Import;
@ -28,12 +29,6 @@ public class PluginController extends BaseController {
@Autowired
private PluginService kongFeignService;
@Autowired
private RouteService routeService;
@Autowired
private ServiceService serviceService;
/**
* 查询所有plugin
@ -42,6 +37,7 @@ public class PluginController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = PLUGIN_URI, method = RequestMethod.GET)
@KongLog(operation = OperationLog.OperationType.OPERATION_ADD, target = OperationLog.OperationTarget.GLOBAL_PLUGIN, content = "#userInfo")
public JsonHeaderWrapper findAll(UserInfo userInfo) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
@ -95,13 +91,12 @@ public class PluginController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = PLUGIN_URI, method = RequestMethod.POST)
@KongLog(target = OperationLog.OperationTarget.GLOBAL_PLUGIN, content = "#plugin")
public JsonHeaderWrapper<Plugin> add(UserInfo userInfo, @RequestBody Plugin plugin) {
JsonHeaderWrapper<Plugin> jsonHeaderWrapper = init();
try {
Plugin result = this.kongFeignService.add(systemProfile(userInfo), plugin);
jsonHeaderWrapper.setData(result);
this.log(userInfo, OperationLog.OperationType.OPERATION_ADD, OperationLog.OperationTarget.GLOBAL_PLUGIN, plugin, remark(userInfo, plugin));
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());
@ -109,24 +104,8 @@ public class PluginController extends BaseController {
return jsonHeaderWrapper;
}
private String remark(UserInfo userInfo, Plugin plugin) {
String remark = String.format(" '%s' 从属于全局", plugin.getName());
try {
if (plugin.getRoute() != null) {
Route route = routeService.find(systemProfile(userInfo), plugin.getRoute().getId());
remark = String.format("'%s' 从属于路由 '%s'", plugin.getName(), route.getName());
}
if (plugin.getService() != null) {
Service service = this.serviceService.find(systemProfile(userInfo), plugin.getService().getId());
remark = String.format("'%s' 从属于服务 '%s'", plugin.getName(), service.getName());
}
} catch (URISyntaxException e) {
return "";
}
return remark;
}
@RequestMapping(value = PLUGIN_ROUTE_URI_PATH, method = RequestMethod.POST)
@KongLog(target = OperationLog.OperationTarget.ROUTE_PLUGIN, content = "#plugin")
public JsonHeaderWrapper addByRoute(UserInfo userInfo, @PathVariable String routeId, @RequestBody Plugin plugin) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
@ -141,6 +120,7 @@ public class PluginController extends BaseController {
}
@RequestMapping(value = PLUGIN_SERVICE_URI_PATH, method = RequestMethod.POST)
@KongLog(target = OperationLog.OperationTarget.SERVICE_PLUGIN, content = "#plugin")
public JsonHeaderWrapper addByService(UserInfo userInfo, @PathVariable String routeId, @RequestBody Plugin plugin) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
@ -163,12 +143,12 @@ public class PluginController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = PLUGIN_URI_ID_PATH, method = RequestMethod.POST)
@KongLog(target = OperationLog.OperationTarget.ROUTE_PLUGIN, content = "#plugin")
public JsonHeaderWrapper<Plugin> update(UserInfo userInfo, @PathVariable String id, @RequestBody Plugin plugin) {
JsonHeaderWrapper<Plugin> jsonHeaderWrapper = init();
try {
Plugin result = this.kongFeignService.update(systemProfile(userInfo), id, plugin);
jsonHeaderWrapper.setData(result);
this.log(userInfo, OperationLog.OperationType.OPERATION_UPDATE, OperationLog.OperationTarget.GLOBAL_PLUGIN, plugin, remark(userInfo, plugin));
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());
@ -185,10 +165,9 @@ public class PluginController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = PLUGIN_URI_ID_PATH, method = RequestMethod.DELETE)
@KongLog(target = OperationLog.OperationTarget.GLOBAL_PLUGIN, content = "#id")
public JsonHeaderWrapper remove(UserInfo userInfo, @PathVariable String id) throws URISyntaxException {
Plugin plugin = this.find(userInfo, id);
this.kongFeignService.remove(systemProfile(userInfo), id);
this.log(userInfo, OperationLog.OperationType.OPERATION_DELETE, OperationLog.OperationTarget.GLOBAL_PLUGIN, plugin, remark(userInfo, plugin));
return findAll(userInfo);
}

View File

@ -2,7 +2,7 @@ package com.kongx.serve.controller.gateway;
import com.kongx.common.core.entity.UserInfo;
import com.kongx.common.jsonwrapper.JsonHeaderWrapper;
import com.kongx.common.utils.Jackson2Helper;
import com.kongx.serve.annotation.KongLog;
import com.kongx.serve.controller.BaseController;
import com.kongx.serve.entity.gateway.KongEntity;
import com.kongx.serve.entity.gateway.Route;
@ -70,6 +70,9 @@ public class RouteController extends BaseController {
return jsonHeaderWrapper;
}
@Autowired
private ServiceService serviceService;
/**
* 批量更新路由Hosts
*
@ -90,10 +93,6 @@ public class RouteController extends BaseController {
datum.setHosts(routeParams.getHosts());
this.kongFeignService.update(systemProfile, datum.getId(), datum);
}
if (!routeKongEntity.getData().isEmpty()) {
this.log(userInfo, OperationLog.OperationType.OPERATION_UPDATE, OperationLog.OperationTarget.ROUTE, routeParams,
routeKongEntity.getData().get(0).getName() + " ...等路由的主机名为:" + Jackson2Helper.toJsonString(routeParams.getHosts()));
}
jsonHeaderWrapper.setErrmsg(routeNames.toString());
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
@ -110,12 +109,12 @@ public class RouteController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = ROUTE_SERVICE_URI_PATH, method = RequestMethod.POST)
@KongLog(target = OperationLog.OperationTarget.ROUTE, content = "#route")
public JsonHeaderWrapper add(UserInfo userInfo, @PathVariable String serviceId, @RequestBody Route route) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
KongEntity<Route> routeKongEntity = this.kongFeignService.add(systemProfile(userInfo), serviceId, route.clear());
jsonHeaderWrapper.setData(routeKongEntity.getData());
this.log(userInfo, OperationLog.OperationType.OPERATION_ADD, OperationLog.OperationTarget.ROUTE, route, remark(userInfo, route));
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());
@ -123,22 +122,6 @@ public class RouteController extends BaseController {
return jsonHeaderWrapper;
}
@Autowired
private ServiceService serviceService;
private String remark(UserInfo userInfo, Route route) {
String remark = "";
try {
if (route.getService() != null) {
Service service = this.serviceService.find(systemProfile(userInfo), route.getService().getId());
remark = String.format("'%s' 从属于服务 '%s'", route.getName(), service.getName());
}
} catch (URISyntaxException e) {
return "";
}
return remark;
}
/**
* 更新Route
*
@ -148,12 +131,12 @@ public class RouteController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = ROUTE_URI_ID_PATH, method = RequestMethod.POST)
@KongLog(target = OperationLog.OperationTarget.ROUTE, content = "#route")
public JsonHeaderWrapper update(UserInfo userInfo, @PathVariable String id, @RequestBody Route route) throws URISyntaxException {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
Route results = this.kongFeignService.update(systemProfile(userInfo), id, route.clear());
jsonHeaderWrapper.setData(results);
this.log(userInfo, OperationLog.OperationType.OPERATION_UPDATE, OperationLog.OperationTarget.ROUTE, route, remark(userInfo, route));
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());
@ -169,13 +152,12 @@ public class RouteController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = ROUTE_URI_ID_PATH, method = RequestMethod.DELETE)
@KongLog(target = OperationLog.OperationTarget.ROUTE, content = "#id")
public JsonHeaderWrapper remove(UserInfo userInfo, @PathVariable String id) throws URISyntaxException {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
Route route = this.kongFeignService.find(systemProfile(userInfo), id);
KongEntity<Route> routeKongEntity = this.kongFeignService.remove(systemProfile(userInfo), id);
jsonHeaderWrapper.setData(routeKongEntity.getData());
this.log(userInfo, OperationLog.OperationType.OPERATION_DELETE, OperationLog.OperationTarget.ROUTE, route, remark(userInfo, route));
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());

View File

@ -2,6 +2,7 @@ package com.kongx.serve.controller.gateway;
import com.kongx.common.core.entity.UserInfo;
import com.kongx.common.jsonwrapper.JsonHeaderWrapper;
import com.kongx.serve.annotation.KongLog;
import com.kongx.serve.controller.BaseController;
import com.kongx.serve.entity.gateway.KongEntity;
import com.kongx.serve.entity.gateway.PluginVO;
@ -71,12 +72,12 @@ public class ServiceController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = SERVICE_URI, method = RequestMethod.POST)
@KongLog(target = OperationLog.OperationTarget.SERVICE, content = "#service")
public JsonHeaderWrapper add(UserInfo userInfo, @RequestBody Service service) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
Service results = this.kongFeignService.add(systemProfile(userInfo), service.trim());
jsonHeaderWrapper.setData(results);
this.log(userInfo, OperationLog.OperationType.OPERATION_ADD, OperationLog.OperationTarget.SERVICE, results, results.getName());
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());
@ -93,12 +94,12 @@ public class ServiceController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = SERVICE_URI_ID_PATH, method = RequestMethod.POST)
@KongLog(target = OperationLog.OperationTarget.SERVICE, content = "#service")
public JsonHeaderWrapper update(UserInfo userInfo, @PathVariable String id, @RequestBody Service service) throws URISyntaxException {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
Service results = this.kongFeignService.update(systemProfile(userInfo), id, service.trim());
jsonHeaderWrapper.setData(results);
this.log(userInfo, OperationLog.OperationType.OPERATION_UPDATE, OperationLog.OperationTarget.SERVICE, results, results.getName());
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());
@ -114,13 +115,12 @@ public class ServiceController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = SERVICE_URI_ID_PATH, method = RequestMethod.DELETE)
@KongLog(target = OperationLog.OperationTarget.SERVICE, content = "#id")
public JsonHeaderWrapper remove(UserInfo userInfo, @PathVariable String id) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
Service service = this.kongFeignService.find(systemProfile(userInfo), id);
KongEntity<Service> upstreamKongEntity = this.kongFeignService.remove(systemProfile(userInfo), id);
jsonHeaderWrapper.setData(upstreamKongEntity.getData());
this.log(userInfo, OperationLog.OperationType.OPERATION_DELETE, OperationLog.OperationTarget.SERVICE, service, service.getName());
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());

View File

@ -0,0 +1,31 @@
package com.kongx.serve.controller.gateway;
import com.kongx.common.core.entity.UserInfo;
import com.kongx.serve.controller.BaseController;
import com.kongx.serve.entity.system.SystemProfile;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
@Slf4j
public class ShellController extends BaseController {
@Value("${kongx.shell.port:8900}")
private int port;
@Value("${kongx.shell.dir:/log}")
private String shellDir;
@GetMapping("/shell")
public String shell(UserInfo userInfo) {
SystemProfile systemProfile = this.systemProfile(userInfo);
String url = systemProfile.getUrl();
url = url.substring(0, url.lastIndexOf(":"));
StringBuilder builder = new StringBuilder("");
builder.append("redirect:").append(url).append(":").append(this.port).append(shellDir);
return builder.toString();
}
}

View File

@ -2,6 +2,7 @@ package com.kongx.serve.controller.gateway;
import com.kongx.common.core.entity.UserInfo;
import com.kongx.common.jsonwrapper.JsonHeaderWrapper;
import com.kongx.serve.annotation.KongLog;
import com.kongx.serve.controller.BaseController;
import com.kongx.serve.entity.gateway.KongEntity;
import com.kongx.serve.entity.gateway.Sni;
@ -49,12 +50,12 @@ public class SniController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = SNIS_URI, method = RequestMethod.POST)
public JsonHeaderWrapper addUpstream(UserInfo userInfo, @RequestBody Sni sni) {
@KongLog(target = OperationLog.OperationTarget.SNI, content = "#sni")
public JsonHeaderWrapper add(UserInfo userInfo, @RequestBody Sni sni) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
Sni results = this.sniService.add(systemProfile(userInfo), sni.trim());
jsonHeaderWrapper.setData(results);
this.log(userInfo, OperationLog.OperationType.OPERATION_ADD, OperationLog.OperationTarget.SNI, sni);
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());
@ -71,12 +72,12 @@ public class SniController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = SNIS_URI_ID, method = RequestMethod.POST)
@KongLog(target = OperationLog.OperationTarget.SNI, content = "#sni")
public JsonHeaderWrapper update(UserInfo userInfo, @PathVariable String id, @RequestBody Sni sni) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
Sni results = this.sniService.update(systemProfile(userInfo), id, sni.trim());
jsonHeaderWrapper.setData(results);
this.log(userInfo, OperationLog.OperationType.OPERATION_UPDATE, OperationLog.OperationTarget.SNI, sni, sni.getName());
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());
@ -92,12 +93,11 @@ public class SniController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = SNIS_URI_ID, method = RequestMethod.DELETE)
@KongLog(target = OperationLog.OperationTarget.SNI, content = "#id")
public JsonHeaderWrapper remove(UserInfo userInfo, @PathVariable String id) throws Exception {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
Sni sni = this.sniService.findEntity(systemProfile(userInfo), id);
KongEntity<Sni> upstreamKongEntity = this.sniService.remove(systemProfile(userInfo), id);
this.log(userInfo, OperationLog.OperationType.OPERATION_DELETE, OperationLog.OperationTarget.SNI, sni);
jsonHeaderWrapper.setData(upstreamKongEntity.getData());
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());

View File

@ -1,9 +1,9 @@
package com.kongx.serve.controller.gateway;
import com.kongx.common.core.entity.PaginationSupport;
import com.kongx.common.core.entity.UserInfo;
import com.kongx.common.jsonwrapper.JsonHeaderWrapper;
import com.kongx.serve.controller.BaseController;
import com.kongx.common.core.entity.UserInfo;
import com.kongx.serve.entity.gateway.Service;
import com.kongx.serve.entity.gateway.SyncConfig;
import com.kongx.serve.entity.gateway.SyncEntity;
@ -15,6 +15,7 @@ import com.kongx.serve.service.system.SyncConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@RestController("/SyncConfigController")
@ -27,12 +28,12 @@ public class SyncConfigController extends BaseController {
private SyncLogService syncLogService;
@RequestMapping(value = "/configs", method = RequestMethod.POST)
public JsonHeaderWrapper add(UserInfo userInfo, @RequestBody SyncConfig syncConfig) {
public JsonHeaderWrapper add(UserInfo userInfo, @RequestBody SyncConfig syncConfig, HttpServletRequest request) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
syncConfig.setCreator(userInfo.getName());
jsonHeaderWrapper.setData(this.syncConfigService.addSyncConfig(userInfo, syncConfig));
this.log(userInfo, OperationLog.OperationType.OPERATION_SYNC, OperationLog.OperationTarget.SYNC_SERVICE, syncConfig, remark(userInfo, syncConfig));
this.log(userInfo, OperationLog.OperationType.OPERATION_SYNC, OperationLog.OperationTarget.SYNC_SERVICE, syncConfig, remark(userInfo, syncConfig), request);
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());

View File

@ -2,15 +2,14 @@ package com.kongx.serve.controller.gateway;
import com.kongx.common.core.entity.UserInfo;
import com.kongx.common.jsonwrapper.JsonHeaderWrapper;
import com.kongx.serve.annotation.KongLog;
import com.kongx.serve.controller.BaseController;
import com.kongx.serve.entity.gateway.KongEntity;
import com.kongx.serve.entity.gateway.Target;
import com.kongx.serve.entity.gateway.TargetHealth;
import com.kongx.serve.entity.gateway.Upstream;
import com.kongx.serve.entity.system.OperationLog;
import com.kongx.serve.entity.system.SystemProfile;
import com.kongx.serve.service.gateway.TargetService;
import com.kongx.serve.service.gateway.UpstreamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FeignClientsConfiguration;
import org.springframework.context.annotation.Import;
@ -57,12 +56,11 @@ public class TargetController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = TARGET_URI_PATH, method = RequestMethod.POST)
@KongLog(target = OperationLog.OperationTarget.TARGETS, content = "#target")
public JsonHeaderWrapper add(UserInfo userInfo, @PathVariable String id, @RequestBody Target target) {
JsonHeaderWrapper jsonHeaderWrapper = init();
try {
this.targetFeignService.add(systemProfile(userInfo), id, target);
this.log(userInfo, OperationLog.OperationType.OPERATION_ADD, OperationLog.OperationTarget.TARGETS, target,
remark(userInfo, target, target.getUpstream().getId()));
} catch (Exception e) {
e.printStackTrace();
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
@ -79,33 +77,15 @@ public class TargetController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = TARGET_URI_ID_PATH, method = RequestMethod.DELETE)
@KongLog(target = OperationLog.OperationTarget.TARGETS, content = "#id 从属于上游服务 #upstreamId")
public JsonHeaderWrapper remove(UserInfo userInfo, @PathVariable String upstreamId, @PathVariable String id) {
JsonHeaderWrapper jsonHeaderWrapper = init();
try {
Target target = this.targetFeignService.findById(systemProfile(userInfo), upstreamId, id);
this.targetFeignService.remove(systemProfile(userInfo), upstreamId, id);
this.log(userInfo, OperationLog.OperationType.OPERATION_DELETE, OperationLog.OperationTarget.TARGETS, target,
remark(userInfo, target, upstreamId));
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());
}
return jsonHeaderWrapper;
}
@Autowired
private UpstreamService upstreamService;
private String remark(UserInfo userInfo, Target target, String upstreamId) {
Upstream upstream = null;
String remark = "";
try {
upstream = this.upstreamService.findUpstream(systemProfile(userInfo), upstreamId);
remark = String.format("'%s' 从属于上游服务 '%s'", target.getTarget(), upstream.getName());
} catch (URISyntaxException e) {
e.printStackTrace();
}
return remark;
}
}

View File

@ -1,8 +1,9 @@
package com.kongx.serve.controller.gateway;
import com.kongx.common.aop.PreAuthorize;
import com.kongx.serve.annotation.Authorize;
import com.kongx.common.core.entity.UserInfo;
import com.kongx.common.jsonwrapper.JsonHeaderWrapper;
import com.kongx.serve.annotation.KongLog;
import com.kongx.serve.controller.BaseController;
import com.kongx.serve.entity.gateway.KongEntity;
import com.kongx.serve.entity.gateway.Upstream;
@ -33,7 +34,7 @@ public class UpstreamController extends BaseController {
* @return
*/
@RequestMapping(value = UPSTREAM_URI, method = RequestMethod.GET)
@PreAuthorize("upstream_view")
@Authorize("upstream_view")
public JsonHeaderWrapper findAll(UserInfo userInfo) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
@ -54,12 +55,12 @@ public class UpstreamController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = UPSTREAM_URI, method = RequestMethod.POST)
public JsonHeaderWrapper addUpstream(UserInfo userInfo, @RequestBody Upstream upstream) {
@KongLog(target = OperationLog.OperationTarget.UPSTREAM, content = "#upstream")
public JsonHeaderWrapper add(UserInfo userInfo, @RequestBody Upstream upstream) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
Upstream results = this.upstreamService.add(systemProfile(userInfo), upstream.trim());
jsonHeaderWrapper.setData(results);
this.log(userInfo, OperationLog.OperationType.OPERATION_ADD, OperationLog.OperationTarget.UPSTREAM, upstream, upstream.getName());
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());
@ -76,12 +77,12 @@ public class UpstreamController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = UPSTREAM_URI_ID, method = RequestMethod.POST)
@KongLog(target = OperationLog.OperationTarget.UPSTREAM, content = "#upstream")
public JsonHeaderWrapper update(UserInfo userInfo, @PathVariable String id, @RequestBody Upstream upstream) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
Upstream results = this.upstreamService.update(systemProfile(userInfo), id, upstream.trim());
jsonHeaderWrapper.setData(results);
this.log(userInfo, OperationLog.OperationType.OPERATION_UPDATE, OperationLog.OperationTarget.UPSTREAM, upstream, upstream.getName());
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());
@ -97,12 +98,11 @@ public class UpstreamController extends BaseController {
* @throws URISyntaxException
*/
@RequestMapping(value = UPSTREAM_URI_ID, method = RequestMethod.DELETE)
@KongLog(target = OperationLog.OperationTarget.UPSTREAM, content = "#id")
public JsonHeaderWrapper remove(UserInfo userInfo, @PathVariable String id) throws Exception {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
Upstream upstream = this.upstreamService.findUpstream(systemProfile(userInfo), id);
KongEntity<Upstream> upstreamKongEntity = this.upstreamService.remove(systemProfile(userInfo), id);
this.log(userInfo, OperationLog.OperationType.OPERATION_DELETE, OperationLog.OperationTarget.UPSTREAM, upstream, upstream.getName());
jsonHeaderWrapper.setData(upstreamKongEntity.getData());
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());

View File

@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
public abstract class DefaultController<T, PK> extends BaseController {
@ -36,12 +37,12 @@ public abstract class DefaultController<T, PK> extends BaseController {
@RequestMapping(method = RequestMethod.POST)
public JsonHeaderWrapper add(@RequestBody T project, UserInfo userInfo) {
public JsonHeaderWrapper add(@RequestBody T project, UserInfo userInfo, HttpServletRequest request) {
JsonHeaderWrapper jsonHeaderWrapper = init();
try {
this.baseService.add(project, userInfo);
jsonHeaderWrapper.setData(project);
this.log(userInfo, OperationLog.OperationType.OPERATION_ADD, operationTarget(), project);
this.log(userInfo, OperationLog.OperationType.OPERATION_ADD, operationTarget(), project, request);
} catch (Exception e) {
e.printStackTrace();
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
@ -51,12 +52,12 @@ public abstract class DefaultController<T, PK> extends BaseController {
}
@RequestMapping(path = "/{id}", method = RequestMethod.POST)
public JsonHeaderWrapper update(@RequestBody T project, UserInfo userInfo) {
public JsonHeaderWrapper update(@RequestBody T project, UserInfo userInfo, HttpServletRequest request) {
JsonHeaderWrapper jsonHeaderWrapper = init();
try {
this.baseService.update(project, userInfo);
jsonHeaderWrapper.setData(project);
this.log(userInfo, OperationLog.OperationType.OPERATION_UPDATE, operationTarget(), project);
this.log(userInfo, OperationLog.OperationType.OPERATION_UPDATE, operationTarget(), project, request);
} catch (Exception e) {
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
jsonHeaderWrapper.setErrmsg(e.getMessage());

View File

@ -1,13 +1,13 @@
package com.kongx.serve.controller.system;
import com.kongx.common.core.entity.UserInfo;
import com.fasterxml.jackson.core.type.TypeReference;
import com.kongx.common.jsonwrapper.JsonHeaderWrapper;
import com.kongx.common.utils.Jackson2Helper;
import com.kongx.serve.annotation.KongLog;
import com.kongx.serve.controller.BaseController;
import com.kongx.serve.entity.system.OperationLog;
import com.kongx.serve.entity.system.ServerConfig;
import com.kongx.serve.service.system.ServerConfigService;
import com.fasterxml.jackson.core.type.TypeReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -28,11 +28,11 @@ public class ServerConfigController extends BaseController {
}
@RequestMapping(value = "/configs", method = RequestMethod.POST)
public JsonHeaderWrapper add(@RequestBody ServerConfig serverConfig, UserInfo userInfo) {
@KongLog(target = OperationLog.OperationTarget.SERVER_CONFIG, content = "#serverConfig.configKey")
public JsonHeaderWrapper add(@RequestBody ServerConfig serverConfig) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
this.serverConfigService.addServerConfig(serverConfig);
this.log(userInfo, OperationLog.OperationType.OPERATION_ADD, OperationLog.OperationTarget.SERVER_CONFIG, serverConfig, serverConfig.getConfigKey());
} catch (Exception e) {
jsonHeaderWrapper.setErrmsg(e.getMessage());
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
@ -41,11 +41,11 @@ public class ServerConfigController extends BaseController {
}
@RequestMapping(value = "/configs/{id}", method = RequestMethod.POST)
public JsonHeaderWrapper update(@PathVariable int id, @RequestBody ServerConfig serverConfig, UserInfo userInfo) {
@KongLog(target = OperationLog.OperationTarget.SERVER_CONFIG, content = "#serverConfig.configKey")
public JsonHeaderWrapper update(@PathVariable int id, @RequestBody ServerConfig serverConfig) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
this.serverConfigService.updateServerConfig(serverConfig);
this.log(userInfo, OperationLog.OperationType.OPERATION_UPDATE, OperationLog.OperationTarget.SERVER_CONFIG, serverConfig, serverConfig.getConfigKey());
} catch (Exception e) {
jsonHeaderWrapper.setErrmsg(e.getMessage());
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());

View File

@ -2,6 +2,7 @@ package com.kongx.serve.controller.system;
import com.kongx.common.core.entity.UserInfo;
import com.kongx.common.jsonwrapper.JsonHeaderWrapper;
import com.kongx.serve.annotation.KongLog;
import com.kongx.serve.controller.BaseController;
import com.kongx.serve.entity.system.OperationLog;
import com.kongx.serve.entity.system.SystemProfile;
@ -79,11 +80,11 @@ public class SystemProfileController extends BaseController {
}
@RequestMapping(value = "/profiles/{clientId}", method = RequestMethod.POST)
@KongLog(target = OperationLog.OperationTarget.SERVER_CONFIG, content = "#systemProfile.profile")
public JsonHeaderWrapper update(@PathVariable int clientId, @RequestBody SystemProfile systemProfile, UserInfo userInfo) {
JsonHeaderWrapper jsonHeaderWrapper = this.init();
try {
this.systemProfileService.updateClient(systemProfile);
this.log(userInfo, OperationLog.OperationType.OPERATION_UPDATE, OperationLog.OperationTarget.SYSTEM_PROFILE, systemProfile, systemProfile.getProfile());
} catch (Exception e) {
jsonHeaderWrapper.setErrmsg(e.getMessage());
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());

View File

@ -23,6 +23,7 @@ public class OperationLog {
private Object content;
private String remark;
private String ip;
public static enum OperationType {
@ -31,14 +32,7 @@ public class OperationLog {
OPERATION_SYNC("sync", "同步"),
OPERATION_ADD("add", "新增"),
OPERATION_UPDATE("update", "修改"),
OPERATION_DELETE("delete", "删除"),
OPERATION_SUBSCRIBE("subscribe", "订阅"),
JOB_STARTUP("job_startup", "启动"),
JOB_PAUSE("job_pause", "暂停"),
JOB_DELETE("job_delete", "删除"),
DEMOTE_CONFIG("demote_config", "执行降级"),
ROLLBACK_CONFIG("rollback_config", "降级回滚"),
ARTHAS_ATTACH("arthas_attach", "Arthas调试"),
OPERATION_DELETE("remove", "删除"),
OPERATION_DEFAULT("none", "");
private String type;
private String remark;
@ -57,6 +51,15 @@ public class OperationLog {
return OPERATION_DEFAULT;
}
public static OperationType mapping(String method) {
for (OperationType value : OperationType.values()) {
if (method.startsWith(value.getType())) {
return value;
}
}
return OPERATION_DEFAULT;
}
public String getType() {
return type;
}
@ -83,6 +86,7 @@ public class OperationLog {
UPSTREAM("upstream", "上游服务"),
SNI("sni", "sni"),
CONSUMERS("consumers", "消费者"),
CONSUMERS_CERTIFICATE("consumers_certificate", "消费者认证"),
CaCertificate("ca_certificate", "CA认证"),
Certificate("certificate", "认证"),
TARGETS("targets", "上游代理"),
@ -92,19 +96,8 @@ public class OperationLog {
SYSTEM_FUNCTION("system_function", "系统功能菜单"),
SYNC_SERVICE("sync_service", "网关服务"),
USER_INFO("user_info", "用户信息"),
TEMPLATE_TYPE("template_type", "模板类型"),
SERVER_CONFIG("server_config", "系统参数"),
SYSTEM_PROFILE("system_profile", "系统环境"),
DEMOTE_APP_PARAMS("demote_app_params", "降级参数"),
SERVICE_PROGRESS("service_progress", "服务进程"),
MONITOR_JOB("monitor_job", "作业"),
MONITOR_JOB_TASK("monitor_job_task", "作业任务"),
DING_TALK_ROBOT("ding_talk_robot", "钉钉机器人"),
ALERT_RULE("alert_rule", "告警规则"),
ALERT_RECORD("alert_record", "告警记录"),
ALERT_TEMPLATE("alert_template", "告警模板"),
PROJECT("project", "项目管理"),
SYNC_APP_PARAMS("sync_app_params", "热配参数"),
SERVER_CONFIG("service_config", "系统配置"),
LOGGER_LEVEL("logger_level", "日志级别");
private String type;
private String target;

View File

@ -8,11 +8,11 @@ import java.util.Map;
@Mapper
public interface LogMapper {
@Insert({"insert into kongx_operation_log(userId,operation_type,content,target,creator,create_at,remark,profile) ",
@Insert({"insert into kongx_operation_log(userId,operation_type,content,target,creator,create_at,remark,profile,ip) ",
"values(#{log.userId}, #{log.operation},",
"#{log.content,typeHandler=com.kongx.common.handler.JSONHandler},#{log.target},",
"#{log.creator}, #{log.create_at, jdbcType=TIMESTAMP},",
"#{log.remark},#{log.profile})"})
"#{log.remark},#{log.profile},#{log.ip})"})
int add(@Param("log") OperationLog log);
@Select("SELECT t.* FROM kongx_operation_log t where TO_DAYS(NOW())-#{days}<TO_DAYS(t.create_at) order by t.create_at desc")

View File

@ -0,0 +1,19 @@
package com.kongx.serve.service;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
@Component
public class ApplicationContextUtil implements ApplicationContextAware {
private static ApplicationContext context;
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
context = applicationContext;
}
public static ApplicationContext getApplicationContext() {
return context;
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
.table-container[data-v-2f514c64]{padding:8px 10px}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"><meta name=apple-mobile-web-app-capable content=yes><meta name=apple-mobile-web-app-status-bar-style content=black><meta name=format-detection content="telephone=no"><meta http-equiv=X-UA-Compatible content="chrome=1"><link rel=stylesheet href=cdn/element-ui/2.13.0/theme-chalk/index.css><link rel=stylesheet href=cdn/animate/3.5.2/animate.css><link rel=stylesheet href=cdn/iconfont/1.0.0/index.css><link rel=icon href=favicon.ico><title>kongx</title><style>html,
<!DOCTYPE html><html><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"><meta name=apple-mobile-web-app-capable content=yes><meta name=apple-mobile-web-app-status-bar-style content=black><meta name=format-detection content="telephone=no"><meta http-equiv=X-UA-Compatible content="chrome=1"><link rel=stylesheet href=cdn/element-ui/2.13.0/theme-chalk/index.css><link rel=stylesheet href=cdn/animate/3.5.2/animate.css><link rel=stylesheet href=cdn/iconfont/1.0.0/index.css><link rel=stylesheet href="https://fonts.googleapis.com/icon?family=Material+Icons"><link rel=icon href=favicon.ico><title>kongx</title><style>html,
body,
#app {
height: 100%;
@ -51,4 +51,4 @@
.avue-home__sub-title {
color: #ABABAB;
font-size: 12px;
}</style><link href=css/chunk-285ecc27.f26f6cd9.css rel=prefetch><link href=css/chunk-36d68c6a.889d7b72.css rel=prefetch><link href=css/chunk-a425ea88.97c43d12.css rel=prefetch><link href=css/page.3f55036c.css rel=prefetch><link href=js/chunk-285ecc27.530b91c1.js rel=prefetch><link href=js/chunk-2d0e4caf.fea686c4.js rel=prefetch><link href=js/chunk-36d68c6a.bf68084c.js rel=prefetch><link href=js/chunk-a425ea88.9930a7b1.js rel=prefetch><link href=js/page.7857dcf8.js rel=prefetch><link href=js/views.428c18a1.js rel=prefetch><link href=css/app.741d39f8.css rel=preload as=style><link href=css/chunk-vendors.cb6420de.css rel=preload as=style><link href=js/app.af38839a.js rel=preload as=script><link href=js/chunk-vendors.4ee75067.js rel=preload as=script><link href=css/chunk-vendors.cb6420de.css rel=stylesheet><link href=css/app.741d39f8.css rel=stylesheet></head><body><noscript><strong>很抱歉,如果没有 JavaScript 支持Avue-cli 将不能正常工作。请启用浏览器的 JavaScript 然后继续。</strong></noscript><div id=app><div class=avue-home><div class=avue-home__main><img class=avue-home__loading src=./svg/loading-spin.svg alt=loading><div class=avue-home__title>正在加载资源</div><div class=avue-home__sub-title>初次加载资源可能需要较多时间 请耐心等待</div></div><div class=avue-home__footer><a href=https://gitee.com/raoxy/kongx target=_blank>https://gitee.com/raoxy/kongx</a></div></div></div><script src=util/aes.js charset=utf-8></script><script src=cdn/vue/2.6.10/vue.min.js charset=utf-8></script><script src=cdn/vuex/3.0.1/vuex.min.js charset=utf-8></script><script src=cdn/vue-router/3.0.1/vue-router.min.js charset=utf-8></script><script src=cdn/axios/1.0.0/axios.min.js charset=utf-8></script><script src=cdn/element-ui/2.13.0/index.js charset=utf-8></script><script src=cdn/xlsx/0.14.1/xlsx.full.min.js charset=utf-8></script><script src=cdn/fileSaver/1.3.8/FileSaver.min.js charset=utf-8></script><script src=cdn/lodash/4.13.1/lodash.min.js charset=utf-8></script><script src=js/chunk-vendors.4ee75067.js></script><script src=js/app.af38839a.js></script></body></html>
}</style><link href=css/chunk-05d1190a.889d7b72.css rel=prefetch><link href=css/chunk-e71f815c.ab7edb4f.css rel=prefetch><link href=css/page.5cf41a71.css rel=prefetch><link href=js/chunk-05d1190a.b42234c2.js rel=prefetch><link href=js/chunk-2d0e4caf.fea686c4.js rel=prefetch><link href=js/chunk-e71f815c.1647f971.js rel=prefetch><link href=js/page.114cf767.js rel=prefetch><link href=js/views.4d62ea9b.js rel=prefetch><link href=css/app.6db76f0a.css rel=preload as=style><link href=css/chunk-vendors.e426cd01.css rel=preload as=style><link href=js/app.b22022b5.js rel=preload as=script><link href=js/chunk-vendors.48ed5c43.js rel=preload as=script><link href=css/chunk-vendors.e426cd01.css rel=stylesheet><link href=css/app.6db76f0a.css rel=stylesheet></head><body><noscript><strong>很抱歉,如果没有 JavaScript 支持Avue-cli 将不能正常工作。请启用浏览器的 JavaScript 然后继续。</strong></noscript><div id=app><div class=avue-home><div class=avue-home__main><img class=avue-home__loading src=./svg/loading-spin.svg alt=loading><div class=avue-home__title>正在加载资源</div><div class=avue-home__sub-title>初次加载资源可能需要较多时间 请耐心等待</div></div><div class=avue-home__footer><a href=https://gitee.com/raoxy/kongx target=_blank>https://gitee.com/raoxy/kongx</a></div></div></div><script src=util/aes.js charset=utf-8></script><script src=cdn/vue/2.6.10/vue.min.js charset=utf-8></script><script src=cdn/vuex/3.0.1/vuex.min.js charset=utf-8></script><script src=cdn/vue-router/3.0.1/vue-router.min.js charset=utf-8></script><script src=cdn/axios/1.0.0/axios.min.js charset=utf-8></script><script src=cdn/element-ui/2.13.0/index.js charset=utf-8></script><script src=cdn/xlsx/0.14.1/xlsx.full.min.js charset=utf-8></script><script src=cdn/fileSaver/1.3.8/FileSaver.min.js charset=utf-8></script><script src=cdn/lodash/4.13.1/lodash.min.js charset=utf-8></script><script src=js/chunk-vendors.48ed5c43.js></script><script src=js/app.b22022b5.js></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

36
pom.xml
View File

@ -13,7 +13,7 @@
<groupId>com.kongx</groupId>
<artifactId>kongx</artifactId>
<packaging>pom</packaging>
<version>2.0.0</version>
<version>2.0.1</version>
<modules>
<module>kongx-serve</module>
<module>kongx-common</module>
@ -26,7 +26,6 @@
<commons.collections4.version>4.1</commons.collections4.version>
<commons.io.version>2.5</commons.io.version>
<dom4j.version>1.6.1</dom4j.version>
<apollo.version>1.3.0</apollo.version>
<guava.version>18.0</guava.version>
<caffeine.version>2.6.2</caffeine.version>
<swagger.version>2.8.0</swagger.version>
@ -35,7 +34,6 @@
<extra-enforcer-rules_version>1.0-alpha-5</extra-enforcer-rules_version>
<maven-enforcer-plugin_version>1.2</maven-enforcer-plugin_version>
<mybatis-spring-boot.version>2.0.0</mybatis-spring-boot.version>
<daling-framework-verion>0.0.3.28</daling-framework-verion>
</properties>
<dependencies>
@ -149,43 +147,11 @@
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<executions>
<execution>
<id>attach-javadoc</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<doclint>none</doclint>
</configuration>
</execution>
</executions>
<configuration>
<show>public</show>
<charset>UTF-8</charset>
<encoding>UTF-8</encoding>
<docencoding>UTF-8</docencoding>
<links>
<link>http://docs.oracle.com/javase/7/docs/api</link>
</links>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>${maven-install-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>