提交 3027277c 编写于 作者: zlt2000's avatar zlt2000

v1.0.1 修复token失效时间无效问题,修复导出问题,优化log查询,优化sentinel配置

上级 ba441726
# microservices-platform
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)<a href='https://gitee.com/zlt2000/microservices-platform'><img src='https://gitee.com/zlt2000/microservices-platform/widgets/widget_4.svg' alt='Fork me on Gitee'></img></a><a href='https://gitee.com/zlt2000/microservices-platform/stargazers'><img src='https://gitee.com/zlt2000/microservices-platform/badge/star.svg?theme=dark' alt='star'></img></a>
## 如果您觉得有帮助,请点右上角 "Star" 支持一下谢谢
......
......@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.zlt</groupId>
<artifactId>central-platform</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<packaging>pom</packaging>
<properties>
......@@ -31,7 +31,7 @@
<mybatis-plus-boot-starter.version>3.0.6</mybatis-plus-boot-starter.version>
<aliyun-sdk-oss>3.4.0</aliyun-sdk-oss>
<qiniu-java-sdk>7.2.17</qiniu-java-sdk>
<easypoi.version>3.0.3</easypoi.version>
<easypoi.version>4.0.0</easypoi.version>
<spring-boot-admin.version>2.0.4</spring-boot-admin.version>
<velocity.version>1.7</velocity.version>
<commons-configuration.version>1.10</commons-configuration.version>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-business</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>code-generator</artifactId>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-business</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>file-center</artifactId>
<description>文件中心</description>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>central-platform</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>zlt-business</artifactId>
<description>业务中心</description>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-business</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>user-center</artifactId>
<description>用户中心</description>
......
......@@ -229,11 +229,11 @@ public class SysUserController {
*
* @return
*/
@GetMapping("/users/export")
@PostMapping("/users/export")
public void exportUser(@RequestParam Map<String, Object> params, HttpServletResponse response) throws IOException {
List<SysUserExcel> result = appUserService.findAllUsers(params);
//导出操作
ExcelUtil.exportExcel(result, null, "用户", SysUserExcel.class, "test", response);
ExcelUtil.exportExcel(result, null, "用户", SysUserExcel.class, "user", response);
}
@PostMapping(value = "/users/import")
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>central-platform</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>zlt-commons</artifactId>
<description>通用组件</description>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-commons</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-commons</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>zlt-common-spring-boot-starter</artifactId>
<description>公共通用组件</description>
......
......@@ -3,6 +3,7 @@ package com.central.common.config;
import com.central.common.feign.UserService;
import com.central.common.resolver.TokenArgumentResolver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
......@@ -15,6 +16,7 @@ import java.util.List;
* @date 2018/8/25
*/
public class LoginArgResolverConfig implements WebMvcConfigurer {
@Lazy
@Autowired
private UserService userService;
/**
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-commons</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-commons</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
......
......@@ -2,7 +2,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-commons</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>zlt-mq-spring-boot-starter</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-commons</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-commons</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-commons</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-commons</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>central-platform</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
......
########################## 统一变量配置 ##########################
##### nacos配置
zlt.nacos.server-addr=120.78.94.191:8848
##### 数据库配置
zlt.datasource.ip=120.78.94.191
zlt.datasource.username=root
zlt.datasource.password=1q2w3e4r
##### redis配置
zlt.redis.host=120.78.94.191
zlt.redis.port=6379
zlt.redis.timeout=5000
##### elasticsearch配置
zlt.elasticsearch.cluster-name=my-es
zlt.elasticsearch.cluster-nodes=120.78.94.191:9300
##### sentinel配置
zlt.sentinel.dashboard=120.78.94.191:6999
\ No newline at end of file
########################## 通用配置 ##########################
# 默认开发环境
spring.profiles.active=dev
spring.profiles.active=test2
##### spring-boot-actuator配置
management.endpoints.web.exposure.include=*
......@@ -43,24 +43,6 @@ feign.compression.response.enabled=true
##### sentinel配置
spring.cloud.sentinel.transport.dashboard=${zlt.sentinel.dashboard}
spring.cloud.sentinel.eager=true
### 动态配置规则
# 系统负载保护
spring.cloud.sentinel.datasource.ds1.nacos.server-addr=${zlt.nacos.server-addr}
spring.cloud.sentinel.datasource.ds1.nacos.dataId=sentinel-system
spring.cloud.sentinel.datasource.ds1.nacos.groupId=DEFAULT_GROUP
spring.cloud.sentinel.datasource.ds1.nacos.rule-type=system
# 限流
spring.cloud.sentinel.datasource.ds2.nacos.server-addr=${zlt.nacos.server-addr}
spring.cloud.sentinel.datasource.ds2.nacos.dataId=sentinel-flow
spring.cloud.sentinel.datasource.ds2.nacos.groupId=DEFAULT_GROUP
spring.cloud.sentinel.datasource.ds2.nacos.data-type=json
spring.cloud.sentinel.datasource.ds2.nacos.rule-type=flow
# 熔断
spring.cloud.sentinel.datasource.ds3.nacos.server-addr=${zlt.nacos.server-addr}
spring.cloud.sentinel.datasource.ds3.nacos.dataId=sentinel-degraderule
spring.cloud.sentinel.datasource.ds3.nacos.groupId=DEFAULT_GROUP
spring.cloud.sentinel.datasource.ds3.nacos.data-type=json
spring.cloud.sentinel.datasource.ds3.nacos.rule-type=degrade
##### druid配置
......
......@@ -27,7 +27,7 @@ CREATE TABLE `oauth_client_details` (
-- ----------------------------
-- Records of oauth_client_details
-- ----------------------------
INSERT INTO `oauth_client_details` VALUES (1, 'app', NULL, '$2a$10$i3F515wEDiB4Gvj9ym9Prui0dasRttEUQ9ink4Wpgb4zEDCAlV8zO', 'app', 'app', 'password,refresh_token', NULL, NULL, 180000, NULL, '{}', 'true', NULL, NULL);
INSERT INTO `oauth_client_details` VALUES (2, 'mobile', 'mobile,test', '$2a$10$ULxRssv/4NWOc388lZFbyus3IFfsbcpG/BZOq4TRxDhsx5HHIR7Jm', 'mobile', 'all', 'password,refresh_token', NULL, NULL, 180000, NULL, '{}', 'true', NULL, NULL);
INSERT INTO `oauth_client_details` VALUES (4, 'webApp', NULL, '$2a$10$06msMGYRH8nrm4iVnKFNKOoddB8wOwymVhbUzw/d3ZixD7Nq8ot72', 'webApp', 'app', 'authorization_code,password,refresh_token,client_credentials', NULL, NULL, 180000, NULL, '{}', 'true', NULL, NULL);
INSERT INTO `oauth_client_details` VALUES (11, 'zlt', NULL, '$2a$10$/o.wuORzVcXaezmYVzwYMuoY7qeWXBALwQmkskXD/7C6rqfCyPrna', 'zlt', 'all', 'authorization_code,password,refresh_token,client_credentials', 'http://127.0.0.1:8080/singleLogin', NULL, 18000, 18000, '{}', 'true', '2018-12-27 00:50:30', '2018-12-27 00:50:30');
\ No newline at end of file
INSERT INTO `oauth_client_details` VALUES (1, 'app', NULL, '$2a$10$i3F515wEDiB4Gvj9ym9Prui0dasRttEUQ9ink4Wpgb4zEDCAlV8zO', 'app', 'app', 'password,refresh_token', NULL, NULL, 18000, NULL, '{}', 'true', NULL, NULL);
INSERT INTO `oauth_client_details` VALUES (2, 'mobile', 'mobile,test', '$2a$10$ULxRssv/4NWOc388lZFbyus3IFfsbcpG/BZOq4TRxDhsx5HHIR7Jm', 'mobile', 'all', 'password,refresh_token', NULL, NULL, 18000, NULL, '{}', 'true', NULL, NULL);
INSERT INTO `oauth_client_details` VALUES (4, 'webApp', NULL, '$2a$10$06msMGYRH8nrm4iVnKFNKOoddB8wOwymVhbUzw/d3ZixD7Nq8ot72', 'webApp', 'app', 'authorization_code,password,refresh_token,client_credentials', NULL, NULL, 18000, NULL, '{}', 'true', NULL, NULL);
INSERT INTO `oauth_client_details` VALUES (11, 'zlt', NULL, '$2a$10$/o.wuORzVcXaezmYVzwYMuoY7qeWXBALwQmkskXD/7C6rqfCyPrna', 'zlt', 'all', 'authorization_code,password,refresh_token,client_credentials', 'http://127.0.0.1:8080/singleLogin', NULL, 18000, 28800, '{}', 'true', '2018-12-27 00:50:30', '2018-12-27 00:50:30');
\ No newline at end of file
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>central-platform</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>zlt-gateway</artifactId>
<packaging>pom</packaging>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-gateway</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>sc-gateway</artifactId>
<description>spring cloud gateway网关</description>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-gateway</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>zuul-gateway</artifactId>
<description>zuul网关</description>
......
......@@ -3,6 +3,7 @@ package com.central.gateway.config;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
......@@ -41,7 +42,7 @@ public class CorsConfigration {
registration.setFilter(corsFilter());
registration.addUrlPatterns("/*");
registration.setName("corsFilter");
registration.setOrder(Integer.MIN_VALUE);
registration.setOrder(Ordered.HIGHEST_PRECEDENCE);
return registration;
}
}
......@@ -4,6 +4,32 @@ spring:
port: ${zlt.redis.port}
timeout: ${zlt.redis.timeout}
# sentinel动态配置规则
cloud:
sentinel:
datasource:
# 限流
ds1:
nacos:
server-addr: ${zlt.nacos.server-addr}
dataId: sentinel-flow
groupId: DEFAULT_GROUP
rule-type: flow
# 熔断
ds2:
nacos:
server-addr: ${zlt.nacos.server-addr}
dataId: sentinel-degrade
groupId: DEFAULT_GROUP
rule-type: degrade
# 系统负载保护
ds4:
nacos:
server-addr: ${zlt.nacos.server-addr}
dataId: sentinel-system
groupId: DEFAULT_GROUP
rule-type: system
zlt:
oauth2:
token:
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-job</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>job-admin</artifactId>
<packaging>jar</packaging>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-job</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>job-core</artifactId>
<packaging>jar</packaging>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-job</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>job-executor-sample</artifactId>
<packaging>jar</packaging>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>central-platform</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>zlt-job</artifactId>
<packaging>pom</packaging>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-monitor</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>log-center</artifactId>
<dependencies>
......
......@@ -3,7 +3,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>central-platform</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>zlt-monitor</artifactId>
<packaging>pom</packaging>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-monitor</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>sc-admin</artifactId>
......
......@@ -3,7 +3,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>central-platform</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>zlt-search</artifactId>
<packaging>pom</packaging>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>central-platform</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>zlt-uaa</artifactId>
<description>认证中心</description>
......
package com.central.oauth.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.central.common.model.SuperEntity;
import lombok.Data;
......@@ -21,8 +22,10 @@ public class Client extends SuperEntity {
private String authorizedGrantTypes = "authorization_code,password,refresh_token,client_credentials";
private String webServerRedirectUri;
private String authorities = "";
private Integer accessTokenValidity = 18000;
private Integer refreshTokenValidity = 28800;
@TableField(value = "access_token_validity")
private Integer accessTokenValiditySeconds = 18000;
@TableField(value = "refresh_token_validity")
private Integer refreshTokenValiditySeconds = 28800;
private String additionalInformation = "{}";
private String autoapprove = "true";
}
......@@ -6,7 +6,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-web</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>back-web</artifactId>
<description>后台管理前端</description>
......
......@@ -59,11 +59,11 @@
<script type="text/javascript" src="assets/libs/pandyle.min.js"></script>
<script type="text/javascript" src="assets/libs/layui/layui.js"></script>
<script type="text/javascript" src="assets/libs/zTree/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=d6240AoITIcflQ6w1a3ZsUcIkeH1SLDg"></script>
<!--<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=d6240AoITIcflQ6w1a3ZsUcIkeH1SLDg"></script>
<script type="text/javascript" src="http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.js"></script>
<script type="text/javascript" src="assets/libs/baidu-map/TextIconOverlay.js"></script>
<script type="text/javascript" src="assets/libs/baidu-map/MarkerClusterer.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js"></script>-->
<script>
layui.config({
......
<div class="layui-card">
<div class="layui-card-header">
<h2 class="header-title">Token管理</h2>
<span class="layui-breadcrumb pull-right">
<a href="#!home_console">首页</a>
<a><cite>Token管理</cite></a>
</span>
</div>
<div class="layui-card-body">
<!-- 数据表格 -->
<table class="layui-table" id="token-table" lay-filter="token-table"></table>
</div>
</div>
<!-- 表格操作列 -->
<script type="text/html" id="token-table-bar">
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script>
layui.use(['form', 'table', 'util', 'config', 'admin'],function () {
var form = layui.form;
var table = layui.table;
var config = layui.config;
var layer = layui.layer;
var util = layui.util;
var admin = layui.admin;
// 渲染表格
table.render({
elem: '#token-table',
url: config.base_server + 'api-uaa/oauth/token/list',
method: 'POST',
where: {
access_token: config.getToken().access_token
},
page: true,
cols: [[
{type: 'numbers'},
{field: 'user_id',width:80, sort: true, title: '用户编号'},
{field: 'user_name', sort: true, title: '用户名称'},
{field: 'client_id', sort: true, title: '应用ID'},
{field: 'token_type', sort: true, title: '类型'},
{field: 'token_value', sort: true, title: 'token'},
{field: 'grant_type' , sort: true, title: '授权方式'},
{
field: 'user_head_imgurl', width: 250, align: 'center', templet: function (d) {
return '<img src="'+d.user_head_imgurl+'" class="layui-badge layui-bg-gray"></img>';
}, title: '用户头像'
},
{align: 'center', width:80, toolbar: '#token-table-bar', title: '操作'}
]]
});
// 工具条点击事件
table.on('tool(token-table)', function (obj) {
var data = obj.data;
var layEvent = obj.event;
if (layEvent === 'del') { // 删除
doDelete(obj);
}
});
// 删除
var doDelete = function (obj) {
layer.confirm('确定要删除吗?', function (i) {
layer.close(i);
layer.load(2);
admin.req('api-uaa/oauth/remove/token?access_token=' + obj.data.token_value, {}, function (data) {
layer.closeAll('loading');
layer.msg('成功', {icon: 1, time: 500});
obj.del();
}, 'POST');
});
};
});
</script>
\ No newline at end of file
......@@ -157,9 +157,18 @@
xhr.setRequestHeader("client_type", "DESKTOP_WEB");
xhr.onload = function() {
if (this.status == 200) {
var fileName = "user.xls";
var blob = this.response;
var objecturl = URL.createObjectURL(blob);
window.location.href = objecturl;
var a = document.createElement('a');
a.innerHTML = fileName;
// 指定生成的文件名
a.download = fileName;
a.href = URL.createObjectURL(blob);
document.body.appendChild(a);
var evt = document.createEvent("MouseEvents");
evt.initEvent("click", false, false);
a.dispatchEvent(evt);
document.body.removeChild(a);
}
}
xhr.send();
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>central-platform</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>zlt-web</artifactId>
<description>前端</description>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册