diff --git a/README.md b/README.md index eb100688..b22a1c91 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 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)Fork me on Giteestar ## 如果您觉得有帮助,请点右上角 "Star" 支持一下谢谢 diff --git a/pom.xml b/pom.xml index 0279a0f8..fbb0027a 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.zlt central-platform - 1.0.0 + 1.0.1 pom @@ -31,7 +31,7 @@ 3.0.6 3.4.0 7.2.17 - 3.0.3 + 4.0.0 2.0.4 1.7 1.10 diff --git a/zlt-business/code-generator/pom.xml b/zlt-business/code-generator/pom.xml index 382b71e6..5bd6df96 100644 --- a/zlt-business/code-generator/pom.xml +++ b/zlt-business/code-generator/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-business - 1.0.0 + 1.0.1 code-generator diff --git a/zlt-business/file-center/pom.xml b/zlt-business/file-center/pom.xml index ec048440..f96245ea 100644 --- a/zlt-business/file-center/pom.xml +++ b/zlt-business/file-center/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-business - 1.0.0 + 1.0.1 file-center 文件中心 diff --git a/zlt-business/pom.xml b/zlt-business/pom.xml index 88c72d1f..2aa43c6f 100644 --- a/zlt-business/pom.xml +++ b/zlt-business/pom.xml @@ -4,7 +4,7 @@ com.zlt central-platform - 1.0.0 + 1.0.1 zlt-business 业务中心 diff --git a/zlt-business/user-center/pom.xml b/zlt-business/user-center/pom.xml index 97e61cd9..fd7d7902 100644 --- a/zlt-business/user-center/pom.xml +++ b/zlt-business/user-center/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-business - 1.0.0 + 1.0.1 user-center 用户中心 diff --git a/zlt-business/user-center/src/main/java/com/central/user/controller/SysUserController.java b/zlt-business/user-center/src/main/java/com/central/user/controller/SysUserController.java index c89763f5..9e2d05c2 100644 --- a/zlt-business/user-center/src/main/java/com/central/user/controller/SysUserController.java +++ b/zlt-business/user-center/src/main/java/com/central/user/controller/SysUserController.java @@ -229,11 +229,11 @@ public class SysUserController { * * @return */ - @GetMapping("/users/export") + @PostMapping("/users/export") public void exportUser(@RequestParam Map params, HttpServletResponse response) throws IOException { List result = appUserService.findAllUsers(params); //导出操作 - ExcelUtil.exportExcel(result, null, "用户", SysUserExcel.class, "test", response); + ExcelUtil.exportExcel(result, null, "用户", SysUserExcel.class, "user", response); } @PostMapping(value = "/users/import") diff --git a/zlt-commons/pom.xml b/zlt-commons/pom.xml index b1deaf1f..076283a2 100644 --- a/zlt-commons/pom.xml +++ b/zlt-commons/pom.xml @@ -4,7 +4,7 @@ com.zlt central-platform - 1.0.0 + 1.0.1 zlt-commons 通用组件 diff --git a/zlt-commons/zlt-auth-client-spring-boot-starter/pom.xml b/zlt-commons/zlt-auth-client-spring-boot-starter/pom.xml index 8e11db66..d7808a3a 100644 --- a/zlt-commons/zlt-auth-client-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-auth-client-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ com.zlt zlt-commons - 1.0.0 + 1.0.1 4.0.0 jar diff --git a/zlt-commons/zlt-common-spring-boot-starter/pom.xml b/zlt-commons/zlt-common-spring-boot-starter/pom.xml index 6aa8e3a2..7122669b 100644 --- a/zlt-commons/zlt-common-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-common-spring-boot-starter/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-commons - 1.0.0 + 1.0.1 zlt-common-spring-boot-starter 公共通用组件 diff --git a/zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/config/LoginArgResolverConfig.java b/zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/config/LoginArgResolverConfig.java index fdf4d21a..79251172 100644 --- a/zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/config/LoginArgResolverConfig.java +++ b/zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/config/LoginArgResolverConfig.java @@ -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; /** diff --git a/zlt-commons/zlt-db-spring-boot-starter/pom.xml b/zlt-commons/zlt-db-spring-boot-starter/pom.xml index 5f6043e7..378a7fcf 100644 --- a/zlt-commons/zlt-db-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-db-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ com.zlt zlt-commons - 1.0.0 + 1.0.1 4.0.0 jar diff --git a/zlt-commons/zlt-log-spring-boot-starter/pom.xml b/zlt-commons/zlt-log-spring-boot-starter/pom.xml index c0f9859a..18c93a4e 100644 --- a/zlt-commons/zlt-log-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-log-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ com.zlt zlt-commons - 1.0.0 + 1.0.1 4.0.0 jar diff --git a/zlt-commons/zlt-mq-spring-boot-starter/pom.xml b/zlt-commons/zlt-mq-spring-boot-starter/pom.xml index 66964923..8521e145 100644 --- a/zlt-commons/zlt-mq-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-mq-spring-boot-starter/pom.xml @@ -2,7 +2,7 @@ com.zlt zlt-commons - 1.0.0 + 1.0.1 4.0.0 zlt-mq-spring-boot-starter diff --git a/zlt-commons/zlt-redis-spring-boot-starter/pom.xml b/zlt-commons/zlt-redis-spring-boot-starter/pom.xml index fcd19da8..d2bae5ea 100644 --- a/zlt-commons/zlt-redis-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-redis-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ com.zlt zlt-commons - 1.0.0 + 1.0.1 4.0.0 jar diff --git a/zlt-commons/zlt-ribbon-spring-boot-starter/pom.xml b/zlt-commons/zlt-ribbon-spring-boot-starter/pom.xml index 4d6a8369..5ece5c79 100644 --- a/zlt-commons/zlt-ribbon-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-ribbon-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ com.zlt zlt-commons - 1.0.0 + 1.0.1 4.0.0 jar diff --git a/zlt-commons/zlt-sentinel-spring-boot-starter/pom.xml b/zlt-commons/zlt-sentinel-spring-boot-starter/pom.xml index 68c3c57e..eeecca8b 100644 --- a/zlt-commons/zlt-sentinel-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-sentinel-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ com.zlt zlt-commons - 1.0.0 + 1.0.1 4.0.0 jar diff --git a/zlt-commons/zlt-swagger2-spring-boot-starter/pom.xml b/zlt-commons/zlt-swagger2-spring-boot-starter/pom.xml index 7b942391..d69b43f6 100644 --- a/zlt-commons/zlt-swagger2-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-swagger2-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ com.zlt zlt-commons - 1.0.0 + 1.0.1 4.0.0 jar diff --git a/zlt-config/pom.xml b/zlt-config/pom.xml index 558dd625..34fedf9f 100644 --- a/zlt-config/pom.xml +++ b/zlt-config/pom.xml @@ -5,7 +5,7 @@ com.zlt central-platform - 1.0.0 + 1.0.1 4.0.0 jar diff --git a/zlt-config/src/main/resources/application-test.properties b/zlt-config/src/main/resources/application-test.properties new file mode 100644 index 00000000..d4e4e04e --- /dev/null +++ b/zlt-config/src/main/resources/application-test.properties @@ -0,0 +1,20 @@ +########################## 统一变量配置 ########################## +##### 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 diff --git a/zlt-config/src/main/resources/application.properties b/zlt-config/src/main/resources/application.properties index c0a6cc1f..e0707913 100644 --- a/zlt-config/src/main/resources/application.properties +++ b/zlt-config/src/main/resources/application.properties @@ -1,6 +1,6 @@ ########################## 通用配置 ########################## # 默认开发环境 -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配置 diff --git a/zlt-doc/sql/oauth-center.sql b/zlt-doc/sql/oauth-center.sql index 99aa151b..bfd9b69d 100644 --- a/zlt-doc/sql/oauth-center.sql +++ b/zlt-doc/sql/oauth-center.sql @@ -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 diff --git a/zlt-gateway/pom.xml b/zlt-gateway/pom.xml index 12ee3ca6..167fc4b9 100644 --- a/zlt-gateway/pom.xml +++ b/zlt-gateway/pom.xml @@ -4,7 +4,7 @@ com.zlt central-platform - 1.0.0 + 1.0.1 zlt-gateway pom diff --git a/zlt-gateway/spring-cloud-gateway/pom.xml b/zlt-gateway/spring-cloud-gateway/pom.xml index 70c12ae7..7dddbfca 100644 --- a/zlt-gateway/spring-cloud-gateway/pom.xml +++ b/zlt-gateway/spring-cloud-gateway/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-gateway - 1.0.0 + 1.0.1 sc-gateway spring cloud gateway网关 diff --git a/zlt-gateway/zuul-gateway/pom.xml b/zlt-gateway/zuul-gateway/pom.xml index 5ffbd351..d2eb422c 100644 --- a/zlt-gateway/zuul-gateway/pom.xml +++ b/zlt-gateway/zuul-gateway/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-gateway - 1.0.0 + 1.0.1 zuul-gateway zuul网关 diff --git a/zlt-gateway/zuul-gateway/src/main/java/com/central/gateway/config/CorsConfigration.java b/zlt-gateway/zuul-gateway/src/main/java/com/central/gateway/config/CorsConfigration.java index ae357a22..2f2c0829 100644 --- a/zlt-gateway/zuul-gateway/src/main/java/com/central/gateway/config/CorsConfigration.java +++ b/zlt-gateway/zuul-gateway/src/main/java/com/central/gateway/config/CorsConfigration.java @@ -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; } } diff --git a/zlt-gateway/zuul-gateway/src/main/resources/application.yml b/zlt-gateway/zuul-gateway/src/main/resources/application.yml index 2011aa10..ae225955 100644 --- a/zlt-gateway/zuul-gateway/src/main/resources/application.yml +++ b/zlt-gateway/zuul-gateway/src/main/resources/application.yml @@ -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: diff --git a/zlt-job/job-admin/pom.xml b/zlt-job/job-admin/pom.xml index f9d7799a..a7a40135 100644 --- a/zlt-job/job-admin/pom.xml +++ b/zlt-job/job-admin/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-job - 1.0.0 + 1.0.1 job-admin jar diff --git a/zlt-job/job-core/pom.xml b/zlt-job/job-core/pom.xml index 583f77e2..4dda8ebf 100644 --- a/zlt-job/job-core/pom.xml +++ b/zlt-job/job-core/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-job - 1.0.0 + 1.0.1 job-core jar diff --git a/zlt-job/job-executor-samples/pom.xml b/zlt-job/job-executor-samples/pom.xml index c8b367dd..265f3be1 100644 --- a/zlt-job/job-executor-samples/pom.xml +++ b/zlt-job/job-executor-samples/pom.xml @@ -6,7 +6,7 @@ com.zlt zlt-job - 1.0.0 + 1.0.1 job-executor-sample jar diff --git a/zlt-job/pom.xml b/zlt-job/pom.xml index caae8263..5f158049 100644 --- a/zlt-job/pom.xml +++ b/zlt-job/pom.xml @@ -4,7 +4,7 @@ com.zlt central-platform - 1.0.0 + 1.0.1 zlt-job pom diff --git a/zlt-monitor/log-center/pom.xml b/zlt-monitor/log-center/pom.xml index 2df9cb1f..9aecdf07 100644 --- a/zlt-monitor/log-center/pom.xml +++ b/zlt-monitor/log-center/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-monitor - 1.0.0 + 1.0.1 log-center diff --git a/zlt-monitor/pom.xml b/zlt-monitor/pom.xml index 77e9a95c..28a835cb 100644 --- a/zlt-monitor/pom.xml +++ b/zlt-monitor/pom.xml @@ -3,7 +3,7 @@ com.zlt central-platform - 1.0.0 + 1.0.1 zlt-monitor pom diff --git a/zlt-monitor/sc-admin/pom.xml b/zlt-monitor/sc-admin/pom.xml index 11156028..59f9e8b4 100644 --- a/zlt-monitor/sc-admin/pom.xml +++ b/zlt-monitor/sc-admin/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-monitor - 1.0.0 + 1.0.1 sc-admin diff --git a/zlt-search/pom.xml b/zlt-search/pom.xml index 79e0b36e..ea31bd37 100644 --- a/zlt-search/pom.xml +++ b/zlt-search/pom.xml @@ -3,7 +3,7 @@ com.zlt central-platform - 1.0.0 + 1.0.1 zlt-search pom diff --git a/zlt-uaa/pom.xml b/zlt-uaa/pom.xml index 504b5fe1..38e3ef6b 100644 --- a/zlt-uaa/pom.xml +++ b/zlt-uaa/pom.xml @@ -4,7 +4,7 @@ com.zlt central-platform - 1.0.0 + 1.0.1 zlt-uaa 认证中心 diff --git a/zlt-uaa/src/main/java/com/central/oauth/model/Client.java b/zlt-uaa/src/main/java/com/central/oauth/model/Client.java index ca42dc48..9150e7f6 100644 --- a/zlt-uaa/src/main/java/com/central/oauth/model/Client.java +++ b/zlt-uaa/src/main/java/com/central/oauth/model/Client.java @@ -1,5 +1,6 @@ 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"; } diff --git a/zlt-web/back-web/pom.xml b/zlt-web/back-web/pom.xml index 80507ae4..ed33d6ca 100644 --- a/zlt-web/back-web/pom.xml +++ b/zlt-web/back-web/pom.xml @@ -6,7 +6,7 @@ com.zlt zlt-web - 1.0.0 + 1.0.1 back-web 后台管理前端 diff --git a/zlt-web/back-web/src/main/resources/static/index.html b/zlt-web/back-web/src/main/resources/static/index.html index 75e58b94..4a5d6696 100644 --- a/zlt-web/back-web/src/main/resources/static/index.html +++ b/zlt-web/back-web/src/main/resources/static/index.html @@ -59,11 +59,11 @@ - + - - - \ No newline at end of file diff --git a/zlt-web/back-web/src/main/resources/static/pages/system/user.html b/zlt-web/back-web/src/main/resources/static/pages/system/user.html index 0ffd75f4..27f20f69 100644 --- a/zlt-web/back-web/src/main/resources/static/pages/system/user.html +++ b/zlt-web/back-web/src/main/resources/static/pages/system/user.html @@ -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(); diff --git a/zlt-web/pom.xml b/zlt-web/pom.xml index 2c741787..98918a9f 100644 --- a/zlt-web/pom.xml +++ b/zlt-web/pom.xml @@ -6,7 +6,7 @@ com.zlt central-platform - 1.0.0 + 1.0.1 zlt-web 前端