mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
4.0.3
This commit is contained in:
@@ -1,54 +0,0 @@
|
|||||||
package com.gitee.sop.gateway.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;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 表名:config_route_limit
|
|
||||||
* 备注:路由限流配置
|
|
||||||
*
|
|
||||||
* @author tanghc
|
|
||||||
*/
|
|
||||||
@Table(name = "config_route_limit")
|
|
||||||
@Data
|
|
||||||
public class ConfigRouteLimit {
|
|
||||||
@Id
|
|
||||||
@Column(name = "id")
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
/** 数据库字段:id */
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/** 路由id, 数据库字段:route_id */
|
|
||||||
private String routeId;
|
|
||||||
|
|
||||||
/** 限流策略,1:窗口策略,2:令牌桶策略, 数据库字段:limit_type */
|
|
||||||
private Byte limitType;
|
|
||||||
|
|
||||||
/** 每秒可处理请求数, 数据库字段:exec_count_per_second */
|
|
||||||
private Integer execCountPerSecond;
|
|
||||||
|
|
||||||
/** 返回的错误码, 数据库字段:limit_code */
|
|
||||||
private String limitCode;
|
|
||||||
|
|
||||||
/** 返回的错误信息, 数据库字段:limit_msg */
|
|
||||||
private String limitMsg;
|
|
||||||
|
|
||||||
/** 令牌桶容量, 数据库字段:token_bucket_count */
|
|
||||||
private Integer tokenBucketCount;
|
|
||||||
|
|
||||||
/** 1:开启,0关闭, 数据库字段:limit_status */
|
|
||||||
private Byte limitStatus;
|
|
||||||
|
|
||||||
/** 数据库字段:gmt_create */
|
|
||||||
private Date gmtCreate;
|
|
||||||
|
|
||||||
/** 数据库字段:gmt_modified */
|
|
||||||
private Date gmtModified;
|
|
||||||
}
|
|
@@ -1,6 +1,5 @@
|
|||||||
package com.gitee.sop.gateway.manager;
|
package com.gitee.sop.gateway.manager;
|
||||||
|
|
||||||
import com.gitee.sop.gateway.mapper.ConfigRouteLimitMapper;
|
|
||||||
import com.gitee.sop.gateway.mapper.ConfigRouteMapper;
|
import com.gitee.sop.gateway.mapper.ConfigRouteMapper;
|
||||||
import com.gitee.sop.gatewaycommon.bean.ChannelMsg;
|
import com.gitee.sop.gatewaycommon.bean.ChannelMsg;
|
||||||
import com.gitee.sop.gatewaycommon.bean.RouteConfig;
|
import com.gitee.sop.gatewaycommon.bean.RouteConfig;
|
||||||
@@ -21,13 +20,10 @@ import java.util.List;
|
|||||||
public class DbRouteConfigManager extends DefaultRouteConfigManager {
|
public class DbRouteConfigManager extends DefaultRouteConfigManager {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
ConfigRouteLimitMapper configRouteLimitMapper;
|
private ConfigRouteMapper configRouteMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
ConfigRouteMapper configRouteMapper;
|
private Environment environment;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
Environment environment;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(String serviceId) {
|
public void load(String serviceId) {
|
||||||
|
@@ -1,11 +0,0 @@
|
|||||||
package com.gitee.sop.gateway.mapper;
|
|
||||||
|
|
||||||
import com.gitee.fastmybatis.core.mapper.CrudMapper;
|
|
||||||
import com.gitee.sop.gateway.entity.ConfigRouteLimit;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author tanghc
|
|
||||||
*/
|
|
||||||
public interface ConfigRouteLimitMapper extends CrudMapper<ConfigRouteLimit, Integer> {
|
|
||||||
}
|
|
@@ -9,7 +9,6 @@ DROP TABLE IF EXISTS `perm_role`;
|
|||||||
DROP TABLE IF EXISTS `perm_isv_role`;
|
DROP TABLE IF EXISTS `perm_isv_role`;
|
||||||
DROP TABLE IF EXISTS `isv_keys`;
|
DROP TABLE IF EXISTS `isv_keys`;
|
||||||
DROP TABLE IF EXISTS `isv_info`;
|
DROP TABLE IF EXISTS `isv_info`;
|
||||||
DROP TABLE IF EXISTS `config_route_limit`;
|
|
||||||
DROP TABLE IF EXISTS `config_route_base`;
|
DROP TABLE IF EXISTS `config_route_base`;
|
||||||
DROP TABLE IF EXISTS `config_limit`;
|
DROP TABLE IF EXISTS `config_limit`;
|
||||||
DROP TABLE IF EXISTS `config_ip_blacklist`;
|
DROP TABLE IF EXISTS `config_ip_blacklist`;
|
||||||
@@ -113,22 +112,6 @@ CREATE TABLE `config_route_base` (
|
|||||||
) ENGINE=INNODB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='路由配置表';
|
) ENGINE=INNODB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='路由配置表';
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE `config_route_limit` (
|
|
||||||
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
||||||
`route_id` VARCHAR(64) NOT NULL COMMENT '路由id',
|
|
||||||
`service_id` VARCHAR(64) NOT NULL DEFAULT '',
|
|
||||||
`limit_type` TINYINT(4) NOT NULL DEFAULT '1' COMMENT '限流策略,1:窗口策略,2:令牌桶策略',
|
|
||||||
`exec_count_per_second` INT(11) DEFAULT NULL COMMENT '每秒可处理请求数',
|
|
||||||
`limit_code` VARCHAR(64) DEFAULT NULL COMMENT '返回的错误码',
|
|
||||||
`limit_msg` VARCHAR(100) DEFAULT NULL COMMENT '返回的错误信息',
|
|
||||||
`token_bucket_count` INT(11) DEFAULT NULL COMMENT '令牌桶容量',
|
|
||||||
`limit_status` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '限流开启状态,1:开启,0关闭',
|
|
||||||
`gmt_create` DATETIME DEFAULT NULL,
|
|
||||||
`gmt_modified` DATETIME DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
UNIQUE KEY `uk_routeid` (`route_id`) USING BTREE
|
|
||||||
) ENGINE=INNODB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='路由限流配置';
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE `isv_info` (
|
CREATE TABLE `isv_info` (
|
||||||
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
@@ -241,13 +224,6 @@ INSERT INTO `config_route_base` (`id`, `route_id`, `status`, `gmt_create`, `gmt_
|
|||||||
(8,'goods.add1.0',1,'2019-05-13 17:23:00','2019-05-13 17:23:11');
|
(8,'goods.add1.0',1,'2019-05-13 17:23:00','2019-05-13 17:23:11');
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `config_route_limit` (`id`, `route_id`, `service_id`, `limit_type`, `exec_count_per_second`, `limit_code`, `limit_msg`, `token_bucket_count`, `limit_status`, `gmt_create`, `gmt_modified`) VALUES
|
|
||||||
(1,'alipay.story.find1.0','story-service',1,10,'isp.service-busy','服务器正忙',NULL,1,'2019-04-10 20:55:08','2019-04-10 21:04:35'),
|
|
||||||
(2,'alipay.story.get1.0','story-service',2,5,'isp.service-busy','服务器正忙',5,0,'2019-04-10 21:05:51','2019-04-11 18:18:03'),
|
|
||||||
(3,'alipay.story.get1.2','story-service',2,10,'isp.service-busy','服务器正忙',3,1,'2019-04-11 17:26:04','2019-04-11 18:19:33'),
|
|
||||||
(4,'alipay.category.get1.0','story-service',1,5,'error-code','服务器忙',5,1,'2019-05-07 12:22:04','2019-05-07 12:25:06');
|
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `isv_info` (`id`, `app_key`, `status`, `sign_type`, `remark`, `gmt_create`, `gmt_modified`) VALUES
|
INSERT INTO `isv_info` (`id`, `app_key`, `status`, `sign_type`, `remark`, `gmt_create`, `gmt_modified`) VALUES
|
||||||
(1,'2019032617262200001',1,1,NULL,'2019-03-27 10:10:34','2019-05-09 11:10:38'),
|
(1,'2019032617262200001',1,1,NULL,'2019-03-27 10:10:34','2019-05-09 11:10:38'),
|
||||||
(3,'asdfasdf',2,1,NULL,'2019-03-27 11:01:11','2019-05-11 10:45:01'),
|
(3,'asdfasdf',2,1,NULL,'2019-03-27 11:01:11','2019-05-11 10:45:01'),
|
||||||
|
25
sop.sql
25
sop.sql
@@ -12,7 +12,6 @@ DROP TABLE IF EXISTS `perm_isv_role`;
|
|||||||
DROP TABLE IF EXISTS `isv_keys`;
|
DROP TABLE IF EXISTS `isv_keys`;
|
||||||
DROP TABLE IF EXISTS `isv_info`;
|
DROP TABLE IF EXISTS `isv_info`;
|
||||||
DROP TABLE IF EXISTS `config_service_route`;
|
DROP TABLE IF EXISTS `config_service_route`;
|
||||||
DROP TABLE IF EXISTS `config_route_limit`;
|
|
||||||
DROP TABLE IF EXISTS `config_route_base`;
|
DROP TABLE IF EXISTS `config_route_base`;
|
||||||
DROP TABLE IF EXISTS `config_limit`;
|
DROP TABLE IF EXISTS `config_limit`;
|
||||||
DROP TABLE IF EXISTS `config_ip_blacklist`;
|
DROP TABLE IF EXISTS `config_ip_blacklist`;
|
||||||
@@ -115,23 +114,6 @@ CREATE TABLE `config_route_base` (
|
|||||||
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='路由配置表';
|
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='路由配置表';
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE `config_route_limit` (
|
|
||||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
|
||||||
`route_id` varchar(64) NOT NULL COMMENT '路由id',
|
|
||||||
`service_id` varchar(64) NOT NULL DEFAULT '',
|
|
||||||
`limit_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '限流策略,1:窗口策略,2:令牌桶策略',
|
|
||||||
`exec_count_per_second` int(11) DEFAULT NULL COMMENT '每秒可处理请求数',
|
|
||||||
`limit_code` varchar(64) DEFAULT NULL COMMENT '返回的错误码',
|
|
||||||
`limit_msg` varchar(100) DEFAULT NULL COMMENT '返回的错误信息',
|
|
||||||
`token_bucket_count` int(11) DEFAULT NULL COMMENT '令牌桶容量',
|
|
||||||
`limit_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '限流开启状态,1:开启,0关闭',
|
|
||||||
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
UNIQUE KEY `uk_routeid` (`route_id`) USING BTREE
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='路由限流配置';
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE `config_service_route` (
|
CREATE TABLE `config_service_route` (
|
||||||
`id` varchar(128) NOT NULL DEFAULT '' COMMENT '路由id',
|
`id` varchar(128) NOT NULL DEFAULT '' COMMENT '路由id',
|
||||||
`service_id` varchar(128) NOT NULL DEFAULT '',
|
`service_id` varchar(128) NOT NULL DEFAULT '',
|
||||||
@@ -244,13 +226,6 @@ INSERT INTO `config_route_base` (`id`, `route_id`, `status`, `gmt_create`, `gmt_
|
|||||||
(8,'goods.add1.0',1,'2019-05-13 17:23:00','2019-05-13 17:23:11');
|
(8,'goods.add1.0',1,'2019-05-13 17:23:00','2019-05-13 17:23:11');
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `config_route_limit` (`id`, `route_id`, `service_id`, `limit_type`, `exec_count_per_second`, `limit_code`, `limit_msg`, `token_bucket_count`, `limit_status`, `gmt_create`, `gmt_modified`) VALUES
|
|
||||||
(1,'alipay.story.find1.0','story-service',1,10,'isp.service-busy','服务器正忙',NULL,1,'2019-04-10 20:55:08','2019-04-10 21:04:35'),
|
|
||||||
(2,'alipay.story.get1.0','story-service',2,5,'isp.service-busy','服务器正忙',5,0,'2019-04-10 21:05:51','2019-04-11 18:18:03'),
|
|
||||||
(3,'alipay.story.get1.2','story-service',2,10,'isp.service-busy','服务器正忙',3,1,'2019-04-11 17:26:04','2019-04-11 18:19:33'),
|
|
||||||
(4,'alipay.category.get1.0','story-service',1,5,'error-code','服务器忙',5,1,'2019-05-07 12:22:04','2019-05-07 12:25:06');
|
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `isv_info` (`id`, `app_key`, `status`, `sign_type`, `remark`, `gmt_create`, `gmt_modified`) VALUES
|
INSERT INTO `isv_info` (`id`, `app_key`, `status`, `sign_type`, `remark`, `gmt_create`, `gmt_modified`) VALUES
|
||||||
(1,'2019032617262200001',1,1,NULL,'2019-03-27 10:10:34','2019-05-09 11:10:38'),
|
(1,'2019032617262200001',1,1,NULL,'2019-03-27 10:10:34','2019-05-09 11:10:38'),
|
||||||
(3,'asdfasdf',2,1,NULL,'2019-03-27 11:01:11','2019-05-11 10:45:01'),
|
(3,'asdfasdf',2,1,NULL,'2019-03-27 11:01:11','2019-05-11 10:45:01'),
|
||||||
|
Reference in New Issue
Block a user