diff --git a/README.md b/README.md index 2e7afd2b..54e23cba 100644 --- a/README.md +++ b/README.md @@ -45,9 +45,6 @@ SOP封装了开放平台大部分功能包括:签名验证、统一异常处 - 应用授权 - 监控日志 -## 后期规划 - -- 调试工具 ## admin界面预览 @@ -73,6 +70,10 @@ SOP封装了开放平台大部分功能包括:签名验证、统一异常处 - sop-test:接口调用测试用例 - sop-website:开放平台对应网站,提供文档API等内容 +## 分支说明 + +- develop:日常开发分支 +- registry-nacos:nacos作为注册中心 ## 相关文档 diff --git a/changelog.md b/changelog.md index ca5e3fe7..89035399 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,17 @@ # changelog +## 1.12.0 + +- admin后台新增角色管理 +- 支持nacos作为注册中心 + +## 1.11.0 + +- 秘钥管理改造 +- 服务端返回sign +- 新增SDK返回sign处理 +- 新增沙箱环境 + ## 1.10.0 - 新增监控日志 diff --git a/doc/docs/_sidebar.md b/doc/docs/_sidebar.md index bfce503d..c3fc8cb3 100644 --- a/doc/docs/_sidebar.md +++ b/doc/docs/_sidebar.md @@ -1,28 +1,31 @@ -* [首页](/?t=1559803778913) +* [首页](/?t=1562549680042) * 开发文档 - * [快速体验](files/10010_快速体验.md?t=1559803778920) - * [项目接入到SOP](files/10011_项目接入到SOP.md?t=1559803778940) - * [新增接口](files/10020_新增接口.md?t=1559803778940) - * [业务参数校验](files/10030_业务参数校验.md?t=1559803778940) - * [错误处理](files/10040_错误处理.md?t=1559803778940) - * [编写文档](files/10041_编写文档.md?t=1559803778941) - * [接口交互详解](files/10050_接口交互详解.md?t=1559803778941) - * [easyopen支持](files/10070_easyopen支持.md?t=1559803778941) - * [使用签名校验工具](files/10080_使用签名校验工具.md?t=1559803778941) - * [ISV管理](files/10085_ISV管理.md?t=1559803778941) - * [路由授权](files/10090_路由授权.md?t=1559803778941) - * [接口限流](files/10092_接口限流.md?t=1559803778941) - * [监控日志](files/10093_监控日志.md?t=1559803778941) - * [SDK开发](files/10095_SDK开发.md?t=1559803778941) - * [使用SpringCloudGateway](files/10096_使用SpringCloudGateway.md?t=1559803778942) - * [应用授权](files/10097_应用授权.md?t=1559803778942) - * [更改数据节点名称](files/10099_更改数据节点名称.md?t=1559803778942) - * [对接前端](files/10100_对接前端.md?t=1559803778942) - * [自定义过滤器](files/10102_自定义过滤器.md?t=1559803778942) - * [文件上传](files/10104_文件上传.md?t=1559803778942) + * [快速体验](files/10010_快速体验.md?t=1562549680042) + * [项目接入到SOP](files/10011_项目接入到SOP.md?t=1562549680065) + * [新增接口](files/10020_新增接口.md?t=1562549680065) + * [业务参数校验](files/10030_业务参数校验.md?t=1562549680065) + * [错误处理](files/10040_错误处理.md?t=1562549680065) + * [编写文档](files/10041_编写文档.md?t=1562549680065) + * [接口交互详解](files/10050_接口交互详解.md?t=1562549680065) + * [easyopen支持](files/10070_easyopen支持.md?t=1562549680065) + * [使用签名校验工具](files/10080_使用签名校验工具.md?t=1562549680066) + * [ISV管理](files/10085_ISV管理.md?t=1562549680066) + * [自定义路由](files/10086_自定义路由.md?t=1562549680066) + * [路由授权](files/10090_路由授权.md?t=1562549680066) + * [接口限流](files/10092_接口限流.md?t=1562549680066) + * [监控日志](files/10093_监控日志.md?t=1562549680066) + * [SDK开发](files/10095_SDK开发.md?t=1562549680067) + * [使用SpringCloudGateway](files/10096_使用SpringCloudGateway.md?t=1562549680067) + * [应用授权](files/10097_应用授权.md?t=1562549680067) + * [更改数据节点名称](files/10099_更改数据节点名称.md?t=1562549680067) + * [对接前端](files/10100_对接前端.md?t=1562549680067) + * [自定义过滤器](files/10102_自定义过滤器.md?t=1562549680067) + * [文件上传](files/10104_文件上传.md?t=1562549680068) + * [nacos注册中心](files/10106_nacos注册中心.md?t=1562549680068) + * [扩展其它注册中心](files/10107_扩展其它注册中心.md?t=1562549680069) * 原理分析 - * [原理分析之@ApiMapping](files/90010_原理分析之@ApiMapping.md?t=1559803778942) - * [原理分析之路由存储](files/90011_原理分析之路由存储.md?t=1559803778942) - * [原理分析之如何路由](files/90012_原理分析之如何路由.md?t=1559803778942) - * [原理分析之文档归纳](files/90013_原理分析之文档归纳.md?t=1559803778942) - * [常见问题](files/90100_常见问题.md?t=1559803778942) + * [原理分析之@ApiMapping](files/90010_原理分析之@ApiMapping.md?t=1562549680069) + * [原理分析之路由存储](files/90011_原理分析之路由存储.md?t=1562549680069) + * [原理分析之如何路由](files/90012_原理分析之如何路由.md?t=1562549680069) + * [原理分析之文档归纳](files/90013_原理分析之文档归纳.md?t=1562549680069) + * [常见问题](files/90100_常见问题.md?t=1562549680069) diff --git a/doc/docs/files/10085_ISV管理.md b/doc/docs/files/10085_ISV管理.md index 991aff16..e6334502 100644 --- a/doc/docs/files/10085_ISV管理.md +++ b/doc/docs/files/10085_ISV管理.md @@ -12,3 +12,13 @@ ISV:独立软体开发商(independent software vendor),即接入方或 界面如下图所示:  + +## 秘钥管理 + +点击操作列的`秘钥管理`,可对ISV的秘钥进行设置。 + +- 如果采用淘宝开放平台签名方式,签名方式选择`MD5`,如果采用支付宝开放平台签名方式,选择`RSA` +- 如果对接的开发者使用非Java语言,秘钥格式选择`PKCS1` +- 带 ★ 的分配给开发者 + + diff --git a/doc/docs/files/10086_自定义路由.md b/doc/docs/files/10086_自定义路由.md new file mode 100644 index 00000000..48f4ebd4 --- /dev/null +++ b/doc/docs/files/10086_自定义路由.md @@ -0,0 +1,23 @@ +# 自定义路由 + +假设有一个非java开发的接口,比如php开发的接口,然后需要接入到SOP,使用接口名版本号进行路由跳转。 + +操作方式如下: + +- 登录sop-admin,服务管理--路由管理 +- 新建一个自定义服务:`php-service` + + + +- 选中php-service,新建一个路由,输入接口名、版本号、uri + + + +- 请求网关 + +`http://localhost:8081/api?method=php.goods.list&version=1.0`会跳转到`http://www.xxx.com/api/listGoods.php` + +注意: + +- php接口返回数据必须是json格式,返回其它内容可能会调用失败 +- 只有自定义服务、路由可以删除 diff --git a/doc/docs/files/10090_路由授权.md b/doc/docs/files/10090_路由授权.md index e68c1ec9..017dccc4 100644 --- a/doc/docs/files/10090_路由授权.md +++ b/doc/docs/files/10090_路由授权.md @@ -9,7 +9,7 @@ 假设把路由a,b,c分配给了`VIP角色`,那么具有VIP角色的ISV可以访问a,b,c三个路由。 -默认情况下,接口访问时公开的,ISV都能访问。如果要设置某个接口需要授权,在`@ApiMapping`注解中指定permission=true。 +默认情况下,接口访问时公开的,ISV都能访问。如果要设置某个接口访问权限,在`@ApiMapping`注解中指定permission=true。 如:`@ApiMapping(value = "permission.story.get", permission = true)`。这样该接口是需要经过授权给ISV才能访问的。 重启服务后,登录admin,服务管理-路由列表界面中,操作操作列会出现一个授权按钮,点击出现授权窗口,勾选对应的角色即可完成授权。 diff --git a/doc/docs/files/10095_SDK开发.md b/doc/docs/files/10095_SDK开发.md index 740d6b6e..82427627 100644 --- a/doc/docs/files/10095_SDK开发.md +++ b/doc/docs/files/10095_SDK开发.md @@ -86,6 +86,8 @@ protected RequestMethod getRequestMethod() { } ``` +**建议读请求用GET,写请求用POST**, + ### 使用方式 ```java diff --git a/doc/docs/files/10106_nacos注册中心.md b/doc/docs/files/10106_nacos注册中心.md new file mode 100644 index 00000000..315983b1 --- /dev/null +++ b/doc/docs/files/10106_nacos注册中心.md @@ -0,0 +1,90 @@ +# nacos注册中心 + +使用nacos作为注册中心,源码在`registry-nacos`分支 + +这里演示如何将默认的eureka注册中心替换成nacos,步骤如下: + +- 准备工作 + +1.安装nacos,前往[最新稳定版本](https://github.com/alibaba/nacos/releases),下载最新版nacos + +2.启动nacos服务器,cd nacos/bin + +Linux/Unix/Mac,启动命令(standalone代表着单机模式运行,非集群模式): + +`sh startup.sh -m standalone` + +Windows,启动命令: + +`cmd startup.cmd` + +或者双击startup.cmd运行文件。 + +更多访问:https://nacos.io/zh-cn/docs/quick-start.html + +- 微服务端修改 + +1.修改微服务应用pom,打开`sop-example/sop-story/sop-story-web/pom.xml`,注释eureka服务发现依赖,添加nacos服务发现依赖 + +```xml + + + + + + org.springframework.cloud + spring-cloud-starter-alibaba-nacos-discovery + 0.2.2.RELEASE + + +``` + +2.yml文件新增nacos配置,并注释掉eureka相关配置 + +```yaml +spring: + cloud: + # nacos注册中心,和eureka只能用一个 + nacos: + discovery: + server-addr: 127.0.0.1:8848 +``` + +- 网关修改 + +找到`sop-gateway`工程,步骤同上 + +- SOP-admin修改 + + +修改yml文件,设置nacos服务器地址,`registry.name`填nacos + +```yaml +# 注册中心地址,根据实际情况改,这里只是参数,并不会去注册 +registry: + eureka-server-addr: http://localhost:1111/eureka/ + # nacos服务器地址 + nacos-server-addr: 127.0.0.1:8848 + # 使用eureka,填:eureka,使用nacos填:nacos + name: nacos +``` + +- website-server修改 + +步骤同`SOP-admin修改` + +如果要改成consul注册中心,可参照以上步骤。 + +- 参考资料 + +1.[nacos介绍及安装](https://nacos.io/zh-cn/docs/quick-start.html) + +2.[nacos spring cloud注册发现](https://nacos.io/zh-cn/docs/quick-start-spring-cloud.html) diff --git a/doc/docs/files/10107_扩展其它注册中心.md b/doc/docs/files/10107_扩展其它注册中心.md new file mode 100644 index 00000000..f52d701c --- /dev/null +++ b/doc/docs/files/10107_扩展其它注册中心.md @@ -0,0 +1,112 @@ +# 扩展其它注册中心 + +**注: nacos注册中心已经实现,本篇以nacos为例介绍如何扩展,如果要改成consul,可按照此方式进行修改** + +SOP默认使用eureka注册中心,如果要换成nacos注册中心,步骤如下: + +- 实现`com.gitee.sop.registryapi.service.RegistryService`接口 + +1.找到`SOP/sop-common/sop-registry-api`工程,在service.impl包下新建一个类,实现RegistryService接口 + +```java +public class RegistryServiceNacos implements RegistryService { + + @Override + public List listAllService(int pageNo, int pageSize) throws Exception { + // TODO: 返回服务实例 + } + + @Override + public void onlineInstance(ServiceInstance serviceInstance) throws Exception { + // TODO: 实例上线 + } + + @Override + public void offlineInstance(ServiceInstance serviceInstance) throws Exception { + // TODO: 实例下线 + } +} +``` + +2.在`com.gitee.sop.registryapi.config.BaseRegistryConfig`中新增 + +```java +/** + * 当配置了registry.name=nacos生效 + * + * @return + */ +@Bean +@ConditionalOnProperty(prefix = "registry", name = "name", havingValue = "nacos") +RegistryService registryServiceNacos() { + return new RegistryServiceNacos(); +} +``` + +其中`@ConditionalOnProperty(prefix = "registry", name = "name", havingValue = "nacos")` +表示`application.properties`配置了`registry.name=nacos`参数才能生效,registry.name=nacos下文会讲到。 + + +- 微服务端修改 + +1.修改微服务应用pom.xml,注释eureka服务发现依赖,添加nacos服务发现依赖 + +```xml + + + + + + org.springframework.cloud + spring-cloud-starter-alibaba-nacos-discovery + 0.2.2.RELEASE + + +``` + +2.yml文件新增nacos配置,并注释掉eureka相关配置 + +```yaml +spring: + cloud: + # nacos注册中心,和eureka只能用一个 + nacos: + discovery: + server-addr: 127.0.0.1:8848 +``` + +- 网关修改 + +找到`sop-gateway`工程,步骤同上 + +- SOP-admin修改 + + +修改yml文件,新增nacos服务器地址,`registry.name`填nacos + +```yaml +# 注册中心地址,根据实际情况改,这里只是参数,并不会去注册 +registry: + # 使用eureka,填:eureka,使用nacos填:nacos + name: nacos + eureka-server-addr: http://localhost:1111/eureka/ + nacos-server-addr: 127.0.0.1:8848 +``` + +- website-server修改 + +步骤同`SOP-admin修改` + +- 参考资料 + +1.[nacos介绍及安装](https://nacos.io/zh-cn/docs/quick-start.html) + +2.[nacos spring cloud注册发现](https://nacos.io/zh-cn/docs/quick-start-spring-cloud.html) diff --git a/doc/docs/files/90100_常见问题.md b/doc/docs/files/90100_常见问题.md index ae293ecd..e40a39c5 100644 --- a/doc/docs/files/90100_常见问题.md +++ b/doc/docs/files/90100_常见问题.md @@ -28,4 +28,22 @@ public class ZuulConfig extends AlipayZuulConfiguration { } } -``` \ No newline at end of file +``` + +## 注册到eureka显示hostname,非ip + +```yaml +eureka: + instance: + prefer-ip-address: true + instance-id: ${spring.cloud.client.ip-address}:${server.port} +``` + +```xml + + org.springframework.cloud + spring-cloud-commons + +``` + +参考:https://www.jianshu.com/p/5ad8317961b7 diff --git a/doc/docs/files/images/10085_1.png b/doc/docs/files/images/10085_1.png index 7bbe87fd..83ebecb7 100644 Binary files a/doc/docs/files/images/10085_1.png and b/doc/docs/files/images/10085_1.png differ diff --git a/doc/docs/files/images/10085_2.png b/doc/docs/files/images/10085_2.png new file mode 100644 index 00000000..ab7fd094 Binary files /dev/null and b/doc/docs/files/images/10085_2.png differ diff --git a/doc/docs/files/images/10086_1.png b/doc/docs/files/images/10086_1.png new file mode 100644 index 00000000..d5da23b6 Binary files /dev/null and b/doc/docs/files/images/10086_1.png differ diff --git a/doc/docs/files/images/10086_2.png b/doc/docs/files/images/10086_2.png new file mode 100644 index 00000000..de61367b Binary files /dev/null and b/doc/docs/files/images/10086_2.png differ diff --git a/sop-1.11.0.sql b/sop-1.11.0.sql new file mode 100644 index 00000000..1ac84122 --- /dev/null +++ b/sop-1.11.0.sql @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS `isv_keys`; + +CREATE TABLE `isv_keys` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `app_key` varchar(128) NOT NULL DEFAULT '应用id(交给开发者)', + `sign_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '1:RSA2,2:MD5', + `secret` varchar(200) NOT NULL DEFAULT '' COMMENT 'sign_type=2时使用', + `key_format` tinyint(4) NOT NULL DEFAULT '1' COMMENT '秘钥格式,1:PKCS8(JAVA适用),2:PKCS1(非JAVA适用)', + `public_key_isv` text NOT NULL COMMENT '开发者生成的公钥', + `private_key_isv` text NOT NULL COMMENT '开发者生成的私钥(交给开发者)', + `public_key_platform` text NOT NULL COMMENT '平台生成的公钥(交给开发者)', + `private_key_platform` text NOT NULL COMMENT '平台生成的私钥', + `gmt_create` datetime DEFAULT CURRENT_TIMESTAMP, + `gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_appkey` (`app_key`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='ISV秘钥'; + +INSERT INTO `sop`.`isv_keys` (`app_key`,`sign_type`, `secret`,`key_format`, `public_key_isv`, `private_key_isv`, `public_key_platform`, `private_key_platform`) +select app_key, sign_type, secret, 1, pub_key,pri_key,'','' from isv_info; \ No newline at end of file diff --git a/sop-admin/readme.md b/sop-admin/readme.md index 64ed8033..ac3691f3 100644 --- a/sop-admin/readme.md +++ b/sop-admin/readme.md @@ -1,5 +1,5 @@ # 后台admin -- sop-admin-front: admin前端layui实现 +- sop-admin-front: admin前端layui实现(停止维护,改用sop-admin-vue) - sop-admin-server: admin服务端 - sop-admin-vue: admin前端vue实现 diff --git a/sop-admin/sop-admin-front/README.md b/sop-admin/sop-admin-front/README.md index b0ac9581..708b3bf6 100644 --- a/sop-admin/sop-admin-front/README.md +++ b/sop-admin/sop-admin-front/README.md @@ -1,4 +1,4 @@ -# admin前端页面 +# admin前端页面(停止维护,改用sop-admin-vue) 做到前后端分离。 diff --git a/sop-admin/sop-admin-server/pom.xml b/sop-admin/sop-admin-server/pom.xml index 6ddcf87f..f3e41d94 100644 --- a/sop-admin/sop-admin-server/pom.xml +++ b/sop-admin/sop-admin-server/pom.xml @@ -13,7 +13,7 @@ org.springframework.boot spring-boot-starter-parent - 2.0.3.RELEASE + 2.1.4.RELEASE @@ -27,12 +27,12 @@ - + sop-registry-api + 1.12.0-SNAPSHOT + + net.oschina.durcframework @@ -78,12 +78,6 @@ - - com.squareup.okhttp3 - okhttp - ${okhttp.version} - - org.springframework.boot spring-boot-starter-web @@ -109,6 +103,12 @@ 1.18.4 provided + + org.springframework.cloud + spring-cloud-commons + 2.1.0.RELEASE + compile + diff --git a/sop-admin/sop-admin-server/readme.md b/sop-admin/sop-admin-server/readme.md index 4ce8a684..e0c3b801 100644 --- a/sop-admin/sop-admin-server/readme.md +++ b/sop-admin/sop-admin-server/readme.md @@ -1,9 +1,7 @@ -# easyopen-server - -启动后,接口url:http://ip:port/api - -如果有contextPath的话则是:http://ip:port/contextPath/api - -业务类在api下,重点关注这里即可。 +# sop admin服务端 +- 打开`application-dev.yml`,修改数据库`username/password` +- 运行`SopAdminServerApplication.java` +- 访问:`http://localhost:8082` +登录账号:admin/123456 diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/IsvApi.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/IsvApi.java index 64e6ca4f..273c3553 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/IsvApi.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/IsvApi.java @@ -7,40 +7,50 @@ import com.gitee.easyopen.doc.DataType; import com.gitee.easyopen.doc.annotation.ApiDoc; import com.gitee.easyopen.doc.annotation.ApiDocField; import com.gitee.easyopen.doc.annotation.ApiDocMethod; -import com.gitee.easyopen.exception.ApiException; import com.gitee.easyopen.util.CopyUtil; -import com.gitee.easyopen.util.KeyStore; -import com.gitee.easyopen.util.RSAUtil; import com.gitee.fastmybatis.core.PageInfo; import com.gitee.fastmybatis.core.query.Query; +import com.gitee.fastmybatis.core.query.Sort; import com.gitee.fastmybatis.core.util.MapperUtil; import com.gitee.sop.adminserver.api.IdParam; -import com.gitee.sop.adminserver.api.isv.param.IsvInfoForm; import com.gitee.sop.adminserver.api.isv.param.IsvInfoFormAdd; import com.gitee.sop.adminserver.api.isv.param.IsvInfoFormUpdate; +import com.gitee.sop.adminserver.api.isv.param.IsvKeysFormUpdate; +import com.gitee.sop.adminserver.api.isv.param.IsvKeysGen; import com.gitee.sop.adminserver.api.isv.param.IsvPageParam; -import com.gitee.sop.adminserver.api.isv.result.IsvFormVO; -import com.gitee.sop.adminserver.api.isv.result.IsvVO; +import com.gitee.sop.adminserver.api.isv.result.IsvDetailDTO; +import com.gitee.sop.adminserver.api.isv.result.IsvInfoVO; +import com.gitee.sop.adminserver.api.isv.result.IsvKeysGenVO; +import com.gitee.sop.adminserver.api.isv.result.IsvKeysVO; import com.gitee.sop.adminserver.api.isv.result.RoleVO; import com.gitee.sop.adminserver.bean.ChannelMsg; import com.gitee.sop.adminserver.bean.ZookeeperContext; +import com.gitee.sop.adminserver.common.BizException; import com.gitee.sop.adminserver.common.IdGen; +import com.gitee.sop.adminserver.common.RSATool; +import com.gitee.sop.adminserver.common.ZookeeperPathNotExistException; import com.gitee.sop.adminserver.entity.IsvInfo; +import com.gitee.sop.adminserver.entity.IsvKeys; import com.gitee.sop.adminserver.entity.PermIsvRole; import com.gitee.sop.adminserver.entity.PermRole; import com.gitee.sop.adminserver.mapper.IsvInfoMapper; +import com.gitee.sop.adminserver.mapper.IsvKeysMapper; import com.gitee.sop.adminserver.mapper.PermIsvRoleMapper; import com.gitee.sop.adminserver.mapper.PermRoleMapper; import com.gitee.sop.adminserver.service.RoutePermissionService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.transaction.annotation.Transactional; +import javax.validation.constraints.NotBlank; import java.text.SimpleDateFormat; import java.util.Collections; import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -51,10 +61,21 @@ import java.util.stream.Collectors; @Slf4j public class IsvApi { - public static final int SIGN_TYPE_RSA2 = 1; + public static final byte SIGN_TYPE_RSA = 1; + public static final byte SIGN_TYPE_MD5 = 2; + + static Map SIGN_TYPE_MAP = new HashMap<>(); + static { + SIGN_TYPE_MAP.put("rsa", (byte) SIGN_TYPE_RSA); + SIGN_TYPE_MAP.put("md5", (byte) SIGN_TYPE_MD5); + } + @Autowired IsvInfoMapper isvInfoMapper; + @Autowired + IsvKeysMapper isvKeysMapper; + @Autowired PermIsvRoleMapper permIsvRoleMapper; @@ -64,25 +85,29 @@ public class IsvApi { @Autowired RoutePermissionService routePermissionService; + @Value("${sop.sign-type}") + private String sopSignType; + @Api(name = "isv.info.page") @ApiDocMethod(description = "isv列表", results = { @ApiDocField(name = "pageIndex", description = "第几页", dataType = DataType.INT, example = "1"), @ApiDocField(name = "pageSize", description = "每页几条数据", dataType = DataType.INT, example = "10"), @ApiDocField(name = "total", description = "每页几条数据", dataType = DataType.LONG, example = "100"), - @ApiDocField(name = "rows", description = "数据", dataType = DataType.ARRAY, elementClass = IsvVO.class) + @ApiDocField(name = "rows", description = "数据", dataType = DataType.ARRAY, elementClass = IsvInfoVO.class) }) - PageInfo pageIsv(IsvPageParam param) { + PageInfo pageIsv(IsvPageParam param) { Query query = Query.build(param); + query.orderby("id", Sort.DESC); PageInfo pageInfo = MapperUtil.query(isvInfoMapper, query); List list = pageInfo.getList(); - List retList = list.stream() + List retList = list.stream() .map(isvInfo -> { return buildIsvVO(isvInfo); }) .collect(Collectors.toList()); - PageInfo pageInfoRet = new PageInfo<>(); + PageInfo pageInfoRet = new PageInfo<>(); pageInfoRet.setTotal(pageInfo.getTotal()); pageInfoRet.setList(retList); @@ -91,16 +116,31 @@ public class IsvApi { @Api(name = "isv.info.get") @ApiDocMethod(description = "获取isv") - IsvVO getIsvVO(IdParam param) { + IsvInfoVO getIsvVO(IdParam param) { IsvInfo isvInfo = isvInfoMapper.getById(param.getId()); return buildIsvVO(isvInfo); } - private IsvVO buildIsvVO(IsvInfo isvInfo) { + @Api(name = "isv.keys.get") + @ApiDocMethod(description = "获取isv2") + IsvKeysVO getIsvKeys(@NotBlank(message = "appKey不能为空") + @ApiDocField(description = "appKey") + String appKey) { + IsvKeys isvKeys = isvKeysMapper.getByColumn("app_key", appKey); + IsvKeysVO isvDetailVO = new IsvKeysVO(); + if (isvKeys != null) { + CopyUtil.copyProperties(isvKeys, isvDetailVO); + } + isvDetailVO.setAppKey(appKey); + isvDetailVO.setSignType(getSignType()); + return isvDetailVO; + } + + private IsvInfoVO buildIsvVO(IsvInfo isvInfo) { if (isvInfo == null) { return null; } - IsvVO vo = new IsvVO(); + IsvInfoVO vo = new IsvInfoVO(); CopyUtil.copyProperties(isvInfo, vo); vo.setRoleList(this.buildIsvRole(isvInfo)); return vo; @@ -132,72 +172,110 @@ public class IsvApi { @ApiDocMethod(description = "添加isv") @Transactional(rollbackFor = Exception.class) public void addIsv(IsvInfoFormAdd param) throws Exception { - if (isvInfoMapper.getByColumn("app_key", param.getAppKey()) != null) { - throw new ApiException("appKey已存在"); - } - formatForm(param); + String appKey = new SimpleDateFormat("yyyyMMdd").format(new Date()) + IdGen.nextId(); IsvInfo rec = new IsvInfo(); + rec.setAppKey(appKey); CopyUtil.copyPropertiesIgnoreNull(param, rec); isvInfoMapper.saveIgnoreNull(rec); if (CollectionUtils.isNotEmpty(param.getRoleCode())) { this.saveIsvRole(rec, param.getRoleCode()); } + IsvKeysGenVO isvKeysGenVO = this.createIsvKeys(); + IsvKeys isvKeys = new IsvKeys(); + isvKeys.setAppKey(appKey); + isvKeys.setSignType(getSignType()); + CopyUtil.copyPropertiesIgnoreNull(isvKeysGenVO, isvKeys); + isvKeysMapper.saveIgnoreNull(isvKeys); - this.sendChannelMsg(rec); + this.sendChannelMsg(rec.getAppKey()); + } + + private byte getSignType() { + return SIGN_TYPE_MAP.getOrDefault(sopSignType, SIGN_TYPE_RSA); } @Api(name = "isv.info.update") @ApiDocMethod(description = "修改isv") @Transactional(rollbackFor = Exception.class) public void updateIsv(IsvInfoFormUpdate param) { - formatForm(param); IsvInfo rec = isvInfoMapper.getById(param.getId()); CopyUtil.copyPropertiesIgnoreNull(param, rec); isvInfoMapper.updateIgnoreNull(rec); this.saveIsvRole(rec, param.getRoleCode()); - this.sendChannelMsg(rec); + this.sendChannelMsg(rec.getAppKey()); } - private void formatForm(IsvInfoForm form) { - if (form.getSignType() == SIGN_TYPE_RSA2) { - form.setSecret(""); + @Api(name = "isv.keys.update") + @ApiDocMethod(description = "修改isv") + @Transactional(rollbackFor = Exception.class) + public void updateIsvKeys(IsvKeysFormUpdate param) { + IsvKeys isvKeys = isvKeysMapper.getByColumn("app_key", param.getAppKey()); + if (isvKeys == null) { + isvKeys = new IsvKeys(); + CopyUtil.copyPropertiesIgnoreNull(param, isvKeys); + isvKeys.setSignType(getSignType()); + isvKeysMapper.saveIgnoreNull(isvKeys); } else { - form.setPubKey(""); - form.setPriKey(""); + CopyUtil.copyPropertiesIgnoreNull(param, isvKeys); + isvKeysMapper.updateIgnoreNull(isvKeys); } + + this.sendChannelMsg(isvKeys.getAppKey()); } - private void sendChannelMsg(IsvInfo rec) { - ChannelMsg channelMsg = new ChannelMsg("update", rec); + private void sendChannelMsg(String appKey) { + IsvDetailDTO isvDetail = isvInfoMapper.getIsvDetail(appKey); + if (isvDetail == null) { + return; + } + ChannelMsg channelMsg = new ChannelMsg("update", isvDetail); String path = ZookeeperContext.getIsvInfoChannelPath(); String data = JSON.toJSONString(channelMsg); try { log.info("消息推送--ISV信息(update), path:{}, data:{}", path, data); ZookeeperContext.updatePathData(path, data); - } catch (Exception e) { + } catch (ZookeeperPathNotExistException e) { log.error("发送isvChannelMsg失败, path:{}, msg:{}", path, data, e); - throw new ApiException("保存失败,请查看日志"); + throw new BizException("路径不存在"); } } - @Api(name = "isv.form.gen") - @ApiDocMethod(description = "isv表单内容一键生成") - IsvFormVO createIsvForm() throws Exception { - IsvFormVO isvFormVO = new IsvFormVO(); - String appKey = new SimpleDateFormat("yyyyMMdd").format(new Date()) + IdGen.nextId(); + private IsvKeysGenVO createIsvKeys() throws Exception { + IsvKeysGenVO isvFormVO = new IsvKeysGenVO(); String secret = IdGen.uuid(); - isvFormVO.setAppKey(appKey); isvFormVO.setSecret(secret); - KeyStore keyStore = RSAUtil.createKeys(); - isvFormVO.setPubKey(keyStore.getPublicKey()); - isvFormVO.setPriKey(keyStore.getPrivateKey()); + RSATool rsaToolIsv = new RSATool(RSATool.KeyFormat.PKCS8, RSATool.KeyLength.LENGTH_2048); + RSATool.KeyStore keyStoreIsv = rsaToolIsv.createKeys(); + isvFormVO.setPublicKeyIsv(keyStoreIsv.getPublicKey()); + isvFormVO.setPrivateKeyIsv(keyStoreIsv.getPrivateKey()); + + RSATool rsaToolPlatform = new RSATool(RSATool.KeyFormat.PKCS8, RSATool.KeyLength.LENGTH_2048); + RSATool.KeyStore keyStorePlatform = rsaToolPlatform.createKeys(); + isvFormVO.setPublicKeyPlatform(keyStorePlatform.getPublicKey()); + isvFormVO.setPrivateKeyPlatform(keyStorePlatform.getPrivateKey()); return isvFormVO; } + @Api(name = "isv.keys.gen") + @ApiDocMethod(description = "生成公私钥") + RSATool.KeyStore createPubPriKey(IsvKeysGen param) throws Exception { + RSATool.KeyFormat format = RSATool.KeyFormat.PKCS8; + Byte keyFormat = param.getKeyFormat(); + if (keyFormat != null && keyFormat == 2) { + format = RSATool.KeyFormat.PKCS1; + } + RSATool rsaTool = new RSATool(format, RSATool.KeyLength.LENGTH_2048); + return rsaTool.createKeys(); + } + @Api(name = "isv.secret.gen") + @ApiDocMethod(description = "生成MD秘钥") + String createSecret() throws Exception { + return IdGen.uuid(); + } void saveIsvRole(IsvInfo isvInfo, List roleCodeList) { Query query = new Query(); @@ -222,7 +300,7 @@ public class IsvApi { routePermissionService.sendIsvRolePermissionToZookeeper(isvInfo.getAppKey(), roleCodeList); } catch (Exception e) { log.error("保存到zookeeper中失败,isvInfo:{}, roleCodeList:{}", isvInfo, roleCodeList); - throw new ApiException("保存失败,请查看日志"); + throw new BizException("同步zookeeper失败,请查看网关日志"); } } } diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/RoleApi.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/RoleApi.java index b659ed66..b8ae1c97 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/RoleApi.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/RoleApi.java @@ -3,14 +3,20 @@ package com.gitee.sop.adminserver.api.isv; import com.gitee.easyopen.annotation.Api; import com.gitee.easyopen.annotation.ApiService; import com.gitee.easyopen.doc.annotation.ApiDoc; +import com.gitee.easyopen.doc.annotation.ApiDocMethod; import com.gitee.easyopen.util.CopyUtil; -import com.gitee.fastmybatis.core.PageInfo; import com.gitee.fastmybatis.core.query.Query; import com.gitee.fastmybatis.core.query.Sort; import com.gitee.fastmybatis.core.support.PageEasyui; import com.gitee.fastmybatis.core.util.MapperUtil; +import com.gitee.sop.adminserver.api.isv.param.RoleForm; +import com.gitee.sop.adminserver.api.isv.param.RolePageParam; import com.gitee.sop.adminserver.api.isv.result.RoleVO; +import com.gitee.sop.adminserver.common.BizException; +import com.gitee.sop.adminserver.entity.PermRole; +import com.gitee.sop.adminserver.entity.PermRolePermission; import com.gitee.sop.adminserver.mapper.PermRoleMapper; +import com.gitee.sop.adminserver.mapper.PermRolePermissionMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -28,6 +34,9 @@ public class RoleApi { @Autowired PermRoleMapper permRoleMapper; + @Autowired + PermRolePermissionMapper permRolePermissionMapper; + @Api(name = "role.listall") List roleListall() { Query query = new Query(); @@ -40,4 +49,39 @@ public class RoleApi { }) .collect(Collectors.toList()); } + + @ApiDocMethod(description = "获取角色,分页") + @Api(name = "role.page") + PageEasyui pageRole(RolePageParam rolePage) { + Query query = Query.build(rolePage); + return MapperUtil.queryForEasyuiDatagrid(permRoleMapper, query, RoleVO.class); + } + + @Api(name = "role.add") + void addRole(RoleForm roleForm) { + PermRole rec = permRoleMapper.getByColumn("role_code", roleForm.getRoleCode()); + if (rec != null) { + throw new BizException("角色码已存在"); + } + PermRole permRole = new PermRole(); + CopyUtil.copyPropertiesIgnoreNull(roleForm, permRole); + permRoleMapper.saveIgnoreNull(permRole); + } + + @Api(name = "role.update") + void updateRole(RoleForm roleForm) { + PermRole rec = permRoleMapper.getById(roleForm.getId()); + rec.setDescription(roleForm.getDescription()); + permRoleMapper.updateIgnoreNull(rec); + } + + @Api(name = "role.del") + void delRole(long id) { + PermRole rec = permRoleMapper.getById(id); + PermRolePermission rolePermission = permRolePermissionMapper.getByColumn("role_code", rec.getRoleCode()); + if (rolePermission != null) { + throw new BizException("该角色已使用,无法删除"); + } + permRoleMapper.deleteById(id); + } } diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/param/IsvInfoForm.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/param/IsvInfoForm.java index 72be5d7f..6d62d1c2 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/param/IsvInfoForm.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/param/IsvInfoForm.java @@ -2,9 +2,7 @@ package com.gitee.sop.adminserver.api.isv.param; import com.gitee.easyopen.doc.annotation.ApiDocField; import lombok.Data; -import org.hibernate.validator.constraints.Length; -import javax.validation.constraints.NotNull; import java.util.Collections; import java.util.List; @@ -14,22 +12,6 @@ import java.util.List; @Data public class IsvInfoForm { - @NotNull(message = "signType不能为null") - private Byte signType; - - /** secret, 数据库字段:secret */ - @ApiDocField(description = "secret") - @Length(max = 100,message = "secret长度不能超过100") - private String secret = ""; - - /** 公钥, 数据库字段:pub_key */ - @ApiDocField(description = "pubKey") - private String pubKey; - - /** 私钥, 数据库字段:pri_key */ - @ApiDocField(description = "priKey") - private String priKey; - /** 0启用,1禁用, 数据库字段:status */ @ApiDocField(description = "状态:0:启用,1:禁用") private Byte status = 0; diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/param/IsvInfoFormAdd.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/param/IsvInfoFormAdd.java index d81c93d4..5fd533b5 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/param/IsvInfoFormAdd.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/param/IsvInfoFormAdd.java @@ -1,11 +1,7 @@ package com.gitee.sop.adminserver.api.isv.param; -import com.gitee.easyopen.doc.annotation.ApiDocField; import lombok.Getter; import lombok.Setter; -import org.hibernate.validator.constraints.Length; - -import javax.validation.constraints.NotBlank; /** * @author tanghc @@ -13,9 +9,4 @@ import javax.validation.constraints.NotBlank; @Getter @Setter public class IsvInfoFormAdd extends IsvInfoForm { - /** appKey, 数据库字段:app_key */ - @ApiDocField(description = "appKey", required = true) - @NotBlank(message = "appKey不能为空") - @Length(max = 100,message = "appKey长度不能超过100") - private String appKey; } diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/param/IsvKeysFormUpdate.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/param/IsvKeysFormUpdate.java new file mode 100644 index 00000000..652db61e --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/param/IsvKeysFormUpdate.java @@ -0,0 +1,47 @@ +package com.gitee.sop.adminserver.api.isv.param; + +import com.gitee.easyopen.doc.annotation.ApiDocField; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; + +/** + * @author tanghc + */ +@Data +public class IsvKeysFormUpdate { + /** appKey, 数据库字段:app_key */ + @ApiDocField(description = "appKey", example = "aaaa") + @NotBlank(message = "appKey不能为空") + @Length(max = 100,message = "appKey长度不能超过100") + private String appKey; + + /** secret, 数据库字段:secret */ + @ApiDocField(description = "secret", example = "bbbb") + private String secret; + + /** 秘钥格式,1:PKCS8(JAVA适用),2:PKCS1(非JAVA适用), 数据库字段:key_format */ + @ApiDocField(description = "秘钥格式,1:PKCS8(JAVA适用),2:PKCS1(非JAVA适用)", example = "1") + @Min(value = 1, message = "秘钥格式错误") + @Max(value = 2, message = "秘钥格式错误") + private Byte keyFormat; + + /** 开发者生成的公钥, 数据库字段:public_key_isv */ + @ApiDocField(description = "开发者生成的公钥") + private String publicKeyIsv; + + /** 开发者生成的私钥(交给开发者), 数据库字段:private_key_isv */ + @ApiDocField(description = "开发者生成的私钥") + private String privateKeyIsv; + + /** 平台生成的公钥(交给开发者), 数据库字段:public_key_platform */ + @ApiDocField(description = "平台生成的公钥") + private String publicKeyPlatform; + + /** 平台生成的私钥, 数据库字段:private_key_platform */ + @ApiDocField(description = "平台生成的私钥") + private String privateKeyPlatform; +} diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/param/IsvKeysGen.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/param/IsvKeysGen.java new file mode 100644 index 00000000..f6b99eed --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/param/IsvKeysGen.java @@ -0,0 +1,18 @@ +package com.gitee.sop.adminserver.api.isv.param; + +import com.gitee.easyopen.doc.annotation.ApiDocField; +import lombok.Data; + +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; + +/** + * @author tanghc + */ +@Data +public class IsvKeysGen { + @ApiDocField(description = "秘钥格式,1:PKCS8(JAVA适用),2:PKCS1(非JAVA适用)", example = "1") + @Min(value = 1, message = "秘钥格式错误") + @Max(value = 2, message = "秘钥格式错误") + private Byte keyFormat; +} diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/param/RoleForm.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/param/RoleForm.java new file mode 100644 index 00000000..7e056a73 --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/param/RoleForm.java @@ -0,0 +1,24 @@ +package com.gitee.sop.adminserver.api.isv.param; + +import com.gitee.easyopen.doc.annotation.ApiDocField; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; + +/** + * @author tanghc + */ +@Data +public class RoleForm { + @ApiDocField(description = "id") + private Long id; + + @ApiDocField(description = "角色码") + @NotBlank(message = "roleCode不能为空") + @Length(max = 64) + private String roleCode; + + @ApiDocField(description = "描述") + private String description; +} diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/param/RolePageParam.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/param/RolePageParam.java new file mode 100644 index 00000000..34690881 --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/param/RolePageParam.java @@ -0,0 +1,19 @@ +package com.gitee.sop.adminserver.api.isv.param; + +import com.gitee.easyopen.doc.annotation.ApiDocField; +import com.gitee.fastmybatis.core.query.Operator; +import com.gitee.fastmybatis.core.query.annotation.Condition; +import com.gitee.fastmybatis.core.query.param.PageParam; +import lombok.Getter; +import lombok.Setter; + +/** + * @author tanghc + */ +@Getter +@Setter +public class RolePageParam extends PageParam { + @ApiDocField(description = "角色码") + @Condition(operator = Operator.like) + private String roleCode; +} diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvAppKeyGenVO.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvAppKeyGenVO.java new file mode 100644 index 00000000..94d5ef1f --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvAppKeyGenVO.java @@ -0,0 +1,11 @@ +package com.gitee.sop.adminserver.api.isv.result; + +import lombok.Data; + +/** + * @author tanghc + */ +@Data +public class IsvAppKeyGenVO { + private String appKey; +} diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvDetailDTO.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvDetailDTO.java new file mode 100644 index 00000000..ae625f9a --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvDetailDTO.java @@ -0,0 +1,34 @@ +package com.gitee.sop.adminserver.api.isv.result; + +import com.gitee.easyopen.doc.annotation.ApiDocField; +import lombok.Data; + +/** + * @author tanghc + */ +@Data +public class IsvDetailDTO { + + /** appKey, 数据库字段:app_key */ + @ApiDocField(description = "appKey", example = "aaaa") + private String appKey; + + /** 0启用,1禁用, 数据库字段:status */ + @ApiDocField(description = "状态:0启用,1禁用") + private Byte status; + + /** secret, 数据库字段:secret */ + @ApiDocField(description = "secret", example = "bbbb") + private String secret; + + /** 开发者生成的公钥, 数据库字段:public_key_isv */ + @ApiDocField(description = "开发者生成的公钥") + private String publicKeyIsv; + + /** 平台生成的私钥, 数据库字段:private_key_platform */ + @ApiDocField(description = "平台生成的私钥") + private String privateKeyPlatform; + + @ApiDocField(description = "签名类型:1:RSA2,2:MD5") + private Byte signType; +} diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvFormVO.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvFormVO.java deleted file mode 100644 index 262fc25b..00000000 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvFormVO.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.gitee.sop.adminserver.api.isv.result; - -import com.gitee.easyopen.doc.annotation.ApiDocField; -import lombok.Data; - -/** - * @author tanghc - */ -@Data -public class IsvFormVO { - @ApiDocField(description = "appKey", example = "aaaa") - private String appKey; - - @ApiDocField(description = "secret", example = "bbbb") - private String secret; - - @ApiDocField(description = "pubKey") - private String pubKey; - - @ApiDocField(description = "priKey") - private String priKey; - -} diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvVO.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvInfoVO.java similarity index 72% rename from sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvVO.java rename to sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvInfoVO.java index 25f020ed..e2279495 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvVO.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvInfoVO.java @@ -10,7 +10,7 @@ import java.util.List; * @author thc */ @Data -public class IsvVO { +public class IsvInfoVO { /** 数据库字段:id */ @ApiDocField(description = "id", example = "1") private Long id; @@ -19,18 +19,6 @@ public class IsvVO { @ApiDocField(description = "appKey", example = "aaaa") private String appKey; - /** secret, 数据库字段:secret */ - @ApiDocField(description = "secret", example = "bbbb") - private String secret; - - /** 公钥, 数据库字段:pub_key */ - @ApiDocField(description = "pubKey") - private String pubKey; - - /** 私钥, 数据库字段:pri_key */ - @ApiDocField(description = "priKey") - private String priKey; - /** 0启用,1禁用, 数据库字段:status */ @ApiDocField(description = "状态:0启用,1禁用") private Byte status; diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvKeysGenVO.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvKeysGenVO.java new file mode 100644 index 00000000..bc21d082 --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvKeysGenVO.java @@ -0,0 +1,25 @@ +package com.gitee.sop.adminserver.api.isv.result; + +import lombok.Data; + +/** + * @author tanghc + */ +@Data +public class IsvKeysGenVO { + /** secret, 数据库字段:secret */ + private String secret; + + /** 开发者生成的公钥, 数据库字段:public_key_isv */ + private String publicKeyIsv; + + /** 开发者生成的私钥(交给开发者), 数据库字段:private_key_isv */ + private String privateKeyIsv; + + /** 平台生成的公钥(交给开发者), 数据库字段:public_key_platform */ + private String publicKeyPlatform; + + /** 平台生成的私钥, 数据库字段:private_key_platform */ + private String privateKeyPlatform; + +} diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvKeysVO.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvKeysVO.java new file mode 100644 index 00000000..a3bf39aa --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvKeysVO.java @@ -0,0 +1,38 @@ +package com.gitee.sop.adminserver.api.isv.result; + +import com.gitee.easyopen.doc.annotation.ApiDocField; +import lombok.Data; + +/** + * @author thc + */ +@Data +public class IsvKeysVO { + + /** appKey, 数据库字段:app_key */ + @ApiDocField(description = "appKey", example = "aaaa") + private String appKey; + + /** secret, 数据库字段:secret */ + @ApiDocField(description = "secret", example = "bbbb") + private String secret; + + /** 秘钥格式,1:PKCS8(JAVA适用),2:PKCS1(非JAVA适用), 数据库字段:key_format */ + private Byte keyFormat = 1; + + /** 开发者生成的公钥, 数据库字段:public_key_isv */ + private String publicKeyIsv; + + /** 开发者生成的私钥(交给开发者), 数据库字段:private_key_isv */ + private String privateKeyIsv; + + /** 平台生成的公钥(交给开发者), 数据库字段:public_key_platform */ + private String publicKeyPlatform; + + /** 平台生成的私钥, 数据库字段:private_key_platform */ + private String privateKeyPlatform; + + @ApiDocField(description = "签名类型:1:RSA2,2:MD5") + private Byte signType = 1; + +} diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/RoleVO.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/RoleVO.java index 3665b427..70b3ab9f 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/RoleVO.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/RoleVO.java @@ -10,10 +10,18 @@ import java.util.Date; */ @Data public class RoleVO { + @ApiDocField(description = "id") private Long id; + @ApiDocField(description = "角色码") private String roleCode; + @ApiDocField(description = "描述") private String description; + + @ApiDocField(description = "创建时间") private Date gmtCreate; + + @ApiDocField(description = "修改时间") + private Date gmtModified; } diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/LimitApi.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/LimitApi.java index 5d5d524c..e6ddb5cd 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/LimitApi.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/LimitApi.java @@ -4,7 +4,6 @@ import com.gitee.easyopen.annotation.Api; import com.gitee.easyopen.annotation.ApiService; import com.gitee.easyopen.doc.annotation.ApiDoc; import com.gitee.easyopen.doc.annotation.ApiDocMethod; -import com.gitee.easyopen.exception.ApiException; import com.gitee.easyopen.util.CopyUtil; import com.gitee.fastmybatis.core.query.Query; import com.gitee.sop.adminserver.api.service.param.LimitParam; @@ -12,6 +11,7 @@ import com.gitee.sop.adminserver.api.service.param.RouteSearchParam; import com.gitee.sop.adminserver.api.service.result.LimitVO; import com.gitee.sop.adminserver.bean.GatewayRouteDefinition; import com.gitee.sop.adminserver.bean.RouteConfigDto; +import com.gitee.sop.adminserver.common.BizException; import com.gitee.sop.adminserver.common.LimitEnum; import com.gitee.sop.adminserver.entity.ConfigRouteLimit; import com.gitee.sop.adminserver.mapper.ConfigRouteLimitMapper; @@ -118,7 +118,7 @@ public class LimitApi { routeConfigService.sendRouteConfigMsg(routeConfigDto); } catch (Exception e) { log.error("推送限流消息错误, param:{}", param, e); - throw new ApiException("修改失败,请查看日志"); + throw new BizException("修改失败,请查看日志"); } } } diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/LimitNewApi.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/LimitNewApi.java index e31fe409..d67ee856 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/LimitNewApi.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/LimitNewApi.java @@ -4,7 +4,6 @@ import com.gitee.easyopen.annotation.Api; import com.gitee.easyopen.annotation.ApiService; import com.gitee.easyopen.doc.annotation.ApiDoc; import com.gitee.easyopen.doc.annotation.ApiDocMethod; -import com.gitee.easyopen.exception.ApiException; import com.gitee.easyopen.util.CopyUtil; import com.gitee.fastmybatis.core.PageInfo; import com.gitee.fastmybatis.core.query.Query; @@ -15,6 +14,7 @@ import com.gitee.sop.adminserver.api.service.param.LimitNewParam; import com.gitee.sop.adminserver.api.service.param.LimitNewUpdateParam; import com.gitee.sop.adminserver.api.service.result.LimitNewVO; import com.gitee.sop.adminserver.bean.ConfigLimitDto; +import com.gitee.sop.adminserver.common.BizException; import com.gitee.sop.adminserver.entity.ConfigLimit; import com.gitee.sop.adminserver.mapper.ConfigLimitMapper; import com.gitee.sop.adminserver.service.RouteConfigService; @@ -65,7 +65,7 @@ public class LimitNewApi { routeConfigService.sendLimitConfigMsg(configLimitDto); } catch (Exception e) { log.error("推送限流消息错误, param:{}", param, e); - throw new ApiException("新增失败,请查看日志"); + throw new BizException("新增失败,请查看日志"); } } @@ -87,7 +87,7 @@ public class LimitNewApi { routeConfigService.sendLimitConfigMsg(configLimitDto); } catch (Exception e) { log.error("推送限流消息错误, param:{}", param, e); - throw new ApiException("修改失败,请查看日志"); + throw new BizException("修改失败,请查看日志"); } } diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/LogApi.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/LogApi.java index ad037c42..e8f8060c 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/LogApi.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/LogApi.java @@ -6,11 +6,11 @@ import com.gitee.easyopen.annotation.Api; import com.gitee.easyopen.annotation.ApiService; import com.gitee.easyopen.doc.annotation.ApiDoc; import com.gitee.easyopen.doc.annotation.ApiDocMethod; -import com.gitee.easyopen.exception.ApiException; import com.gitee.easyopen.verify.DefaultMd5Verifier; import com.gitee.fastmybatis.core.query.Query; import com.gitee.sop.adminserver.api.service.param.LogMonitorInstanceAddParam; import com.gitee.sop.adminserver.api.service.result.LogMonitorInstanceVO; +import com.gitee.sop.adminserver.common.BizException; import com.gitee.sop.adminserver.common.QueryUtil; import com.gitee.sop.adminserver.entity.ConfigCommon; import com.gitee.sop.adminserver.mapper.ConfigCommonMapper; @@ -80,7 +80,7 @@ public class LogApi { } } catch (Exception e) { log.error("获取日志信息出错", e); - throw new ApiException("获取日志信息出错"); + logMonitorInstanceVOParent.setMonitorName(logMonitorInstanceVOParent.getMonitorName() + "(请求出错)"); } } Collections.sort(ret, Comparator.comparing(LogMonitorInstanceVO::getCount)); @@ -98,7 +98,7 @@ public class LogApi { String ipPort = configCommon.getConfigKey(); this.requestLogServer(ipPort, "clearErrors"); } catch (Exception e) { - throw new ApiException("清除失败"); + throw new BizException("清除失败"); } } @@ -114,7 +114,7 @@ public class LogApi { @Api(name = "monitor.instance.add") @ApiDocMethod(description = "添加监控实例") void addServiceInstance(LogMonitorInstanceAddParam param) { - String ipPort = param.getIp() + ":" + param.getPort(); + String ipPort = param.getIpPort(); this.checkInstance(ipPort); Query query = new Query(); @@ -122,7 +122,7 @@ public class LogApi { .eq("config_key", ipPort); ConfigCommon rec = configCommonMapper.getByQuery(query); if (rec != null) { - throw new ApiException("该实例已添加"); + throw new BizException("该实例已添加"); } ConfigCommon configCommon = new ConfigCommon(); configCommon.setConfigGroup(LOG_MONITOR_INSTANCE); @@ -137,11 +137,11 @@ public class LogApi { JSONObject jsonObject = JSON.parseObject(json); if (!CODE_SUCCESS.equals(jsonObject.getString("code"))) { log.error("请求结果:{}", json); - throw new ApiException("添加失败"); + throw new BizException("添加失败"); } } catch (Exception e) { log.error("添加失败", e); - throw new ApiException("添加失败"); + throw new BizException("添加失败"); } } diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/RouteApi.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/RouteApi.java index 433a0b00..8b582df2 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/RouteApi.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/RouteApi.java @@ -5,21 +5,22 @@ import com.gitee.easyopen.annotation.Api; import com.gitee.easyopen.annotation.ApiService; import com.gitee.easyopen.doc.annotation.ApiDoc; import com.gitee.easyopen.doc.annotation.ApiDocMethod; -import com.gitee.easyopen.exception.ApiException; import com.gitee.easyopen.util.CopyUtil; -import com.gitee.fastmybatis.core.query.Query; import com.gitee.sop.adminserver.api.isv.result.RoleVO; -import com.gitee.sop.adminserver.api.service.param.RouteParam; +import com.gitee.sop.adminserver.api.service.param.RouteAddParam; +import com.gitee.sop.adminserver.api.service.param.RouteDeleteParam; import com.gitee.sop.adminserver.api.service.param.RoutePermissionParam; import com.gitee.sop.adminserver.api.service.param.RouteSearchParam; +import com.gitee.sop.adminserver.api.service.param.RouteUpdateParam; import com.gitee.sop.adminserver.api.service.result.RouteVO; -import com.gitee.sop.adminserver.api.service.result.ServiceInfo; import com.gitee.sop.adminserver.bean.GatewayRouteDefinition; import com.gitee.sop.adminserver.bean.RouteConfigDto; import com.gitee.sop.adminserver.bean.ZookeeperContext; +import com.gitee.sop.adminserver.common.BizException; +import com.gitee.sop.adminserver.common.ZookeeperPathExistException; +import com.gitee.sop.adminserver.common.ZookeeperPathNotExistException; import com.gitee.sop.adminserver.entity.ConfigRouteBase; import com.gitee.sop.adminserver.entity.PermRole; -import com.gitee.sop.adminserver.entity.PermRolePermission; import com.gitee.sop.adminserver.mapper.ConfigRouteBaseMapper; import com.gitee.sop.adminserver.mapper.PermRoleMapper; import com.gitee.sop.adminserver.mapper.PermRolePermissionMapper; @@ -27,15 +28,11 @@ import com.gitee.sop.adminserver.service.RouteConfigService; import com.gitee.sop.adminserver.service.RoutePermissionService; import com.gitee.sop.adminserver.service.RouteService; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang.BooleanUtils; import org.apache.commons.lang.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -96,67 +93,84 @@ public class RouteApi { return routeDefinitionList; } + @Api(name = "route.add") + @ApiDocMethod(description = "新增路由") + void addRoute(RouteAddParam param) { + String id = param.getName() + param.getVersion(); + String routePath = ZookeeperContext.buildRoutePath(param.getServiceId(), id); + GatewayRouteDefinition routeDefinition = new GatewayRouteDefinition(); + CopyUtil.copyPropertiesIgnoreNull(param, routeDefinition); + routeDefinition.setId(id); + routeDefinition.setCustom(1); + try { + ZookeeperContext.addPath(routePath, JSON.toJSONString(routeDefinition)); + } catch (ZookeeperPathExistException e) { + throw new BizException("路由已存在"); + } + this.updateRouteConfig(routeDefinition); + } + @Api(name = "route.update") @ApiDocMethod(description = "修改路由") - void updateRoute(RouteParam param) throws Exception { - String serviceIdPath = ZookeeperContext.getSopRouteRootPath() + "/" + param.getServiceId(); - String zookeeperRoutePath = serviceIdPath + "/" + param.getId(); - String data = ZookeeperContext.getData(zookeeperRoutePath); - GatewayRouteDefinition routeDefinition = JSON.parseObject(data, GatewayRouteDefinition.class); + void updateRoute(RouteUpdateParam param) { + String routePath = ZookeeperContext.buildRoutePath(param.getServiceId(), param.getId()); + GatewayRouteDefinition routeDefinition = this.getGatewayRouteDefinition(routePath); CopyUtil.copyPropertiesIgnoreNull(param, routeDefinition); - ZookeeperContext.updatePathData(zookeeperRoutePath, JSON.toJSONString(routeDefinition)); + try { + ZookeeperContext.updatePathData(routePath, JSON.toJSONString(routeDefinition)); + } catch (ZookeeperPathNotExistException e) { + throw new BizException("路由不存在"); + } + this.updateRouteConfig(routeDefinition); + } - this.updateRouteConfig(param); + @Api(name = "route.del") + @ApiDocMethod(description = "删除路由") + void delRoute(RouteDeleteParam param) { + String routePath = ZookeeperContext.buildRoutePath(param.getServiceId(), param.getId()); + GatewayRouteDefinition routeDefinition = this.getGatewayRouteDefinition(routePath); + if (!BooleanUtils.toBoolean(routeDefinition.getCustom())) { + throw new BizException("非自定义路由,无法删除"); + } + ZookeeperContext.deletePathDeep(routePath); } - @Api(name = "route.add") - @ApiDocMethod(description = "新增路由") - void addRoute(RouteParam param) throws Exception { - String serviceIdPath = ZookeeperContext.getSopRouteRootPath() + "/" + param.getServiceId(); - String zookeeperRoutePath = serviceIdPath + "/" + param.getId(); - if (ZookeeperContext.isPathExist(zookeeperRoutePath)) { - throw new ApiException("id已存在"); + private GatewayRouteDefinition getGatewayRouteDefinition(String zookeeperRoutePath) { + String data = null; + try { + data = ZookeeperContext.getData(zookeeperRoutePath); + } catch (ZookeeperPathNotExistException e) { + throw new BizException("路由不存在"); } - GatewayRouteDefinition routeDefinition = new GatewayRouteDefinition(); - CopyUtil.copyPropertiesIgnoreNull(param, routeDefinition); - ZookeeperContext.createNewData(zookeeperRoutePath, JSON.toJSONString(routeDefinition)); - ServiceInfo serviceInfo = new ServiceInfo(); - serviceInfo.setServiceId(param.getServiceId()); - serviceInfo.setDescription(param.getServiceId()); - String now = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); - serviceInfo.setCreateTime(now); - serviceInfo.setUpdateTime(now); - ZookeeperContext.updatePathData(serviceIdPath, JSON.toJSONString(serviceInfo)); - - this.updateRouteConfig(param); + return JSON.parseObject(data, GatewayRouteDefinition.class); } - private void updateRouteConfig(RouteParam param) { + private void updateRouteConfig(GatewayRouteDefinition routeDefinition) { try { - String routeId = param.getId(); + String routeId = routeDefinition.getId(); ConfigRouteBase configRouteBase = configRouteBaseMapper.getByColumn("route_id", routeId); boolean doSave = configRouteBase == null; if (doSave) { configRouteBase = new ConfigRouteBase(); - configRouteBase.setRouteId(param.getId()); + configRouteBase.setRouteId(routeId); } - configRouteBase.setStatus(param.getStatus().byteValue()); + configRouteBase.setStatus((byte) routeDefinition.getStatus()); int i = doSave ? configRouteBaseMapper.save(configRouteBase) : configRouteBaseMapper.update(configRouteBase); if (i > 0) { - this.sendMsg(param); + this.sendMsg(routeDefinition); } } catch (Exception e) { log.error("发送msg失败", e); } } - private void sendMsg(RouteParam param) throws Exception { + private void sendMsg(GatewayRouteDefinition routeDefinition) { RouteConfigDto routeConfigDto = new RouteConfigDto(); - routeConfigDto.setRouteId(param.getId()); - routeConfigDto.setStatus(param.getStatus()); + routeConfigDto.setRouteId(routeDefinition.getId()); + routeConfigDto.setStatus(routeDefinition.getStatus()); routeConfigService.sendRouteConfigMsg(routeConfigDto); } @@ -164,11 +178,16 @@ public class RouteApi { @ApiDocMethod(description = "获取路由对应的角色", elementClass = RoleVO.class) List getRouteRole(RouteSearchParam param) { if (StringUtils.isBlank(param.getId())) { - throw new ApiException("id不能为空"); + throw new BizException("id不能为空"); } return this.getRouteRole(param.getId()); } + /** + * 获取路由对应的角色 + * @param id routeId + * @return + */ private List getRouteRole(String id) { return permRolePermissionMapper.listByColumn("route_id", id) .stream() @@ -184,33 +203,28 @@ public class RouteApi { @Api(name = "route.role.update") @ApiDocMethod(description = "更新路由对应的角色") - @Transactional(rollbackFor = Exception.class) public void updateRouteRole(RoutePermissionParam param) { - String routeId = param.getRouteId(); - // 删除所有数据 - Query delQuery = new Query(); - delQuery.eq("route_id", routeId); - permRolePermissionMapper.deleteByQuery(delQuery); - - List roleCodes = param.getRoleCode(); - if (CollectionUtils.isNotEmpty(roleCodes)) { - List tobeSave = new ArrayList<>(roleCodes.size()); - for (String roleCode : roleCodes) { - PermRolePermission permRolePermission = new PermRolePermission(); - permRolePermission.setRoleCode(roleCode); - permRolePermission.setRouteId(routeId); - tobeSave.add(permRolePermission); - } - // 批量添加 - permRolePermissionMapper.saveBatch(tobeSave); - } - + RoutePermissionParam oldRoutePermission = this.buildOldRoutePermission(param.getRouteId()); + routePermissionService.updateRoutePermission(param); try { - routePermissionService.sendRoutePermissionReloadMsg(); + routePermissionService.sendRoutePermissionReloadMsg(oldRoutePermission); } catch (Exception e) { - log.info("消息推送--路由权限(reload)失败", e); - throw new ApiException("修改失败,请查看日志"); + log.error("消息推送--路由权限(reload)失败", e); + // 回滚 + routePermissionService.updateRoutePermission(oldRoutePermission); + throw new BizException(e.getMessage()); } } + private RoutePermissionParam buildOldRoutePermission(String routeId) { + List routeRole = this.getRouteRole(routeId); + List roleCodeList = routeRole.stream() + .map(RoleVO::getRoleCode) + .collect(Collectors.toList()); + RoutePermissionParam routePermissionParam = new RoutePermissionParam(); + routePermissionParam.setRouteId(routeId); + routePermissionParam.setRoleCode(roleCodeList); + return routePermissionParam; + } + } diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/ServiceApi.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/ServiceApi.java index 93653a3b..05f6c147 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/ServiceApi.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/ServiceApi.java @@ -5,29 +5,30 @@ import com.gitee.easyopen.annotation.Api; import com.gitee.easyopen.annotation.ApiService; import com.gitee.easyopen.doc.annotation.ApiDoc; import com.gitee.easyopen.doc.annotation.ApiDocMethod; -import com.gitee.easyopen.exception.ApiException; -import com.gitee.sop.adminserver.api.service.param.ServiceInstanceParam; +import com.gitee.sop.adminserver.api.service.param.ServiceAddParam; import com.gitee.sop.adminserver.api.service.param.ServiceSearchParam; -import com.gitee.sop.adminserver.api.service.result.ServiceInfo; +import com.gitee.sop.adminserver.api.service.result.RouteServiceInfo; import com.gitee.sop.adminserver.api.service.result.ServiceInfoVo; -import com.gitee.sop.adminserver.bean.EurekaApplication; -import com.gitee.sop.adminserver.bean.EurekaApps; -import com.gitee.sop.adminserver.bean.EurekaInstance; -import com.gitee.sop.adminserver.bean.EurekaUri; +import com.gitee.sop.adminserver.api.service.result.ServiceInstanceVO; +import com.gitee.sop.adminserver.bean.ServiceRouteInfo; import com.gitee.sop.adminserver.bean.ZookeeperContext; +import com.gitee.sop.adminserver.common.BizException; +import com.gitee.sop.adminserver.common.ZookeeperPathExistException; +import com.gitee.sop.adminserver.common.ZookeeperPathNotExistException; +import com.gitee.sop.registryapi.bean.ServiceInfo; +import com.gitee.sop.registryapi.bean.ServiceInstance; +import com.gitee.sop.registryapi.service.RegistryService; import lombok.extern.slf4j.Slf4j; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; +import org.apache.commons.lang.BooleanUtils; import org.apache.commons.lang.StringUtils; import org.apache.curator.framework.recipes.cache.ChildData; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.env.Environment; -import javax.annotation.PostConstruct; import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; @@ -40,26 +41,19 @@ import java.util.stream.Collectors; @Slf4j public class ServiceApi { - - OkHttpClient client = new OkHttpClient(); - @Autowired - private Environment environment; - - private String eurekaUrl; + private RegistryService registryService; - // eureka.client.serviceUrl.defaultZone - - @Api(name = "service.list") - @ApiDocMethod(description = "服务列表(旧)", elementClass = ServiceInfo.class) - List listServiceInfo(ServiceSearchParam param) throws Exception { + @Api(name = "zookeeper.service.list") + @ApiDocMethod(description = "zk中的服务列表", elementClass = RouteServiceInfo.class) + List listServiceInfo(ServiceSearchParam param) { String routeRootPath = ZookeeperContext.getSopRouteRootPath(); List childDataList = ZookeeperContext.getChildrenData(routeRootPath); - List serviceInfoList = childDataList.stream() + List serviceInfoList = childDataList.stream() .filter(childData -> childData.getData() != null && childData.getData().length > 0) .map(childData -> { String serviceNodeData = new String(childData.getData()); - ServiceInfo serviceInfo = JSON.parseObject(serviceNodeData, ServiceInfo.class); + RouteServiceInfo serviceInfo = JSON.parseObject(serviceNodeData, RouteServiceInfo.class); return serviceInfo; }) .filter(serviceInfo -> { @@ -74,40 +68,83 @@ public class ServiceApi { return serviceInfoList; } - @Api(name = "service.instance.list") - @ApiDocMethod(description = "服务列表", elementClass = ServiceInfoVo.class) - List listService(ServiceSearchParam param) throws Exception { - String json = this.requestEurekaServer(EurekaUri.QUERY_APPS); - EurekaApps eurekaApps = JSON.parseObject(json, EurekaApps.class); + @Api(name = "service.custom.add") + @ApiDocMethod(description = "添加服务") + void addService(ServiceAddParam param) { + String serviceId = param.getServiceId(); + String servicePath = ZookeeperContext.buildServiceIdPath(serviceId); + ServiceRouteInfo serviceRouteInfo = new ServiceRouteInfo(); + Date now = new Date(); + serviceRouteInfo.setServiceId(serviceId); + serviceRouteInfo.setDescription("自定义服务"); + serviceRouteInfo.setCreateTime(now); + serviceRouteInfo.setUpdateTime(now); + serviceRouteInfo.setCustom(BooleanUtils.toInteger(true)); + String serviceData = JSON.toJSONString(serviceRouteInfo); + try { + ZookeeperContext.addPath(servicePath, serviceData); + } catch (ZookeeperPathExistException e) { + throw new BizException("服务已存在"); + } + } + + @Api(name = "service.custom.del") + @ApiDocMethod(description = "删除自定义服务") + void delService(ServiceSearchParam param) { + String serviceId = param.getServiceId(); + String servicePath = ZookeeperContext.buildServiceIdPath(serviceId); + String data = null; + try { + data = ZookeeperContext.getData(servicePath); + } catch (ZookeeperPathNotExistException e) { + throw new BizException("服务不存在"); + } + if (StringUtils.isBlank(data)) { + throw new BizException("非自定义服务,无法删除"); + } + ServiceRouteInfo serviceRouteInfo = JSON.parseObject(data, ServiceRouteInfo.class); + int custom = serviceRouteInfo.getCustom(); + if (!BooleanUtils.toBoolean(custom)) { + throw new BizException("非自定义服务,无法删除"); + } + ZookeeperContext.deletePathDeep(servicePath); + } - List serviceInfoVoList = new ArrayList<>(); - List applicationList = eurekaApps.getApplications().getApplication(); + @Api(name = "service.instance.list") + @ApiDocMethod(description = "获取注册中心的服务列表", elementClass = ServiceInfoVo.class) + List listService(ServiceSearchParam param) { + List serviceInfos; + try { + serviceInfos = registryService.listAllService(1, 99999/* 获取所有实例 */); + } catch (Exception e) { + log.error("获取服务实例失败", e); + return Collections.emptyList(); + } + List serviceInfoVoList = new ArrayList<>(); AtomicInteger idGen = new AtomicInteger(1); - applicationList.stream() - .filter(eurekaApplication -> { + serviceInfos.stream() + .filter(serviceInfo -> { if (StringUtils.isBlank(param.getServiceId())) { return true; } - return StringUtils.containsIgnoreCase(eurekaApplication.getName(), param.getServiceId()); + return StringUtils.containsIgnoreCase(serviceInfo.getServiceId(), param.getServiceId()); }) - .forEach(eurekaApplication -> { + .forEach(serviceInfo -> { int pid = idGen.getAndIncrement(); - String name = eurekaApplication.getName(); - ServiceInfoVo parent = new ServiceInfoVo(); + String serviceId = serviceInfo.getServiceId(); + ServiceInstanceVO parent = new ServiceInstanceVO(); parent.setId(pid); - parent.setName(name); + parent.setServiceId(serviceId); parent.setParentId(0); serviceInfoVoList.add(parent); - List instanceList = eurekaApplication.getInstance(); - for (EurekaInstance instance : instanceList) { - ServiceInfoVo vo = new ServiceInfoVo(); - BeanUtils.copyProperties(instance, vo); + List instanceList = serviceInfo.getInstances(); + for (ServiceInstance instance : instanceList) { + ServiceInstanceVO instanceVO = new ServiceInstanceVO(); + BeanUtils.copyProperties(instance, instanceVO); int id = idGen.getAndIncrement(); - vo.setId(id); - vo.setName(name); - vo.setParentId(pid); - vo.setServerPort(instance.fetchPort()); - serviceInfoVoList.add(vo); + instanceVO.setId(id); + instanceVO.setParentId(pid); + serviceInfoVoList.add(instanceVO); } }); @@ -116,38 +153,24 @@ public class ServiceApi { @Api(name = "service.instance.offline") @ApiDocMethod(description = "服务下线") - void serviceOffline(ServiceInstanceParam param) throws IOException { - this.requestEurekaServer(EurekaUri.OFFLINE_SERVICE, param.getServiceId(), param.getInstanceId()); + void serviceOffline(ServiceInstance param) { + try { + registryService.offlineInstance(param); + } catch (Exception e) { + log.error("下线失败,param:{}", param, e); + throw new BizException("下线失败,请查看日志"); + } } @Api(name = "service.instance.online") @ApiDocMethod(description = "服务上线") - void serviceOnline(ServiceInstanceParam param) throws IOException { - this.requestEurekaServer(EurekaUri.ONLINE_SERVICE, param.getServiceId(), param.getInstanceId()); - } - - private String requestEurekaServer(EurekaUri eurekaUri, String... args) throws IOException { - Request request = eurekaUri.getRequest(this.eurekaUrl, args); - Response response = client.newCall(request).execute(); - if (response.isSuccessful()) { - return response.body().string(); - } else { - log.error("操作失败,url:{}, msg:{}, code:{}", eurekaUri.getUri(args), response.message(), response.code()); - throw new ApiException("操作失败", String.valueOf(response.code())); - } - } - - @PostConstruct - protected void after() { - String eurekaUrls = environment.getProperty("eureka.client.serviceUrl.defaultZone"); - if (StringUtils.isBlank(eurekaUrls)) { - throw new ApiException("未指定eureka.client.serviceUrl.defaultZone参数"); - } - String url = eurekaUrls.split("\\,")[0]; - if (url.endsWith("/")) { - url = eurekaUrls.substring(0, eurekaUrls.length() - 1); + void serviceOnline(ServiceInstance param) throws IOException { + try { + registryService.onlineInstance(param); + } catch (Exception e) { + log.error("上线失败,param:{}", param, e); + throw new BizException("上线失败,请查看日志"); } - this.eurekaUrl = url; } } diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/LimitNewAddParam.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/LimitNewAddParam.java index 0936c270..e7da2c63 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/LimitNewAddParam.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/LimitNewAddParam.java @@ -41,10 +41,12 @@ public class LimitNewAddParam { /** 返回的错误码, 数据库字段:limit_code */ @ApiDocField(description = "返回的错误码") + @Length(max = 64, message = "limitCode长度不能超过64") private String limitCode; /** 返回的错误信息, 数据库字段:limit_msg */ @ApiDocField(description = "返回的错误信息") + @Length(max = 100, message = "limitMsg长度不能超过100") private String limitMsg; /** 令牌桶容量, 数据库字段:token_bucket_count */ diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/LimitNewUpdateParam.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/LimitNewUpdateParam.java index d04630e6..aebadc77 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/LimitNewUpdateParam.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/LimitNewUpdateParam.java @@ -46,10 +46,12 @@ public class LimitNewUpdateParam { /** 返回的错误码, 数据库字段:limit_code */ @ApiDocField(description = "返回的错误码") + @Length(max = 64, message = "limitCode长度不能超过64") private String limitCode; /** 返回的错误信息, 数据库字段:limit_msg */ @ApiDocField(description = "返回的错误信息") + @Length(max = 100, message = "limitMsg长度不能超过100") private String limitMsg; /** 令牌桶容量, 数据库字段:token_bucket_count */ diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/LogMonitorInstanceAddParam.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/LogMonitorInstanceAddParam.java index bc618268..5a902152 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/LogMonitorInstanceAddParam.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/LogMonitorInstanceAddParam.java @@ -12,8 +12,6 @@ public class LogMonitorInstanceAddParam { @NotBlank(message = "serviceId不能为空") private String serviceId; - @NotBlank(message = "ip不能为空") - private String ip; - - private int port; + @NotBlank(message = "ipPort不能为空") + private String ipPort; } diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/RouteAddParam.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/RouteAddParam.java new file mode 100644 index 00000000..f72a274e --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/RouteAddParam.java @@ -0,0 +1,76 @@ +package com.gitee.sop.adminserver.api.service.param; + +import com.gitee.easyopen.doc.annotation.ApiDocField; +import lombok.Getter; +import lombok.Setter; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * @author tanghc + */ +@Getter +@Setter +public class RouteAddParam { + + @NotBlank(message = "serviceId不能为空") + @Length(max = 100, message = "serviceId长度不能超过100") + @ApiDocField(description = "serviceId") + private String serviceId; + + /** + * 接口名 + */ + @NotBlank(message = "接口名不能为空") + @Length(max = 100, message = "name长度不能超过100") + @ApiDocField(description = "接口名") + private String name; + + /** + * 版本号 + */ + @NotBlank(message = "版本号不能为空") + @Length(max = 100, message = "version长度不能超过100") + @ApiDocField(description = "版本号") + private String version; + + /** + * 路由规则转发的目标uri + */ + @NotBlank(message = "uri不能为空") + @Length(max = 100, message = "uri长度不能超过100") + @ApiDocField(description = "路由uri") + private String uri; + + /** + * uri后面跟的path + */ + @ApiDocField(description = "路由path") + @Length(max = 100, message = "path长度不能超过100") + private String path; + + /** + * 是否忽略验证,业务参数验证除外 + */ + @ApiDocField(description = "是否忽略验证,业务参数验证除外,1:忽略,0:不忽略") + private Integer ignoreValidate; + + /** + * 合并结果,统一格式输出 + */ + @ApiDocField(description = "合并结果,统一格式输出,1:合并,2:不合并") + private Integer mergeResult; + + /** + * 状态 + */ + @NotNull + @ApiDocField(description = "状态,0:审核,1:启用,2:禁用") + private Integer status; + + @ApiDocField(description = "是否是自定义路由,1:是,0:否") + private Integer custom; + +} diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/RouteDeleteParam.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/RouteDeleteParam.java new file mode 100644 index 00000000..8ab52da5 --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/RouteDeleteParam.java @@ -0,0 +1,22 @@ +package com.gitee.sop.adminserver.api.service.param; + +import com.gitee.easyopen.doc.annotation.ApiDocField; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; + +/** + * @author tanghc + */ +@Getter +@Setter +public class RouteDeleteParam { + @ApiDocField(description = "服务名serviceId") + @NotBlank(message = "serviceId不能为空") + private String serviceId; + + @ApiDocField(description = "路由id") + @NotBlank(message = "id不能为空") + private String id; +} diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/RouteParam.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/RouteUpdateParam.java similarity index 54% rename from sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/RouteParam.java rename to sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/RouteUpdateParam.java index 3ea6bbd4..be0ccf1c 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/RouteParam.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/RouteUpdateParam.java @@ -3,6 +3,7 @@ package com.gitee.sop.adminserver.api.service.param; import com.gitee.easyopen.doc.annotation.ApiDocField; import lombok.Getter; import lombok.Setter; +import org.hibernate.validator.constraints.Length; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; @@ -12,23 +13,25 @@ import javax.validation.constraints.NotNull; */ @Getter @Setter -public class RouteParam { - - @NotBlank(message = "serviceId不能为空") - @ApiDocField(description = "serviceId") - private String serviceId; +public class RouteUpdateParam { /** * 路由的Id */ @NotBlank(message = "id不能为空") @ApiDocField(description = "路由id") - private String id = ""; + private String id; + + @NotBlank(message = "serviceId不能为空") + @Length(max = 100, message = "serviceId长度不能超过100") + @ApiDocField(description = "serviceId") + private String serviceId; /** * 路由规则转发的目标uri */ @NotBlank(message = "uri不能为空") + @Length(max = 100, message = "uri长度不能超过100") @ApiDocField(description = "路由uri") private String uri; @@ -36,8 +39,21 @@ public class RouteParam { * uri后面跟的path */ @ApiDocField(description = "路由path") + @Length(max = 100, message = "path长度不能超过100") private String path; + /** + * 是否忽略验证,业务参数验证除外 + */ + @ApiDocField(description = "是否忽略验证,业务参数验证除外,1:忽略,0:不忽略") + private Integer ignoreValidate; + + /** + * 合并结果,统一格式输出 + */ + @ApiDocField(description = "合并结果,统一格式输出,1:合并,2:不合并") + private Integer mergeResult; + /** * 状态 */ @@ -45,4 +61,7 @@ public class RouteParam { @ApiDocField(description = "状态,0:审核,1:启用,2:禁用") private Integer status; + @ApiDocField(description = "是否是自定义路由,1:是,0:否") + private Integer custom; + } diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/ServiceAddParam.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/ServiceAddParam.java new file mode 100644 index 00000000..e9dedcbc --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/ServiceAddParam.java @@ -0,0 +1,21 @@ +package com.gitee.sop.adminserver.api.service.param; + +import com.gitee.easyopen.doc.annotation.ApiDocField; +import lombok.Getter; +import lombok.Setter; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; + +/** + * @author tanghc + */ +@Getter +@Setter +public class ServiceAddParam { + + @ApiDocField(description = "服务名serviceId") + @Length(max = 100, message = "长度不能超过100") + @NotBlank(message = "serviceId不能为空") + private String serviceId; +} diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/result/ServiceInfo.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/result/RouteServiceInfo.java similarity index 70% rename from sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/result/ServiceInfo.java rename to sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/result/RouteServiceInfo.java index 85d561fb..26e057ce 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/result/ServiceInfo.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/result/RouteServiceInfo.java @@ -7,7 +7,7 @@ import lombok.Data; * @author tanghc */ @Data -public class ServiceInfo { +public class RouteServiceInfo { @ApiDocField(description = "serviceId") private String serviceId; @@ -19,4 +19,8 @@ public class ServiceInfo { @ApiDocField(description = "描述") private String description; + + /** 是否是自定义服务,1:是,0:否 */ + @ApiDocField(description = "是否是自定义服务,1:是,0:否") + private Integer custom; } diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/result/ServiceInstanceVO.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/result/ServiceInstanceVO.java new file mode 100644 index 00000000..e7280367 --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/result/ServiceInstanceVO.java @@ -0,0 +1,54 @@ +package com.gitee.sop.adminserver.api.service.result; + +import com.alibaba.fastjson.annotation.JSONField; +import com.gitee.easyopen.doc.annotation.ApiDocField; +import lombok.Data; +import org.apache.commons.lang.StringUtils; + +import java.util.Date; + +/** + * @author tanghc + */ +@Data +public class ServiceInstanceVO { + @ApiDocField(description = "id") + private Integer id; + + @ApiDocField(description = "服务名称(serviceId)") + private String serviceId; + + @ApiDocField(description = "instanceId") + private String instanceId; + + @ApiDocField(description = "ipPort") + private String ipPort; + + @ApiDocField(description = "ip") + private String ip; + + @ApiDocField(description = "port") + private int port; + + @ApiDocField(description = "status,服务状态,UP:已上线,OUT_OF_SERVICE:已下线") + private String status; + + @ApiDocField(description = "最后更新时间") + private String lastUpdatedTimestamp; + + @ApiDocField(description = "parentId") + private Integer parentId; + + @JSONField(format = "yyyy-MM-dd HH:mm:ss") + public Date getUpdateTime() { + if (StringUtils.isBlank(lastUpdatedTimestamp)) { + return null; + } + return new Date(Long.valueOf(lastUpdatedTimestamp)); + } + + public String getIpPort() { + return ip != null && port > 0 ? ip + ":" + port : ""; + } + +} diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/GatewayRouteDefinition.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/GatewayRouteDefinition.java index 8ad92c47..9dd60585 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/GatewayRouteDefinition.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/GatewayRouteDefinition.java @@ -1,5 +1,6 @@ package com.gitee.sop.adminserver.bean; +import com.alibaba.fastjson.annotation.JSONField; import com.gitee.easyopen.doc.annotation.ApiDocField; import lombok.Data; @@ -30,11 +31,13 @@ public class GatewayRouteDefinition { /** * 路由断言集合配置 */ + @JSONField(serialize = false) private List predicates = new ArrayList<>(); /** * 路由过滤器集合配置 */ + @JSONField(serialize = false) private List filters = new ArrayList<>(); /** @@ -67,14 +70,20 @@ public class GatewayRouteDefinition { private int status = 1; /** - * 合并结果 + * 合并结果,统一格式输出 */ - @ApiDocField(description = "合并结果,1:合并,2:不合并") + @ApiDocField(description = "合并结果,统一格式输出,1:合并,0:不合并") private int mergeResult = 1; /** * 是否需要授权才能访问 */ - @ApiDocField(description = "是否需要授权才能访问,1:是,2:否") + @ApiDocField(description = "是否需要授权才能访问,1:是,0:否") private int permission; + + /** + * 是否是自定义路由 + */ + @ApiDocField(description = "是否是自定义路由,1:是,0:否") + private int custom; } \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/IsvRoutePermission.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/IsvRoutePermission.java index ca5ee89a..043b99e6 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/IsvRoutePermission.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/IsvRoutePermission.java @@ -13,4 +13,5 @@ public class IsvRoutePermission { private String appKey; private List routeIdList; private String routeIdListMd5; + private String listenPath; } diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/ServiceRouteInfo.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/ServiceRouteInfo.java index 25317cf2..9a3d1034 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/ServiceRouteInfo.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/ServiceRouteInfo.java @@ -24,4 +24,7 @@ public class ServiceRouteInfo { @JSONField(serialize = false) private List routeDefinitionList; + + /** 是否是自定义服务,1:是,0:否 */ + private int custom; } \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/SopAdminConstants.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/SopAdminConstants.java index 9f411a09..ba4cf281 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/SopAdminConstants.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/SopAdminConstants.java @@ -9,14 +9,11 @@ public class SopAdminConstants { */ public static final String SOP_SERVICE_ROUTE_PATH = "/com.gitee.sop.route"; - /** - * zookeeper存放路由授权信息根目录 - */ - public static final String SOP_ROUTE_PERMISSION_PATH = "/com.gitee.sop.isv.route.permission"; - /** * 消息监听路径 */ public static final String SOP_MSG_CHANNEL_PATH = "/com.gitee.sop.channel"; + public static final String RELOAD_ROUTE_PERMISSION_PATH = "/com.gitee.sop.route.permission.reload"; + } diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/ZookeeperContext.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/ZookeeperContext.java index 8f8d8487..1238fc29 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/ZookeeperContext.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/ZookeeperContext.java @@ -1,62 +1,91 @@ package com.gitee.sop.adminserver.bean; -import com.gitee.easyopen.exception.ApiException; +import com.gitee.sop.adminserver.common.ZookeeperOperationException; +import com.gitee.sop.adminserver.common.ZookeeperPathExistException; +import com.gitee.sop.adminserver.common.ZookeeperPathNotExistException; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.math.NumberUtils; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.CuratorFrameworkFactory; import org.apache.curator.framework.recipes.cache.ChildData; +import org.apache.curator.framework.recipes.cache.NodeCache; +import org.apache.curator.framework.recipes.cache.NodeCacheListener; import org.apache.curator.framework.recipes.cache.PathChildrenCache; import org.apache.curator.retry.ExponentialBackoffRetry; +import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.data.Stat; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.util.Assert; -import javax.annotation.PostConstruct; +import java.io.Closeable; import java.util.Collections; import java.util.List; import static com.gitee.sop.adminserver.bean.SopAdminConstants.SOP_MSG_CHANNEL_PATH; -import static com.gitee.sop.adminserver.bean.SopAdminConstants.SOP_ROUTE_PERMISSION_PATH; /** * @author tanghc */ -@Configuration +@Slf4j public class ZookeeperContext { private static CuratorFramework client; - @Value("${spring.cloud.zookeeper.connect-string}") - private String zookeeperServerAddr; + private static Environment environment; - @Value("${spring.cloud.zookeeper.baseSleepTimeMs}") - private String baseSleepTimeMs; + public static void setEnvironment(Environment environment) { + Assert.notNull(environment, "environment不能为null"); + ZookeeperContext.environment = environment; + initZookeeperClient(); + } - @Value("${spring.cloud.zookeeper.maxRetries}") - private String maxRetries; + public synchronized static void initZookeeperClient() { + if (client != null) { + return; + } + setClient(createClient()); + } - @PostConstruct - protected void after() { + public static CuratorFramework createClient() { + String zookeeperServerAddr = environment.getProperty("spring.cloud.zookeeper.connect-string"); if (StringUtils.isBlank(zookeeperServerAddr)) { - throw new IllegalArgumentException("未指定spring.cloud.zookeeper.connect-string参数"); + throw new RuntimeException("未指定spring.cloud.zookeeper.connect-string参数"); } + String baseSleepTimeMs = environment.getProperty("spring.cloud.zookeeper.baseSleepTimeMs"); + String maxRetries = environment.getProperty("spring.cloud.zookeeper.maxRetries"); + log.info("初始化zookeeper客户端,zookeeperServerAddr:{}, baseSleepTimeMs:{}, maxRetries:{}", + zookeeperServerAddr, baseSleepTimeMs, maxRetries); CuratorFramework client = CuratorFrameworkFactory.builder() .connectString(zookeeperServerAddr) .retryPolicy(new ExponentialBackoffRetry(NumberUtils.toInt(baseSleepTimeMs, 3000), NumberUtils.toInt(maxRetries, 3))) .build(); client.start(); - - setClient(client); + return client; } public static String getSopRouteRootPath() { return SopAdminConstants.SOP_SERVICE_ROUTE_PATH; } - public static String getRoutePermissionPath() { - return SOP_ROUTE_PERMISSION_PATH; + public static String buildServiceIdPath(String serviceId) { + if (StringUtils.isBlank(serviceId)) { + throw new NullPointerException("serviceId不能为空"); + } + return getSopRouteRootPath() + "/" + serviceId; + } + + public static String buildRoutePath(String serviceId, String routeId) { + if (StringUtils.isBlank(serviceId)) { + throw new NullPointerException("serviceId不能为空"); + } + if (StringUtils.isBlank(routeId)) { + throw new NullPointerException("routeId不能为空"); + } + String serviceIdPath = getSopRouteRootPath() + "/" + serviceId; + return serviceIdPath + "/" + routeId; } public static String getIsvInfoChannelPath() { @@ -95,54 +124,128 @@ public class ZookeeperContext { * 对已存在的path赋值。如果path不存在抛异常 * * @param path 已存在的 - * @param data + * @param data 数据 * @return - * @throws Exception + * @throws ZookeeperPathNotExistException */ - public static Stat updatePathData(String path, String data) throws Exception { + public static Stat updatePathData(String path, String data) throws ZookeeperPathNotExistException { if (!isPathExist(path)) { - throw new ApiException("path " + path + " 不存在"); + throw new ZookeeperPathNotExistException("path " + path + " 不存在"); + } + try { + return getClient().setData().forPath(path, data.getBytes()); + } catch (Exception e) { + throw new ZookeeperOperationException("updatePathData error, path=" + path, e); } - return getClient().setData().forPath(path, data.getBytes()); } /** * 创建新的path,并赋值。如果path已存在抛异常 + * * @param path 待创建的path * @param data 值 + * @throws ZookeeperPathExistException */ - public static String createNewData(String path, String data) throws Exception { + public static String addPath(String path, String data) throws ZookeeperPathExistException { if (isPathExist(path)) { - throw new ApiException("path " + path + " 已存在"); + throw new ZookeeperPathExistException("path " + path + " 已存在"); + } + try { + return addPath(path, CreateMode.PERSISTENT, data); + } catch (Exception e) { + throw new ZookeeperOperationException("addPath error path=" + path, e); + } + } + + /** + * 添加节点 + * + * @param path 待创建的path + * @param createMode 节点类型 + * @param data 节点数据 + * @return + */ + public static String addPath(String path, CreateMode createMode, String data) { + try { + return getClient().create() + // 如果指定节点的父节点不存在,则Curator将会自动级联创建父节点 + .creatingParentContainersIfNeeded() + .withMode(createMode) + .forPath(path, data.getBytes()); + } catch (Exception e) { + throw new ZookeeperOperationException("addPath error path=" + path, e); + } + } + + /** + * 删除节点及子节点 + * + * @param path + */ + public static void deletePathDeep(String path) { + try { + getClient().delete() + .deletingChildrenIfNeeded() + .forPath(path); + } catch (Exception e) { + } + } + + + /** + * 创建新的path,并赋值。如果path已存在则不创建 + * + * @param path 待创建的path + * @param data 值 + */ + public static String addPathQuietly(String path, String data) { + if (isPathExist(path)) { + return path; + } + try { + return addPath(path, data); + } catch (Exception e) { + throw new ZookeeperOperationException("addPathQuietly error path=" + path, e); } - return getClient().create() - // 如果指定节点的父节点不存在,则Curator将会自动级联创建父节点 - .creatingParentContainersIfNeeded() - .forPath(path, data.getBytes()); } /** * 新建或保存节点 + * * @param path * @param data * @return - * @throws Exception */ - public static String createOrUpdateData(String path, String data) throws Exception { - return getClient().create() - // 如果节点存在则Curator将会使用给出的数据设置这个节点的值 - .orSetData() - // 如果指定节点的父节点不存在,则Curator将会自动级联创建父节点 - .creatingParentContainersIfNeeded() - .forPath(path, data.getBytes()); + public static String createOrUpdateData(String path, String data) { + try { + return getClient().create() + // 如果节点存在则Curator将会使用给出的数据设置这个节点的值 + .orSetData() + // 如果指定节点的父节点不存在,则Curator将会自动级联创建父节点 + .creatingParentContainersIfNeeded() + .forPath(path, data.getBytes()); + } catch (Exception e) { + throw new ZookeeperOperationException("createOrUpdateData error path=" + path, e); + } } - public static String getData(String path) throws Exception { + /** + * 获取节点内容 + * + * @param path + * @return + * @throws ZookeeperPathNotExistException + */ + public static String getData(String path) throws ZookeeperPathNotExistException { if (!isPathExist(path)) { - return null; + throw new ZookeeperPathNotExistException("path 不存在, path=" + path); + } + try { + byte[] data = getClient().getData().forPath(path); + return new String(data); + } catch (Exception e) { + throw new ZookeeperOperationException("getData error path=" + path, e); } - byte[] data = getClient().getData().forPath(path); - return new String(data); } /** @@ -150,9 +253,8 @@ public class ZookeeperContext { * * @param parentPath 父节点 * @return - * @throws Exception */ - public static List getChildrenData(String parentPath) throws Exception { + public static List getChildrenData(String parentPath) { PathChildrenCache pathChildrenCache = buildPathChildrenCache(parentPath); if (pathChildrenCache == null) { return Collections.emptyList(); @@ -160,7 +262,7 @@ public class ZookeeperContext { return pathChildrenCache.getCurrentData(); } - public static PathChildrenCache buildPathChildrenCache(String path) throws Exception { + public static PathChildrenCache buildPathChildrenCache(String path) { if (!isPathExist(path)) { return null; } @@ -168,8 +270,66 @@ public class ZookeeperContext { // 且第三个参数要设置为true,不然ChildData对象中的getData返回null PathChildrenCache childrenCache = new PathChildrenCache(client, path, true); // 列出子节点数据列表,需要使用BUILD_INITIAL_CACHE同步初始化模式才能获得,异步是获取不到的 - childrenCache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE); + try { + childrenCache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE); + } catch (Exception e) { + throw new ZookeeperOperationException("buildPathChildrenCache error path=" + path, e); + } return childrenCache; } + /** + * 监听一个节点 + * + * @param path + * @param listenCallback 回调 + * @return 返回path + * @throws Exception + */ + public static void listenTempPath(String path, ListenCallback listenCallback) throws Exception { + String initData = "{}"; + CuratorFramework client = createClient(); + client.create() + // 如果指定节点的父节点不存在,则Curator将会自动级联创建父节点 + .creatingParentContainersIfNeeded() + .withMode(CreateMode.EPHEMERAL) + .forPath(path, initData.getBytes()); + + final NodeCache cache = new NodeCache(client, path, false); + cache.getListenable().addListener(new NodeCacheListener() { + @Override + public void nodeChanged() throws Exception { + byte[] nodeData = cache.getCurrentData().getData(); + String data = new String(nodeData); + if (StringUtils.isNotBlank(data) && !initData.equals(data)) { + listenCallback.onError(data); + new Thread(new ZKClose(cache, client)).start(); + } + } + }); + cache.start(); + } + + public interface ListenCallback { + void onError(String errorMsg); + } + + static class ZKClose implements Runnable { + Closeable[] closes; + + public ZKClose(Closeable ...closes) { + this.closes = closes; + } + + @Override + public void run() { + try { + Thread.sleep(2000); + IOUtils.closeQuietly(closes); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + } diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/common/BizException.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/common/BizException.java new file mode 100644 index 00000000..0c7c46ce --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/common/BizException.java @@ -0,0 +1,33 @@ +package com.gitee.sop.adminserver.common; + +import com.gitee.easyopen.exception.ApiException; +import com.gitee.easyopen.message.Error; + +/** + * @author tanghc + */ +public class BizException extends ApiException { + public BizException(String msg) { + super(msg, "4000"); + } + + public BizException(Exception e) { + super(e); + } + + public BizException(Error error) { + super(error); + } + + public BizException(String msg, String code) { + super(msg, code); + } + + public BizException(String msg, String code, Object data) { + super(msg, code, data); + } + + public BizException(Error error, Object data) { + super(error, data); + } +} diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/common/RSATool.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/common/RSATool.java new file mode 100644 index 00000000..b19890f3 --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/common/RSATool.java @@ -0,0 +1,410 @@ +package com.gitee.sop.adminserver.common; + +import org.apache.commons.codec.binary.Base64; +import org.bouncycastle.asn1.ASN1Encodable; +import org.bouncycastle.asn1.ASN1Primitive; +import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; + +import javax.crypto.Cipher; +import java.security.KeyFactory; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.interfaces.RSAPrivateKey; +import java.security.interfaces.RSAPublicKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; + +/** + * RSA加解密工具 + * + * @author tanghc + */ +public class RSATool { + public static String RSA_ALGORITHM = "RSA"; + + private KeyFormat keyFormat; + private KeyLength keyLength; + + public RSATool(KeyFormat keyFormat, KeyLength keyLength) { + this.keyFormat = keyFormat; + this.keyLength = keyLength; + } + + /** + * 创建公钥私钥 + * + * @return 返回公私钥对 + * @throws Exception + */ + public KeyStore createKeys() throws Exception { + KeyPairGenerator keyPairGeno = KeyPairGenerator.getInstance(RSA_ALGORITHM); + keyPairGeno.initialize(keyLength.getLength()); + KeyPair keyPair = keyPairGeno.generateKeyPair(); + + RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); + RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate(); + + KeyStore keyStore = new KeyStore(); + if (this.keyFormat == KeyFormat.PKCS1) { + keyStore.setPublicKey(Base64.encodeBase64String(publicKey.getEncoded())); + keyStore.setPrivateKey(convertPkcs8ToPkcs1(privateKey.getEncoded())); + } else { + keyStore.setPublicKey(Base64.encodeBase64String(publicKey.getEncoded())); + keyStore.setPrivateKey(Base64.encodeBase64String(privateKey.getEncoded())); + } + return keyStore; + } + + /** + * 获取公钥对象 + * + * @param pubKeyData 公钥 + * @return 返回公钥对象 + * @throws Exception + */ + public RSAPublicKey getPublicKey(byte[] pubKeyData) throws Exception { + X509EncodedKeySpec keySpec = new X509EncodedKeySpec(pubKeyData); + KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM); + return (RSAPublicKey) keyFactory.generatePublic(keySpec); + } + + /** + * 获取公钥对象 + * + * @param pubKey 公钥 + * @return 返回私钥对象 + * @throws Exception + */ + public RSAPublicKey getPublicKey(String pubKey) throws Exception { + return getPublicKey(Base64.decodeBase64(pubKey)); + + } + + /** + * 获取私钥对象 + * + * @param priKey 私钥 + * @return 私钥对象 + * @throws Exception + */ + public RSAPrivateKey getPrivateKey(String priKey) throws Exception { + return getPrivateKey(Base64.decodeBase64(priKey)); + } + + /** + * 通过私钥byte[]将公钥还原,适用于RSA算法 + * + * @param keyBytes + * @return 返回私钥 + * @throws Exception + */ + public RSAPrivateKey getPrivateKey(byte[] keyBytes) throws Exception { + PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM); + return (RSAPrivateKey) keyFactory.generatePrivate(keySpec); + + } + + /** + * 公钥加密 + * + * @param data 待加密内容 + * @param publicKey 公钥 + * @return 返回密文 + * @throws Exception + */ + public String encryptByPublicKey(String data, RSAPublicKey publicKey) throws Exception { + Cipher cipher = Cipher.getInstance(keyFormat.getCipherAlgorithm()); + cipher.init(Cipher.ENCRYPT_MODE, publicKey); + // 模长 + int key_len = publicKey.getModulus().bitLength() / 8; + // 加密数据长度 <= 模长-11 + String[] datas = splitString(data, key_len - 11); + String mi = ""; + // 如果明文长度大于模长-11则要分组加密 + for (String s : datas) { + mi += bcd2Str(cipher.doFinal(s.getBytes())); + } + return mi; + } + + public String encryptByPrivateKey(String data, String privateKey) throws Exception { + return encryptByPrivateKey(data, getPrivateKey(privateKey)); + } + + /** + * 私钥加密 + * + * @param data 待加密数据 + * @param privateKey 私钥 + * @return 返回密文 + * @throws Exception + */ + public String encryptByPrivateKey(String data, RSAPrivateKey privateKey) throws Exception { + Cipher cipher = Cipher.getInstance(keyFormat.getCipherAlgorithm()); + cipher.init(Cipher.ENCRYPT_MODE, privateKey); + // 模长 + int key_len = privateKey.getModulus().bitLength() / 8; + // 加密数据长度 <= 模长-11 + String[] datas = splitString(data, key_len - 11); + String mi = ""; + // 如果明文长度大于模长-11则要分组加密 + for (String s : datas) { + mi += bcd2Str(cipher.doFinal(s.getBytes())); + } + return mi; + } + + public String decryptByPrivateKey(String data, String privateKey) throws Exception { + return decryptByPrivateKey(data, getPrivateKey(privateKey)); + } + + /** + * 私钥解密 + * + * @param data 待解密内容 + * @param privateKey 私钥 + * @return 返回明文 + * @throws Exception + */ + public String decryptByPrivateKey(String data, RSAPrivateKey privateKey) throws Exception { + Cipher cipher = Cipher.getInstance(keyFormat.getCipherAlgorithm()); + cipher.init(Cipher.DECRYPT_MODE, privateKey); + // 模长 + int key_len = privateKey.getModulus().bitLength() / 8; + byte[] bytes = data.getBytes(); + byte[] bcd = ASCII_To_BCD(bytes, bytes.length); + // 如果密文长度大于模长则要分组解密 + String ming = ""; + byte[][] arrays = splitArray(bcd, key_len); + for (byte[] arr : arrays) { + ming += new String(cipher.doFinal(arr)); + } + return ming; + } + + /** + * 公钥解密 + * + * @param data 待解密内容 + * @param rsaPublicKey 公钥 + * @return 返回明文 + * @throws Exception + */ + public String decryptByPublicKey(String data, RSAPublicKey rsaPublicKey) throws Exception { + Cipher cipher = Cipher.getInstance(keyFormat.getCipherAlgorithm()); + cipher.init(Cipher.DECRYPT_MODE, rsaPublicKey); + // 模长 + int key_len = rsaPublicKey.getModulus().bitLength() / 8; + byte[] bytes = data.getBytes(); + byte[] bcd = ASCII_To_BCD(bytes, bytes.length); + // 如果密文长度大于模长则要分组解密 + String ming = ""; + byte[][] arrays = splitArray(bcd, key_len); + for (byte[] arr : arrays) { + ming += new String(cipher.doFinal(arr)); + } + return ming; + } + + public static String convertPkcs8ToPkcs1(byte[] privateKeyData) throws Exception{ + PrivateKeyInfo pkInfo = PrivateKeyInfo.getInstance(privateKeyData); + ASN1Encodable encodable = pkInfo.parsePrivateKey(); + ASN1Primitive primitive = encodable.toASN1Primitive(); + byte[] privateKeyPKCS1 = primitive.getEncoded(); + return Base64.encodeBase64String(privateKeyPKCS1); + } + + + /** + * ASCII码转BCD码 + */ + public static byte[] ASCII_To_BCD(byte[] ascii, int asc_len) { + byte[] bcd = new byte[asc_len / 2]; + int j = 0; + for (int i = 0; i < (asc_len + 1) / 2; i++) { + bcd[i] = asc_to_bcd(ascii[j++]); + bcd[i] = (byte) (((j >= asc_len) ? 0x00 : asc_to_bcd(ascii[j++]) & 0xff) + (bcd[i] << 4)); + } + return bcd; + } + + public static byte asc_to_bcd(byte asc) { + byte bcd; + + if ((asc >= '0') && (asc <= '9')) { + bcd = (byte) (asc - '0'); + } else if ((asc >= 'A') && (asc <= 'F')) { + bcd = (byte) (asc - 'A' + 10); + } else if ((asc >= 'a') && (asc <= 'f')) { + bcd = (byte) (asc - 'a' + 10); + } else { + bcd = (byte) (asc - 48); + } + return bcd; + } + + /** + * BCD转字符串 + */ + public String bcd2Str(byte[] bytes) { + char[] temp = new char[bytes.length * 2]; + char val; + + for (int i = 0; i < bytes.length; i++) { + val = (char) (((bytes[i] & 0xf0) >> 4) & 0x0f); + temp[i * 2] = (char) (val > 9 ? val + 'A' - 10 : val + '0'); + + val = (char) (bytes[i] & 0x0f); + temp[i * 2 + 1] = (char) (val > 9 ? val + 'A' - 10 : val + '0'); + } + return new String(temp); + } + + /** + * 拆分字符串 + */ + public String[] splitString(String string, int len) { + int x = string.length() / len; + int y = string.length() % len; + int z = 0; + if (y != 0) { + z = 1; + } + String[] strings = new String[x + z]; + String str = ""; + for (int i = 0; i < x + z; i++) { + if (i == x + z - 1 && y != 0) { + str = string.substring(i * len, i * len + y); + } else { + str = string.substring(i * len, i * len + len); + } + strings[i] = str; + } + return strings; + } + + /** + * 拆分数组 + */ + public byte[][] splitArray(byte[] data, int len) { + int x = data.length / len; + int y = data.length % len; + int z = 0; + if (y != 0) { + z = 1; + } + byte[][] arrays = new byte[x + z][]; + byte[] arr; + for (int i = 0; i < x + z; i++) { + arr = new byte[len]; + if (i == x + z - 1 && y != 0) { + System.arraycopy(data, i * len, arr, 0, y); + } else { + System.arraycopy(data, i * len, arr, 0, len); + } + arrays[i] = arr; + } + return arrays; + } + + public enum KeyLength { + LENGTH_1024(1024), LENGTH_2048(2048); + private int length; + + KeyLength(int length) { + this.length = length; + } + + public int getLength() { + return length; + } + } + + public static class KeyStore { + private String publicKey; + private String privateKey; + + public String getPublicKey() { + return publicKey; + } + + public void setPublicKey(String publicKey) { + this.publicKey = publicKey; + } + + public String getPrivateKey() { + return privateKey; + } + + public void setPrivateKey(String privateKey) { + this.privateKey = privateKey; + } + } + + public enum KeyFormat { + PKCS1("RSA/ECB/PKCS1Padding"), PKCS8("RSA"); + private String cipherAlgorithm; + + KeyFormat(String cipherAlgorithm) { + this.cipherAlgorithm = cipherAlgorithm; + } + + public String getCipherAlgorithm() { + return cipherAlgorithm; + } + } + + public KeyFormat getKeyFormat() { + return keyFormat; + } + + public KeyLength getKeyLength() { + return keyLength; + } + + + + /* ------------ Test ------------ + public static void main(String[] args) throws Exception { + + RSATool rsa_pkcs8_1024 = new RSATool(KeyFormat.PKCS8, KeyLength.LENGTH_1024); + RSATool rsa_pkcs8_2048 = new RSATool(KeyFormat.PKCS8, KeyLength.LENGTH_2048); + + doTest(rsa_pkcs8_1024); + doTest(rsa_pkcs8_2048); + + // PKCS在Java环境无法测试,可以生成一对,到非java平台测试,如C# + } + + private static void doTest(RSATool rsaTool) throws Exception { + System.out.println("秘钥格式:" + rsaTool.keyFormat.name() + ", 秘钥长度:" + rsaTool.keyLength.getLength()); + KeyStore keys = rsaTool.createKeys(); + String pubKey = keys.getPublicKey(); + System.out.println("pubKey:"); + System.out.println(pubKey); + String priKey = keys.getPrivateKey(); + System.out.println("priKey:"); + System.out.println(priKey); + System.out.println("--------"); + + String ming = "你好,abc123~!@="; + // 用公钥加密 + String mi = rsaTool.encryptByPublicKey(ming, rsaTool.getPublicKey(pubKey)); + System.out.println("mi : " + mi); + // 用私钥解密 + String ming2 = rsaTool.decryptByPrivateKey(mi, rsaTool.getPrivateKey(priKey)); + System.out.println("ming : " + ming2 + ", 结果:" + ming2.equals(ming)); + + // 用私钥加密 + String mi2 = rsaTool.encryptByPrivateKey(ming, rsaTool.getPrivateKey(priKey)); + + System.out.println("mi2 : " + mi2); + // 用公钥解密 + String ming3 = rsaTool.decryptByPublicKey(mi2, rsaTool.getPublicKey(pubKey)); + System.out.println("ming3 : " + ming3 + ", 结果:" + ming3.equals(ming)); + System.out.println("---------------------"); + } + */ + +} \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/common/ZookeeperOperationException.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/common/ZookeeperOperationException.java new file mode 100644 index 00000000..d75f35df --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/common/ZookeeperOperationException.java @@ -0,0 +1,26 @@ +package com.gitee.sop.adminserver.common; + +/** + * @author tanghc + */ +public class ZookeeperOperationException extends RuntimeException { + + public ZookeeperOperationException() { + } + + public ZookeeperOperationException(String message) { + super(message); + } + + public ZookeeperOperationException(String message, Throwable cause) { + super(message, cause); + } + + public ZookeeperOperationException(Throwable cause) { + super(cause); + } + + public ZookeeperOperationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } +} diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/common/ZookeeperPathExistException.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/common/ZookeeperPathExistException.java new file mode 100644 index 00000000..4ec2e104 --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/common/ZookeeperPathExistException.java @@ -0,0 +1,10 @@ +package com.gitee.sop.adminserver.common; + +/** + * @author tanghc + */ +public class ZookeeperPathExistException extends Exception { + public ZookeeperPathExistException(String message) { + super(message); + } +} diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/common/ZookeeperPathNotExistException.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/common/ZookeeperPathNotExistException.java new file mode 100644 index 00000000..bf690146 --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/common/ZookeeperPathNotExistException.java @@ -0,0 +1,10 @@ +package com.gitee.sop.adminserver.common; + +/** + * @author tanghc + */ +public class ZookeeperPathNotExistException extends Exception { + public ZookeeperPathNotExistException(String message) { + super(message); + } +} diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/config/RegistryConfig.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/config/RegistryConfig.java new file mode 100644 index 00000000..57b9e819 --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/config/RegistryConfig.java @@ -0,0 +1,12 @@ +package com.gitee.sop.adminserver.config; + +import com.gitee.sop.registryapi.config.BaseRegistryConfig; +import org.springframework.context.annotation.Configuration; + +/** + * @author tanghc + */ +@Configuration +public class RegistryConfig extends BaseRegistryConfig { + +} diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/config/WebConfig.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/config/WebConfig.java index 7c8be1f3..07dabc5d 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/config/WebConfig.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/config/WebConfig.java @@ -8,13 +8,17 @@ import com.gitee.easyopen.ApiParamParser; import com.gitee.easyopen.ParamNames; import com.gitee.easyopen.interceptor.ApiInterceptor; import com.gitee.easyopen.session.ApiSessionManager; +import com.gitee.sop.adminserver.bean.ZookeeperContext; import com.gitee.sop.adminserver.interceptor.LoginInterceptor; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.math.NumberUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import javax.annotation.PostConstruct; import javax.servlet.http.HttpServletRequest; @@ -29,6 +33,9 @@ public class WebConfig { @Value("${admin.access-token.timeout-minutes}") private String accessTokenTimeout; + @Autowired + private Environment environment; + @Bean ApiConfig apiConfig() { ApiConfig apiConfig = new ApiConfig(); @@ -59,4 +66,9 @@ public class WebConfig { return apiConfig; } + @PostConstruct + public void after() { + ZookeeperContext.setEnvironment(environment); + } + } \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/entity/AdminUserInfo.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/entity/AdminUserInfo.java index 22e1458a..17c99007 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/entity/AdminUserInfo.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/entity/AdminUserInfo.java @@ -2,13 +2,13 @@ package com.gitee.sop.adminserver.entity; import lombok.Data; -import java.util.Date; - import javax.persistence.Column; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import java.io.Serializable; +import java.util.Date; /** @@ -19,7 +19,7 @@ import javax.persistence.Table; */ @Table(name = "admin_user_info") @Data -public class AdminUserInfo { +public class AdminUserInfo implements Serializable { @Id @Column(name = "id") @GeneratedValue(strategy = GenerationType.IDENTITY) diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/entity/IsvInfo.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/entity/IsvInfo.java index 0d5e57a9..44720207 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/entity/IsvInfo.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/entity/IsvInfo.java @@ -28,21 +28,18 @@ public class IsvInfo { /** appKey, 数据库字段:app_key */ private String appKey; - /** secret, 数据库字段:secret */ - private String secret; + // 不再使用,转移到isv_keys表 + private String secret = ""; - /** 公钥, 数据库字段:pub_key */ + /** 公钥,不再使用,转移到isv_keys表 数据库字段:pub_key */ private String pubKey; - /** 私钥, 数据库字段:pri_key */ + /** 私钥,不再使用,转移到isv_keys表 数据库字段:pri_key */ private String priKey; /** 1启用,2禁用, 数据库字段:status */ private Byte status; - /** 1:RSA2,2:MD5, 数据库字段:sign_type */ - private Byte signType; - /** 数据库字段:gmt_create */ private Date gmtCreate; diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/entity/IsvKeys.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/entity/IsvKeys.java new file mode 100644 index 00000000..03989420 --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/entity/IsvKeys.java @@ -0,0 +1,57 @@ +package com.gitee.sop.adminserver.entity; + +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import java.util.Date; + + +/** + * 表名:isv_keys + * 备注:ISV秘钥 + * + * @author tanghc + */ +@Table(name = "isv_keys") +@Data +public class IsvKeys { + @Id + @Column(name = "id") + @GeneratedValue(strategy = GenerationType.IDENTITY) + /** 数据库字段:id */ + private Long id; + + /** 数据库字段:app_key */ + private String appKey; + + /** 1:RSA2,2:MD5, 数据库字段:sign_type */ + private Byte signType; + + /** isv_info.sign_type=2时使用, 数据库字段:secret */ + private String secret; + + /** 秘钥格式,1:PKCS8(JAVA适用),2:PKCS1(非JAVA适用), 数据库字段:key_format */ + private Byte keyFormat; + + /** 开发者生成的公钥, 数据库字段:public_key_isv */ + private String publicKeyIsv; + + /** 开发者生成的私钥(交给开发者), 数据库字段:private_key_isv */ + private String privateKeyIsv; + + /** 平台生成的公钥(交给开发者), 数据库字段:public_key_platform */ + private String publicKeyPlatform; + + /** 平台生成的私钥, 数据库字段:private_key_platform */ + private String privateKeyPlatform; + + /** 数据库字段:gmt_create */ + private Date gmtCreate; + + /** 数据库字段:gmt_modified */ + private Date gmtModified; +} diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/mapper/IsvInfoMapper.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/mapper/IsvInfoMapper.java index 9747701c..ab8d28ae 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/mapper/IsvInfoMapper.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/mapper/IsvInfoMapper.java @@ -2,11 +2,27 @@ package com.gitee.sop.adminserver.mapper; import com.gitee.fastmybatis.core.mapper.CrudMapper; +import com.gitee.sop.adminserver.api.isv.result.IsvDetailDTO; import com.gitee.sop.adminserver.entity.IsvInfo; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; /** * @author tanghc */ public interface IsvInfoMapper extends CrudMapper { + + @Select("SELECT " + + " t.app_key appKey " + + " ,t.status " + + " ,t2.sign_type signType " + + " ,t2.secret " + + " ,t2.public_key_isv publicKeyIsv " + + " ,t2.private_key_platform privateKeyPlatform " + + "FROM isv_info t " + + "INNER JOIN isv_keys t2 ON t.app_key = t2.app_key " + + "WHERE t.app_key = #{appKey}") + IsvDetailDTO getIsvDetail(@Param("appKey") String appKey); + } diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/mapper/IsvKeysMapper.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/mapper/IsvKeysMapper.java new file mode 100644 index 00000000..6c2e696e --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/mapper/IsvKeysMapper.java @@ -0,0 +1,12 @@ +package com.gitee.sop.adminserver.mapper; + +import com.gitee.fastmybatis.core.mapper.CrudMapper; + +import com.gitee.sop.adminserver.entity.IsvKeys; + + +/** + * @author tanghc + */ +public interface IsvKeysMapper extends CrudMapper { +} diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/RouteConfigService.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/RouteConfigService.java index ac02f8db..0b09a09b 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/RouteConfigService.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/RouteConfigService.java @@ -20,7 +20,7 @@ public class RouteConfigService { * @param routeConfigDto * @throws Exception */ - public void sendRouteConfigMsg(RouteConfigDto routeConfigDto) throws Exception { + public void sendRouteConfigMsg(RouteConfigDto routeConfigDto) { String configData = JSON.toJSONString(routeConfigDto); ChannelMsg channelMsg = new ChannelMsg("update", configData); String jsonData = JSON.toJSONString(channelMsg); diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/RoutePermissionService.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/RoutePermissionService.java index 3600a31f..2cf4a344 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/RoutePermissionService.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/RoutePermissionService.java @@ -2,8 +2,10 @@ package com.gitee.sop.adminserver.service; import com.alibaba.fastjson.JSON; import com.gitee.fastmybatis.core.query.Query; +import com.gitee.sop.adminserver.api.service.param.RoutePermissionParam; import com.gitee.sop.adminserver.bean.ChannelMsg; import com.gitee.sop.adminserver.bean.IsvRoutePermission; +import com.gitee.sop.adminserver.bean.SopAdminConstants; import com.gitee.sop.adminserver.bean.ZookeeperContext; import com.gitee.sop.adminserver.entity.PermIsvRole; import com.gitee.sop.adminserver.entity.PermRolePermission; @@ -16,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -93,12 +96,45 @@ public class RoutePermissionService { /** * 推送所有路由权限到zookeeper */ - public void sendRoutePermissionReloadMsg() throws Exception { - ChannelMsg channelMsg = new ChannelMsg("reload", null); + public void sendRoutePermissionReloadMsg(RoutePermissionParam oldRoutePermission) throws Exception { + String listenPath = SopAdminConstants.RELOAD_ROUTE_PERMISSION_PATH + "/" + System.currentTimeMillis(); + ZookeeperContext.listenTempPath(listenPath, errorMsg -> { + log.error("推送所有路由权限到zookeeper失败,进行回滚,errorMsg: {},oldRoutePermission:{}", errorMsg, JSON.toJSONString(oldRoutePermission)); + // 回滚 + updateRoutePermission(oldRoutePermission); + }); + IsvRoutePermission isvRoutePermission = new IsvRoutePermission(); + isvRoutePermission.setListenPath(listenPath); + ChannelMsg channelMsg = new ChannelMsg("reload", isvRoutePermission); String jsonData = JSON.toJSONString(channelMsg); String path = ZookeeperContext.getIsvRoutePermissionChannelPath(); log.info("消息推送--路由权限(reload), path:{}, data:{}", path, jsonData); ZookeeperContext.createOrUpdateData(path, jsonData); } + /** + * 更新路由权限 + * + * @param param + */ + public synchronized void updateRoutePermission(RoutePermissionParam param) { + String routeId = param.getRouteId(); + // 删除所有数据 + Query delQuery = new Query(); + delQuery.eq("route_id", routeId); + permRolePermissionMapper.deleteByQuery(delQuery); + + List roleCodes = param.getRoleCode(); + if (org.apache.commons.collections.CollectionUtils.isNotEmpty(roleCodes)) { + List tobeSave = new ArrayList<>(roleCodes.size()); + for (String roleCode : roleCodes) { + PermRolePermission permRolePermission = new PermRolePermission(); + permRolePermission.setRoleCode(roleCode); + permRolePermission.setRouteId(routeId); + tobeSave.add(permRolePermission); + } + // 批量添加 + permRolePermissionMapper.saveBatch(tobeSave); + } + } } diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/RouteService.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/RouteService.java index 4b48c084..b3fe1670 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/RouteService.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/RouteService.java @@ -10,7 +10,6 @@ import org.springframework.stereotype.Service; import java.util.Collections; import java.util.List; -import java.util.stream.Stream; import static java.util.stream.Collectors.toList; @@ -44,8 +43,7 @@ public class RouteService { return isRoute && gatewayRouteDefinition.getId().contains(id); } }) - .collect(toList()) - ; + .collect(toList()); return routeDefinitionStream; } diff --git a/sop-admin/sop-admin-server/src/main/resources/application-dev.yml b/sop-admin/sop-admin-server/src/main/resources/application-dev.yml index e33f7e29..0064c80c 100644 --- a/sop-admin/sop-admin-server/src/main/resources/application-dev.yml +++ b/sop-admin/sop-admin-server/src/main/resources/application-dev.yml @@ -6,12 +6,18 @@ admin: access-token: timeout-minutes: 30 +sop: + # 签名方式,rsa:支付宝开放平台签名方式,md5:淘宝开放平台签名方式 + sign-type: rsa + # 不用改 spring: application: name: sop-admin cloud: + + # zookeeper地址,根据实际情况修改 zookeeper: connect-string: localhost:2181 baseSleepTimeMs: 3000 @@ -31,12 +37,13 @@ easyopen: ignore-validate: true # 注册中心地址,根据实际情况改,这里只是参数,并不会去注册 -eureka: - port: 1111 - host: localhost - client: - serviceUrl: - defaultZone: http://${eureka.host}:${eureka.port}/eureka/ +registry: + eureka-server-addr: http://localhost:1111/eureka/ + # nacos服务器地址 + nacos-server-addr: 127.0.0.1:8848 + # 使用eureka,填:eureka,使用nacos填:nacos + name: eureka + # 根据实际情况改 logging: @@ -49,6 +56,6 @@ mybatis: fill: {com.gitee.fastmybatis.core.support.DateFillInsert: gmt_create, com.gitee.fastmybatis.core.support.DateFillUpdate: gmt_modified} -# 不用改,如果要改,建议全局替换修改 +# 不用改,如果要改,请全局替换修改 zuul: secret: MZZOUSTua6LzApIWXCwEgbBmxSzpzC \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/resources/public/index.html b/sop-admin/sop-admin-server/src/main/resources/public/index.html index 73897f95..db9c4412 100644 --- a/sop-admin/sop-admin-server/src/main/resources/public/index.html +++ b/sop-admin/sop-admin-server/src/main/resources/public/index.html @@ -1 +1 @@ -SOP AdminWe're sorry but SOP Admin doesn't work properly without JavaScript enabled. Please enable it to continue. \ No newline at end of file +SOP AdminWe're sorry but SOP Admin doesn't work properly without JavaScript enabled. Please enable it to continue. \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-009073d4.0af16c7e.css b/sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-009073d4.0af16c7e.css new file mode 100644 index 00000000..7bdb9a3e --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-009073d4.0af16c7e.css @@ -0,0 +1 @@ +.custom-tree-node{-webkit-box-flex:1;-ms-flex:1;flex:1;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;font-size:14px;padding-right:8px}.el-input.is-disabled .el-input__inner,.el-radio__input.is-disabled+span.el-radio__label{color:#909399}.limit-tip[data-v-b81bfbde]{cursor:pointer;margin-left:10px} \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-25908fca.89ab33e8.css b/sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-25908fca.89ab33e8.css new file mode 100644 index 00000000..2caa9193 --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-25908fca.89ab33e8.css @@ -0,0 +1 @@ +.gen-key{margin-bottom:0!important}fieldset{border:1px solid #ccc;color:grey;margin-left:40px;margin-bottom:20px}fieldset label{width:110px!important}fieldset .el-form-item__content{margin-left:110px!important}.key-view .el-form-item{margin-bottom:10px!important} \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-29b24c82.857979fb.css b/sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-29b24c82.857979fb.css deleted file mode 100644 index 26ea8fa2..00000000 --- a/sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-29b24c82.857979fb.css +++ /dev/null @@ -1 +0,0 @@ -.limit-tip[data-v-29df7fee]{cursor:pointer;margin-left:10px} \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-ea2e58a4.d10599db.css b/sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-29e7142c.d10599db.css similarity index 100% rename from sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-ea2e58a4.d10599db.css rename to sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-29e7142c.d10599db.css diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-19100986.a43114f3.css b/sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-37401378.a43114f3.css similarity index 100% rename from sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-19100986.a43114f3.css rename to sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-37401378.a43114f3.css diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-6a68a33e.3b12267b.css b/sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-6a68a33e.3b12267b.css new file mode 100644 index 00000000..e41f7849 --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-6a68a33e.3b12267b.css @@ -0,0 +1 @@ +.custom-tree-node{-webkit-box-flex:1;-ms-flex:1;flex:1;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;font-size:14px;padding-right:8px}.el-input.is-disabled .el-input__inner,.el-radio__input.is-disabled+span.el-radio__label{color:#909399} \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-73b2dcec.99cf6327.css b/sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-73b2dcec.99cf6327.css new file mode 100644 index 00000000..31a81618 --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/resources/public/static/css/chunk-73b2dcec.99cf6327.css @@ -0,0 +1 @@ +.gen-key{margin-bottom:0!important}fieldset{border:1px solid #ccc;color:grey;margin-left:40px;margin-bottom:20px}fieldset label{width:110px!important}fieldset .el-form-item__content{margin-left:110px!important} \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/js/app.36a3cb86.js b/sop-admin/sop-admin-server/src/main/resources/public/static/js/app.095e8b9c.js similarity index 51% rename from sop-admin/sop-admin-server/src/main/resources/public/static/js/app.36a3cb86.js rename to sop-admin/sop-admin-server/src/main/resources/public/static/js/app.095e8b9c.js index d0df45df..53b7189d 100644 --- a/sop-admin/sop-admin-server/src/main/resources/public/static/js/app.36a3cb86.js +++ b/sop-admin/sop-admin-server/src/main/resources/public/static/js/app.095e8b9c.js @@ -1 +1 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["app"],{0:function(e,t,n){e.exports=n("56d7")},"0cb8":function(e,t,n){},"186a":function(e,t,n){"use strict";var a=n("dc52"),i=n.n(a);i.a},"18f0":function(e,t,n){"use strict";n.r(t);var a=n("e017"),i=n.n(a),o=n("21a1"),r=n.n(o),s=new i.a({id:"icon-link",use:"icon-link-usage",viewBox:"0 0 128 128",content:''});r.a.add(s);t["default"]=s},"1f59":function(e,t,n){},2536:function(e,t,n){},2635:function(e,t,n){},"2a3d":function(e,t,n){"use strict";n.r(t);var a=n("e017"),i=n.n(a),o=n("21a1"),r=n.n(o),s=new i.a({id:"icon-password",use:"icon-password-usage",viewBox:"0 0 128 128",content:''});r.a.add(s);t["default"]=s},"30c3":function(e,t,n){"use strict";n.r(t);var a=n("e017"),i=n.n(a),o=n("21a1"),r=n.n(o),s=new i.a({id:"icon-example",use:"icon-example-usage",viewBox:"0 0 128 128",content:''});r.a.add(s);t["default"]=s},"34c8":function(e,t,n){"use strict";var a=n("5332"),i=n.n(a);i.a},"405a":function(e,t,n){"use strict";var a=n("1f59"),i=n.n(a);i.a},"47f1":function(e,t,n){"use strict";n.r(t);var a=n("e017"),i=n.n(a),o=n("21a1"),r=n.n(o),s=new i.a({id:"icon-table",use:"icon-table-usage",viewBox:"0 0 128 128",content:''});r.a.add(s);t["default"]=s},"4df5":function(e,t,n){"use strict";n.r(t);var a=n("e017"),i=n.n(a),o=n("21a1"),r=n.n(o),s=new i.a({id:"icon-eye",use:"icon-eye-usage",viewBox:"0 0 128 64",content:''});r.a.add(s);t["default"]=s},"50be":function(e,t,n){"use strict";var a=n("2536"),i=n.n(a);i.a},"51ff":function(e,t,n){var a={"./dashboard.svg":"f782","./example.svg":"30c3","./eye-open.svg":"d7ec","./eye.svg":"4df5","./form.svg":"eb1b","./link.svg":"18f0","./nested.svg":"dcf8","./password.svg":"2a3d","./table.svg":"47f1","./tree.svg":"93cd","./user.svg":"b3b5"};function i(e){var t=o(e);return n(t)}function o(e){var t=a[e];if(!(t+1)){var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}return t}i.keys=function(){return Object.keys(a)},i.resolve=o,e.exports=i,i.id="51ff"},5332:function(e,t,n){},"56d7":function(e,t,n){"use strict";n.r(t);n("cadf"),n("551c"),n("f751"),n("097d");var a=n("2b0e"),i=(n("f5df"),n("5c96")),o=n.n(i),r=(n("0fae"),n("f0d9")),s=n.n(r),c=(n("b20f"),function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{attrs:{id:"app"}},[n("router-view")],1)}),u=[],l={name:"App"},d=l,m=n("2877"),h=Object(m["a"])(d,c,u,!1,null,null,null),f=h.exports,p=n("2f62"),v=(n("7f7f"),{sidebar:function(e){return e.app.sidebar},device:function(e){return e.app.device},token:function(e){return e.user.token},avatar:function(e){return e.user.avatar},name:function(e){return e.user.name}}),b=v,g=n("a78e"),w=n.n(g),x={sidebar:{opened:!w.a.get("sidebarStatus")||!!+w.a.get("sidebarStatus"),withoutAnimation:!1},device:"desktop"},y={TOGGLE_SIDEBAR:function(e){e.sidebar.opened=!e.sidebar.opened,e.sidebar.withoutAnimation=!1,e.sidebar.opened?w.a.set("sidebarStatus",1):w.a.set("sidebarStatus",0)},CLOSE_SIDEBAR:function(e,t){w.a.set("sidebarStatus",0),e.sidebar.opened=!1,e.sidebar.withoutAnimation=t},TOGGLE_DEVICE:function(e,t){e.device=t}},_={toggleSideBar:function(e){var t=e.commit;t("TOGGLE_SIDEBAR")},closeSideBar:function(e,t){var n=e.commit,a=t.withoutAnimation;n("CLOSE_SIDEBAR",a)},toggleDevice:function(e,t){var n=e.commit;n("TOGGLE_DEVICE",t)}},C={namespaced:!0,state:x,mutations:y,actions:_},k=n("83d6"),O=n.n(k),S=O.a.showSettings,z=O.a.fixedHeader,B=O.a.sidebarLogo,H={showSettings:S,fixedHeader:z,sidebarLogo:B},M={CHANGE_SETTING:function(e,t){var n=t.key,a=t.value;e.hasOwnProperty(n)&&(e[n]=a)}},T={changeSetting:function(e,t){var n=e.commit;n("CHANGE_SETTING",t)}},E={namespaced:!0,state:H,mutations:M,actions:T},L=n("bc3a"),$=n.n(L),V=n("5f87"),A=$.a.create({baseURL:"/api",withCredentials:!0,timeout:5e3});A.interceptors.request.use(function(e){return bt.getters.token&&(e.headers["X-Token"]=Object(V["a"])()),e},function(e){return console.log(e),Promise.reject(e)}),A.interceptors.response.use(function(e){var t=e.data;return 2e4!==t.code?(Object(i["Message"])({message:t.message||"error",type:"error",duration:5e3}),50008!==t.code&&50012!==t.code&&50014!==t.code||i["MessageBox"].confirm("You have been logged out, you can cancel to stay on this page, or log in again","Confirm logout",{confirmButtonText:"Re-Login",cancelButtonText:"Cancel",type:"warning"}).then(function(){bt.dispatch("user/resetToken").then(function(){location.reload()})}),Promise.reject(t.message||"error")):t},function(e){return console.log("err"+e),Object(i["Message"])({message:e.message,type:"error",duration:5e3}),Promise.reject(e)});var j=A;function P(e){return j({url:"/user/login",method:"post",data:e})}function I(e){return j({url:"/user/info",method:"get",params:{token:e}})}function N(){return j({url:"/user/logout",method:"post"})}var D=n("8c4f"),q=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"app-wrapper",class:e.classObj},["mobile"===e.device&&e.sidebar.opened?n("div",{staticClass:"drawer-bg",on:{click:e.handleClickOutside}}):e._e(),e._v(" "),n("sidebar",{staticClass:"sidebar-container"}),e._v(" "),n("div",{staticClass:"main-container"},[n("div",{class:{"fixed-header":e.fixedHeader}},[n("navbar")],1),e._v(" "),n("app-main")],1)],1)},R=[],G=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"navbar"},[n("hamburger",{staticClass:"hamburger-container",attrs:{"is-active":e.sidebar.opened},on:{toggleClick:e.toggleSideBar}}),e._v(" "),n("breadcrumb",{staticClass:"breadcrumb-container"}),e._v(" "),n("div",{staticClass:"right-menu"},[n("el-button",{staticStyle:{"margin-right":"10px"},attrs:{type:"text"},on:{click:e.doLogout}},[e._v("退出")])],1)],1)},F=[],U=n("cebc"),K=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("el-breadcrumb",{staticClass:"app-breadcrumb",attrs:{separator:"/"}},[n("transition-group",{attrs:{name:"breadcrumb"}},e._l(e.levelList,function(t,a){return n("el-breadcrumb-item",{key:t.path},["noRedirect"===t.redirect||a==e.levelList.length-1?n("span",{staticClass:"no-redirect"},[e._v(e._s(t.meta.title))]):n("a",{on:{click:function(n){return n.preventDefault(),e.handleLink(t)}}},[e._v(e._s(t.meta.title))])])}),1)],1)},W=[],J=n("bd11"),X=n.n(J),Y={data:function(){return{levelList:null}},watch:{$route:function(){this.getBreadcrumb()}},created:function(){this.getBreadcrumb()},methods:{getBreadcrumb:function(){var e=this.$route.matched.filter(function(e){return e.meta&&e.meta.title}),t=e[0];this.isDashboard(t)||(e=[{path:"/dashboard",meta:{title:"Dashboard"}}].concat(e)),this.levelList=e.filter(function(e){return e.meta&&e.meta.title&&!1!==e.meta.breadcrumb})},isDashboard:function(e){var t=e&&e.name;return!!t&&t.trim().toLocaleLowerCase()==="Dashboard".toLocaleLowerCase()},pathCompile:function(e){var t=this.$route.params,n=X.a.compile(e);return n(t)},handleLink:function(e){var t=e.redirect,n=e.path;t?this.$router.push(t):this.$router.push(this.pathCompile(n))}}},Q=Y,Z=(n("34c8"),Object(m["a"])(Q,K,W,!1,null,"62cc9144",null)),ee=Z.exports,te=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticStyle:{padding:"0 15px"},on:{click:e.toggleClick}},[n("svg",{staticClass:"hamburger",class:{"is-active":e.isActive},attrs:{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:"64",height:"64"}},[n("path",{attrs:{d:"M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM142.4 642.1L298.7 519a8.84 8.84 0 0 0 0-13.9L142.4 381.9c-5.8-4.6-14.4-.5-14.4 6.9v246.3a8.9 8.9 0 0 0 14.4 7z"}})])])},ne=[],ae={name:"Hamburger",props:{isActive:{type:Boolean,default:!1}},methods:{toggleClick:function(){this.$emit("toggleClick")}}},ie=ae,oe=(n("186a"),Object(m["a"])(ie,te,ne,!1,null,"49e15297",null)),re=oe.exports,se={components:{Breadcrumb:ee,Hamburger:re},computed:Object(U["a"])({},Object(p["b"])(["sidebar","avatar"])),methods:{toggleSideBar:function(){this.$store.dispatch("app/toggleSideBar")},doLogout:function(){this.logout()}}},ce=se,ue=(n("405a"),Object(m["a"])(ce,G,F,!1,null,"1eff5c58",null)),le=ue.exports,de=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{class:{"has-logo":e.showLogo}},[e.showLogo?n("logo",{attrs:{collapse:e.isCollapse}}):e._e(),e._v(" "),n("el-scrollbar",{attrs:{"wrap-class":"scrollbar-wrapper"}},[n("el-menu",{attrs:{"default-active":e.activeMenu,collapse:e.isCollapse,"background-color":e.variables.menuBg,"text-color":e.variables.menuText,"unique-opened":!1,"active-text-color":e.variables.menuActiveText,"collapse-transition":!1,mode:"vertical"}},e._l(e.routes,function(e){return n("sidebar-item",{key:e.path,attrs:{item:e,"base-path":e.path}})}),1)],1)],1)},me=[],he=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"sidebar-logo-container",class:{collapse:e.collapse}},[n("transition",{attrs:{name:"sidebarLogoFade"}},[e.collapse?n("router-link",{key:"collapse",staticClass:"sidebar-logo-link",attrs:{to:"/"}},[e.logo?n("img",{staticClass:"sidebar-logo",attrs:{src:e.logo}}):n("h1",{staticClass:"sidebar-title"},[e._v(e._s(e.title)+" ")])]):n("router-link",{key:"expand",staticClass:"sidebar-logo-link",attrs:{to:"/"}},[e.logo?n("img",{staticClass:"sidebar-logo",attrs:{src:e.logo}}):e._e(),e._v(" "),n("h1",{staticClass:"sidebar-title"},[e._v(e._s(e.title)+" ")])])],1)],1)},fe=[],pe={name:"SidebarLogo",props:{collapse:{type:Boolean,required:!0}},data:function(){return{title:"SOP Admin",logo:"https://wpimg.wallstcn.com/69a1c46c-eb1c-4b46-8bd4-e9e686ef5251.png"}}},ve=pe,be=(n("7c27"),Object(m["a"])(ve,he,fe,!1,null,"b905289c",null)),ge=be.exports,we=function(){var e=this,t=e.$createElement,n=e._self._c||t;return e.item.hidden?e._e():n("div",{staticClass:"menu-wrapper"},[!e.hasOneShowingChild(e.item.children,e.item)||e.onlyOneChild.children&&!e.onlyOneChild.noShowingChildren||e.item.alwaysShow?n("el-submenu",{ref:"subMenu",attrs:{index:e.resolvePath(e.item.path),"popper-append-to-body":""}},[n("template",{slot:"title"},[e.item.meta?n("item",{attrs:{icon:e.item.meta&&e.item.meta.icon,title:e.item.meta.title}}):e._e()],1),e._v(" "),e._l(e.item.children,function(t){return n("sidebar-item",{key:t.path,staticClass:"nest-menu",attrs:{"is-nest":!0,item:t,"base-path":e.resolvePath(t.path)}})})],2):[e.onlyOneChild.meta?n("app-link",{attrs:{to:e.resolvePath(e.onlyOneChild.path)}},[n("el-menu-item",{class:{"submenu-title-noDropdown":!e.isNest},attrs:{index:e.resolvePath(e.onlyOneChild.path)}},[n("item",{attrs:{icon:e.onlyOneChild.meta.icon||e.item.meta&&e.item.meta.icon,title:e.onlyOneChild.meta.title}})],1)],1):e._e()]],2)},xe=[],ye=n("df7c"),_e=n.n(ye);function Ce(e){return/^(https?:|mailto:|tel:)/.test(e)}var ke,Oe,Se={name:"MenuItem",functional:!0,props:{icon:{type:String,default:""},title:{type:String,default:""}},render:function(e,t){var n=t.props,a=n.icon,i=n.title,o=[];return a&&o.push(e("svg-icon",{attrs:{"icon-class":a}})),i&&o.push(e("span",{slot:"title"},[i])),o}},ze=Se,Be=Object(m["a"])(ze,ke,Oe,!1,null,null,null),He=Be.exports,Me=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("component",e._b({},"component",e.linkProps(e.to),!1),[e._t("default")],2)},Te=[],Ee={props:{to:{type:String,required:!0}},methods:{linkProps:function(e){return Ce(e)?{is:"a",href:e,target:"_blank",rel:"noopener"}:{is:"router-link",to:e}}}},Le=Ee,$e=Object(m["a"])(Le,Me,Te,!1,null,null,null),Ve=$e.exports,Ae={computed:{device:function(){return this.$store.state.app.device}},mounted:function(){this.fixBugIniOS()},methods:{fixBugIniOS:function(){var e=this,t=this.$refs.subMenu;if(t){var n=t.handleMouseleave;t.handleMouseleave=function(t){"mobile"!==e.device&&n(t)}}}}},je={name:"SidebarItem",components:{Item:He,AppLink:Ve},mixins:[Ae],props:{item:{type:Object,required:!0},isNest:{type:Boolean,default:!1},basePath:{type:String,default:""}},data:function(){return this.onlyOneChild=null,{}},methods:{hasOneShowingChild:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,a=t.filter(function(t){return!t.hidden&&(e.onlyOneChild=t,!0)});return 1===a.length||0===a.length&&(this.onlyOneChild=Object(U["a"])({},n,{path:"",noShowingChildren:!0}),!0)},resolvePath:function(e){return Ce(e)?e:Ce(this.basePath)?this.basePath:_e.a.resolve(this.basePath,e)}}},Pe=je,Ie=Object(m["a"])(Pe,we,xe,!1,null,null,null),Ne=Ie.exports,De=n("cf1e"),qe=n.n(De),Re={components:{SidebarItem:Ne,Logo:ge},computed:Object(U["a"])({},Object(p["b"])(["sidebar"]),{routes:function(){return this.$router.options.routes},activeMenu:function(){var e=this.$route,t=e.meta,n=e.path;return t.activeMenu?t.activeMenu:n},showLogo:function(){return this.$store.state.settings.sidebarLogo},variables:function(){return qe.a},isCollapse:function(){return!this.sidebar.opened}})},Ge=Re,Fe=Object(m["a"])(Ge,de,me,!1,null,null,null),Ue=Fe.exports,Ke=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("section",{staticClass:"app-main"},[n("transition",{attrs:{name:"fade-transform",mode:"out-in"}},[n("router-view",{key:e.key})],1)],1)},We=[],Je={name:"AppMain",computed:{key:function(){return this.$route.fullPath}}},Xe=Je,Ye=(n("50be"),Object(m["a"])(Xe,Ke,We,!1,null,"43c24f68",null)),Qe=Ye.exports,Ze=document,et=Ze.body,tt=992,nt={watch:{$route:function(e){"mobile"===this.device&&this.sidebar.opened&&bt.dispatch("app/closeSideBar",{withoutAnimation:!1})}},beforeMount:function(){window.addEventListener("resize",this.$_resizeHandler)},beforeDestroy:function(){window.removeEventListener("resize",this.$_resizeHandler)},mounted:function(){var e=this.$_isMobile();e&&(bt.dispatch("app/toggleDevice","mobile"),bt.dispatch("app/closeSideBar",{withoutAnimation:!0}))},methods:{$_isMobile:function(){var e=et.getBoundingClientRect();return e.width-1'});r.a.add(s);t["default"]=s},"9f2b":function(e,t,n){"use strict";var a=n("5bb9"),i=n.n(a);i.a},b20f:function(e,t,n){e.exports={menuText:"#bfcbd9",menuActiveText:"#409EFF",subMenuActiveText:"#f4f4f5",menuBg:"#304156",menuHover:"#263445",subMenuBg:"#1f2d3d",subMenuHover:"#001528",sideBarWidth:"210px"}},b3b5:function(e,t,n){"use strict";n.r(t);var a=n("e017"),i=n.n(a),o=n("21a1"),r=n.n(o),s=new i.a({id:"icon-user",use:"icon-user-usage",viewBox:"0 0 130 130",content:''});r.a.add(s);t["default"]=s},cf1e:function(e,t,n){e.exports={menuText:"#bfcbd9",menuActiveText:"#409EFF",subMenuActiveText:"#f4f4f5",menuBg:"#304156",menuHover:"#263445",subMenuBg:"#1f2d3d",subMenuHover:"#001528",sideBarWidth:"210px"}},d7ec:function(e,t,n){"use strict";n.r(t);var a=n("e017"),i=n.n(a),o=n("21a1"),r=n.n(o),s=new i.a({id:"icon-eye-open",use:"icon-eye-open-usage",viewBox:"0 0 1024 1024",content:''});r.a.add(s);t["default"]=s},dc52:function(e,t,n){},dcf8:function(e,t,n){"use strict";n.r(t);var a=n("e017"),i=n.n(a),o=n("21a1"),r=n.n(o),s=new i.a({id:"icon-nested",use:"icon-nested-usage",viewBox:"0 0 128 128",content:''});r.a.add(s);t["default"]=s},eb1b:function(e,t,n){"use strict";n.r(t);var a=n("e017"),i=n.n(a),o=n("21a1"),r=n.n(o),s=new i.a({id:"icon-form",use:"icon-form-usage",viewBox:"0 0 128 128",content:''});r.a.add(s);t["default"]=s},f782:function(e,t,n){"use strict";n.r(t);var a=n("e017"),i=n.n(a),o=n("21a1"),r=n.n(o),s=new i.a({id:"icon-dashboard",use:"icon-dashboard-usage",viewBox:"0 0 128 100",content:''});r.a.add(s);t["default"]=s}},[[0,"runtime","chunk-elementUI","chunk-libs"]]]); \ No newline at end of file +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["app"],{0:function(e,t,n){e.exports=n("56d7")},"0cb8":function(e,t,n){},"186a":function(e,t,n){"use strict";var a=n("dc52"),i=n.n(a);i.a},"18f0":function(e,t,n){"use strict";n.r(t);var a=n("e017"),i=n.n(a),o=n("21a1"),r=n.n(o),s=new i.a({id:"icon-link",use:"icon-link-usage",viewBox:"0 0 128 128",content:''});r.a.add(s);t["default"]=s},"1f59":function(e,t,n){},2536:function(e,t,n){},2635:function(e,t,n){},"2a3d":function(e,t,n){"use strict";n.r(t);var a=n("e017"),i=n.n(a),o=n("21a1"),r=n.n(o),s=new i.a({id:"icon-password",use:"icon-password-usage",viewBox:"0 0 128 128",content:''});r.a.add(s);t["default"]=s},"30c3":function(e,t,n){"use strict";n.r(t);var a=n("e017"),i=n.n(a),o=n("21a1"),r=n.n(o),s=new i.a({id:"icon-example",use:"icon-example-usage",viewBox:"0 0 128 128",content:''});r.a.add(s);t["default"]=s},"34c8":function(e,t,n){"use strict";var a=n("5332"),i=n.n(a);i.a},"405a":function(e,t,n){"use strict";var a=n("1f59"),i=n.n(a);i.a},"47f1":function(e,t,n){"use strict";n.r(t);var a=n("e017"),i=n.n(a),o=n("21a1"),r=n.n(o),s=new i.a({id:"icon-table",use:"icon-table-usage",viewBox:"0 0 128 128",content:''});r.a.add(s);t["default"]=s},"4df5":function(e,t,n){"use strict";n.r(t);var a=n("e017"),i=n.n(a),o=n("21a1"),r=n.n(o),s=new i.a({id:"icon-eye",use:"icon-eye-usage",viewBox:"0 0 128 64",content:''});r.a.add(s);t["default"]=s},"50be":function(e,t,n){"use strict";var a=n("2536"),i=n.n(a);i.a},"51ff":function(e,t,n){var a={"./dashboard.svg":"f782","./example.svg":"30c3","./eye-open.svg":"d7ec","./eye.svg":"4df5","./form.svg":"eb1b","./link.svg":"18f0","./nested.svg":"dcf8","./password.svg":"2a3d","./table.svg":"47f1","./tree.svg":"93cd","./user.svg":"b3b5"};function i(e){var t=o(e);return n(t)}function o(e){var t=a[e];if(!(t+1)){var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}return t}i.keys=function(){return Object.keys(a)},i.resolve=o,e.exports=i,i.id="51ff"},5332:function(e,t,n){},"56d7":function(e,t,n){"use strict";n.r(t);n("cadf"),n("551c"),n("f751"),n("097d");var a=n("2b0e"),i=(n("f5df"),n("5c96")),o=n.n(i),r=(n("0fae"),n("f0d9")),s=n.n(r),c=(n("b20f"),function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{attrs:{id:"app"}},[n("router-view")],1)}),u=[],l={name:"App"},d=l,m=n("2877"),h=Object(m["a"])(d,c,u,!1,null,null,null),f=h.exports,p=n("2f62"),v=(n("7f7f"),{sidebar:function(e){return e.app.sidebar},device:function(e){return e.app.device},token:function(e){return e.user.token},avatar:function(e){return e.user.avatar},name:function(e){return e.user.name}}),b=v,g=n("a78e"),w=n.n(g),x={sidebar:{opened:!w.a.get("sidebarStatus")||!!+w.a.get("sidebarStatus"),withoutAnimation:!1},device:"desktop"},y={TOGGLE_SIDEBAR:function(e){e.sidebar.opened=!e.sidebar.opened,e.sidebar.withoutAnimation=!1,e.sidebar.opened?w.a.set("sidebarStatus",1):w.a.set("sidebarStatus",0)},CLOSE_SIDEBAR:function(e,t){w.a.set("sidebarStatus",0),e.sidebar.opened=!1,e.sidebar.withoutAnimation=t},TOGGLE_DEVICE:function(e,t){e.device=t}},_={toggleSideBar:function(e){var t=e.commit;t("TOGGLE_SIDEBAR")},closeSideBar:function(e,t){var n=e.commit,a=t.withoutAnimation;n("CLOSE_SIDEBAR",a)},toggleDevice:function(e,t){var n=e.commit;n("TOGGLE_DEVICE",t)}},C={namespaced:!0,state:x,mutations:y,actions:_},k=n("83d6"),O=n.n(k),S=O.a.showSettings,z=O.a.fixedHeader,B=O.a.sidebarLogo,H={showSettings:S,fixedHeader:z,sidebarLogo:B},M={CHANGE_SETTING:function(e,t){var n=t.key,a=t.value;e.hasOwnProperty(n)&&(e[n]=a)}},T={changeSetting:function(e,t){var n=e.commit;n("CHANGE_SETTING",t)}},E={namespaced:!0,state:H,mutations:M,actions:T},L=n("bc3a"),$=n.n(L),V=n("5f87"),A=$.a.create({baseURL:"/api",withCredentials:!0,timeout:5e3});A.interceptors.request.use(function(e){return bt.getters.token&&(e.headers["X-Token"]=Object(V["a"])()),e},function(e){return console.log(e),Promise.reject(e)}),A.interceptors.response.use(function(e){var t=e.data;return 2e4!==t.code?(Object(i["Message"])({message:t.message||"error",type:"error",duration:5e3}),50008!==t.code&&50012!==t.code&&50014!==t.code||i["MessageBox"].confirm("You have been logged out, you can cancel to stay on this page, or log in again","Confirm logout",{confirmButtonText:"Re-Login",cancelButtonText:"Cancel",type:"warning"}).then(function(){bt.dispatch("user/resetToken").then(function(){location.reload()})}),Promise.reject(t.message||"error")):t},function(e){return console.log("err"+e),Object(i["Message"])({message:e.message,type:"error",duration:5e3}),Promise.reject(e)});var j=A;function I(e){return j({url:"/user/login",method:"post",data:e})}function P(e){return j({url:"/user/info",method:"get",params:{token:e}})}function N(){return j({url:"/user/logout",method:"post"})}var D=n("8c4f"),R=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"app-wrapper",class:e.classObj},["mobile"===e.device&&e.sidebar.opened?n("div",{staticClass:"drawer-bg",on:{click:e.handleClickOutside}}):e._e(),e._v(" "),n("sidebar",{staticClass:"sidebar-container"}),e._v(" "),n("div",{staticClass:"main-container"},[n("div",{class:{"fixed-header":e.fixedHeader}},[n("navbar")],1),e._v(" "),n("app-main")],1)],1)},q=[],G=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"navbar"},[n("hamburger",{staticClass:"hamburger-container",attrs:{"is-active":e.sidebar.opened},on:{toggleClick:e.toggleSideBar}}),e._v(" "),n("breadcrumb",{staticClass:"breadcrumb-container"}),e._v(" "),n("div",{staticClass:"right-menu"},[n("el-button",{staticStyle:{"margin-right":"10px"},attrs:{type:"text"},on:{click:e.doLogout}},[e._v("退出")])],1)],1)},F=[],U=n("cebc"),K=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("el-breadcrumb",{staticClass:"app-breadcrumb",attrs:{separator:"/"}},[n("transition-group",{attrs:{name:"breadcrumb"}},e._l(e.levelList,function(t,a){return n("el-breadcrumb-item",{key:t.path},["noRedirect"===t.redirect||a==e.levelList.length-1?n("span",{staticClass:"no-redirect"},[e._v(e._s(t.meta.title))]):n("a",{on:{click:function(n){return n.preventDefault(),e.handleLink(t)}}},[e._v(e._s(t.meta.title))])])}),1)],1)},W=[],J=n("bd11"),X=n.n(J),Y={data:function(){return{levelList:null}},watch:{$route:function(){this.getBreadcrumb()}},created:function(){this.getBreadcrumb()},methods:{getBreadcrumb:function(){var e=this.$route.matched.filter(function(e){return e.meta&&e.meta.title}),t=e[0];this.isDashboard(t)||(e=[{path:"/dashboard",meta:{title:"Dashboard"}}].concat(e)),this.levelList=e.filter(function(e){return e.meta&&e.meta.title&&!1!==e.meta.breadcrumb})},isDashboard:function(e){var t=e&&e.name;return!!t&&t.trim().toLocaleLowerCase()==="Dashboard".toLocaleLowerCase()},pathCompile:function(e){var t=this.$route.params,n=X.a.compile(e);return n(t)},handleLink:function(e){var t=e.redirect,n=e.path;t?this.$router.push(t):this.$router.push(this.pathCompile(n))}}},Q=Y,Z=(n("34c8"),Object(m["a"])(Q,K,W,!1,null,"62cc9144",null)),ee=Z.exports,te=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticStyle:{padding:"0 15px"},on:{click:e.toggleClick}},[n("svg",{staticClass:"hamburger",class:{"is-active":e.isActive},attrs:{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:"64",height:"64"}},[n("path",{attrs:{d:"M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM142.4 642.1L298.7 519a8.84 8.84 0 0 0 0-13.9L142.4 381.9c-5.8-4.6-14.4-.5-14.4 6.9v246.3a8.9 8.9 0 0 0 14.4 7z"}})])])},ne=[],ae={name:"Hamburger",props:{isActive:{type:Boolean,default:!1}},methods:{toggleClick:function(){this.$emit("toggleClick")}}},ie=ae,oe=(n("186a"),Object(m["a"])(ie,te,ne,!1,null,"49e15297",null)),re=oe.exports,se={components:{Breadcrumb:ee,Hamburger:re},computed:Object(U["a"])({},Object(p["b"])(["sidebar","avatar"])),methods:{toggleSideBar:function(){this.$store.dispatch("app/toggleSideBar")},doLogout:function(){this.logout()}}},ce=se,ue=(n("405a"),Object(m["a"])(ce,G,F,!1,null,"1eff5c58",null)),le=ue.exports,de=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{class:{"has-logo":e.showLogo}},[e.showLogo?n("logo",{attrs:{collapse:e.isCollapse}}):e._e(),e._v(" "),n("el-scrollbar",{attrs:{"wrap-class":"scrollbar-wrapper"}},[n("el-menu",{attrs:{"default-active":e.activeMenu,collapse:e.isCollapse,"background-color":e.variables.menuBg,"text-color":e.variables.menuText,"unique-opened":!1,"active-text-color":e.variables.menuActiveText,"collapse-transition":!1,mode:"vertical"}},e._l(e.routes,function(e){return n("sidebar-item",{key:e.path,attrs:{item:e,"base-path":e.path}})}),1)],1)],1)},me=[],he=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"sidebar-logo-container",class:{collapse:e.collapse}},[n("transition",{attrs:{name:"sidebarLogoFade"}},[e.collapse?n("router-link",{key:"collapse",staticClass:"sidebar-logo-link",attrs:{to:"/"}},[e.logo?n("img",{staticClass:"sidebar-logo",attrs:{src:e.logo}}):n("h1",{staticClass:"sidebar-title"},[e._v(e._s(e.title)+" ")])]):n("router-link",{key:"expand",staticClass:"sidebar-logo-link",attrs:{to:"/"}},[e.logo?n("img",{staticClass:"sidebar-logo",attrs:{src:e.logo}}):e._e(),e._v(" "),n("h1",{staticClass:"sidebar-title"},[e._v(e._s(e.title)+" ")])])],1)],1)},fe=[],pe={name:"SidebarLogo",props:{collapse:{type:Boolean,required:!0}},data:function(){return{title:"SOP Admin",logo:"https://wpimg.wallstcn.com/69a1c46c-eb1c-4b46-8bd4-e9e686ef5251.png"}}},ve=pe,be=(n("7c27"),Object(m["a"])(ve,he,fe,!1,null,"b905289c",null)),ge=be.exports,we=function(){var e=this,t=e.$createElement,n=e._self._c||t;return e.item.hidden?e._e():n("div",{staticClass:"menu-wrapper"},[!e.hasOneShowingChild(e.item.children,e.item)||e.onlyOneChild.children&&!e.onlyOneChild.noShowingChildren||e.item.alwaysShow?n("el-submenu",{ref:"subMenu",attrs:{index:e.resolvePath(e.item.path),"popper-append-to-body":""}},[n("template",{slot:"title"},[e.item.meta?n("item",{attrs:{icon:e.item.meta&&e.item.meta.icon,title:e.item.meta.title}}):e._e()],1),e._v(" "),e._l(e.item.children,function(t){return n("sidebar-item",{key:t.path,staticClass:"nest-menu",attrs:{"is-nest":!0,item:t,"base-path":e.resolvePath(t.path)}})})],2):[e.onlyOneChild.meta?n("app-link",{attrs:{to:e.resolvePath(e.onlyOneChild.path)}},[n("el-menu-item",{class:{"submenu-title-noDropdown":!e.isNest},attrs:{index:e.resolvePath(e.onlyOneChild.path)}},[n("item",{attrs:{icon:e.onlyOneChild.meta.icon||e.item.meta&&e.item.meta.icon,title:e.onlyOneChild.meta.title}})],1)],1):e._e()]],2)},xe=[],ye=n("df7c"),_e=n.n(ye);function Ce(e){return/^(https?:|mailto:|tel:)/.test(e)}var ke,Oe,Se={name:"MenuItem",functional:!0,props:{icon:{type:String,default:""},title:{type:String,default:""}},render:function(e,t){var n=t.props,a=n.icon,i=n.title,o=[];return a&&o.push(e("svg-icon",{attrs:{"icon-class":a}})),i&&o.push(e("span",{slot:"title"},[i])),o}},ze=Se,Be=Object(m["a"])(ze,ke,Oe,!1,null,null,null),He=Be.exports,Me=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("component",e._b({},"component",e.linkProps(e.to),!1),[e._t("default")],2)},Te=[],Ee={props:{to:{type:String,required:!0}},methods:{linkProps:function(e){return Ce(e)?{is:"a",href:e,target:"_blank",rel:"noopener"}:{is:"router-link",to:e}}}},Le=Ee,$e=Object(m["a"])(Le,Me,Te,!1,null,null,null),Ve=$e.exports,Ae={computed:{device:function(){return this.$store.state.app.device}},mounted:function(){this.fixBugIniOS()},methods:{fixBugIniOS:function(){var e=this,t=this.$refs.subMenu;if(t){var n=t.handleMouseleave;t.handleMouseleave=function(t){"mobile"!==e.device&&n(t)}}}}},je={name:"SidebarItem",components:{Item:He,AppLink:Ve},mixins:[Ae],props:{item:{type:Object,required:!0},isNest:{type:Boolean,default:!1},basePath:{type:String,default:""}},data:function(){return this.onlyOneChild=null,{}},methods:{hasOneShowingChild:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,a=t.filter(function(t){return!t.hidden&&(e.onlyOneChild=t,!0)});return 1===a.length||0===a.length&&(this.onlyOneChild=Object(U["a"])({},n,{path:"",noShowingChildren:!0}),!0)},resolvePath:function(e){return Ce(e)?e:Ce(this.basePath)?this.basePath:_e.a.resolve(this.basePath,e)}}},Ie=je,Pe=Object(m["a"])(Ie,we,xe,!1,null,null,null),Ne=Pe.exports,De=n("cf1e"),Re=n.n(De),qe={components:{SidebarItem:Ne,Logo:ge},computed:Object(U["a"])({},Object(p["b"])(["sidebar"]),{routes:function(){return this.$router.options.routes},activeMenu:function(){var e=this.$route,t=e.meta,n=e.path;return t.activeMenu?t.activeMenu:n},showLogo:function(){return this.$store.state.settings.sidebarLogo},variables:function(){return Re.a},isCollapse:function(){return!this.sidebar.opened}})},Ge=qe,Fe=Object(m["a"])(Ge,de,me,!1,null,null,null),Ue=Fe.exports,Ke=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("section",{staticClass:"app-main"},[n("transition",{attrs:{name:"fade-transform",mode:"out-in"}},[n("router-view",{key:e.key})],1)],1)},We=[],Je={name:"AppMain",computed:{key:function(){return this.$route.fullPath}}},Xe=Je,Ye=(n("50be"),Object(m["a"])(Xe,Ke,We,!1,null,"43c24f68",null)),Qe=Ye.exports,Ze=document,et=Ze.body,tt=992,nt={watch:{$route:function(e){"mobile"===this.device&&this.sidebar.opened&&bt.dispatch("app/closeSideBar",{withoutAnimation:!1})}},beforeMount:function(){window.addEventListener("resize",this.$_resizeHandler)},beforeDestroy:function(){window.removeEventListener("resize",this.$_resizeHandler)},mounted:function(){var e=this.$_isMobile();e&&(bt.dispatch("app/toggleDevice","mobile"),bt.dispatch("app/closeSideBar",{withoutAnimation:!0}))},methods:{$_isMobile:function(){var e=et.getBoundingClientRect();return e.width-1'});r.a.add(s);t["default"]=s},"9f2b":function(e,t,n){"use strict";var a=n("5bb9"),i=n.n(a);i.a},b20f:function(e,t,n){e.exports={menuText:"#bfcbd9",menuActiveText:"#409EFF",subMenuActiveText:"#f4f4f5",menuBg:"#304156",menuHover:"#263445",subMenuBg:"#1f2d3d",subMenuHover:"#001528",sideBarWidth:"210px"}},b3b5:function(e,t,n){"use strict";n.r(t);var a=n("e017"),i=n.n(a),o=n("21a1"),r=n.n(o),s=new i.a({id:"icon-user",use:"icon-user-usage",viewBox:"0 0 130 130",content:''});r.a.add(s);t["default"]=s},cf1e:function(e,t,n){e.exports={menuText:"#bfcbd9",menuActiveText:"#409EFF",subMenuActiveText:"#f4f4f5",menuBg:"#304156",menuHover:"#263445",subMenuBg:"#1f2d3d",subMenuHover:"#001528",sideBarWidth:"210px"}},d7ec:function(e,t,n){"use strict";n.r(t);var a=n("e017"),i=n.n(a),o=n("21a1"),r=n.n(o),s=new i.a({id:"icon-eye-open",use:"icon-eye-open-usage",viewBox:"0 0 1024 1024",content:''});r.a.add(s);t["default"]=s},dc52:function(e,t,n){},dcf8:function(e,t,n){"use strict";n.r(t);var a=n("e017"),i=n.n(a),o=n("21a1"),r=n.n(o),s=new i.a({id:"icon-nested",use:"icon-nested-usage",viewBox:"0 0 128 128",content:''});r.a.add(s);t["default"]=s},eb1b:function(e,t,n){"use strict";n.r(t);var a=n("e017"),i=n.n(a),o=n("21a1"),r=n.n(o),s=new i.a({id:"icon-form",use:"icon-form-usage",viewBox:"0 0 128 128",content:''});r.a.add(s);t["default"]=s},f782:function(e,t,n){"use strict";n.r(t);var a=n("e017"),i=n.n(a),o=n("21a1"),r=n.n(o),s=new i.a({id:"icon-dashboard",use:"icon-dashboard-usage",viewBox:"0 0 128 100",content:''});r.a.add(s);t["default"]=s}},[[0,"runtime","chunk-elementUI","chunk-libs"]]]); \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-009073d4.28312808.js b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-009073d4.28312808.js new file mode 100644 index 00000000..746b34f6 --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-009073d4.28312808.js @@ -0,0 +1 @@ +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-009073d4"],{"0a49":function(e,t,i){var a=i("9b43"),l=i("626a"),o=i("4bf8"),r=i("9def"),n=i("cd1c");e.exports=function(e,t){var i=1==e,s=2==e,m=3==e,c=4==e,p=6==e,u=5==e||p,d=t||n;return function(t,n,g){for(var f,h,D=o(t),v=l(D),y=a(n,g,3),b=r(v.length),k=0,x=i?d(t,b):s?d(t,0):void 0;b>k;k++)if((u||k in v)&&(f=v[k],h=y(f,k,D),e))if(i)x[k]=h;else if(h)switch(e){case 3:return!0;case 5:return f;case 6:return k;case 2:x.push(f)}else if(c)return!1;return p?-1:m||c?c:x}}},1169:function(e,t,i){var a=i("2d95");e.exports=Array.isArray||function(e){return"Array"==a(e)}},1510:function(e,t,i){"use strict";i.r(t);var a=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"app-container"},[i("el-container",[i("el-aside",{staticStyle:{"min-height":"300px",width:"250px"}},[i("el-input",{staticStyle:{"margin-bottom":"20px"},attrs:{"prefix-icon":"el-icon-search",placeholder:"搜索服务...",size:"mini",clearable:""},model:{value:e.filterText,callback:function(t){e.filterText=t},expression:"filterText"}}),e._v(" "),i("el-tree",{ref:"tree2",staticClass:"filter-tree",attrs:{data:e.treeData,props:e.defaultProps,"filter-node-method":e.filterNode,"highlight-current":!0,"expand-on-click-node":!1,"empty-text":"无数据","node-key":"id","default-expand-all":""},on:{"node-click":e.onNodeClick},scopedSlots:e._u([{key:"default",fn:function(t){t.node;var a=t.data;return i("span",{staticClass:"custom-tree-node"},[i("div",[i("el-tooltip",{directives:[{name:"show",rawName:"v-show",value:a.custom,expression:"data.custom"}],staticClass:"item",attrs:{content:"自定义服务",effect:"light",placement:"left"}},[i("i",{staticClass:"el-icon-warning-outline"})]),e._v(" "),a.label.lengthsubCode:"+e.limitCode),t.push("subMsg:"+e.limitMsg)):2===e.limitType&&t.push("令牌桶容量:"+e.tokenBucketCount),t.join("")},onLimitDialogSave:function(){var e=this;this.$refs["limitDialogForm"].validate(function(t){if(t){e.cleanCheckboxData(),e.limitDialogFormData.serviceId=e.serviceId;var i=e.limitDialogFormData.id?"config.limit.update":"config.limit.add";e.post(i,e.limitDialogFormData,function(e){this.limitDialogVisible=!1,this.loadTable()})}})},cleanCheckboxData:function(){this.checkTypeKey(1)||(this.limitDialogFormData.routeId=""),this.checkTypeKey(2)||(this.limitDialogFormData.appKey=""),this.checkTypeKey(3)||(this.limitDialogFormData.limitIp="")},onLimitTypeTipClick:function(){var e="窗口策略:每秒处理固定数量的请求,超出请求数量返回错误信息。",t="令牌桶策略:每秒放置固定数量的令牌数,每个请求进来后先去拿令牌,拿到了令牌才能继续,拿不到则等候令牌重新生成了再拿。",i=e+""+t;this.$alert(i,"限流策略",{dangerouslyUseHTMLString:!0})},onSizeChange:function(e){this.searchFormData.pageSize=e,this.loadTable()},onPageIndexChange:function(e){this.searchFormData.pageIndex=e,this.loadTable()},checkTypeKey:function(e){return this.limitDialogFormData.typeKey.find(function(t,i,a){return t===e})},isWindowType:function(){return 1===this.limitDialogFormData.limitType},isTokenType:function(){return 2===this.limitDialogFormData.limitType},limitRender:function(e){var t=[],i=[];return e.routeId&&(i.push(e.routeId),t.push("路由ID")),e.appKey&&(i.push(e.appKey),t.push("AppKey")),e.limitIp&&(i.push(e.limitIp),t.push("IP")),i.join(" + ")+"("+t.join(" + ")+")"}}}),r=o,n=(i("18f8"),i("7bbc"),i("2877")),s=Object(n["a"])(r,a,l,!1,null,"b81bfbde",null);t["default"]=s.exports},"18f8":function(e,t,i){"use strict";var a=i("74a4"),l=i.n(a);l.a},"4e11":function(e,t,i){},"74a4":function(e,t,i){},7514:function(e,t,i){"use strict";var a=i("5ca1"),l=i("0a49")(5),o="find",r=!0;o in[]&&Array(1)[o](function(){r=!1}),a(a.P+a.F*r,"Array",{find:function(e){return l(this,e,arguments.length>1?arguments[1]:void 0)}}),i("9c6c")(o)},"7bbc":function(e,t,i){"use strict";var a=i("4e11"),l=i.n(a);l.a},cd1c:function(e,t,i){var a=i("e853");e.exports=function(e,t){return new(a(e))(t)}},e853:function(e,t,i){var a=i("d3f4"),l=i("1169"),o=i("2b4c")("species");e.exports=function(e){var t;return l(e)&&(t=e.constructor,"function"!=typeof t||t!==Array&&!l(t.prototype)||(t=void 0),a(t)&&(t=t[o],null===t&&(t=void 0))),void 0===t?Array:t}}}]); \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-25908fca.9d8bc0b6.js b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-25908fca.9d8bc0b6.js new file mode 100644 index 00000000..ec5a6661 --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-25908fca.9d8bc0b6.js @@ -0,0 +1 @@ +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-25908fca"],{"021d":function(e,t,a){},"0bac":function(e,t,a){"use strict";var s=a("021d"),i=a.n(s);i.a},cb56:function(e,t,a){"use strict";a.r(t);var s=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"app-container"},[a("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0,model:e.searchFormData,size:"mini"}},[a("el-form-item",{attrs:{label:"appKey"}},[a("el-input",{staticStyle:{width:"250px"},attrs:{clearable:!0,placeholder:"appKey"},model:{value:e.searchFormData.appKey,callback:function(t){e.$set(e.searchFormData,"appKey",t)},expression:"searchFormData.appKey"}})],1),e._v(" "),a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-search"},on:{click:e.onSearchTable}},[e._v("查询")])],1)],1),e._v(" "),a("el-button",{staticStyle:{"margin-bottom":"10px"},attrs:{type:"primary",size:"mini",icon:"el-icon-plus"},on:{click:e.onAdd}},[e._v("新增ISV")]),e._v(" "),a("el-table",{attrs:{data:e.pageInfo.list,border:"",fit:"","highlight-current-row":""}},[a("el-table-column",{attrs:{prop:"id",label:"ID",width:"80"}}),e._v(" "),a("el-table-column",{attrs:{prop:"appKey",label:"appKey",width:"250"}}),e._v(" "),a("el-table-column",{attrs:{prop:"",label:"秘钥",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(a){return e.onShowKeys(t.row)}}},[e._v("查看")])]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"roleList",label:"角色"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("div",{domProps:{innerHTML:e._s(e.roleRender(t.row))}})]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"status",label:"状态",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[1===t.row.status?a("span",{staticStyle:{color:"#67C23A"}},[e._v("已启用")]):e._e(),e._v(" "),2===t.row.status?a("span",{staticStyle:{color:"#F56C6C"}},[e._v("已禁用")]):e._e()]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"gmtCreate",label:"添加时间",width:"160"}}),e._v(" "),a("el-table-column",{attrs:{prop:"gmtModified",label:"修改时间",width:"160"}}),e._v(" "),a("el-table-column",{attrs:{label:"操作",width:"150"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(a){return e.onTableUpdate(t.row)}}},[e._v("修改")]),e._v(" "),a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(a){return e.onKeysUpdate(t.row)}}},[e._v("秘钥管理")])]}}])})],1),e._v(" "),a("el-pagination",{staticStyle:{"margin-top":"5px"},attrs:{background:"","current-page":e.searchFormData.pageIndex,"page-size":e.searchFormData.pageSize,"page-sizes":[5,10,20,40],total:e.pageInfo.total,layout:"total, sizes, prev, pager, next"},on:{"size-change":e.onSizeChange,"current-change":e.onPageIndexChange}}),e._v(" "),a("el-dialog",{attrs:{title:e.isvDialogTitle,visible:e.isvDialogVisible,"close-on-click-modal":!1},on:{"update:visible":function(t){e.isvDialogVisible=t},close:e.onIsvDialogClose}},[a("el-form",{ref:"isvForm",attrs:{rules:e.rulesIsvForm,model:e.isvDialogFormData,"label-width":"120px",size:"mini"}},[a("el-form-item",{attrs:{label:"appKey"}},[0===e.isvDialogFormData.id?a("span",{staticStyle:{color:"gray"}},[e._v("(系统自动生成)")]):a("span",[e._v(e._s(e.isvDialogFormData.appKey))])]),e._v(" "),a("el-form-item",{attrs:{label:"角色"}},[a("el-checkbox-group",{model:{value:e.isvDialogFormData.roleCode,callback:function(t){e.$set(e.isvDialogFormData,"roleCode",t)},expression:"isvDialogFormData.roleCode"}},e._l(e.roles,function(t){return a("el-checkbox",{key:t.roleCode,attrs:{label:t.roleCode}},[e._v(e._s(t.description))])}),1)],1),e._v(" "),a("el-form-item",{attrs:{label:"状态"}},[a("el-radio-group",{model:{value:e.isvDialogFormData.status,callback:function(t){e.$set(e.isvDialogFormData,"status",t)},expression:"isvDialogFormData.status"}},[a("el-radio",{attrs:{label:1,name:"status"}},[e._v("启用")]),e._v(" "),a("el-radio",{attrs:{label:2,name:"status"}},[e._v("禁用")])],1)],1)],1),e._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(t){e.isvDialogVisible=!1}}},[e._v("取 消")]),e._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:e.onIsvDialogSave}},[e._v("保 存")])],1)],1),e._v(" "),a("el-dialog",{attrs:{title:"秘钥信息",visible:e.isvKeysDialogVisible},on:{"update:visible":function(t){e.isvKeysDialogVisible=t},close:function(t){return e.resetForm("isvKeysFrom")}}},[a("el-form",{ref:"isvKeysFrom",staticClass:"key-view",attrs:{model:e.isvKeysFormData,"label-width":"160px",size:"mini"}},[a("el-form-item",{attrs:{label:""}},[a("el-alert",{attrs:{title:"带 ★ 的分配给开发者",type:"warning",closable:!1}})],1),e._v(" "),a("el-form-item",{attrs:{label:e.selfLabel("appKey")}},[a("span",[e._v(e._s(e.isvKeysFormData.appKey))])]),e._v(" "),a("el-form-item",{directives:[{name:"show",rawName:"v-show",value:e.showKeys(),expression:"showKeys()"}],attrs:{label:"秘钥格式"}},[1===e.isvKeysFormData.keyFormat?a("span",[e._v("PKCS8(JAVA适用)")]):e._e(),e._v(" "),2===e.isvKeysFormData.keyFormat?a("span",[e._v("PKCS1(非JAVA适用)")]):e._e()]),e._v(" "),a("el-form-item",{directives:[{name:"show",rawName:"v-show",value:2===e.isvKeysFormData.signType,expression:"isvKeysFormData.signType === 2"}],attrs:{label:e.selfLabel("secret")}},[a("span",[e._v(e._s(e.isvKeysFormData.secret))])]),e._v(" "),a("fieldset",{directives:[{name:"show",rawName:"v-show",value:e.showKeys(),expression:"showKeys()"}]},[a("legend",[e._v("ISV公私钥")]),e._v(" "),a("el-form-item",{attrs:{label:"ISV公钥"}},[a("el-input",{attrs:{type:"textarea",readonly:""},model:{value:e.isvKeysFormData.publicKeyIsv,callback:function(t){e.$set(e.isvKeysFormData,"publicKeyIsv",t)},expression:"isvKeysFormData.publicKeyIsv"}})],1),e._v(" "),a("el-form-item",{attrs:{label:e.selfLabel("ISV私钥")}},[a("el-input",{attrs:{type:"textarea",readonly:""},model:{value:e.isvKeysFormData.privateKeyIsv,callback:function(t){e.$set(e.isvKeysFormData,"privateKeyIsv",t)},expression:"isvKeysFormData.privateKeyIsv"}})],1)],1),e._v(" "),a("fieldset",{directives:[{name:"show",rawName:"v-show",value:e.showKeys(),expression:"showKeys()"}]},[a("legend",[e._v("平台公私钥")]),e._v(" "),a("el-form-item",{attrs:{label:e.selfLabel("平台公钥")}},[a("el-input",{attrs:{type:"textarea",readonly:""},model:{value:e.isvKeysFormData.publicKeyPlatform,callback:function(t){e.$set(e.isvKeysFormData,"publicKeyPlatform",t)},expression:"isvKeysFormData.publicKeyPlatform"}})],1),e._v(" "),a("el-form-item",{attrs:{prop:"privateKeyPlatform",label:"平台私钥"}},[a("el-input",{attrs:{type:"textarea",readonly:""},model:{value:e.isvKeysFormData.privateKeyPlatform,callback:function(t){e.$set(e.isvKeysFormData,"privateKeyPlatform",t)},expression:"isvKeysFormData.privateKeyPlatform"}})],1)],1)],1),e._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(t){e.isvKeysDialogVisible=!1}}},[e._v("关 闭")])],1)],1)],1)},i=[],o={data:function(){return{searchFormData:{appKey:"",pageIndex:1,pageSize:10},pageInfo:{list:[],total:0},roles:[],isvDialogVisible:!1,isvDialogTitle:"新增ISV",isvDialogFormData:{id:0,status:1,roleCode:[]},rulesIsvForm:{appKey:[{required:!0,message:"不能为空",trigger:"blur"},{min:1,max:100,message:"长度在 1 到 100 个字符",trigger:"blur"}]},isvKeysDialogVisible:!1,isvKeysFormData:{appKey:"",secret:"",publicKeyIsv:"",privateKeyIsv:"",publicKeyPlatform:"",privateKeyPlatform:"",signType:""}}},created:function(){this.loadTable(),this.loadRouteRole()},methods:{loadTable:function(){this.post("isv.info.page",this.searchFormData,function(e){this.pageInfo=e.data})},loadRouteRole:function(){0===this.roles.length&&this.post("role.listall",{},function(e){this.roles=e.data})},onShowKeys:function(e){this.post("isv.keys.get",{appKey:e.appKey},function(e){var t=this;this.isvKeysDialogVisible=!0,this.$nextTick(function(){Object.assign(t.isvKeysFormData,e.data)})})},onSearchTable:function(){this.loadTable()},onTableUpdate:function(e){var t=this;this.isvDialogTitle="修改ISV",this.isvDialogVisible=!0,this.$nextTick(function(){t.post("isv.info.get",{id:e.id},function(e){for(var t=e.data,a=t.roleList,s=[],i=0;ik;k++)if((u||k in y)&&(f=y[k],h=v(f,k,D),e))if(i)x[k]=h;else if(h)switch(e){case 3:return!0;case 5:return f;case 6:return k;case 2:x.push(f)}else if(c)return!1;return p?-1:m||c?c:x}}},1169:function(e,t,i){var a=i("2d95");e.exports=Array.isArray||function(e){return"Array"==a(e)}},1510:function(e,t,i){"use strict";i.r(t);var a=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"app-container"},[i("el-container",[i("el-aside",{staticStyle:{"min-height":"300px",width:"200px"}},[i("el-input",{staticStyle:{"margin-bottom":"20px"},attrs:{"prefix-icon":"el-icon-search",placeholder:"搜索服务...",size:"mini",clearable:""},model:{value:e.filterText,callback:function(t){e.filterText=t},expression:"filterText"}}),e._v(" "),i("el-tree",{ref:"tree2",staticClass:"filter-tree",attrs:{data:e.treeData,props:e.defaultProps,"filter-node-method":e.filterNode,"highlight-current":!0,"expand-on-click-node":!1,"empty-text":"无数据","node-key":"id","default-expand-all":""},on:{"node-click":e.onNodeClick},scopedSlots:e._u([{key:"default",fn:function(t){t.node;var a=t.data;return i("span",{staticClass:"custom-tree-node"},[a.label.length<15?i("span",[e._v(e._s(a.label))]):i("span",[i("el-tooltip",{staticClass:"item",attrs:{content:a.label,effect:"light",placement:"right"}},[i("span",[e._v(e._s(a.label.substring(0,15)+"..."))])])],1)])}}])})],1),e._v(" "),i("el-main",{staticStyle:{"padding-top":"0"}},[i("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0,model:e.searchFormData,size:"mini"}},[i("el-form-item",{attrs:{label:"路由ID"}},[i("el-input",{attrs:{placeholder:"接口名,支持模糊查询",clearable:""},model:{value:e.searchFormData.routeId,callback:function(t){e.$set(e.searchFormData,"routeId",t)},expression:"searchFormData.routeId"}})],1),e._v(" "),i("el-form-item",{attrs:{label:"AppKey"}},[i("el-input",{attrs:{placeholder:"AppKey,支持模糊查询",clearable:""},model:{value:e.searchFormData.appKey,callback:function(t){e.$set(e.searchFormData,"appKey",t)},expression:"searchFormData.appKey"}})],1),e._v(" "),i("el-form-item",{attrs:{label:"IP"}},[i("el-input",{attrs:{placeholder:"ip,支持模糊查询",clearable:""},model:{value:e.searchFormData.limitIp,callback:function(t){e.$set(e.searchFormData,"limitIp",t)},expression:"searchFormData.limitIp"}})],1),e._v(" "),i("el-form-item",[i("el-button",{attrs:{type:"primary",icon:"el-icon-search",size:"mini"},on:{click:e.onSearchTable}},[e._v("查询")])],1)],1),e._v(" "),i("el-button",{staticStyle:{"margin-bottom":"10px"},attrs:{type:"primary",size:"mini",icon:"el-icon-plus"},on:{click:e.onAdd}},[e._v("新增限流")]),e._v(" "),i("el-table",{attrs:{data:e.pageInfo.list,border:""}},[i("el-table-column",{attrs:{prop:"limitKey",label:"限流维度",width:"400"},scopedSlots:e._u([{key:"default",fn:function(t){return[i("div",{domProps:{innerHTML:e._s(e.limitRender(t.row))}})]}}])}),e._v(" "),i("el-table-column",{attrs:{prop:"limitType",label:"限流策略",width:"120"},scopedSlots:e._u([{key:"default",fn:function(t){return[1===t.row.limitType?i("span",[e._v("窗口策略")]):e._e(),e._v(" "),2===t.row.limitType?i("span",[e._v("令牌桶策略")]):e._e()]}}])},[i("template",{slot:"header"},[e._v("\n 限流策略 "),i("i",{staticClass:"el-icon-question",staticStyle:{cursor:"pointer"},on:{click:e.onLimitTypeTipClick}})])],2),e._v(" "),i("el-table-column",{attrs:{prop:"info",label:"限流信息",width:"250"},scopedSlots:e._u([{key:"default",fn:function(t){return[i("span",{domProps:{innerHTML:e._s(e.infoRender(t.row))}})]}}])}),e._v(" "),i("el-table-column",{attrs:{prop:"limitStatus",label:"状态",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[1===t.row.limitStatus?i("span",{staticStyle:{color:"#67C23A"}},[e._v("已开启")]):e._e(),e._v(" "),0===t.row.limitStatus?i("span",{staticStyle:{color:"#909399"}},[e._v("已关闭")]):e._e()]}}])}),e._v(" "),i("el-table-column",{attrs:{prop:"orderIndex",label:"排序",width:"80"}}),e._v(" "),i("el-table-column",{attrs:{prop:"remark",label:"备注",width:"150","show-overflow-tooltip":!0}}),e._v(" "),i("el-table-column",{attrs:{prop:"gmtCreate",label:"创建时间",width:"160"}}),e._v(" "),i("el-table-column",{attrs:{prop:"gmtModified",label:"修改时间",width:"160"}}),e._v(" "),i("el-table-column",{attrs:{label:"操作",fixed:"right",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[i("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(i){return e.onTableUpdate(t.row)}}},[e._v("修改")])]}}])})],1),e._v(" "),i("el-pagination",{staticStyle:{"margin-top":"5px"},attrs:{background:"","current-page":e.searchFormData.pageIndex,"page-size":e.searchFormData.pageSize,"page-sizes":[5,10,20,40],total:e.pageInfo.total,layout:"total, sizes, prev, pager, next"},on:{"size-change":e.onSizeChange,"current-change":e.onPageIndexChange}}),e._v(" "),i("el-dialog",{attrs:{title:e.dlgTitle,visible:e.limitDialogVisible,"close-on-click-modal":!1},on:{"update:visible":function(t){e.limitDialogVisible=t},close:e.onLimitDialogClose}},[i("el-form",{ref:"limitDialogForm",attrs:{model:e.limitDialogFormData,rules:e.rulesLimit,"label-width":"150px",size:"mini"}},[i("el-form-item",{attrs:{label:"限流维度",prop:"typeKey"}},[i("el-checkbox-group",{model:{value:e.limitDialogFormData.typeKey,callback:function(t){e.$set(e.limitDialogFormData,"typeKey",t)},expression:"limitDialogFormData.typeKey"}},[i("el-checkbox",{attrs:{label:1,name:"typeKey"},model:{value:e.limitDialogFormData.typeKey[0],callback:function(t){e.$set(e.limitDialogFormData.typeKey,0,t)},expression:"limitDialogFormData.typeKey[0]"}},[e._v("路由ID")]),e._v(" "),i("el-checkbox",{attrs:{label:2,name:"typeKey"},model:{value:e.limitDialogFormData.typeKey[1],callback:function(t){e.$set(e.limitDialogFormData.typeKey,1,t)},expression:"limitDialogFormData.typeKey[1]"}},[e._v("AppKey")]),e._v(" "),i("el-checkbox",{attrs:{label:3,name:"typeKey"},model:{value:e.limitDialogFormData.typeKey[2],callback:function(t){e.$set(e.limitDialogFormData.typeKey,2,t)},expression:"limitDialogFormData.typeKey[2]"}},[e._v("IP")])],1)],1),e._v(" "),i("el-form-item",{directives:[{name:"show",rawName:"v-show",value:e.checkTypeKey(1),expression:"checkTypeKey(1)"}],attrs:{prop:"routeId",label:"路由ID",rules:e.checkTypeKey(1)?e.rulesLimit.routeId:[]}},[i("el-select",{staticStyle:{width:"300px"},attrs:{filterable:"",placeholder:"可筛选"},model:{value:e.limitDialogFormData.routeId,callback:function(t){e.$set(e.limitDialogFormData,"routeId",t)},expression:"limitDialogFormData.routeId"}},e._l(e.routeList,function(t){return i("el-option",{key:t.id,attrs:{label:t.id,value:t.id}},[i("span",{staticStyle:{float:"left"}},[e._v(e._s(t.name))]),e._v(" "),i("span",{staticStyle:{float:"right",color:"#8492a6","font-size":"13px"}},[e._v(e._s(t.version))])])}),1)],1),e._v(" "),i("el-form-item",{directives:[{name:"show",rawName:"v-show",value:e.checkTypeKey(2),expression:"checkTypeKey(2)"}],attrs:{prop:"appKey",label:"AppKey",rules:e.checkTypeKey(2)?e.rulesLimit.appKey:[]}},[i("el-input",{attrs:{placeholder:"需要限流的appKey"},model:{value:e.limitDialogFormData.appKey,callback:function(t){e.$set(e.limitDialogFormData,"appKey",t)},expression:"limitDialogFormData.appKey"}})],1),e._v(" "),i("el-form-item",{directives:[{name:"show",rawName:"v-show",value:e.checkTypeKey(3),expression:"checkTypeKey(3)"}],attrs:{label:"限流IP",prop:"limitIp",rules:e.checkTypeKey(3)?e.rulesLimit.ip:[]}},[i("el-input",{attrs:{type:"textarea",rows:2,placeholder:"多个用英文逗号隔开"},model:{value:e.limitDialogFormData.limitIp,callback:function(t){e.$set(e.limitDialogFormData,"limitIp",t)},expression:"limitDialogFormData.limitIp"}})],1),e._v(" "),i("el-form-item",{attrs:{label:"限流策略"}},[i("el-radio-group",{model:{value:e.limitDialogFormData.limitType,callback:function(t){e.$set(e.limitDialogFormData,"limitType",t)},expression:"limitDialogFormData.limitType"}},[i("el-radio",{attrs:{label:1}},[e._v("窗口策略")]),e._v(" "),i("el-radio",{attrs:{label:2}},[e._v("令牌桶策略")])],1),e._v(" "),i("i",{staticClass:"el-icon-question limit-tip",on:{click:e.onLimitTypeTipClick}})],1),e._v(" "),i("el-form-item",{attrs:{label:"开启状态"}},[i("el-switch",{attrs:{"active-color":"#13ce66","inactive-color":"#ff4949","active-value":1,"inactive-value":0},model:{value:e.limitDialogFormData.limitStatus,callback:function(t){e.$set(e.limitDialogFormData,"limitStatus",t)},expression:"limitDialogFormData.limitStatus"}})],1),e._v(" "),i("el-form-item",{attrs:{label:"排序",prop:"orderIndex"}},[i("el-input-number",{attrs:{"controls-position":"right",min:0},model:{value:e.limitDialogFormData.orderIndex,callback:function(t){e.$set(e.limitDialogFormData,"orderIndex",t)},expression:"limitDialogFormData.orderIndex"}}),e._v(" "),i("el-tooltip",{staticClass:"item",attrs:{content:"值小优先执行",placement:"top"}},[i("i",{staticClass:"el-icon-question limit-tip"})])],1),e._v(" "),i("el-form-item",{directives:[{name:"show",rawName:"v-show",value:e.isWindowType(),expression:"isWindowType()"}],attrs:{label:"每秒可处理请求数",prop:"execCountPerSecond",rules:e.isWindowType()?e.rulesLimit.execCountPerSecond:[]}},[i("el-input-number",{attrs:{"controls-position":"right",min:1},model:{value:e.limitDialogFormData.execCountPerSecond,callback:function(t){e.$set(e.limitDialogFormData,"execCountPerSecond",t)},expression:"limitDialogFormData.execCountPerSecond"}})],1),e._v(" "),i("el-form-item",{directives:[{name:"show",rawName:"v-show",value:e.isWindowType(),expression:"isWindowType()"}],attrs:{label:"错误码",prop:"limitCode",rules:e.isWindowType()?e.rulesLimit.limitCode:[]}},[i("el-input",{model:{value:e.limitDialogFormData.limitCode,callback:function(t){e.$set(e.limitDialogFormData,"limitCode",t)},expression:"limitDialogFormData.limitCode"}})],1),e._v(" "),i("el-form-item",{directives:[{name:"show",rawName:"v-show",value:e.isWindowType(),expression:"isWindowType()"}],attrs:{label:"错误信息",prop:"limitMsg",rules:e.isWindowType()?e.rulesLimit.limitMsg:[]}},[i("el-input",{model:{value:e.limitDialogFormData.limitMsg,callback:function(t){e.$set(e.limitDialogFormData,"limitMsg",t)},expression:"limitDialogFormData.limitMsg"}})],1),e._v(" "),i("el-form-item",{directives:[{name:"show",rawName:"v-show",value:e.isTokenType(),expression:"isTokenType()"}],attrs:{label:"令牌桶容量",prop:"tokenBucketCount",rules:e.isTokenType()?e.rulesLimit.tokenBucketCount:[]}},[i("el-input-number",{attrs:{"controls-position":"right",min:1},model:{value:e.limitDialogFormData.tokenBucketCount,callback:function(t){e.$set(e.limitDialogFormData,"tokenBucketCount",t)},expression:"limitDialogFormData.tokenBucketCount"}})],1),e._v(" "),i("el-form-item",{attrs:{label:"备注",prop:"remark"}},[i("el-input",{attrs:{type:"textarea",rows:2},model:{value:e.limitDialogFormData.remark,callback:function(t){e.$set(e.limitDialogFormData,"remark",t)},expression:"limitDialogFormData.remark"}})],1)],1),e._v(" "),i("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:function(t){e.limitDialogVisible=!1}}},[e._v("取 消")]),e._v(" "),i("el-button",{attrs:{type:"primary"},on:{click:e.onLimitDialogSave}},[e._v("保 存")])],1)],1)],1)],1)],1)},l=[],o=(i("7514"),{data:function(){return{filterText:"",treeData:[],tableData:[],serviceId:"",searchFormData:{pageIndex:1,pageSize:5},pageInfo:{list:[],total:0},routeList:[],defaultProps:{children:"children",label:"label"},dlgTitle:"设置限流",limitDialogVisible:!1,limitDialogFormData:{id:0,routeId:"",appKey:"",limitIp:"",limitKey:"",execCountPerSecond:5,limitCode:"",limitMsg:"",tokenBucketCount:5,limitStatus:0,limitType:1,orderIndex:0,remark:"",typeKey:[]},rulesLimit:{typeKey:[{type:"array",required:!0,message:"请至少选择一个",trigger:"change"}],routeId:[{required:!0,message:"不能为空",trigger:"blur"},{min:1,max:100,message:"长度在 1 到 100 个字符",trigger:"blur"}],appKey:[{required:!0,message:"不能为空",trigger:"blur"},{min:1,max:100,message:"长度在 1 到 100 个字符",trigger:"blur"}],ip:[{required:!0,message:"不能为空",trigger:"blur"},{min:1,max:500,message:"长度在 1 到 500 个字符",trigger:"blur"}],execCountPerSecond:[{required:!0,message:"不能为空",trigger:"blur"}],limitCode:[{required:!0,message:"不能为空",trigger:"blur"},{min:1,max:64,message:"长度在 1 到 64 个字符",trigger:"blur"}],limitMsg:[{required:!0,message:"不能为空",trigger:"blur"},{min:1,max:100,message:"长度在 1 到 100 个字符",trigger:"blur"}],tokenBucketCount:[{required:!0,message:"不能为空",trigger:"blur"}],orderIndex:[{required:!0,message:"不能为空",trigger:"blur"}],remark:[{max:128,message:"长度不能超过128字符",trigger:"blur"}]}}},watch:{filterText:function(e){this.$refs.tree2.filter(e)}},created:function(){this.loadTree()},methods:{loadTree:function(){this.post("service.list",{},function(e){var t=e.data;this.treeData=this.convertToTreeData(t,0)})},filterNode:function(e,t){return!e||-1!==t.label.indexOf(e)},onNodeClick:function(e,t,i){e.parentId&&(this.serviceId=e.label,this.searchFormData.serviceId=this.serviceId,this.loadTable(),this.loadRouteList(this.serviceId))},convertToTreeData:function(e,t){for(var i=[],a={label:"服务列表",parentId:t},l=[],o=0;osubCode:"+e.limitCode),t.push("subMsg:"+e.limitMsg)):2===e.limitType&&t.push("令牌桶容量:"+e.tokenBucketCount),t.join("")},onLimitDialogSave:function(){var e=this;this.$refs["limitDialogForm"].validate(function(t){if(t){e.cleanCheckboxData(),e.limitDialogFormData.serviceId=e.serviceId;var i=e.limitDialogFormData.id?"config.limit.update":"config.limit.add";e.post(i,e.limitDialogFormData,function(e){this.limitDialogVisible=!1,this.loadTable()})}})},cleanCheckboxData:function(){this.checkTypeKey(1)||(this.limitDialogFormData.routeId=""),this.checkTypeKey(2)||(this.limitDialogFormData.appKey=""),this.checkTypeKey(3)||(this.limitDialogFormData.limitIp="")},onLimitTypeTipClick:function(){var e="窗口策略:每秒处理固定数量的请求,超出请求数量返回错误信息。",t="令牌桶策略:每秒放置固定数量的令牌数,每个请求进来后先去拿令牌,拿到了令牌才能继续,拿不到则等候令牌重新生成了再拿。",i=e+""+t;this.$alert(i,"限流策略",{dangerouslyUseHTMLString:!0})},onSizeChange:function(e){this.searchFormData.pageSize=e,this.loadTable()},onPageIndexChange:function(e){this.searchFormData.pageIndex=e,this.loadTable()},checkTypeKey:function(e){return this.limitDialogFormData.typeKey.find(function(t,i,a){return t===e})},isWindowType:function(){return 1===this.limitDialogFormData.limitType},isTokenType:function(){return 2===this.limitDialogFormData.limitType},limitRender:function(e){var t=[],i=[];return e.routeId&&(i.push(e.routeId),t.push("路由ID")),e.appKey&&(i.push(e.appKey),t.push("AppKey")),e.limitIp&&(i.push(e.limitIp),t.push("IP")),i.join(" + ")+"("+t.join(" + ")+")"}}}),r=o,s=(i("edd4"),i("2877")),n=Object(s["a"])(r,a,l,!1,null,"29df7fee",null);t["default"]=n.exports},"44f4":function(e,t,i){},7514:function(e,t,i){"use strict";var a=i("5ca1"),l=i("0a49")(5),o="find",r=!0;o in[]&&Array(1)[o](function(){r=!1}),a(a.P+a.F*r,"Array",{find:function(e){return l(this,e,arguments.length>1?arguments[1]:void 0)}}),i("9c6c")(o)},cd1c:function(e,t,i){var a=i("e853");e.exports=function(e,t){return new(a(e))(t)}},e853:function(e,t,i){var a=i("d3f4"),l=i("1169"),o=i("2b4c")("species");e.exports=function(e){var t;return l(e)&&(t=e.constructor,"function"!=typeof t||t!==Array&&!l(t.prototype)||(t=void 0),a(t)&&(t=t[o],null===t&&(t=void 0))),void 0===t?Array:t}},edd4:function(e,t,i){"use strict";var a=i("44f4"),l=i.n(a);l.a}}]); \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-ea2e58a4.f3f85b0e.js b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-29e7142c.994a3ac0.js similarity index 98% rename from sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-ea2e58a4.f3f85b0e.js rename to sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-29e7142c.994a3ac0.js index 71a5f277..b402f56e 100644 --- a/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-ea2e58a4.f3f85b0e.js +++ b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-29e7142c.994a3ac0.js @@ -1,4 +1,4 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-ea2e58a4"],{2017:function(t,e,r){"use strict";var s=r("3b76"),o=r.n(s);o.a},"3b76":function(t,e,r){},"3c35":function(t,e){(function(e){t.exports=e}).call(this,{})},8237:function(module,exports,__webpack_require__){(function(process,global){var __WEBPACK_AMD_DEFINE_RESULT__; +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-29e7142c"],{2017:function(t,e,r){"use strict";var s=r("3b76"),o=r.n(s);o.a},"3b76":function(t,e,r){},"3c35":function(t,e){(function(e){t.exports=e}).call(this,{})},8237:function(module,exports,__webpack_require__){(function(process,global){var __WEBPACK_AMD_DEFINE_RESULT__; /** * [js-md5]{@link https://github.com/emn178/js-md5} * @@ -17,4 +17,4 @@ * @copyright Chen, Yi-Cyuan 2014-2017 * @license MIT */ -(function(){"use strict";var ERROR="input is invalid type",WINDOW="object"===typeof window,root=WINDOW?window:{};root.JS_MD5_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&"object"===typeof self,NODE_JS=!root.JS_MD5_NO_NODE_JS&&"object"===typeof process&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_MD5_NO_COMMON_JS&&"object"===typeof module&&module.exports,AMD=__webpack_require__("3c35"),ARRAY_BUFFER=!root.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!==typeof ArrayBuffer,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[128,32768,8388608,-2147483648],SHIFT=[0,8,16,24],OUTPUT_TYPES=["hex","array","digest","buffer","arrayBuffer","base64"],BASE64_ENCODE_CHAR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),blocks=[],buffer8;if(ARRAY_BUFFER){var buffer=new ArrayBuffer(68);buffer8=new Uint8Array(buffer),blocks=new Uint32Array(buffer)}!root.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!ARRAY_BUFFER||!root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"===typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var createOutputMethod=function(t){return function(e){return new Md5(!0).update(e)[t]()}},createMethod=function(){var t=createOutputMethod("hex");NODE_JS&&(t=nodeWrap(t)),t.create=function(){return new Md5},t.update=function(e){return t.create().update(e)};for(var e=0;e>2]|=t[i]<>6,h[o++]=128|63&s):s<55296||s>=57344?(h[o++]=224|s>>12,h[o++]=128|s>>6&63,h[o++]=128|63&s):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++i)),h[o++]=240|s>>18,h[o++]=128|s>>12&63,h[o++]=128|s>>6&63,h[o++]=128|63&s);else for(o=this.start;i>2]|=s<>2]|=(192|s>>6)<>2]|=(128|63&s)<=57344?(a[o>>2]|=(224|s>>12)<>2]|=(128|s>>6&63)<>2]|=(128|63&s)<>2]|=(240|s>>18)<>2]|=(128|s>>12&63)<>2]|=(128|s>>6&63)<>2]|=(128|63&s)<=64?(this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Md5.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[e>>2]|=EXTRA[3&e],e>=56&&(this.hashed||this.hash(),t[0]=t[16],t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.bytes<<3,t[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},Md5.prototype.hash=function(){var t,e,r,s,o,i,n=this.blocks;this.first?(t=n[0]-680876937,t=(t<<7|t>>>25)-271733879<<0,s=(-1732584194^2004318071&t)+n[1]-117830708,s=(s<<12|s>>>20)+t<<0,r=(-271733879^s&(-271733879^t))+n[2]-1126478375,r=(r<<17|r>>>15)+s<<0,e=(t^r&(s^t))+n[3]-1316259209,e=(e<<22|e>>>10)+r<<0):(t=this.h0,e=this.h1,r=this.h2,s=this.h3,t+=(s^e&(r^s))+n[0]-680876936,t=(t<<7|t>>>25)+e<<0,s+=(r^t&(e^r))+n[1]-389564586,s=(s<<12|s>>>20)+t<<0,r+=(e^s&(t^e))+n[2]+606105819,r=(r<<17|r>>>15)+s<<0,e+=(t^r&(s^t))+n[3]-1044525330,e=(e<<22|e>>>10)+r<<0),t+=(s^e&(r^s))+n[4]-176418897,t=(t<<7|t>>>25)+e<<0,s+=(r^t&(e^r))+n[5]+1200080426,s=(s<<12|s>>>20)+t<<0,r+=(e^s&(t^e))+n[6]-1473231341,r=(r<<17|r>>>15)+s<<0,e+=(t^r&(s^t))+n[7]-45705983,e=(e<<22|e>>>10)+r<<0,t+=(s^e&(r^s))+n[8]+1770035416,t=(t<<7|t>>>25)+e<<0,s+=(r^t&(e^r))+n[9]-1958414417,s=(s<<12|s>>>20)+t<<0,r+=(e^s&(t^e))+n[10]-42063,r=(r<<17|r>>>15)+s<<0,e+=(t^r&(s^t))+n[11]-1990404162,e=(e<<22|e>>>10)+r<<0,t+=(s^e&(r^s))+n[12]+1804603682,t=(t<<7|t>>>25)+e<<0,s+=(r^t&(e^r))+n[13]-40341101,s=(s<<12|s>>>20)+t<<0,r+=(e^s&(t^e))+n[14]-1502002290,r=(r<<17|r>>>15)+s<<0,e+=(t^r&(s^t))+n[15]+1236535329,e=(e<<22|e>>>10)+r<<0,t+=(r^s&(e^r))+n[1]-165796510,t=(t<<5|t>>>27)+e<<0,s+=(e^r&(t^e))+n[6]-1069501632,s=(s<<9|s>>>23)+t<<0,r+=(t^e&(s^t))+n[11]+643717713,r=(r<<14|r>>>18)+s<<0,e+=(s^t&(r^s))+n[0]-373897302,e=(e<<20|e>>>12)+r<<0,t+=(r^s&(e^r))+n[5]-701558691,t=(t<<5|t>>>27)+e<<0,s+=(e^r&(t^e))+n[10]+38016083,s=(s<<9|s>>>23)+t<<0,r+=(t^e&(s^t))+n[15]-660478335,r=(r<<14|r>>>18)+s<<0,e+=(s^t&(r^s))+n[4]-405537848,e=(e<<20|e>>>12)+r<<0,t+=(r^s&(e^r))+n[9]+568446438,t=(t<<5|t>>>27)+e<<0,s+=(e^r&(t^e))+n[14]-1019803690,s=(s<<9|s>>>23)+t<<0,r+=(t^e&(s^t))+n[3]-187363961,r=(r<<14|r>>>18)+s<<0,e+=(s^t&(r^s))+n[8]+1163531501,e=(e<<20|e>>>12)+r<<0,t+=(r^s&(e^r))+n[13]-1444681467,t=(t<<5|t>>>27)+e<<0,s+=(e^r&(t^e))+n[2]-51403784,s=(s<<9|s>>>23)+t<<0,r+=(t^e&(s^t))+n[7]+1735328473,r=(r<<14|r>>>18)+s<<0,e+=(s^t&(r^s))+n[12]-1926607734,e=(e<<20|e>>>12)+r<<0,o=e^r,t+=(o^s)+n[5]-378558,t=(t<<4|t>>>28)+e<<0,s+=(o^t)+n[8]-2022574463,s=(s<<11|s>>>21)+t<<0,i=s^t,r+=(i^e)+n[11]+1839030562,r=(r<<16|r>>>16)+s<<0,e+=(i^r)+n[14]-35309556,e=(e<<23|e>>>9)+r<<0,o=e^r,t+=(o^s)+n[1]-1530992060,t=(t<<4|t>>>28)+e<<0,s+=(o^t)+n[4]+1272893353,s=(s<<11|s>>>21)+t<<0,i=s^t,r+=(i^e)+n[7]-155497632,r=(r<<16|r>>>16)+s<<0,e+=(i^r)+n[10]-1094730640,e=(e<<23|e>>>9)+r<<0,o=e^r,t+=(o^s)+n[13]+681279174,t=(t<<4|t>>>28)+e<<0,s+=(o^t)+n[0]-358537222,s=(s<<11|s>>>21)+t<<0,i=s^t,r+=(i^e)+n[3]-722521979,r=(r<<16|r>>>16)+s<<0,e+=(i^r)+n[6]+76029189,e=(e<<23|e>>>9)+r<<0,o=e^r,t+=(o^s)+n[9]-640364487,t=(t<<4|t>>>28)+e<<0,s+=(o^t)+n[12]-421815835,s=(s<<11|s>>>21)+t<<0,i=s^t,r+=(i^e)+n[15]+530742520,r=(r<<16|r>>>16)+s<<0,e+=(i^r)+n[2]-995338651,e=(e<<23|e>>>9)+r<<0,t+=(r^(e|~s))+n[0]-198630844,t=(t<<6|t>>>26)+e<<0,s+=(e^(t|~r))+n[7]+1126891415,s=(s<<10|s>>>22)+t<<0,r+=(t^(s|~e))+n[14]-1416354905,r=(r<<15|r>>>17)+s<<0,e+=(s^(r|~t))+n[5]-57434055,e=(e<<21|e>>>11)+r<<0,t+=(r^(e|~s))+n[12]+1700485571,t=(t<<6|t>>>26)+e<<0,s+=(e^(t|~r))+n[3]-1894986606,s=(s<<10|s>>>22)+t<<0,r+=(t^(s|~e))+n[10]-1051523,r=(r<<15|r>>>17)+s<<0,e+=(s^(r|~t))+n[1]-2054922799,e=(e<<21|e>>>11)+r<<0,t+=(r^(e|~s))+n[8]+1873313359,t=(t<<6|t>>>26)+e<<0,s+=(e^(t|~r))+n[15]-30611744,s=(s<<10|s>>>22)+t<<0,r+=(t^(s|~e))+n[6]-1560198380,r=(r<<15|r>>>17)+s<<0,e+=(s^(r|~t))+n[13]+1309151649,e=(e<<21|e>>>11)+r<<0,t+=(r^(e|~s))+n[4]-145523070,t=(t<<6|t>>>26)+e<<0,s+=(e^(t|~r))+n[11]-1120210379,s=(s<<10|s>>>22)+t<<0,r+=(t^(s|~e))+n[2]+718787259,r=(r<<15|r>>>17)+s<<0,e+=(s^(r|~t))+n[9]-343485551,e=(e<<21|e>>>11)+r<<0,this.first?(this.h0=t+1732584193<<0,this.h1=e-271733879<<0,this.h2=r-1732584194<<0,this.h3=s+271733878<<0,this.first=!1):(this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+r<<0,this.h3=this.h3+s<<0)},Md5.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,s=this.h3;return HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[15&s]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,s=this.h3;return[255&t,t>>8&255,t>>16&255,t>>24&255,255&e,e>>8&255,e>>16&255,e>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255,255&s,s>>8&255,s>>16&255,s>>24&255]},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(16),e=new Uint32Array(t);return e[0]=this.h0,e[1]=this.h1,e[2]=this.h2,e[3]=this.h3,t},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var t,e,r,s="",o=this.array(),i=0;i<15;)t=o[i++],e=o[i++],r=o[i++],s+=BASE64_ENCODE_CHAR[t>>>2]+BASE64_ENCODE_CHAR[63&(t<<4|e>>>4)]+BASE64_ENCODE_CHAR[63&(e<<2|r>>>6)]+BASE64_ENCODE_CHAR[63&r];return t=o[i],s+=BASE64_ENCODE_CHAR[t>>>2]+BASE64_ENCODE_CHAR[t<<4&63]+"==",s};var exports=createMethod();COMMON_JS?module.exports=exports:(root.md5=exports,AMD&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))})()}).call(this,__webpack_require__("4362"),__webpack_require__("c8ba"))},"9ed6":function(t,e,r){"use strict";r.r(e);var s=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"login-container"},[r("el-form",{ref:"loginForm",staticClass:"login-form",attrs:{model:t.loginForm,rules:t.loginRules,"auto-complete":"on","label-position":"left"}},[r("div",{staticClass:"title-container"},[r("h3",{staticClass:"title"},[t._v("SOP Admin")])]),t._v(" "),r("el-form-item",{attrs:{prop:"username"}},[r("span",{staticClass:"svg-container"},[r("svg-icon",{attrs:{"icon-class":"user"}})],1),t._v(" "),r("el-input",{ref:"username",attrs:{placeholder:"用户名",name:"username",type:"text",tabindex:"1","auto-complete":"on"},model:{value:t.loginForm.username,callback:function(e){t.$set(t.loginForm,"username",e)},expression:"loginForm.username"}})],1),t._v(" "),r("el-form-item",{attrs:{prop:"password"}},[r("span",{staticClass:"svg-container"},[r("svg-icon",{attrs:{"icon-class":"password"}})],1),t._v(" "),r("el-input",{key:t.passwordType,ref:"password",attrs:{type:t.passwordType,placeholder:"密码",name:"password",tabindex:"2","auto-complete":"on"},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.handleLogin(e)}},model:{value:t.loginForm.password,callback:function(e){t.$set(t.loginForm,"password",e)},expression:"loginForm.password"}}),t._v(" "),r("span",{staticClass:"show-pwd",on:{click:t.showPwd}},[r("svg-icon",{attrs:{"icon-class":"password"===t.passwordType?"eye":"eye-open"}})],1)],1),t._v(" "),r("el-button",{staticStyle:{width:"100%","margin-bottom":"30px"},attrs:{loading:t.loading,type:"primary"},nativeOn:{click:function(e){return e.preventDefault(),t.handleLogin(e)}}},[t._v("登 录")])],1)],1)},o=[],i=r("8237"),n=r.n(i),a=r("5f87"),h={name:"Login",data:function(){var t=function(t,e,r){0===e.length?r(new Error("请输入用户名")):r()},e=function(t,e,r){0===e.length?r(new Error("请输入密码")):e.length<6?r(new Error("请密码长度不得小于6位")):r()};return{loginForm:{username:"",password:""},loginRules:{username:[{required:!0,trigger:"blur",validator:t}],password:[{required:!0,trigger:"blur",validator:e}]},loading:!1,passwordType:"password",redirect:void 0}},watch:{$route:{handler:function(t){this.redirect=t.query&&t.query.redirect},immediate:!0}},methods:{showPwd:function(){var t=this;"password"===this.passwordType?this.passwordType="":this.passwordType="password",this.$nextTick(function(){t.$refs.password.focus()})},handleLogin:function(){var t=this;this.$refs.loginForm.validate(function(e){if(e){var r=t.loginForm,s=r.password;s=n()(s);var o={username:r.username,password:s};t.post("nologin.admin.login",o,function(t){Object(a["c"])(t.data),this.$router.push({path:this.redirect||"/"})})}})}}},u=h,c=(r("2017"),r("d982"),r("2877")),f=Object(c["a"])(u,s,o,!1,null,"0204d890",null);e["default"]=f.exports},d982:function(t,e,r){"use strict";var s=r("dabb"),o=r.n(s);o.a},dabb:function(t,e,r){}}]); \ No newline at end of file +(function(){"use strict";var ERROR="input is invalid type",WINDOW="object"===typeof window,root=WINDOW?window:{};root.JS_MD5_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&"object"===typeof self,NODE_JS=!root.JS_MD5_NO_NODE_JS&&"object"===typeof process&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_MD5_NO_COMMON_JS&&"object"===typeof module&&module.exports,AMD=__webpack_require__("3c35"),ARRAY_BUFFER=!root.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!==typeof ArrayBuffer,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[128,32768,8388608,-2147483648],SHIFT=[0,8,16,24],OUTPUT_TYPES=["hex","array","digest","buffer","arrayBuffer","base64"],BASE64_ENCODE_CHAR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),blocks=[],buffer8;if(ARRAY_BUFFER){var buffer=new ArrayBuffer(68);buffer8=new Uint8Array(buffer),blocks=new Uint32Array(buffer)}!root.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!ARRAY_BUFFER||!root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"===typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var createOutputMethod=function(t){return function(e){return new Md5(!0).update(e)[t]()}},createMethod=function(){var t=createOutputMethod("hex");NODE_JS&&(t=nodeWrap(t)),t.create=function(){return new Md5},t.update=function(e){return t.create().update(e)};for(var e=0;e>2]|=t[i]<>6,h[o++]=128|63&s):s<55296||s>=57344?(h[o++]=224|s>>12,h[o++]=128|s>>6&63,h[o++]=128|63&s):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++i)),h[o++]=240|s>>18,h[o++]=128|s>>12&63,h[o++]=128|s>>6&63,h[o++]=128|63&s);else for(o=this.start;i>2]|=s<>2]|=(192|s>>6)<>2]|=(128|63&s)<=57344?(a[o>>2]|=(224|s>>12)<>2]|=(128|s>>6&63)<>2]|=(128|63&s)<>2]|=(240|s>>18)<>2]|=(128|s>>12&63)<>2]|=(128|s>>6&63)<>2]|=(128|63&s)<=64?(this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Md5.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[e>>2]|=EXTRA[3&e],e>=56&&(this.hashed||this.hash(),t[0]=t[16],t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.bytes<<3,t[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},Md5.prototype.hash=function(){var t,e,r,s,o,i,n=this.blocks;this.first?(t=n[0]-680876937,t=(t<<7|t>>>25)-271733879<<0,s=(-1732584194^2004318071&t)+n[1]-117830708,s=(s<<12|s>>>20)+t<<0,r=(-271733879^s&(-271733879^t))+n[2]-1126478375,r=(r<<17|r>>>15)+s<<0,e=(t^r&(s^t))+n[3]-1316259209,e=(e<<22|e>>>10)+r<<0):(t=this.h0,e=this.h1,r=this.h2,s=this.h3,t+=(s^e&(r^s))+n[0]-680876936,t=(t<<7|t>>>25)+e<<0,s+=(r^t&(e^r))+n[1]-389564586,s=(s<<12|s>>>20)+t<<0,r+=(e^s&(t^e))+n[2]+606105819,r=(r<<17|r>>>15)+s<<0,e+=(t^r&(s^t))+n[3]-1044525330,e=(e<<22|e>>>10)+r<<0),t+=(s^e&(r^s))+n[4]-176418897,t=(t<<7|t>>>25)+e<<0,s+=(r^t&(e^r))+n[5]+1200080426,s=(s<<12|s>>>20)+t<<0,r+=(e^s&(t^e))+n[6]-1473231341,r=(r<<17|r>>>15)+s<<0,e+=(t^r&(s^t))+n[7]-45705983,e=(e<<22|e>>>10)+r<<0,t+=(s^e&(r^s))+n[8]+1770035416,t=(t<<7|t>>>25)+e<<0,s+=(r^t&(e^r))+n[9]-1958414417,s=(s<<12|s>>>20)+t<<0,r+=(e^s&(t^e))+n[10]-42063,r=(r<<17|r>>>15)+s<<0,e+=(t^r&(s^t))+n[11]-1990404162,e=(e<<22|e>>>10)+r<<0,t+=(s^e&(r^s))+n[12]+1804603682,t=(t<<7|t>>>25)+e<<0,s+=(r^t&(e^r))+n[13]-40341101,s=(s<<12|s>>>20)+t<<0,r+=(e^s&(t^e))+n[14]-1502002290,r=(r<<17|r>>>15)+s<<0,e+=(t^r&(s^t))+n[15]+1236535329,e=(e<<22|e>>>10)+r<<0,t+=(r^s&(e^r))+n[1]-165796510,t=(t<<5|t>>>27)+e<<0,s+=(e^r&(t^e))+n[6]-1069501632,s=(s<<9|s>>>23)+t<<0,r+=(t^e&(s^t))+n[11]+643717713,r=(r<<14|r>>>18)+s<<0,e+=(s^t&(r^s))+n[0]-373897302,e=(e<<20|e>>>12)+r<<0,t+=(r^s&(e^r))+n[5]-701558691,t=(t<<5|t>>>27)+e<<0,s+=(e^r&(t^e))+n[10]+38016083,s=(s<<9|s>>>23)+t<<0,r+=(t^e&(s^t))+n[15]-660478335,r=(r<<14|r>>>18)+s<<0,e+=(s^t&(r^s))+n[4]-405537848,e=(e<<20|e>>>12)+r<<0,t+=(r^s&(e^r))+n[9]+568446438,t=(t<<5|t>>>27)+e<<0,s+=(e^r&(t^e))+n[14]-1019803690,s=(s<<9|s>>>23)+t<<0,r+=(t^e&(s^t))+n[3]-187363961,r=(r<<14|r>>>18)+s<<0,e+=(s^t&(r^s))+n[8]+1163531501,e=(e<<20|e>>>12)+r<<0,t+=(r^s&(e^r))+n[13]-1444681467,t=(t<<5|t>>>27)+e<<0,s+=(e^r&(t^e))+n[2]-51403784,s=(s<<9|s>>>23)+t<<0,r+=(t^e&(s^t))+n[7]+1735328473,r=(r<<14|r>>>18)+s<<0,e+=(s^t&(r^s))+n[12]-1926607734,e=(e<<20|e>>>12)+r<<0,o=e^r,t+=(o^s)+n[5]-378558,t=(t<<4|t>>>28)+e<<0,s+=(o^t)+n[8]-2022574463,s=(s<<11|s>>>21)+t<<0,i=s^t,r+=(i^e)+n[11]+1839030562,r=(r<<16|r>>>16)+s<<0,e+=(i^r)+n[14]-35309556,e=(e<<23|e>>>9)+r<<0,o=e^r,t+=(o^s)+n[1]-1530992060,t=(t<<4|t>>>28)+e<<0,s+=(o^t)+n[4]+1272893353,s=(s<<11|s>>>21)+t<<0,i=s^t,r+=(i^e)+n[7]-155497632,r=(r<<16|r>>>16)+s<<0,e+=(i^r)+n[10]-1094730640,e=(e<<23|e>>>9)+r<<0,o=e^r,t+=(o^s)+n[13]+681279174,t=(t<<4|t>>>28)+e<<0,s+=(o^t)+n[0]-358537222,s=(s<<11|s>>>21)+t<<0,i=s^t,r+=(i^e)+n[3]-722521979,r=(r<<16|r>>>16)+s<<0,e+=(i^r)+n[6]+76029189,e=(e<<23|e>>>9)+r<<0,o=e^r,t+=(o^s)+n[9]-640364487,t=(t<<4|t>>>28)+e<<0,s+=(o^t)+n[12]-421815835,s=(s<<11|s>>>21)+t<<0,i=s^t,r+=(i^e)+n[15]+530742520,r=(r<<16|r>>>16)+s<<0,e+=(i^r)+n[2]-995338651,e=(e<<23|e>>>9)+r<<0,t+=(r^(e|~s))+n[0]-198630844,t=(t<<6|t>>>26)+e<<0,s+=(e^(t|~r))+n[7]+1126891415,s=(s<<10|s>>>22)+t<<0,r+=(t^(s|~e))+n[14]-1416354905,r=(r<<15|r>>>17)+s<<0,e+=(s^(r|~t))+n[5]-57434055,e=(e<<21|e>>>11)+r<<0,t+=(r^(e|~s))+n[12]+1700485571,t=(t<<6|t>>>26)+e<<0,s+=(e^(t|~r))+n[3]-1894986606,s=(s<<10|s>>>22)+t<<0,r+=(t^(s|~e))+n[10]-1051523,r=(r<<15|r>>>17)+s<<0,e+=(s^(r|~t))+n[1]-2054922799,e=(e<<21|e>>>11)+r<<0,t+=(r^(e|~s))+n[8]+1873313359,t=(t<<6|t>>>26)+e<<0,s+=(e^(t|~r))+n[15]-30611744,s=(s<<10|s>>>22)+t<<0,r+=(t^(s|~e))+n[6]-1560198380,r=(r<<15|r>>>17)+s<<0,e+=(s^(r|~t))+n[13]+1309151649,e=(e<<21|e>>>11)+r<<0,t+=(r^(e|~s))+n[4]-145523070,t=(t<<6|t>>>26)+e<<0,s+=(e^(t|~r))+n[11]-1120210379,s=(s<<10|s>>>22)+t<<0,r+=(t^(s|~e))+n[2]+718787259,r=(r<<15|r>>>17)+s<<0,e+=(s^(r|~t))+n[9]-343485551,e=(e<<21|e>>>11)+r<<0,this.first?(this.h0=t+1732584193<<0,this.h1=e-271733879<<0,this.h2=r-1732584194<<0,this.h3=s+271733878<<0,this.first=!1):(this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+r<<0,this.h3=this.h3+s<<0)},Md5.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,s=this.h3;return HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[15&s]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,s=this.h3;return[255&t,t>>8&255,t>>16&255,t>>24&255,255&e,e>>8&255,e>>16&255,e>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255,255&s,s>>8&255,s>>16&255,s>>24&255]},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(16),e=new Uint32Array(t);return e[0]=this.h0,e[1]=this.h1,e[2]=this.h2,e[3]=this.h3,t},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var t,e,r,s="",o=this.array(),i=0;i<15;)t=o[i++],e=o[i++],r=o[i++],s+=BASE64_ENCODE_CHAR[t>>>2]+BASE64_ENCODE_CHAR[63&(t<<4|e>>>4)]+BASE64_ENCODE_CHAR[63&(e<<2|r>>>6)]+BASE64_ENCODE_CHAR[63&r];return t=o[i],s+=BASE64_ENCODE_CHAR[t>>>2]+BASE64_ENCODE_CHAR[t<<4&63]+"==",s};var exports=createMethod();COMMON_JS?module.exports=exports:(root.md5=exports,AMD&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))})()}).call(this,__webpack_require__("4362"),__webpack_require__("c8ba"))},"9ed6":function(t,e,r){"use strict";r.r(e);var s=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"login-container"},[r("el-form",{ref:"loginForm",staticClass:"login-form",attrs:{model:t.loginForm,rules:t.loginRules,"auto-complete":"on","label-position":"left"}},[r("div",{staticClass:"title-container"},[r("h3",{staticClass:"title"},[t._v("SOP Admin")])]),t._v(" "),r("el-form-item",{attrs:{prop:"username"}},[r("span",{staticClass:"svg-container"},[r("svg-icon",{attrs:{"icon-class":"user"}})],1),t._v(" "),r("el-input",{ref:"username",attrs:{placeholder:"用户名",name:"username",type:"text",tabindex:"1","auto-complete":"on"},model:{value:t.loginForm.username,callback:function(e){t.$set(t.loginForm,"username",e)},expression:"loginForm.username"}})],1),t._v(" "),r("el-form-item",{attrs:{prop:"password"}},[r("span",{staticClass:"svg-container"},[r("svg-icon",{attrs:{"icon-class":"password"}})],1),t._v(" "),r("el-input",{key:t.passwordType,ref:"password",attrs:{type:t.passwordType,placeholder:"密码",name:"password",tabindex:"2","auto-complete":"on"},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.handleLogin(e)}},model:{value:t.loginForm.password,callback:function(e){t.$set(t.loginForm,"password",e)},expression:"loginForm.password"}}),t._v(" "),r("span",{staticClass:"show-pwd",on:{click:t.showPwd}},[r("svg-icon",{attrs:{"icon-class":"password"===t.passwordType?"eye":"eye-open"}})],1)],1),t._v(" "),r("el-button",{staticStyle:{width:"100%","margin-bottom":"30px"},attrs:{loading:t.loading,type:"primary"},nativeOn:{click:function(e){return e.preventDefault(),t.handleLogin(e)}}},[t._v("登 录")])],1)],1)},o=[],i=r("8237"),n=r.n(i),a=r("5f87"),h={name:"Login",data:function(){var t=function(t,e,r){0===e.length?r(new Error("请输入用户名")):r()},e=function(t,e,r){0===e.length?r(new Error("请输入密码")):e.length<6?r(new Error("请密码长度不得小于6位")):r()};return{loginForm:{username:"",password:""},loginRules:{username:[{required:!0,trigger:"blur",validator:t}],password:[{required:!0,trigger:"blur",validator:e}]},loading:!1,passwordType:"password",redirect:void 0}},watch:{$route:{handler:function(t){this.redirect=t.query&&t.query.redirect},immediate:!0}},methods:{showPwd:function(){var t=this;"password"===this.passwordType?this.passwordType="":this.passwordType="password",this.$nextTick(function(){t.$refs.password.focus()})},handleLogin:function(){var t=this;this.$refs.loginForm.validate(function(e){if(e){var r=t.loginForm,s=r.password;s=n()(s);var o={username:r.username,password:s};t.post("nologin.admin.login",o,function(t){Object(a["c"])(t.data),this.$router.push({path:this.redirect||"/"})})}})}}},c=h,u=(r("2017"),r("d982"),r("2877")),f=Object(u["a"])(c,s,o,!1,null,"0204d890",null);e["default"]=f.exports},d982:function(t,e,r){"use strict";var s=r("dabb"),o=r.n(s);o.a},dabb:function(t,e,r){}}]); \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-2d0aa95b.447435b3.js b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-2d0aa95b.447435b3.js deleted file mode 100644 index da97f7e1..00000000 --- a/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-2d0aa95b.447435b3.js +++ /dev/null @@ -1 +0,0 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0aa95b"],{1248:function(t,e,a){"use strict";a.r(e);var o=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"app-container"},[a("el-container",[a("el-aside",{staticStyle:{"min-height":"300px",width:"200px"}},[a("el-input",{staticStyle:{"margin-bottom":"20px"},attrs:{"prefix-icon":"el-icon-search",placeholder:"搜索服务...",size:"mini",clearable:""},model:{value:t.filterText,callback:function(e){t.filterText=e},expression:"filterText"}}),t._v(" "),a("el-tree",{ref:"tree2",staticClass:"filter-tree",attrs:{data:t.treeData,props:t.defaultProps,"filter-node-method":t.filterNode,"highlight-current":!0,"expand-on-click-node":!1,"empty-text":"无数据","node-key":"id","default-expand-all":""},on:{"node-click":t.onNodeClick},scopedSlots:t._u([{key:"default",fn:function(e){e.node;var o=e.data;return a("span",{staticClass:"custom-tree-node"},[o.label.length<15?a("span",[t._v(t._s(o.label))]):a("span",[a("el-tooltip",{staticClass:"item",attrs:{content:o.label,effect:"light",placement:"right"}},[a("span",[t._v(t._s(o.label.substring(0,15)+"..."))])])],1)])}}])})],1),t._v(" "),a("el-main",{staticStyle:{"padding-top":"0"}},[a("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0,model:t.searchFormData,size:"mini"}},[a("el-form-item",{attrs:{label:"路由名称"}},[a("el-input",{attrs:{placeholder:"输入接口名或版本号"},model:{value:t.searchFormData.id,callback:function(e){t.$set(t.searchFormData,"id",e)},expression:"searchFormData.id"}})],1),t._v(" "),a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-search"},on:{click:t.onSearchTable}},[t._v("查询")])],1)],1),t._v(" "),a("el-table",{attrs:{data:t.tableData,border:"","max-height":"500"}},[a("el-table-column",{attrs:{prop:"name",label:"接口名 (版本号)",width:"200"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v("\n "+t._s(e.row.name+(e.row.version?" ("+e.row.version+")":""))+"\n ")]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"uri",label:"LoadBalance",width:"350"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v("\n "+t._s(e.row.uri+e.row.path)+"\n ")]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"roles",label:"访问权限",width:"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",{domProps:{innerHTML:t._s(t.roleRender(e.row))}})]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"ignoreValidate",label:"忽略验证",width:"80"},scopedSlots:t._u([{key:"default",fn:function(e){return[1===e.row.ignoreValidate?a("span",{staticStyle:{color:"#67C23A"}},[t._v("是")]):t._e(),t._v(" "),0===e.row.ignoreValidate?a("span",{staticStyle:{color:"#909399"}},[t._v("否")]):t._e()]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"mergeResult",label:"统一格式输出",width:"120"},scopedSlots:t._u([{key:"default",fn:function(e){return[1===e.row.mergeResult?a("span",{staticStyle:{color:"#67C23A"}},[t._v("是")]):t._e(),t._v(" "),0===e.row.mergeResult?a("span",{staticStyle:{color:"#E6A23C"}},[t._v("否")]):t._e()]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"status",label:"状态",width:"80"},scopedSlots:t._u([{key:"default",fn:function(e){return[0===e.row.status?a("span",{staticStyle:{color:"#909399"}},[t._v("待审核")]):t._e(),t._v(" "),1===e.row.status?a("span",{staticStyle:{color:"#67C23A"}},[t._v("已启用")]):t._e(),t._v(" "),2===e.row.status?a("span",{staticStyle:{color:"#F56C6C"}},[t._v("已禁用")]):t._e()]}}])}),t._v(" "),a("el-table-column",{attrs:{label:"操作",fixed:"right",width:"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(a){return t.onTableUpdate(e.row)}}},[t._v("修改")]),t._v(" "),e.row.permission?a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(a){return t.onTableAuth(e.row)}}},[t._v("授权")]):t._e()]}}])})],1),t._v(" "),a("el-dialog",{attrs:{title:"修改路由",visible:t.routeDialogVisible,"close-on-click-modal":!1},on:{"update:visible":function(e){t.routeDialogVisible=e}}},[a("el-form",{attrs:{model:t.routeDialogFormData,"label-width":"120px",size:"mini"}},[a("el-form-item",{attrs:{label:"id"}},[a("el-input",{attrs:{readonly:"readonly"},model:{value:t.routeDialogFormData.id,callback:function(e){t.$set(t.routeDialogFormData,"id",e)},expression:"routeDialogFormData.id"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"uri"}},[a("el-input",{model:{value:t.routeDialogFormData.uri,callback:function(e){t.$set(t.routeDialogFormData,"uri",e)},expression:"routeDialogFormData.uri"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"path"}},[a("el-input",{model:{value:t.routeDialogFormData.path,callback:function(e){t.$set(t.routeDialogFormData,"path",e)},expression:"routeDialogFormData.path"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"状态"}},[a("el-radio-group",{model:{value:t.routeDialogFormData.status,callback:function(e){t.$set(t.routeDialogFormData,"status",e)},expression:"routeDialogFormData.status"}},[a("el-radio",{attrs:{label:1,name:"status"}},[t._v("启用")]),t._v(" "),a("el-radio",{staticStyle:{color:"#F56C6C"},attrs:{label:2,name:"status"}},[t._v("禁用")])],1)],1)],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.routeDialogVisible=!1}}},[t._v("取 消")]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.onRouteDialogSave}},[t._v("保 存")])],1)],1),t._v(" "),a("el-dialog",{attrs:{title:"路由授权",visible:t.authDialogVisible,"close-on-click-modal":!1},on:{"update:visible":function(e){t.authDialogVisible=e}}},[a("el-form",{attrs:{model:t.authDialogFormData,"label-width":"120px",size:"mini"}},[a("el-form-item",{attrs:{label:"id"}},[a("el-input",{attrs:{readonly:"readonly"},model:{value:t.authDialogFormData.routeId,callback:function(e){t.$set(t.authDialogFormData,"routeId",e)},expression:"authDialogFormData.routeId"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"角色"}},[a("el-checkbox-group",{model:{value:t.authDialogFormData.roleCode,callback:function(e){t.$set(t.authDialogFormData,"roleCode",e)},expression:"authDialogFormData.roleCode"}},t._l(t.roles,function(e){return a("el-checkbox",{key:e.roleCode,attrs:{label:e.roleCode}},[t._v(t._s(e.description))])}),1)],1)],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.authDialogVisible=!1}}},[t._v("取 消")]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.onAuthDialogSave}},[t._v("保 存")])],1)],1)],1)],1)],1)},l=[],i={data:function(){return{filterText:"",treeData:[],tableData:[],serviceId:"",searchFormData:{},defaultProps:{children:"children",label:"label"},routeDialogFormData:{status:1},routeDialogVisible:!1,roles:[],authDialogFormData:{routeId:"",roleCode:[]},authDialogVisible:!1}},watch:{filterText:function(t){this.$refs.tree2.filter(t)}},created:function(){this.loadTree(),this.loadRouteRole()},methods:{loadTree:function(){this.post("service.list",{},function(t){var e=t.data;this.treeData=this.convertToTreeData(e,0)})},filterNode:function(t,e){return!t||-1!==e.label.indexOf(t)},onNodeClick:function(t,e,a){t.parentId&&(this.serviceId=t.label,this.searchFormData.serviceId=this.serviceId,this.loadTable())},convertToTreeData:function(t,e){for(var a=[],o={label:"服务列表",parentId:e},l=[],i=0;i0?e.join(", "):'未授权'},onRouteDialogSave:function(){this.routeDialogFormData.serviceId=this.serviceId,this.post("route.update",this.routeDialogFormData,function(){this.routeDialogVisible=!1,this.loadTable()})},onAuthDialogSave:function(){this.post("route.role.update",this.authDialogFormData,function(){console.log(this.authDialogFormData),this.authDialogVisible=!1,this.loadTable()})}}},r=i,s=a("2877"),n=Object(s["a"])(r,o,l,!1,null,null,null);e["default"]=n.exports}}]); \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-2d2085ef.a63a74dc.js b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-2d2085ef.a63a74dc.js new file mode 100644 index 00000000..41bf33fb --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-2d2085ef.a63a74dc.js @@ -0,0 +1 @@ +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d2085ef"],{a505:function(e,o,a){"use strict";a.r(o);var t=function(){var e=this,o=e.$createElement,a=e._self._c||o;return a("div",{staticClass:"app-container"},[a("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0,model:e.searchFormData,size:"mini"}},[a("el-form-item",{attrs:{label:"角色码"}},[a("el-input",{staticStyle:{width:"250px"},attrs:{clearable:!0,placeholder:"输入角色码"},model:{value:e.searchFormData.roleCode,callback:function(o){e.$set(e.searchFormData,"roleCode",o)},expression:"searchFormData.roleCode"}})],1),e._v(" "),a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-search"},on:{click:e.loadTable}},[e._v("查询")])],1)],1),e._v(" "),a("el-button",{staticStyle:{"margin-bottom":"10px"},attrs:{type:"primary",size:"mini",icon:"el-icon-plus"},on:{click:e.onAdd}},[e._v("新增角色")]),e._v(" "),a("el-table",{attrs:{data:e.pageInfo.rows,border:"","highlight-current-row":""}},[a("el-table-column",{attrs:{prop:"roleCode",label:"角色码",width:"200"}}),e._v(" "),a("el-table-column",{attrs:{prop:"description",label:"角色描述",width:"200"}}),e._v(" "),a("el-table-column",{attrs:{prop:"gmtCreate",label:"添加时间",width:"160"}}),e._v(" "),a("el-table-column",{attrs:{prop:"gmtModified",label:"修改时间",width:"160"}}),e._v(" "),a("el-table-column",{attrs:{label:"操作",width:"150"},scopedSlots:e._u([{key:"default",fn:function(o){return[a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(a){return e.onTableUpdate(o.row)}}},[e._v("修改")]),e._v(" "),a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(a){return e.onTableDelete(o.row)}}},[e._v("删除")])]}}])})],1),e._v(" "),a("el-pagination",{staticStyle:{"margin-top":"5px"},attrs:{background:"","current-page":e.searchFormData.pageIndex,"page-size":e.searchFormData.pageSize,"page-sizes":[5,10,20,40],total:e.pageInfo.total,layout:"total, sizes, prev, pager, next"},on:{"size-change":e.onSizeChange,"current-change":e.onPageIndexChange}}),e._v(" "),a("el-dialog",{attrs:{title:e.roleDialogTitle,visible:e.roleDialogVisible,"close-on-click-modal":!1},on:{"update:visible":function(o){e.roleDialogVisible=o},close:function(o){return e.resetForm("roleForm")}}},[a("el-form",{ref:"roleForm",attrs:{rules:e.roleDialogFormRules,model:e.roleDialogFormData,"label-width":"120px",size:"mini"}},[a("el-form-item",{attrs:{prop:"roleCode",label:"角色码"}},[a("el-input",{directives:[{name:"show",rawName:"v-show",value:0===e.roleDialogFormData.id,expression:"roleDialogFormData.id === 0"}],model:{value:e.roleDialogFormData.roleCode,callback:function(o){e.$set(e.roleDialogFormData,"roleCode",o)},expression:"roleDialogFormData.roleCode"}}),e._v(" "),a("span",{directives:[{name:"show",rawName:"v-show",value:e.roleDialogFormData.id>0,expression:"roleDialogFormData.id > 0"}]},[e._v(e._s(e.roleDialogFormData.roleCode))])],1),e._v(" "),a("el-form-item",{attrs:{prop:"description",label:"角色描述"}},[a("el-input",{model:{value:e.roleDialogFormData.description,callback:function(o){e.$set(e.roleDialogFormData,"description",o)},expression:"roleDialogFormData.description"}})],1)],1),e._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(o){e.roleDialogVisible=!1}}},[e._v("取 消")]),e._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:e.onRoleDialogSave}},[e._v("保 存")])],1)],1)],1)},l=[],i={data:function(){return{searchFormData:{roleCode:"",pageIndex:1,pageSize:10},pageInfo:{rows:[],total:0},roleDialogVisible:!1,roleDialogTitle:"",roleDialogFormData:{id:0,roleCode:"",description:""},roleDialogFormRules:{roleCode:[{required:!0,message:"不能为空",trigger:"blur"},{min:1,max:64,message:"长度在 1 到 100 个字符",trigger:"blur"}],description:[{max:64,message:"不能超过 64 个字符",trigger:"blur"}]},rulesIsvForm:{appKey:[{required:!0,message:"不能为空",trigger:"blur"},{min:1,max:100,message:"长度在 1 到 100 个字符",trigger:"blur"}]}}},created:function(){this.loadTable()},methods:{loadTable:function(){this.post("role.page",this.searchFormData,function(e){this.pageInfo=e.data})},onTableUpdate:function(e){var o=this;this.roleDialogTitle="修改角色",this.roleDialogVisible=!0,this.$nextTick(function(){Object.assign(o.roleDialogFormData,e)})},onTableDelete:function(e){this.confirm("确认要删除角色【".concat(e.roleCode,"】吗?"),function(o){var a={id:e.id};this.post("role.del",a,function(){o(),this.tip("删除成功"),this.loadTable()})})},onRoleDialogSave:function(){var e=this;this.$refs.roleForm.validate(function(o){if(o){var a=e.roleDialogFormData.id?"role.update":"role.add";e.post(a,e.roleDialogFormData,function(){this.roleDialogVisible=!1,this.loadTable()})}})},onSizeChange:function(e){this.searchFormData.pageSize=e,this.loadTable()},onAdd:function(){this.roleDialogTitle="新增角色",this.roleDialogVisible=!0,this.roleDialogFormData.id=0},onPageIndexChange:function(e){this.searchFormData.pageIndex=e,this.loadTable()}}},r=i,n=a("2877"),s=Object(n["a"])(r,t,l,!1,null,null,null);o["default"]=s.exports}}]); \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-2d221836.574c9ab6.js b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-2d221836.574c9ab6.js deleted file mode 100644 index afc45880..00000000 --- a/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-2d221836.574c9ab6.js +++ /dev/null @@ -1 +0,0 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d221836"],{cb56:function(e,t,a){"use strict";a.r(t);var i=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"app-container"},[a("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0,model:e.searchFormData,size:"mini"}},[a("el-form-item",{attrs:{label:"appKey"}},[a("el-input",{staticStyle:{width:"250px"},attrs:{clearable:!0,placeholder:"appKey"},model:{value:e.searchFormData.appKey,callback:function(t){e.$set(e.searchFormData,"appKey",t)},expression:"searchFormData.appKey"}})],1),e._v(" "),a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-search"},on:{click:e.onSearchTable}},[e._v("查询")])],1)],1),e._v(" "),a("el-button",{staticStyle:{"margin-bottom":"10px"},attrs:{type:"primary",size:"mini",icon:"el-icon-plus"},on:{click:e.onAdd}},[e._v("新增ISV")]),e._v(" "),a("el-table",{attrs:{data:e.pageInfo.list,border:"",fit:"","highlight-current-row":""}},[a("el-table-column",{attrs:{prop:"id",label:"ID",width:"80"}}),e._v(" "),a("el-table-column",{attrs:{prop:"appKey",label:"appKey",width:"250"}}),e._v(" "),a("el-table-column",{attrs:{prop:"secret",label:"secret",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[2===t.row.signType?a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(a){return e.onShowSecret(t.row)}}},[e._v("查看")]):e._e()]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"",label:"公私钥",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[1===t.row.signType?a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(a){return e.onShowPriPubKey(t.row)}}},[e._v("查看")]):e._e()]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"signType",label:"签名类型",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[1===t.row.signType?a("span",[e._v("RSA2")]):e._e(),e._v(" "),2===t.row.signType?a("span",[e._v("MD5")]):e._e()]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"roleList",label:"角色"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("div",{domProps:{innerHTML:e._s(e.roleRender(t.row))}})]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"status",label:"状态",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[1===t.row.status?a("span",{staticStyle:{color:"#67C23A"}},[e._v("已启用")]):e._e(),e._v(" "),2===t.row.status?a("span",{staticStyle:{color:"#F56C6C"}},[e._v("已禁用")]):e._e()]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"gmtCreate",label:"添加时间",width:"160"}}),e._v(" "),a("el-table-column",{attrs:{prop:"gmtModified",label:"修改时间",width:"160"}}),e._v(" "),a("el-table-column",{attrs:{label:"操作",fixed:"right",width:"100"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(a){return e.onTableUpdate(t.row)}}},[e._v("修改")])]}}])})],1),e._v(" "),a("el-pagination",{staticStyle:{"margin-top":"5px"},attrs:{background:"","current-page":e.searchFormData.pageIndex,"page-size":e.searchFormData.pageSize,"page-sizes":[5,10,20,40],total:e.pageInfo.total,layout:"total, sizes, prev, pager, next"},on:{"size-change":e.onSizeChange,"current-change":e.onPageIndexChange}}),e._v(" "),a("el-dialog",{attrs:{title:e.isvDialogTitle,visible:e.isvDialogVisible,"close-on-click-modal":!1},on:{"update:visible":function(t){e.isvDialogVisible=t},close:e.onIsvDialogClose}},[a("el-form",{ref:"isvForm",attrs:{rules:e.rulesIsvForm,model:e.isvDialogFormData,"label-width":"120px",size:"mini"}},[a("el-form-item",{attrs:{label:""}},[a("el-button",{attrs:{size:"mini"},on:{click:e.onDataGen}},[e._v("一键生成数据")])],1),e._v(" "),a("el-form-item",{attrs:{prop:"appKey",label:"appKey"}},[a("el-input",{attrs:{size:"mini"},model:{value:e.isvDialogFormData.appKey,callback:function(t){e.$set(e.isvDialogFormData,"appKey",t)},expression:"isvDialogFormData.appKey"}})],1),e._v(" "),a("el-form-item",{attrs:{prop:"signType",label:"签名方式"}},[a("el-radio-group",{model:{value:e.isvDialogFormData.signType,callback:function(t){e.$set(e.isvDialogFormData,"signType",t)},expression:"isvDialogFormData.signType"}},[a("el-radio",{attrs:{label:1,name:"status"}},[e._v("RSA2")]),e._v(" "),a("el-radio",{attrs:{label:2,name:"status"}},[e._v("MD5")])],1)],1),e._v(" "),a("el-form-item",{directives:[{name:"show",rawName:"v-show",value:2===e.isvDialogFormData.signType,expression:"isvDialogFormData.signType === 2"}],attrs:{prop:"secret",label:"secret"}},[a("el-input",{attrs:{size:"mini"},model:{value:e.isvDialogFormData.secret,callback:function(t){e.$set(e.isvDialogFormData,"secret",t)},expression:"isvDialogFormData.secret"}})],1),e._v(" "),a("el-form-item",{directives:[{name:"show",rawName:"v-show",value:1===e.isvDialogFormData.signType,expression:"isvDialogFormData.signType === 1"}],attrs:{prop:"pubKey",label:"公钥"}},[a("el-input",{attrs:{type:"textarea"},model:{value:e.isvDialogFormData.pubKey,callback:function(t){e.$set(e.isvDialogFormData,"pubKey",t)},expression:"isvDialogFormData.pubKey"}})],1),e._v(" "),a("el-form-item",{directives:[{name:"show",rawName:"v-show",value:1===e.isvDialogFormData.signType,expression:"isvDialogFormData.signType === 1"}],attrs:{prop:"priKey",label:"私钥"}},[a("el-input",{attrs:{type:"textarea"},model:{value:e.isvDialogFormData.priKey,callback:function(t){e.$set(e.isvDialogFormData,"priKey",t)},expression:"isvDialogFormData.priKey"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"角色"}},[a("el-checkbox-group",{model:{value:e.isvDialogFormData.roleCode,callback:function(t){e.$set(e.isvDialogFormData,"roleCode",t)},expression:"isvDialogFormData.roleCode"}},e._l(e.roles,function(t){return a("el-checkbox",{key:t.roleCode,attrs:{label:t.roleCode}},[e._v(e._s(t.description))])}),1)],1),e._v(" "),a("el-form-item",{attrs:{label:"状态"}},[a("el-radio-group",{model:{value:e.isvDialogFormData.status,callback:function(t){e.$set(e.isvDialogFormData,"status",t)},expression:"isvDialogFormData.status"}},[a("el-radio",{attrs:{label:1,name:"status"}},[e._v("启用")]),e._v(" "),a("el-radio",{attrs:{label:2,name:"status"}},[e._v("禁用")])],1)],1)],1),e._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(t){e.isvDialogVisible=!1}}},[e._v("取 消")]),e._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:e.onIsvDialogSave}},[e._v("保 存")])],1)],1)],1)},o=[],s={data:function(){var e=this,t=function(t,a,i){2===e.isvDialogFormData.signType&&(""===a&&i(new Error("不能为空")),a.length>200&&i(new Error("长度不能超过200"))),i()},a=function(t,a,i){1===e.isvDialogFormData.signType&&""===a&&i(new Error("不能为空")),i()};return{searchFormData:{appKey:"",pageIndex:1,pageSize:10},pageInfo:{list:[],total:0},roles:[],isvDialogVisible:!1,isvDialogTitle:"新增ISV",isvDialogFormData:{id:0,appKey:"",secret:"",pubKey:"",priKey:"",signType:1,status:1,roleCode:[]},rulesIsvForm:{appKey:[{required:!0,message:"不能为空",trigger:"blur"},{min:1,max:100,message:"长度在 1 到 100 个字符",trigger:"blur"}],secret:[{validator:t,trigger:"blur"}],pubKey:[{validator:a,trigger:"blur"}],priKey:[{validator:a,trigger:"blur"}]}}},created:function(){this.loadTable(),this.loadRouteRole()},methods:{loadTable:function(){this.post("isv.info.page",this.searchFormData,function(e){this.pageInfo=e.data})},loadRouteRole:function(){0===this.roles.length&&this.post("role.listall",{},function(e){this.roles=e.data})},onShowSecret:function(e){this.$alert(e.secret,"secret")},onShowPriPubKey:function(e){var t=e.pubKey,a=e.priKey,i='公钥:'+t+'私钥:'+a+"";this.$alert(i,"公私钥",{dangerouslyUseHTMLString:!0})},onSearchTable:function(){this.loadTable()},onTableUpdate:function(e){var t=this;this.isvDialogTitle="修改ISV",this.isvDialogVisible=!0,this.$nextTick(function(){t.post("isv.info.get",{id:e.id},function(e){for(var t=e.data,a=t.roleList,i=[],o=0;o0&&"UP"===e.row.status?a("el-tag",{attrs:{type:"success"}},[t._v("已上线")]):t._e(),t._v(" "),e.row.parentId>0&&"STARTING"===e.row.status?a("el-tag",{attrs:{type:"info"}},[t._v("正在启动")]):t._e(),t._v(" "),e.row.parentId>0&&"UNKNOWN"===e.row.status?a("el-tag",[t._v("未知")]):t._e(),t._v(" "),e.row.parentId>0&&("OUT_OF_SERVICE"===e.row.status||"DOWN"===e.row.status)?a("el-tag",{attrs:{type:"danger"}},[t._v("已下线")]):t._e()]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"updateTime",label:"最后更新时间",width:"160"}}),t._v(" "),a("el-table-column",{attrs:{label:"操作",width:"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[e.row.parentId>0&&"UP"===e.row.status?a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(a){return t.onOffline(e.row)}}},[t._v("下线")]):t._e(),t._v(" "),e.row.parentId>0&&"OUT_OF_SERVICE"===e.row.status?a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(a){return t.onOnline(e.row)}}},[t._v("上线")]):t._e()]}}])})],1)],1)},r=[],i=(a("7f7f"),a("ac6a"),{data:function(){return{searchFormData:{serviceId:""},tableData:[]}},created:function(){this.loadTable()},methods:{loadTable:function(){this.post("service.instance.list",this.searchFormData,function(t){this.tableData=this.buildTreeData(t.data)})},buildTreeData:function(t){return t.forEach(function(e){var a=e.parentId;0===a||t.forEach(function(t){if(t.id===a){var n=t.children;n||(n=[]),n.push(e),t.children=n}})}),t=t.filter(function(t){return 0===t.parentId}),t},onSearchTable:function(){this.loadTable()},onOffline:function(t){this.confirm("确定要下线【"+t.name+"】吗?",function(e){var a={serviceId:t.name,instanceId:t.instanceId};this.post("service.instance.offline",a,function(){this.tip("下线成功"),e()})})},onOnline:function(t){this.confirm("确定要上线【"+t.name+"】吗?",function(e){var a={serviceId:t.name,instanceId:t.instanceId};this.post("service.instance.online",a,function(){this.tip("上线成功"),e()})})}}}),s=i,o=a("2877"),l=Object(o["a"])(s,n,r,!1,null,null,null);e["default"]=l.exports}}]); \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-2d22c2e3.4a098244.js b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-2d22c2e3.4a098244.js new file mode 100644 index 00000000..bb906ed7 --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-2d22c2e3.4a098244.js @@ -0,0 +1 @@ +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d22c2e3"],{f1ac:function(t,e,n){"use strict";n.r(e);var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"app-container"},[n("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0,model:t.searchFormData,size:"mini"}},[n("el-form-item",{attrs:{label:"serviceId"}},[n("el-input",{staticStyle:{width:"250px"},attrs:{clearable:!0,placeholder:"serviceId"},model:{value:t.searchFormData.serviceId,callback:function(e){t.$set(t.searchFormData,"serviceId",e)},expression:"searchFormData.serviceId"}})],1),t._v(" "),n("el-form-item",[n("el-button",{attrs:{type:"primary",icon:"el-icon-search"},on:{click:t.onSearchTable}},[t._v("查询")])],1)],1),t._v(" "),n("el-table",{staticStyle:{width:"100%","margin-bottom":"20px"},attrs:{data:t.tableData,border:"","row-key":"id"}},[n("el-table-column",{attrs:{prop:"serviceId",label:"服务名称",width:"200"},scopedSlots:t._u([{key:"default",fn:function(e){return[n("span",{domProps:{innerHTML:t._s(t.renderServiceName(e.row))}})]}}])}),t._v(" "),n("el-table-column",{attrs:{prop:"ipPort",label:"IP端口",width:"250"}}),t._v(" "),n("el-table-column",{attrs:{prop:"status",label:"服务状态",width:"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[e.row.parentId>0&&"UP"===e.row.status?n("el-tag",{attrs:{type:"success"}},[t._v("已上线")]):t._e(),t._v(" "),e.row.parentId>0&&"STARTING"===e.row.status?n("el-tag",{attrs:{type:"info"}},[t._v("正在启动")]):t._e(),t._v(" "),e.row.parentId>0&&"UNKNOWN"===e.row.status?n("el-tag",[t._v("未知")]):t._e(),t._v(" "),e.row.parentId>0&&("OUT_OF_SERVICE"===e.row.status||"DOWN"===e.row.status)?n("el-tag",{attrs:{type:"danger"}},[t._v("已下线")]):t._e()]}}])}),t._v(" "),n("el-table-column",{attrs:{prop:"updateTime",label:"最后更新时间",width:"160"}}),t._v(" "),n("el-table-column",{attrs:{label:"操作",width:"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[e.row.parentId>0&&"UP"===e.row.status?n("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(n){return t.onOffline(e.row)}}},[t._v("下线")]):t._e(),t._v(" "),e.row.parentId>0&&"OUT_OF_SERVICE"===e.row.status?n("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(n){return t.onOnline(e.row)}}},[t._v("上线")]):t._e()]}}])})],1)],1)},r=[],i=(n("ac6a"),{data:function(){return{searchFormData:{serviceId:""},tableData:[]}},created:function(){this.loadTable()},methods:{loadTable:function(){this.post("service.instance.list",this.searchFormData,function(t){this.tableData=this.buildTreeData(t.data)})},buildTreeData:function(t){return t.forEach(function(e){var n=e.parentId;0===n||t.forEach(function(t){if(t.id===n){var a=t.children;a||(a=[]),a.push(e),t.children=a}})}),t=t.filter(function(t){return 0===t.parentId}),t},onSearchTable:function(){this.loadTable()},onOffline:function(t){this.confirm("确定要下线【"+t.serviceId+"】吗?",function(e){this.post("service.instance.offline",t,function(){this.tip("下线成功"),e()})})},onOnline:function(t){this.confirm("确定要上线【"+t.serviceId+"】吗?",function(e){this.post("service.instance.online",t,function(){this.tip("上线成功"),e()})})},renderServiceName:function(t){var e="";if(t.children&&t.children.length>0){var n=t.children.filter(function(t){return"UP"===t.status}).length;e=" (".concat(n,"/").concat(t.children.length,")")}return t.serviceId+e}}}),o=i,s=n("2877"),l=Object(s["a"])(o,a,r,!1,null,null,null);e["default"]=l.exports}}]); \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-19100986.3ec98327.js b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-37401378.4e39ec9b.js similarity index 89% rename from sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-19100986.3ec98327.js rename to sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-37401378.4e39ec9b.js index f55a61bb..3d8d7bb3 100644 --- a/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-19100986.3ec98327.js +++ b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-37401378.4e39ec9b.js @@ -1 +1 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-19100986"],{5040:function(t,n,a){"use strict";var e=a("a5a4"),s=a.n(e);s.a},9406:function(t,n,a){"use strict";a.r(n);var e=function(){var t=this,n=t.$createElement;t._self._c;return t._m(0)},s=[function(){var t=this,n=t.$createElement,a=t._self._c||n;return a("div",{staticClass:"dashboard-container"},[a("div",{staticClass:"dashboard-text"},[t._v("欢迎使用SOP Admin")])])}],i={created:function(){this.post("admin.userinfo.get",{},function(t){})}},c=i,r=(a("5040"),a("2877")),o=Object(r["a"])(c,e,s,!1,null,"b4bd5162",null);n["default"]=o.exports},a5a4:function(t,n,a){}}]); \ No newline at end of file +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-37401378"],{5040:function(t,n,a){"use strict";var e=a("a5a4"),s=a.n(e);s.a},9406:function(t,n,a){"use strict";a.r(n);var e=function(){var t=this,n=t.$createElement;t._self._c;return t._m(0)},s=[function(){var t=this,n=t.$createElement,a=t._self._c||n;return a("div",{staticClass:"dashboard-container"},[a("div",{staticClass:"dashboard-text"},[t._v("欢迎使用SOP Admin")])])}],i={created:function(){this.post("admin.userinfo.get",{},function(t){})}},c=i,r=(a("5040"),a("2877")),o=Object(r["a"])(c,e,s,!1,null,"b4bd5162",null);n["default"]=o.exports},a5a4:function(t,n,a){}}]); \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-4a59cbe4.a6360c68.js b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-4a59cbe4.a6360c68.js new file mode 100644 index 00000000..4f96ae52 --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-4a59cbe4.a6360c68.js @@ -0,0 +1 @@ +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-4a59cbe4"],{"02f4":function(t,e,n){var r=n("4588"),i=n("be13");t.exports=function(t){return function(e,n){var o,a,l=String(i(e)),c=r(n),s=l.length;return c<0||c>=s?t?"":void 0:(o=l.charCodeAt(c),o<55296||o>56319||c+1===s||(a=l.charCodeAt(c+1))<56320||a>57343?t?l.charAt(c):o:t?l.slice(c,c+2):a-56320+(o-55296<<10)+65536)}}},"0390":function(t,e,n){"use strict";var r=n("02f4")(!0);t.exports=function(t,e,n){return e+(n?r(t,e).length:1)}},"0a49":function(t,e,n){var r=n("9b43"),i=n("626a"),o=n("4bf8"),a=n("9def"),l=n("cd1c");t.exports=function(t,e){var n=1==t,c=2==t,s=3==t,u=4==t,f=6==t,d=5==t||f,v=e||l;return function(e,l,p){for(var g,h,b=o(e),m=i(b),D=r(l,p,3),x=a(m.length),y=0,_=n?v(e,x):c?v(e,0):void 0;x>y;y++)if((d||y in m)&&(g=m[y],h=D(g,y,b),t))if(n)_[y]=h;else if(h)switch(t){case 3:return!0;case 5:return g;case 6:return y;case 2:_.push(g)}else if(u)return!1;return f?-1:s||u?u:_}}},"0bfb":function(t,e,n){"use strict";var r=n("cb7c");t.exports=function(){var t=r(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},1169:function(t,e,n){var r=n("2d95");t.exports=Array.isArray||function(t){return"Array"==r(t)}},"20d6":function(t,e,n){"use strict";var r=n("5ca1"),i=n("0a49")(6),o="findIndex",a=!0;o in[]&&Array(1)[o](function(){a=!1}),r(r.P+r.F*a,"Array",{findIndex:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),n("9c6c")(o)},"214f":function(t,e,n){"use strict";n("b0c5");var r=n("2aba"),i=n("32e9"),o=n("79e5"),a=n("be13"),l=n("2b4c"),c=n("520a"),s=l("species"),u=!o(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")}),f=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2===n.length&&"a"===n[0]&&"b"===n[1]}();t.exports=function(t,e,n){var d=l(t),v=!o(function(){var e={};return e[d]=function(){return 7},7!=""[t](e)}),p=v?!o(function(){var e=!1,n=/a/;return n.exec=function(){return e=!0,null},"split"===t&&(n.constructor={},n.constructor[s]=function(){return n}),n[d](""),!e}):void 0;if(!v||!p||"replace"===t&&!u||"split"===t&&!f){var g=/./[d],h=n(a,d,""[t],function(t,e,n,r,i){return e.exec===c?v&&!i?{done:!0,value:g.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}}),b=h[0],m=h[1];r(String.prototype,t,b),i(RegExp.prototype,d,2==e?function(t,e){return m.call(t,this,e)}:function(t){return m.call(t,this)})}}},"520a":function(t,e,n){"use strict";var r=n("0bfb"),i=RegExp.prototype.exec,o=String.prototype.replace,a=i,l="lastIndex",c=function(){var t=/a/,e=/b*/g;return i.call(t,"a"),i.call(e,"a"),0!==t[l]||0!==e[l]}(),s=void 0!==/()??/.exec("")[1],u=c||s;u&&(a=function(t){var e,n,a,u,f=this;return s&&(n=new RegExp("^"+f.source+"$(?!\\s)",r.call(f))),c&&(e=f[l]),a=i.call(f,t),c&&a&&(f[l]=f.global?a.index+a[0].length:e),s&&a&&a.length>1&&o.call(a[0],n,function(){for(u=1;u]*>)/g,v=/\$([$&`']|\d\d?)/g,p=function(t){return void 0===t?t:String(t)};n("214f")("replace",2,function(t,e,n,g){return[function(r,i){var o=t(this),a=void 0==r?void 0:r[e];return void 0!==a?a.call(r,o,i):n.call(String(o),r,i)},function(t,e){var i=g(n,t,this,e);if(i.done)return i.value;var f=r(t),d=String(this),v="function"===typeof e;v||(e=String(e));var b=f.global;if(b){var m=f.unicode;f.lastIndex=0}var D=[];while(1){var x=c(f,d);if(null===x)break;if(D.push(x),!b)break;var y=String(x[0]);""===y&&(f.lastIndex=l(d,o(f.lastIndex),m))}for(var _="",w=0,I=0;I=w&&(_+=d.slice(w,k)+L,w=k+S.length)}return _+d.slice(w)}];function h(t,e,r,o,a,l){var c=r+t.length,s=o.length,u=v;return void 0!==a&&(a=i(a),u=d),n.call(l,u,function(n,i){var l;switch(i.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,r);case"'":return e.slice(c);case"<":l=a[i.slice(1,-1)];break;default:var u=+i;if(0===u)return n;if(u>s){var d=f(u/10);return 0===d?n:d<=s?void 0===o[d-1]?i.charAt(1):o[d-1]+i.charAt(1):n}l=o[u-1]}return void 0===l?"":l})}})},b0c5:function(t,e,n){"use strict";var r=n("520a");n("5ca1")({target:"RegExp",proto:!0,forced:r!==/./.exec},{exec:r})},cd1c:function(t,e,n){var r=n("e853");t.exports=function(t,e){return new(r(t))(e)}},e853:function(t,e,n){var r=n("d3f4"),i=n("1169"),o=n("2b4c")("species");t.exports=function(t){var e;return i(t)&&(e=t.constructor,"function"!=typeof e||e!==Array&&!i(e.prototype)||(e=void 0),r(e)&&(e=e[o],null===e&&(e=void 0))),void 0===e?Array:e}},ec2a:function(t,e,n){"use strict";n.r(e);var r=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"app-container"},[n("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0,model:t.searchFormData,size:"mini"}},[n("el-form-item",[n("el-button",{attrs:{type:"primary",icon:"el-icon-plus"},on:{click:t.onAddServer}},[t._v("添加监控服务器")])],1)],1),t._v(" "),n("el-table",{staticStyle:{width:"100%","margin-bottom":"20px"},attrs:{data:t.tableData,border:"","default-expand-all":!0,"row-key":"treeId","empty-text":"请添加监控服务器"}},[n("el-table-column",{attrs:{prop:"monitorName",label:"网关实例",width:"300"},scopedSlots:t._u([{key:"default",fn:function(e){return[0===e.row.parentId?n("span",[t._v(t._s(e.row.monitorName))]):t._e()]}}])}),t._v(" "),n("el-table-column",{attrs:{prop:"serviceId",label:"serviceId",width:"200"},scopedSlots:t._u([{key:"default",fn:function(e){return[e.row.parentId>0?n("span",[t._v(t._s(e.row.serviceId))]):t._e()]}}])}),t._v(" "),n("el-table-column",{attrs:{prop:"name",label:"接口名 (版本号)",width:"200"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v("\n "+t._s(e.row.name+(e.row.version?" ("+e.row.version+")":""))+"\n ")]}}])}),t._v(" "),n("el-table-column",{attrs:{prop:"count",label:"出错次数",width:"100"}}),t._v(" "),n("el-table-column",{attrs:{prop:"errorMsg",label:"报错信息",width:"300"},scopedSlots:t._u([{key:"default",fn:function(e){return e.row.parentId>0?[n("div",{staticStyle:{display:"inline-block"},domProps:{innerHTML:t._s(t.showErrorMsg(e.row))}}),t._v(" "),n("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(n){return t.onShowErrorDetail(e.row)}}},[t._v("详情")])]:void 0}}],null,!0)}),t._v(" "),n("el-table-column",{attrs:{label:"操作",width:"180"},scopedSlots:t._u([{key:"default",fn:function(e){return[0===e.row.parentId&&e.row.children?n("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(n){return t.onClearLog(e.row)}}},[t._v("清空日志")]):t._e(),t._v(" "),0===e.row.parentId?n("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(n){return t.onDelete(e.row)}}},[t._v("删除实例")]):t._e()]}}])})],1),t._v(" "),n("el-dialog",{attrs:{title:"选择服务器实例",visible:t.logDialogInstanceVisible,"close-on-click-modal":!1},on:{"update:visible":function(e){t.logDialogInstanceVisible=e}}},[n("el-form",{ref:"logDialogForm",attrs:{model:t.logDialogFormData,rules:t.rulesLog,"label-width":"150px",size:"mini"}},[n("el-form-item",[n("p",{staticStyle:{color:"#878787"}},[t._v("只能选择网关实例,其它实例不支持")])]),t._v(" "),n("el-form-item",{attrs:{prop:"instanceData",label:"服务器实例"}},[n("el-select",{staticStyle:{width:"400px"},attrs:{"value-key":"id"},model:{value:t.logDialogFormData.instanceData,callback:function(e){t.$set(t.logDialogFormData,"instanceData",e)},expression:"logDialogFormData.instanceData"}},t._l(t.serviceData,function(e){return n("el-option",{key:e.id,attrs:{label:e.serviceId+"("+e.ipPort+")",value:e,disabled:t.isOptionDisabled(e)}},[n("span",{staticStyle:{float:"left"}},[t._v(t._s(e.serviceId)+" "),t.isOptionDisabled(e)?n("span",[t._v("(已添加)")]):t._e()]),t._v(" "),n("span",{staticStyle:{float:"right",color:"#8492a6","font-size":"13px"}},[t._v(t._s(e.ipPort))])])}),1)],1)],1),t._v(" "),n("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{on:{click:function(e){t.logDialogInstanceVisible=!1}}},[t._v("取 消")]),t._v(" "),n("el-button",{attrs:{type:"primary"},on:{click:t.onLogDialogSave}},[t._v("保 存")])],1)],1),t._v(" "),n("el-dialog",{attrs:{title:"错误详情",visible:t.logDetailVisible,width:"60%"},on:{"update:visible":function(e){t.logDetailVisible=e}}},[n("div",{staticStyle:{"overflow-x":"auto"},domProps:{innerHTML:t._s(t.errorMsgDetail)}}),t._v(" "),n("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{attrs:{type:"primary"},on:{click:function(e){t.logDetailVisible=!1}}},[t._v("关 闭")])],1)])],1)},i=[],o=(n("a481"),n("ac6a"),n("20d6"),{data:function(){return{searchFormData:{},tableData:[],serviceData:[],addedInstanceList:[],logDialogFormData:{instanceData:null},logDialogInstanceVisible:!1,logDetailVisible:!1,rulesLog:{instanceData:[{required:!0,message:"不能为空",trigger:"blur"}]},errorMsgDetail:""}},created:function(){this.loadServiceInstance(),this.loadTable()},methods:{loadServiceInstance:function(){this.post("service.instance.list",{},function(t){this.serviceData=t.data.filter(function(t){return t.instanceId&&t.instanceId.length>0})}),this.post("monitor.instance.list",{},function(t){this.addedInstanceList=t.data})},loadTable:function(){this.post("monitor.log.list",{},function(t){this.tableData=this.buildTreeData(t.data)})},isOptionDisabled:function(t){var e=t.ipPort,n=this.addedInstanceList.findIndex(function(t,n,r){return t===e});return n>-1},buildTreeData:function(t){return t.forEach(function(e){var n=e.parentId;0===n||t.forEach(function(t){if(t.treeId===n){var r=t.children;r||(r=[]),r.push(e),t.children=r}})}),t=t.filter(function(t){return 0===t.parentId}),t},showErrorMsg:function(t){var e=t.errorMsg.replace(/\/g,"");return e.substring(0,30)+"..."},onAddServer:function(){this.logDialogInstanceVisible=!0},onDelete:function(t){this.confirm("确定要删除实例【"+t.monitorName+"】吗?",function(e){this.post("monitor.instance.del",{id:t.rawId},function(t){e(),this.tip("删除成功"),this.loadTable()})})},onClearLog:function(t){this.confirm("确定要清空日志吗?",function(e){this.post("monitor.log.clear",{id:t.rawId},function(t){e(),this.tip("清空成功"),this.loadTable()})})},onShowErrorDetail:function(t){this.errorMsgDetail=t.errorMsg,this.logDetailVisible=!0},onLogDialogSave:function(){var t=this;this.$refs["logDialogForm"].validate(function(e){if(e){var n=t.logDialogFormData.instanceData;t.post("monitor.instance.add",n,function(t){this.logDialogInstanceVisible=!1,this.loadTable()})}})}}}),a=o,l=n("2877"),c=Object(l["a"])(a,r,i,!1,null,null,null);e["default"]=c.exports}}]); \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-4a59cbe4.b5e74cc4.js b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-4a59cbe4.b5e74cc4.js deleted file mode 100644 index 3b814941..00000000 --- a/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-4a59cbe4.b5e74cc4.js +++ /dev/null @@ -1 +0,0 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-4a59cbe4"],{"02f4":function(t,e,r){var n=r("4588"),i=r("be13");t.exports=function(t){return function(e,r){var o,a,l=String(i(e)),c=n(r),s=l.length;return c<0||c>=s?t?"":void 0:(o=l.charCodeAt(c),o<55296||o>56319||c+1===s||(a=l.charCodeAt(c+1))<56320||a>57343?t?l.charAt(c):o:t?l.slice(c,c+2):a-56320+(o-55296<<10)+65536)}}},"0390":function(t,e,r){"use strict";var n=r("02f4")(!0);t.exports=function(t,e,r){return e+(r?n(t,e).length:1)}},"0a49":function(t,e,r){var n=r("9b43"),i=r("626a"),o=r("4bf8"),a=r("9def"),l=r("cd1c");t.exports=function(t,e){var r=1==t,c=2==t,s=3==t,u=4==t,d=6==t,f=5==t||d,v=e||l;return function(e,l,p){for(var g,h,b=o(e),m=i(b),D=n(l,p,3),x=a(m.length),y=0,_=r?v(e,x):c?v(e,0):void 0;x>y;y++)if((f||y in m)&&(g=m[y],h=D(g,y,b),t))if(r)_[y]=h;else if(h)switch(t){case 3:return!0;case 5:return g;case 6:return y;case 2:_.push(g)}else if(u)return!1;return d?-1:s||u?u:_}}},"0bfb":function(t,e,r){"use strict";var n=r("cb7c");t.exports=function(){var t=n(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},1169:function(t,e,r){var n=r("2d95");t.exports=Array.isArray||function(t){return"Array"==n(t)}},"20d6":function(t,e,r){"use strict";var n=r("5ca1"),i=r("0a49")(6),o="findIndex",a=!0;o in[]&&Array(1)[o](function(){a=!1}),n(n.P+n.F*a,"Array",{findIndex:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),r("9c6c")(o)},"214f":function(t,e,r){"use strict";r("b0c5");var n=r("2aba"),i=r("32e9"),o=r("79e5"),a=r("be13"),l=r("2b4c"),c=r("520a"),s=l("species"),u=!o(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")}),d=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var r="ab".split(t);return 2===r.length&&"a"===r[0]&&"b"===r[1]}();t.exports=function(t,e,r){var f=l(t),v=!o(function(){var e={};return e[f]=function(){return 7},7!=""[t](e)}),p=v?!o(function(){var e=!1,r=/a/;return r.exec=function(){return e=!0,null},"split"===t&&(r.constructor={},r.constructor[s]=function(){return r}),r[f](""),!e}):void 0;if(!v||!p||"replace"===t&&!u||"split"===t&&!d){var g=/./[f],h=r(a,f,""[t],function(t,e,r,n,i){return e.exec===c?v&&!i?{done:!0,value:g.call(e,r,n)}:{done:!0,value:t.call(r,e,n)}:{done:!1}}),b=h[0],m=h[1];n(String.prototype,t,b),i(RegExp.prototype,f,2==e?function(t,e){return m.call(t,this,e)}:function(t){return m.call(t,this)})}}},"520a":function(t,e,r){"use strict";var n=r("0bfb"),i=RegExp.prototype.exec,o=String.prototype.replace,a=i,l="lastIndex",c=function(){var t=/a/,e=/b*/g;return i.call(t,"a"),i.call(e,"a"),0!==t[l]||0!==e[l]}(),s=void 0!==/()??/.exec("")[1],u=c||s;u&&(a=function(t){var e,r,a,u,d=this;return s&&(r=new RegExp("^"+d.source+"$(?!\\s)",n.call(d))),c&&(e=d[l]),a=i.call(d,t),c&&a&&(d[l]=d.global?a.index+a[0].length:e),s&&a&&a.length>1&&o.call(a[0],r,function(){for(u=1;u]*>)/g,v=/\$([$&`']|\d\d?)/g,p=function(t){return void 0===t?t:String(t)};r("214f")("replace",2,function(t,e,r,g){return[function(n,i){var o=t(this),a=void 0==n?void 0:n[e];return void 0!==a?a.call(n,o,i):r.call(String(o),n,i)},function(t,e){var i=g(r,t,this,e);if(i.done)return i.value;var d=n(t),f=String(this),v="function"===typeof e;v||(e=String(e));var b=d.global;if(b){var m=d.unicode;d.lastIndex=0}var D=[];while(1){var x=c(d,f);if(null===x)break;if(D.push(x),!b)break;var y=String(x[0]);""===y&&(d.lastIndex=l(f,o(d.lastIndex),m))}for(var _="",w=0,I=0;I=w&&(_+=f.slice(w,k)+L,w=k+S.length)}return _+f.slice(w)}];function h(t,e,n,o,a,l){var c=n+t.length,s=o.length,u=v;return void 0!==a&&(a=i(a),u=f),r.call(l,u,function(r,i){var l;switch(i.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,n);case"'":return e.slice(c);case"<":l=a[i.slice(1,-1)];break;default:var u=+i;if(0===u)return r;if(u>s){var f=d(u/10);return 0===f?r:f<=s?void 0===o[f-1]?i.charAt(1):o[f-1]+i.charAt(1):r}l=o[u-1]}return void 0===l?"":l})}})},b0c5:function(t,e,r){"use strict";var n=r("520a");r("5ca1")({target:"RegExp",proto:!0,forced:n!==/./.exec},{exec:n})},cd1c:function(t,e,r){var n=r("e853");t.exports=function(t,e){return new(n(t))(e)}},e853:function(t,e,r){var n=r("d3f4"),i=r("1169"),o=r("2b4c")("species");t.exports=function(t){var e;return i(t)&&(e=t.constructor,"function"!=typeof e||e!==Array&&!i(e.prototype)||(e=void 0),n(e)&&(e=e[o],null===e&&(e=void 0))),void 0===e?Array:e}},ec2a:function(t,e,r){"use strict";r.r(e);var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"app-container"},[r("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0,model:t.searchFormData,size:"mini"}},[r("el-form-item",[r("el-button",{attrs:{type:"primary",icon:"el-icon-plus"},on:{click:t.onAddServer}},[t._v("添加监控服务器")])],1)],1),t._v(" "),r("el-table",{staticStyle:{width:"100%","margin-bottom":"20px"},attrs:{data:t.tableData,border:"","default-expand-all":!0,"row-key":"treeId","empty-text":"请添加监控服务器"}},[r("el-table-column",{attrs:{prop:"monitorName",label:"网关实例",width:"300"},scopedSlots:t._u([{key:"default",fn:function(e){return[0===e.row.parentId?r("span",[t._v(t._s(e.row.monitorName))]):t._e()]}}])}),t._v(" "),r("el-table-column",{attrs:{prop:"serviceId",label:"serviceId",width:"200"},scopedSlots:t._u([{key:"default",fn:function(e){return[e.row.parentId>0?r("span",[t._v(t._s(e.row.serviceId))]):t._e()]}}])}),t._v(" "),r("el-table-column",{attrs:{prop:"name",label:"接口名 (版本号)",width:"200"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v("\n "+t._s(e.row.name+(e.row.version?" ("+e.row.version+")":""))+"\n ")]}}])}),t._v(" "),r("el-table-column",{attrs:{prop:"count",label:"出错次数",width:"100"}}),t._v(" "),r("el-table-column",{attrs:{prop:"errorMsg",label:"报错信息",width:"300"},scopedSlots:t._u([{key:"default",fn:function(e){return e.row.parentId>0?[r("div",{staticStyle:{display:"inline-block"},domProps:{innerHTML:t._s(t.showErrorMsg(e.row))}}),t._v(" "),r("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(r){return t.onShowErrorDetail(e.row)}}},[t._v("详情")])]:void 0}}],null,!0)}),t._v(" "),r("el-table-column",{attrs:{label:"操作",width:"180"},scopedSlots:t._u([{key:"default",fn:function(e){return[0===e.row.parentId&&e.row.children?r("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(r){return t.onClearLog(e.row)}}},[t._v("清空日志")]):t._e(),t._v(" "),0===e.row.parentId?r("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(r){return t.onDelete(e.row)}}},[t._v("删除实例")]):t._e()]}}])})],1),t._v(" "),r("el-dialog",{attrs:{title:"选择服务器实例",visible:t.logDialogInstanceVisible,"close-on-click-modal":!1},on:{"update:visible":function(e){t.logDialogInstanceVisible=e}}},[r("el-form",{ref:"logDialogForm",attrs:{model:t.logDialogFormData,rules:t.rulesLog,"label-width":"150px",size:"mini"}},[r("el-form-item",[r("p",{staticStyle:{color:"#878787"}},[t._v("只能选择网关实例,其它实例不支持")])]),t._v(" "),r("el-form-item",{attrs:{prop:"instanceData",label:"服务器实例"}},[r("el-select",{staticStyle:{width:"400px"},attrs:{"value-key":"id"},model:{value:t.logDialogFormData.instanceData,callback:function(e){t.$set(t.logDialogFormData,"instanceData",e)},expression:"logDialogFormData.instanceData"}},t._l(t.serviceData,function(e){return r("el-option",{key:e.id,attrs:{label:e.name+"("+e.ipAddr+":"+e.serverPort+")",value:e,disabled:t.isOptionDisabled(e)}},[r("span",{staticStyle:{float:"left"}},[t._v(t._s(e.name)+" "),t.isOptionDisabled(e)?r("span",[t._v("(已添加)")]):t._e()]),t._v(" "),r("span",{staticStyle:{float:"right",color:"#8492a6","font-size":"13px"}},[t._v(t._s(e.ipAddr+":"+e.serverPort))])])}),1)],1)],1),t._v(" "),r("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[r("el-button",{on:{click:function(e){t.logDialogInstanceVisible=!1}}},[t._v("取 消")]),t._v(" "),r("el-button",{attrs:{type:"primary"},on:{click:t.onLogDialogSave}},[t._v("保 存")])],1)],1),t._v(" "),r("el-dialog",{attrs:{title:"错误详情",visible:t.logDetailVisible,width:"60%"},on:{"update:visible":function(e){t.logDetailVisible=e}}},[r("div",{staticStyle:{"overflow-x":"auto"},domProps:{innerHTML:t._s(t.errorMsgDetail)}}),t._v(" "),r("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[r("el-button",{attrs:{type:"primary"},on:{click:function(e){t.logDetailVisible=!1}}},[t._v("关 闭")])],1)])],1)},i=[],o=(r("a481"),r("ac6a"),r("20d6"),{data:function(){return{searchFormData:{},tableData:[],serviceData:[],addedInstanceList:[],logDialogFormData:{instanceData:null},logDialogInstanceVisible:!1,logDetailVisible:!1,rulesLog:{instanceData:[{required:!0,message:"不能为空",trigger:"blur"}]},errorMsgDetail:""}},created:function(){this.loadServiceInstance(),this.loadTable()},methods:{loadServiceInstance:function(){this.post("service.instance.list",{},function(t){this.serviceData=t.data.filter(function(t){return t.instanceId&&t.instanceId.length>0})}),this.post("monitor.instance.list",{},function(t){this.addedInstanceList=t.data})},loadTable:function(){this.post("monitor.log.list",{},function(t){this.tableData=this.buildTreeData(t.data)})},isOptionDisabled:function(t){var e=t.ipAddr+":"+t.serverPort,r=this.addedInstanceList.findIndex(function(t,r,n){return t===e});return r>-1},buildTreeData:function(t){return t.forEach(function(e){var r=e.parentId;0===r||t.forEach(function(t){if(t.treeId===r){var n=t.children;n||(n=[]),n.push(e),t.children=n}})}),t=t.filter(function(t){return 0===t.parentId}),t},showErrorMsg:function(t){var e=t.errorMsg.replace(/\/g,"");return e.substring(0,30)+"..."},onAddServer:function(){this.logDialogInstanceVisible=!0},onDelete:function(t){this.confirm("确定要删除实例【"+t.monitorName+"】吗?",function(e){this.post("monitor.instance.del",{id:t.rawId},function(t){e(),this.tip("删除成功"),this.loadTable()})})},onClearLog:function(t){this.confirm("确定要清空日志吗?",function(e){this.post("monitor.log.clear",{id:t.rawId},function(t){e(),this.tip("清空成功"),this.loadTable()})})},onShowErrorDetail:function(t){this.errorMsgDetail=t.errorMsg,this.logDetailVisible=!0},onLogDialogSave:function(){var t=this;this.$refs["logDialogForm"].validate(function(e){if(e){var r=t.logDialogFormData.instanceData,n={serviceId:r.serviceId,ip:r.ipAddr,port:r.serverPort};t.post("monitor.instance.add",n,function(t){this.logDialogInstanceVisible=!1,this.loadTable()})}})}}}),a=o,l=r("2877"),c=Object(l["a"])(a,n,i,!1,null,null,null);e["default"]=c.exports}}]); \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-6a68a33e.b6685cb9.js b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-6a68a33e.b6685cb9.js new file mode 100644 index 00000000..84b89c0e --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-6a68a33e.b6685cb9.js @@ -0,0 +1 @@ +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6a68a33e"],{1248:function(e,t,o){"use strict";o.r(t);var a=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"app-container"},[o("el-container",[o("el-aside",{staticStyle:{"min-height":"300px",width:"250px"}},[o("el-button",{attrs:{type:"primary",plain:"",size:"mini",icon:"el-icon-plus"},on:{click:function(t){return t.stopPropagation(),e.addService(t)}}},[e._v("\n 新建服务\n ")]),e._v(" "),o("el-input",{staticStyle:{"margin-bottom":"10px","margin-top":"10px"},attrs:{"prefix-icon":"el-icon-search",placeholder:"搜索服务...",size:"mini",clearable:""},model:{value:e.filterText,callback:function(t){e.filterText=t},expression:"filterText"}}),e._v(" "),o("el-tree",{ref:"serviceTree",staticClass:"filter-tree",attrs:{data:e.treeData,props:e.defaultProps,"filter-node-method":e.filterNode,"highlight-current":!0,"expand-on-click-node":!1,"empty-text":"无数据","node-key":"serviceId","default-expand-all":""},on:{"node-click":e.onNodeClick},scopedSlots:e._u([{key:"default",fn:function(t){t.node;var a=t.data;return o("span",{staticClass:"custom-tree-node"},[o("div",[o("el-tooltip",{directives:[{name:"show",rawName:"v-show",value:a.custom,expression:"data.custom"}],staticClass:"item",attrs:{content:"自定义服务",effect:"light",placement:"left"}},[o("i",{staticClass:"el-icon-warning-outline"})]),e._v(" "),a.label.length0?t.join(", "):'未授权'},onRouteDialogSave:function(){var e=this;this.$refs.routeDialogFormRef.validate(function(t){if(t){var o=e.routeDialogFormData.id?"route.update":"route.add";e.routeDialogFormData.serviceId=e.serviceId,e.post(o,e.routeDialogFormData,function(){this.routeDialogVisible=!1,this.loadTable()})}})},onAuthDialogSave:function(){this.post("route.role.update",this.authDialogFormData,function(){this.authDialogVisible=!1,this.loadTable()})},addService:function(){this.addServiceDialogVisible=!0},closeAddServiceDlg:function(){this.$refs.addServiceForm.resetFields()},onAddService:function(){var e=this;this.$refs.addServiceForm.validate(function(t){t&&e.post("service.custom.add",e.addServiceForm,function(e){this.addServiceDialogVisible=!1,this.tip("添加成功"),this.loadTree()})})},onDelService:function(e){var t=e.serviceId;this.confirm("确认要删除服务"+t+"吗,【对应的路由配置会一起删除】",function(e){var o={serviceId:t};this.post("service.custom.del",o,function(){e(),this.tip("删除成功"),this.loadTree()})})}}},l=r,s=(o("55a2"),o("2877")),n=Object(s["a"])(l,a,i,!1,null,null,null);t["default"]=n.exports},"55a2":function(e,t,o){"use strict";var a=o("b294"),i=o.n(a);i.a},b294:function(e,t,o){}}]); \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-73b2dcec.14f248eb.js b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-73b2dcec.14f248eb.js new file mode 100644 index 00000000..d4f46ee6 --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-73b2dcec.14f248eb.js @@ -0,0 +1 @@ +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-73b2dcec"],{"29fd":function(e,t,s){},"3bf7":function(e,t,s){"use strict";s.r(t);var a=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"app-container"},[s("el-button",{staticClass:"el-icon-back",attrs:{type:"text"},on:{click:e.onBack}},[e._v("返回")]),e._v(" "),s("el-form",{ref:"isvKeysForm",staticStyle:{width:"700px"},attrs:{rules:e.rulesIsvKeysForm,model:e.isvKeysFormData,"label-width":"160px",size:"mini"}},[s("el-form-item",{attrs:{label:""}},[s("el-alert",{attrs:{title:"带 ★ 的分配给开发者",type:"warning",closable:!1}})],1),e._v(" "),s("el-form-item",{attrs:{label:e.selfLabel("appKey")}},[s("div",[e._v(e._s(e.isvKeysFormData.appKey))])]),e._v(" "),s("el-form-item",{directives:[{name:"show",rawName:"v-show",value:e.showKeys(),expression:"showKeys()"}],attrs:{label:"秘钥格式"}},[s("el-radio-group",{model:{value:e.isvKeysFormData.keyFormat,callback:function(t){e.$set(e.isvKeysFormData,"keyFormat",t)},expression:"isvKeysFormData.keyFormat"}},[s("el-radio",{attrs:{label:1,name:"keyFormat"}},[e._v("PKCS8(JAVA适用)")]),e._v(" "),s("el-radio",{attrs:{label:2,name:"keyFormat"}},[e._v("PKCS1(非JAVA适用)")])],1)],1),e._v(" "),s("el-form-item",{directives:[{name:"show",rawName:"v-show",value:2===e.isvKeysFormData.signType,expression:"isvKeysFormData.signType === 2"}],attrs:{prop:"secret",label:e.selfLabel("secret")}},[s("el-input",{model:{value:e.isvKeysFormData.secret,callback:function(t){e.$set(e.isvKeysFormData,"secret",t)},expression:"isvKeysFormData.secret"}}),e._v(" "),s("el-button",{attrs:{type:"text"},on:{click:e.onGenSecret}},[e._v("重新生成")])],1),e._v(" "),s("fieldset",{directives:[{name:"show",rawName:"v-show",value:e.showKeys(),expression:"showKeys()"}]},[s("legend",[e._v("ISV公私钥")]),e._v(" "),s("el-form-item",{staticClass:"gen-key"},[s("el-button",{attrs:{type:"text"},on:{click:e.onGenKeysIsv}},[e._v("重新生成")])],1),e._v(" "),s("el-form-item",{attrs:{prop:"publicKeyIsv",label:"ISV公钥"}},[s("el-input",{attrs:{type:"textarea"},model:{value:e.isvKeysFormData.publicKeyIsv,callback:function(t){e.$set(e.isvKeysFormData,"publicKeyIsv",t)},expression:"isvKeysFormData.publicKeyIsv"}})],1),e._v(" "),s("el-form-item",{attrs:{prop:"privateKeyIsv",label:e.selfLabel("ISV私钥")}},[s("el-input",{attrs:{type:"textarea"},model:{value:e.isvKeysFormData.privateKeyIsv,callback:function(t){e.$set(e.isvKeysFormData,"privateKeyIsv",t)},expression:"isvKeysFormData.privateKeyIsv"}})],1)],1),e._v(" "),s("fieldset",{directives:[{name:"show",rawName:"v-show",value:e.showKeys(),expression:"showKeys()"}]},[s("legend",[e._v("平台公私钥")]),e._v(" "),s("el-form-item",{staticClass:"gen-key"},[s("el-button",{attrs:{type:"text"},on:{click:e.onGenKeysPlatform}},[e._v("重新生成")])],1),e._v(" "),s("el-form-item",{attrs:{prop:"publicKeyPlatform",label:e.selfLabel("平台公钥")}},[s("el-input",{attrs:{type:"textarea"},model:{value:e.isvKeysFormData.publicKeyPlatform,callback:function(t){e.$set(e.isvKeysFormData,"publicKeyPlatform",t)},expression:"isvKeysFormData.publicKeyPlatform"}})],1),e._v(" "),s("el-form-item",{attrs:{prop:"privateKeyPlatform",label:"平台私钥"}},[s("el-input",{attrs:{type:"textarea"},model:{value:e.isvKeysFormData.privateKeyPlatform,callback:function(t){e.$set(e.isvKeysFormData,"privateKeyPlatform",t)},expression:"isvKeysFormData.privateKeyPlatform"}})],1)],1),e._v(" "),s("el-form-item",[s("el-button",{attrs:{type:"primary"},on:{click:e.onSubmit}},[e._v("保存")]),e._v(" "),s("el-button",{on:{click:e.onBack}},[e._v("取消")])],1)],1)],1)},i=[],r={data:function(){var e=this,t=function(t,s,a){2===e.isvKeysFormData.signType&&(""===s&&a(new Error("不能为空")),s.length>200&&a(new Error("长度不能超过200"))),a()},s=function(t,s,a){1===e.isvKeysFormData.signType&&""===s&&a(new Error("不能为空")),a()};return{isvKeysFormData:{appKey:"",secret:"",keyFormat:1,publicKeyIsv:"",privateKeyIsv:"",publicKeyPlatform:"",privateKeyPlatform:"",signType:1},rulesIsvKeysForm:{secret:[{validator:t,trigger:"blur"}],publicKeyIsv:[{validator:s,trigger:"blur"}],privateKeyIsv:[{validator:s,trigger:"blur"}]}}},created:function(){var e=this.$route.query;this.isvKeysFormData.appKey=e.appKey,this.loadForm()},methods:{loadForm:function(){this.post("isv.keys.get",{appKey:this.isvKeysFormData.appKey},function(e){Object.assign(this.isvKeysFormData,e.data)})},selfLabel:function(e){return"★ "+e},onSubmit:function(){var e=this;this.$refs.isvKeysForm.validate(function(t){t&&e.post("isv.keys.update",e.isvKeysFormData,function(){this.tip("保存成功")})})},onBack:function(){this.$router.push({path:"list"})},onGenKeysPlatform:function(){this.post("isv.keys.gen",{},function(e){this.tip("生成公私钥成功");var t=e.data;this.isvKeysFormData.publicKeyPlatform=t.publicKey,this.isvKeysFormData.privateKeyPlatform=t.privateKey})},onGenKeysIsv:function(){this.post("isv.keys.gen",{keyFormat:this.isvKeysFormData.keyFormat},function(e){this.tip("生成公私钥成功");var t=e.data;this.isvKeysFormData.publicKeyIsv=t.publicKey,this.isvKeysFormData.privateKeyIsv=t.privateKey})},onGenSecret:function(){this.post("isv.secret.gen",{},function(e){this.isvKeysFormData.secret=e.data})},showKeys:function(){return 1===this.isvKeysFormData.signType}}},o=r,l=(s("8b91"),s("2877")),n=Object(l["a"])(o,a,i,!1,null,null,null);t["default"]=n.exports},"8b91":function(e,t,s){"use strict";var a=s("29fd"),i=s.n(a);i.a}}]); \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/test/java/com/gitee/sop/adminserver/CuratorTest.java b/sop-admin/sop-admin-server/src/test/java/com/gitee/sop/adminserver/CuratorTest.java new file mode 100644 index 00000000..7cf5c1ed --- /dev/null +++ b/sop-admin/sop-admin-server/src/test/java/com/gitee/sop/adminserver/CuratorTest.java @@ -0,0 +1,45 @@ +package com.gitee.sop.adminserver; + +import com.gitee.sop.adminserver.bean.SopAdminConstants; +import junit.framework.TestCase; +import org.apache.curator.framework.CuratorFramework; +import org.apache.curator.framework.CuratorFrameworkFactory; +import org.apache.curator.retry.ExponentialBackoffRetry; +import org.apache.zookeeper.data.Stat; + +public class CuratorTest extends TestCase { + + private static String zookeeperServerAddr = "localhost:2181"; + + static CuratorFramework client; + + public CuratorTest() { + client = CuratorFrameworkFactory.builder() + .connectString(zookeeperServerAddr) + .retryPolicy(new ExponentialBackoffRetry(1000, 3)) + .build(); + + client.start(); + } + + /** + * 递归删除节点,只能在测试环境用。 + * + * @throws Exception + */ + public void testDel() { + try { + client.delete() + .deletingChildrenIfNeeded() + .forPath(SopAdminConstants.RELOAD_ROUTE_PERMISSION_PATH); + } catch (Exception e) { + } + } + + public void testCheck() throws Exception { + String path = SopAdminConstants.RELOAD_ROUTE_PERMISSION_PATH + "/1562231019332"; + Stat stat = client.checkExists().forPath(path); + System.out.println(path + (stat == null ? "不存在" : "存在")); + } + +} \ No newline at end of file diff --git a/sop-admin/sop-admin-server/src/test/java/com/gitee/sop/adminserver/IsvInfoMapperTest.java b/sop-admin/sop-admin-server/src/test/java/com/gitee/sop/adminserver/IsvInfoMapperTest.java new file mode 100644 index 00000000..dbff7a83 --- /dev/null +++ b/sop-admin/sop-admin-server/src/test/java/com/gitee/sop/adminserver/IsvInfoMapperTest.java @@ -0,0 +1,21 @@ +package com.gitee.sop.adminserver; + +import com.gitee.sop.adminserver.api.isv.result.IsvDetailDTO; +import com.gitee.sop.adminserver.mapper.IsvInfoMapper; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * @author tanghc + */ +public class IsvInfoMapperTest extends SopAdminServerApplicationTests { + + @Autowired + IsvInfoMapper isvInfoMapper; + + @Test + public void testGet() { + IsvDetailDTO isvDetail = isvInfoMapper.getIsvDetail("2019032617262200001"); + System.out.println(isvDetail); + } +} diff --git a/sop-admin/sop-admin-server/src/test/java/com/gitee/durcframework/easyopen/server/PubPriKeyTest.java b/sop-admin/sop-admin-server/src/test/java/com/gitee/sop/adminserver/PubPriKeyTest.java similarity index 91% rename from sop-admin/sop-admin-server/src/test/java/com/gitee/durcframework/easyopen/server/PubPriKeyTest.java rename to sop-admin/sop-admin-server/src/test/java/com/gitee/sop/adminserver/PubPriKeyTest.java index 7833a8e9..fe54c969 100644 --- a/sop-admin/sop-admin-server/src/test/java/com/gitee/durcframework/easyopen/server/PubPriKeyTest.java +++ b/sop-admin/sop-admin-server/src/test/java/com/gitee/sop/adminserver/PubPriKeyTest.java @@ -1,4 +1,4 @@ -package com.gitee.durcframework.easyopen.server; +package com.gitee.sop.adminserver; import org.junit.Test; diff --git a/sop-admin/sop-admin-server/src/test/java/com/gitee/durcframework/easyopen/server/SignTest.java b/sop-admin/sop-admin-server/src/test/java/com/gitee/sop/adminserver/SignTest.java similarity index 96% rename from sop-admin/sop-admin-server/src/test/java/com/gitee/durcframework/easyopen/server/SignTest.java rename to sop-admin/sop-admin-server/src/test/java/com/gitee/sop/adminserver/SignTest.java index 1162a0cc..234cbd63 100644 --- a/sop-admin/sop-admin-server/src/test/java/com/gitee/durcframework/easyopen/server/SignTest.java +++ b/sop-admin/sop-admin-server/src/test/java/com/gitee/sop/adminserver/SignTest.java @@ -1,4 +1,4 @@ -package com.gitee.durcframework.easyopen.server; +package com.gitee.sop.adminserver; import java.io.IOException; import java.util.HashMap; diff --git a/sop-admin/sop-admin-server/src/test/java/com/gitee/durcframework/easyopen/server/SopAdminServerApplicationTests.java b/sop-admin/sop-admin-server/src/test/java/com/gitee/sop/adminserver/SopAdminServerApplicationTests.java similarity index 86% rename from sop-admin/sop-admin-server/src/test/java/com/gitee/durcframework/easyopen/server/SopAdminServerApplicationTests.java rename to sop-admin/sop-admin-server/src/test/java/com/gitee/sop/adminserver/SopAdminServerApplicationTests.java index def0a054..02573978 100644 --- a/sop-admin/sop-admin-server/src/test/java/com/gitee/durcframework/easyopen/server/SopAdminServerApplicationTests.java +++ b/sop-admin/sop-admin-server/src/test/java/com/gitee/sop/adminserver/SopAdminServerApplicationTests.java @@ -1,4 +1,4 @@ -package com.gitee.durcframework.easyopen.server; +package com.gitee.sop.adminserver; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/sop-admin/sop-admin-vue/src/router/index.js b/sop-admin/sop-admin-vue/src/router/index.js index c99d3982..6ac2aa67 100644 --- a/sop-admin/sop-admin-vue/src/router/index.js +++ b/sop-admin/sop-admin-vue/src/router/index.js @@ -91,6 +91,7 @@ export const constantRoutes = [ { path: '/isv', component: Layout, + name: 'Isv', meta: { title: 'ISV管理', icon: 'user' }, children: [ { @@ -98,6 +99,19 @@ export const constantRoutes = [ name: 'IsvList', component: () => import('@/views/isv/index'), meta: { title: 'ISV列表' } + }, + { + path: 'role', + name: 'Role', + component: () => import('@/views/isv/role'), + meta: { title: '角色管理' } + }, + { + path: 'keys', + name: 'Keys', + component: () => import('@/views/isv/keys'), + hidden: true, + meta: { title: '秘钥管理' } } ] }, diff --git a/sop-admin/sop-admin-vue/src/utils/global.js b/sop-admin/sop-admin-vue/src/utils/global.js index 1d3b1bca..ea6db9ca 100644 --- a/sop-admin/sop-admin-vue/src/utils/global.js +++ b/sop-admin/sop-admin-vue/src/utils/global.js @@ -8,7 +8,7 @@ import { getToken, removeToken } from './auth' // 创建axios实例 const client = axios.create({ baseURL: process.env.VUE_APP_BASE_API, // api 的 base_url - timeout: 5000 // 请求超时时间 + timeout: 60000 // 请求超时时间,60秒 }) Object.assign(Vue.prototype, { @@ -94,6 +94,14 @@ Object.assign(Vue.prototype, { } }).catch(function() {}) }, + /** + * 重置表单 + * @param formName 表单元素的ref + */ + resetForm(formName) { + const frm = this.$refs[formName] + frm && frm.resetFields() + }, logout: function() { removeToken() const fullPath = this.$route.fullPath diff --git a/sop-admin/sop-admin-vue/src/views/isv/index.vue b/sop-admin/sop-admin-vue/src/views/isv/index.vue index 2e719e23..6b732348 100644 --- a/sop-admin/sop-admin-vue/src/views/isv/index.vue +++ b/sop-admin/sop-admin-vue/src/views/isv/index.vue @@ -25,32 +25,13 @@ label="appKey" width="250" /> - - - 查看 - - - 查看 - - - - - RSA2 - MD5 + 查看 修改 + 秘钥管理 @@ -116,26 +97,9 @@ label-width="120px" size="mini" > - - 一键生成数据 - - - - - - - RSA2 - MD5 - - - - - - - - - - + + (系统自动生成) + {{ isvDialogFormData.appKey }} @@ -154,31 +118,71 @@ 保 存 + + + + + + + + {{ isvKeysFormData.appKey }} + + + PKCS8(JAVA适用) + PKCS1(非JAVA适用) + + + {{ isvKeysFormData.secret }} + + + ISV公私钥 + + + + + + + + + 平台公私钥 + + + + + + + + + + 关 闭 + + - + diff --git a/sop-admin/sop-admin-vue/src/views/isv/role.vue b/sop-admin/sop-admin-vue/src/views/isv/role.vue new file mode 100644 index 00000000..74507d04 --- /dev/null +++ b/sop-admin/sop-admin-vue/src/views/isv/role.vue @@ -0,0 +1,179 @@ + + + + + + + + 查询 + + + 新增角色 + + + + + + + + 修改 + 删除 + + + + + + + + + + {{ roleDialogFormData.roleCode }} + + + + + + + + + + + diff --git a/sop-admin/sop-admin-vue/src/views/service/limit/index.vue b/sop-admin/sop-admin-vue/src/views/service/limit/index.vue index ac9e0fbe..1e6ada92 100644 --- a/sop-admin/sop-admin-vue/src/views/service/limit/index.vue +++ b/sop-admin/sop-admin-vue/src/views/service/limit/index.vue @@ -211,7 +211,7 @@ export default { methods: { // 加载树 loadTree: function() { - this.post('service.list', {}, function(resp) { + this.post('zookeeper.service.list', {}, function(resp) { const respData = resp.data this.treeData = this.convertToTreeData(respData, 0) }) diff --git a/sop-admin/sop-admin-vue/src/views/service/limit/index2.vue b/sop-admin/sop-admin-vue/src/views/service/limit/index2.vue index 96ef8bbb..1424c84f 100644 --- a/sop-admin/sop-admin-vue/src/views/service/limit/index2.vue +++ b/sop-admin/sop-admin-vue/src/views/service/limit/index2.vue @@ -1,7 +1,7 @@ - + - {{ data.label }} - - - {{ data.label.substring(0, 15) + '...' }} + + + + {{ data.label }} + + + {{ data.label.substring(0, serviceTextLimitSize) + '...' }} + + + + + onDelService(data)"/> @@ -217,11 +231,23 @@ - + - + + +