add 新增 ruoyi-doc 模块 集成 Knife4j
parent
94c732c439
commit
ac4005c9dd
|
|
@ -49,7 +49,7 @@
|
||||||
| Redis客户端 | Redisson | [Redisson文档](https://github.com/redisson/redisson/wiki/%E7%9B%AE%E5%BD%95) | 支持单机、集群配置 |
|
| Redis客户端 | Redisson | [Redisson文档](https://github.com/redisson/redisson/wiki/%E7%9B%AE%E5%BD%95) | 支持单机、集群配置 |
|
||||||
| 校验框架(待优化) | Validation | [Validation文档](https://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/) | 增强接口安全性、严谨性 支持国际化 |
|
| 校验框架(待优化) | Validation | [Validation文档](https://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/) | 增强接口安全性、严谨性 支持国际化 |
|
||||||
| Excel框架(未完成) | Alibaba EasyExcel | [EasyExcel文档](https://www.yuque.com/easyexcel/doc/easyexcel) | 性能优异 扩展性强 |
|
| Excel框架(未完成) | Alibaba EasyExcel | [EasyExcel文档](https://www.yuque.com/easyexcel/doc/easyexcel) | 性能优异 扩展性强 |
|
||||||
| 文档框架(未完成) | Knife4j | [Knife4j文档](https://doc.xiaominfo.com/knife4j/documentation/) | 美化接口文档 |
|
| 文档框架 | Knife4j | [Knife4j文档](https://doc.xiaominfo.com/knife4j/documentation/) | 美化接口文档 |
|
||||||
| 工具类框架 | Hutool、Lombok | [Hutool文档](https://www.hutool.cn/docs/) | 减少代码冗余 增加安全性 |
|
| 工具类框架 | Hutool、Lombok | [Hutool文档](https://www.hutool.cn/docs/) | 减少代码冗余 增加安全性 |
|
||||||
| 代码生成器(未完成) | 适配MP、Knife4j规范化代码 | [Hutool文档](https://www.hutool.cn/docs/) | 一键生成前后端代码 |
|
| 代码生成器(未完成) | 适配MP、Knife4j规范化代码 | [Hutool文档](https://www.hutool.cn/docs/) | 一键生成前后端代码 |
|
||||||
| 部署方式(未完成) | Docker | [Docker文档](https://docs.docker.com/) | 容器编排 一键部署业务集群 |
|
| 部署方式(未完成) | Docker | [Docker文档](https://docs.docker.com/) | 容器编排 一键部署业务集群 |
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ redisson:
|
||||||
# 单节点配置
|
# 单节点配置
|
||||||
singleServerConfig:
|
singleServerConfig:
|
||||||
# 客户端名称
|
# 客户端名称
|
||||||
clientName: ${ruoyi.name}
|
clientName: ${spring.application.name}
|
||||||
# 最小空闲连接数
|
# 最小空闲连接数
|
||||||
connectionMinimumIdleSize: 32
|
connectionMinimumIdleSize: 32
|
||||||
# 连接池大小
|
# 连接池大小
|
||||||
|
|
@ -158,8 +158,40 @@ mybatis:
|
||||||
|
|
||||||
# swagger配置
|
# swagger配置
|
||||||
swagger:
|
swagger:
|
||||||
license: Powered By ruoyi
|
# 是否开启swagger
|
||||||
licenseUrl: https://ruoyi.vip
|
enabled: true
|
||||||
|
# 标题
|
||||||
|
title: '标题:RuoYi-Cloud-Plus微服务权限管理系统_接口文档'
|
||||||
|
# 描述
|
||||||
|
description: '描述:微服务权限管理系统, 具体包括XXX,XXX模块...'
|
||||||
|
# 版本
|
||||||
|
version: '版本号:系统版本...'
|
||||||
|
# 作者信息
|
||||||
|
contact:
|
||||||
|
name: Lion Li
|
||||||
|
email: crazylionli@163.com
|
||||||
|
url: https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus
|
||||||
|
|
||||||
|
knife4j:
|
||||||
|
# 是否开启Knife4j增强模式
|
||||||
|
enable: true
|
||||||
|
# 是否开启生产环境保护策略
|
||||||
|
production: true
|
||||||
|
# 登录认证
|
||||||
|
basic:
|
||||||
|
enable: true
|
||||||
|
username: ruoyi
|
||||||
|
password: 123456
|
||||||
|
# 前端Ui的个性化配置属性
|
||||||
|
setting:
|
||||||
|
# 默认语言
|
||||||
|
language: zh-CN
|
||||||
|
# 是否显示Footer
|
||||||
|
enableFooter: true
|
||||||
|
# 是否开启动态参数调试功能
|
||||||
|
enableDynamicParameter: true
|
||||||
|
# 是否在每个Debug调试栏后显示刷新变量按钮
|
||||||
|
enableReloadCacheParameter: true
|
||||||
|
|
||||||
# seata配置
|
# seata配置
|
||||||
seata:
|
seata:
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,6 @@ dubbo:
|
||||||
# 需要远程调用的服务 多个用逗号分割
|
# 需要远程调用的服务 多个用逗号分割
|
||||||
subscribed-services: ruoyi-system
|
subscribed-services: ruoyi-system
|
||||||
|
|
||||||
# swagger配置
|
|
||||||
swagger:
|
|
||||||
title: 代码生成接口文档
|
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
dynamic:
|
dynamic:
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,6 @@ dubbo:
|
||||||
# 需要远程调用的服务 多个用逗号分割
|
# 需要远程调用的服务 多个用逗号分割
|
||||||
subscribed-services: ruoyi-file
|
subscribed-services: ruoyi-file
|
||||||
|
|
||||||
# swagger配置
|
|
||||||
swagger:
|
|
||||||
title: 系统模块接口文档
|
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
dynamic:
|
dynamic:
|
||||||
|
|
|
||||||
22
pom.xml
22
pom.xml
|
|
@ -23,7 +23,6 @@
|
||||||
<alibaba.nacos.version>2.0.3</alibaba.nacos.version>
|
<alibaba.nacos.version>2.0.3</alibaba.nacos.version>
|
||||||
<spring-boot-admin.version>2.5.4</spring-boot-admin.version>
|
<spring-boot-admin.version>2.5.4</spring-boot-admin.version>
|
||||||
<spring-boot.mybatis>2.2.0</spring-boot.mybatis>
|
<spring-boot.mybatis>2.2.0</spring-boot.mybatis>
|
||||||
<swagger.fox.version>3.0.0</swagger.fox.version>
|
|
||||||
<swagger.core.version>1.6.2</swagger.core.version>
|
<swagger.core.version>1.6.2</swagger.core.version>
|
||||||
<tobato.version>1.27.2</tobato.version>
|
<tobato.version>1.27.2</tobato.version>
|
||||||
<kaptcha.version>2.3.2</kaptcha.version>
|
<kaptcha.version>2.3.2</kaptcha.version>
|
||||||
|
|
@ -44,6 +43,8 @@
|
||||||
<dubbo.version>2.7.15</dubbo.version>
|
<dubbo.version>2.7.15</dubbo.version>
|
||||||
<spring.context.support.version>1.0.11</spring.context.support.version>
|
<spring.context.support.version>1.0.11</spring.context.support.version>
|
||||||
<xxl-job.version>2.3.0</xxl-job.version>
|
<xxl-job.version>2.3.0</xxl-job.version>
|
||||||
|
<knife4j-aggregation.version>2.0.9</knife4j-aggregation.version>
|
||||||
|
<knife4j.version>3.0.3</knife4j.version>
|
||||||
|
|
||||||
<!-- docker 配置 -->
|
<!-- docker 配置 -->
|
||||||
<docker.registry.url>localhost</docker.registry.url>
|
<docker.registry.url>localhost</docker.registry.url>
|
||||||
|
|
@ -184,11 +185,6 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Swagger 依赖配置 -->
|
<!-- Swagger 依赖配置 -->
|
||||||
<dependency>
|
|
||||||
<groupId>io.swagger</groupId>
|
|
||||||
<artifactId>swagger-models</artifactId>
|
|
||||||
<version>${swagger.core.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.swagger</groupId>
|
<groupId>io.swagger</groupId>
|
||||||
<artifactId>swagger-annotations</artifactId>
|
<artifactId>swagger-annotations</artifactId>
|
||||||
|
|
@ -231,9 +227,9 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Collection 增强Java集合框架 -->
|
<!-- Collection 增强Java集合框架 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-collections</groupId>
|
<groupId>commons-collections</groupId>
|
||||||
<artifactId>commons-collections</artifactId>
|
<artifactId>commons-collections</artifactId>
|
||||||
<version>${commons-collections.version}</version>
|
<version>${commons-collections.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
@ -271,6 +267,12 @@
|
||||||
<version>${xxl-job.version}</version>
|
<version>${xxl-job.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
|
<artifactId>knife4j-micro-spring-boot-starter</artifactId>
|
||||||
|
<version>${knife4j.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|
@ -349,4 +351,4 @@
|
||||||
</pluginRepository>
|
</pluginRepository>
|
||||||
</pluginRepositories>
|
</pluginRepositories>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>ruoyi-common-core</artifactId>
|
<artifactId>ruoyi-common-core</artifactId>
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
ruoyi-common-core核心模块
|
ruoyi-common-core核心模块
|
||||||
</description>
|
</description>
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
<!-- <groupId>org.springframework.cloud</groupId>-->
|
<!-- <groupId>org.springframework.cloud</groupId>-->
|
||||||
<!-- <artifactId>spring-cloud-starter-openfeign</artifactId>-->
|
<!-- <artifactId>spring-cloud-starter-openfeign</artifactId>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<!-- SpringCloud Loadbalancer -->
|
<!-- SpringCloud Loadbalancer -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
|
@ -131,6 +131,12 @@
|
||||||
<artifactId>hutool-extra</artifactId>
|
<artifactId>hutool-extra</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 自动生成YML配置关联JSON文件 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
||||||
|
|
@ -17,17 +17,22 @@
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- SpringBoot core -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- SpringBoot Web -->
|
<!-- SpringBoot Web -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common-web</artifactId>
|
<artifactId>ruoyi-common-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Swagger -->
|
<!-- knife4j -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.springfox</groupId>
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
<artifactId>springfox-swagger2</artifactId>
|
<artifactId>knife4j-micro-spring-boot-starter</artifactId>
|
||||||
<version>${swagger.fox.version}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
package com.ruoyi.common.swagger.annotation;
|
|
||||||
|
|
||||||
import com.ruoyi.common.swagger.config.SwaggerAutoConfiguration;
|
|
||||||
import org.springframework.context.annotation.Import;
|
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
|
||||||
|
|
||||||
@Target({ElementType.TYPE})
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Documented
|
|
||||||
@Inherited
|
|
||||||
@Import({SwaggerAutoConfiguration.class})
|
|
||||||
public @interface EnableCustomSwagger2 {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,116 +1,119 @@
|
||||||
package com.ruoyi.common.swagger.config;
|
package com.ruoyi.common.swagger.config;
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import com.ruoyi.common.swagger.config.properties.SwaggerProperties;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Bean;
|
||||||
import springfox.documentation.builders.ApiInfoBuilder;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import springfox.documentation.builders.PathSelectors;
|
import springfox.documentation.builders.ApiInfoBuilder;
|
||||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
import springfox.documentation.builders.PathSelectors;
|
||||||
import springfox.documentation.service.*;
|
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||||
import springfox.documentation.spi.DocumentationType;
|
import springfox.documentation.service.*;
|
||||||
import springfox.documentation.spi.service.contexts.SecurityContext;
|
import springfox.documentation.spi.DocumentationType;
|
||||||
import springfox.documentation.spring.web.plugins.ApiSelectorBuilder;
|
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||||
import springfox.documentation.spring.web.plugins.Docket;
|
import springfox.documentation.spring.web.plugins.ApiSelectorBuilder;
|
||||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
import springfox.documentation.spring.web.plugins.Docket;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
@Configuration
|
/**
|
||||||
@EnableSwagger2
|
* Swagger 文档配置
|
||||||
@EnableAutoConfiguration
|
*
|
||||||
@ConditionalOnProperty(name = "swagger.enabled", matchIfMissing = true)
|
* @author Lion Li
|
||||||
public class SwaggerAutoConfiguration {
|
*/
|
||||||
/**
|
@Configuration
|
||||||
* 默认的排除路径,排除Spring Boot默认的错误处理路径和端点
|
@EnableKnife4j
|
||||||
*/
|
@EnableConfigurationProperties(SwaggerProperties.class)
|
||||||
private static final List<String> DEFAULT_EXCLUDE_PATH = Arrays.asList("/error", "/actuator/**");
|
@ConditionalOnProperty(name = "swagger.enabled", matchIfMissing = true)
|
||||||
|
public class SwaggerAutoConfiguration {
|
||||||
private static final String BASE_PATH = "/**";
|
|
||||||
|
/**
|
||||||
@Bean
|
* 默认的排除路径,排除Spring Boot默认的错误处理路径和端点
|
||||||
@ConditionalOnMissingBean
|
*/
|
||||||
public SwaggerProperties swaggerProperties() {
|
private static final List<String> DEFAULT_EXCLUDE_PATH = Arrays.asList("/error", "/actuator/**");
|
||||||
return new SwaggerProperties();
|
|
||||||
}
|
private static final String BASE_PATH = "/**";
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Docket api(SwaggerProperties swaggerProperties) {
|
public Docket api(SwaggerProperties swaggerProperties) {
|
||||||
// base-path处理
|
// base-path处理
|
||||||
if (swaggerProperties.getBasePath().isEmpty()) {
|
if (swaggerProperties.getBasePath().isEmpty()) {
|
||||||
swaggerProperties.getBasePath().add(BASE_PATH);
|
swaggerProperties.getBasePath().add(BASE_PATH);
|
||||||
}
|
}
|
||||||
// noinspection unchecked
|
// noinspection unchecked
|
||||||
List<Predicate<String>> basePath = new ArrayList<Predicate<String>>();
|
List<Predicate<String>> basePath = new ArrayList<>();
|
||||||
swaggerProperties.getBasePath().forEach(path -> basePath.add(PathSelectors.ant(path)));
|
swaggerProperties.getBasePath().forEach(path -> basePath.add(PathSelectors.ant(path)));
|
||||||
|
|
||||||
// exclude-path处理
|
// exclude-path处理
|
||||||
if (swaggerProperties.getExcludePath().isEmpty()) {
|
if (swaggerProperties.getExcludePath().isEmpty()) {
|
||||||
swaggerProperties.getExcludePath().addAll(DEFAULT_EXCLUDE_PATH);
|
swaggerProperties.getExcludePath().addAll(DEFAULT_EXCLUDE_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Predicate<String>> excludePath = new ArrayList<>();
|
List<Predicate<String>> excludePath = new ArrayList<>();
|
||||||
swaggerProperties.getExcludePath().forEach(path -> excludePath.add(PathSelectors.ant(path)));
|
swaggerProperties.getExcludePath().forEach(path -> excludePath.add(PathSelectors.ant(path)));
|
||||||
|
|
||||||
ApiSelectorBuilder builder = new Docket(DocumentationType.SWAGGER_2).host(swaggerProperties.getHost())
|
ApiSelectorBuilder builder = new Docket(DocumentationType.OAS_30)
|
||||||
.apiInfo(apiInfo(swaggerProperties)).select()
|
.host(swaggerProperties.getHost())
|
||||||
.apis(RequestHandlerSelectors.basePackage(swaggerProperties.getBasePackage()));
|
.apiInfo(apiInfo(swaggerProperties))
|
||||||
|
.select()
|
||||||
swaggerProperties.getBasePath().forEach(p -> builder.paths(PathSelectors.ant(p)));
|
.apis(RequestHandlerSelectors.basePackage(swaggerProperties.getBasePackage()));
|
||||||
swaggerProperties.getExcludePath().forEach(p -> builder.paths(PathSelectors.ant(p).negate()));
|
|
||||||
|
swaggerProperties.getBasePath().forEach(p -> builder.paths(PathSelectors.ant(p)));
|
||||||
return builder.build().securitySchemes(securitySchemes()).securityContexts(securityContexts()).pathMapping("/");
|
swaggerProperties.getExcludePath().forEach(p -> builder.paths(PathSelectors.ant(p).negate()));
|
||||||
}
|
|
||||||
|
return builder.build()
|
||||||
/**
|
.securitySchemes(securitySchemes())
|
||||||
* 安全模式,这里指定token通过Authorization头请求头传递
|
.securityContexts(securityContexts())
|
||||||
*/
|
.pathMapping("/");
|
||||||
private List<SecurityScheme> securitySchemes() {
|
}
|
||||||
List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
|
|
||||||
apiKeyList.add(new ApiKey("Authorization", "Authorization", "header"));
|
/**
|
||||||
return apiKeyList;
|
* 安全模式,这里指定token通过Authorization头请求头传递
|
||||||
}
|
*/
|
||||||
|
private List<SecurityScheme> securitySchemes() {
|
||||||
/**
|
List<SecurityScheme> apiKeyList = new ArrayList<>();
|
||||||
* 安全上下文
|
apiKeyList.add(new ApiKey("Authorization", "Authorization", "header"));
|
||||||
*/
|
return apiKeyList;
|
||||||
private List<SecurityContext> securityContexts() {
|
}
|
||||||
List<SecurityContext> securityContexts = new ArrayList<>();
|
|
||||||
securityContexts.add(
|
/**
|
||||||
SecurityContext.builder()
|
* 安全上下文
|
||||||
.securityReferences(defaultAuth())
|
*/
|
||||||
.operationSelector(o -> o.requestMappingPattern().matches("/.*"))
|
private List<SecurityContext> securityContexts() {
|
||||||
.build());
|
List<SecurityContext> securityContexts = new ArrayList<>();
|
||||||
return securityContexts;
|
securityContexts.add(
|
||||||
}
|
SecurityContext.builder()
|
||||||
|
.securityReferences(defaultAuth())
|
||||||
/**
|
.operationSelector(o -> o.requestMappingPattern().matches("/.*"))
|
||||||
* 默认的全局鉴权策略
|
.build());
|
||||||
*
|
return securityContexts;
|
||||||
* @return
|
}
|
||||||
*/
|
|
||||||
private List<SecurityReference> defaultAuth() {
|
/**
|
||||||
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
|
* 默认的全局鉴权策略
|
||||||
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
*/
|
||||||
authorizationScopes[0] = authorizationScope;
|
private List<SecurityReference> defaultAuth() {
|
||||||
List<SecurityReference> securityReferences = new ArrayList<>();
|
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
|
||||||
securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
|
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
||||||
return securityReferences;
|
authorizationScopes[0] = authorizationScope;
|
||||||
}
|
List<SecurityReference> securityReferences = new ArrayList<>();
|
||||||
|
securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
|
||||||
private ApiInfo apiInfo(SwaggerProperties swaggerProperties) {
|
return securityReferences;
|
||||||
return new ApiInfoBuilder()
|
}
|
||||||
.title(swaggerProperties.getTitle())
|
|
||||||
.description(swaggerProperties.getDescription())
|
private ApiInfo apiInfo(SwaggerProperties swaggerProperties) {
|
||||||
.license(swaggerProperties.getLicense())
|
return new ApiInfoBuilder()
|
||||||
.licenseUrl(swaggerProperties.getLicenseUrl())
|
.title(swaggerProperties.getTitle())
|
||||||
.termsOfServiceUrl(swaggerProperties.getTermsOfServiceUrl())
|
.description(swaggerProperties.getDescription())
|
||||||
.contact(new Contact(swaggerProperties.getContact().getName(), swaggerProperties.getContact().getUrl(), swaggerProperties.getContact().getEmail()))
|
.license(swaggerProperties.getLicense())
|
||||||
.version(swaggerProperties.getVersion())
|
.licenseUrl(swaggerProperties.getLicenseUrl())
|
||||||
.build();
|
.termsOfServiceUrl(swaggerProperties.getTermsOfServiceUrl())
|
||||||
}
|
.contact(new Contact(swaggerProperties.getContact().getName(), swaggerProperties.getContact().getUrl(), swaggerProperties.getContact().getEmail()))
|
||||||
}
|
.version(swaggerProperties.getVersion())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
package com.ruoyi.common.swagger.config;
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* swagger 资源映射路径
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class SwaggerWebConfiguration implements WebMvcConfigurer {
|
|
||||||
@Override
|
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
||||||
/** swagger-ui 地址 */
|
|
||||||
registry.addResourceHandler("/swagger-ui/**")
|
|
||||||
.addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,140 +1,146 @@
|
||||||
package com.ruoyi.common.swagger.config;
|
package com.ruoyi.common.swagger.config.properties;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
import java.util.List;
|
|
||||||
|
/**
|
||||||
@Data
|
* swagger 配置属性
|
||||||
@NoArgsConstructor
|
*
|
||||||
@Accessors(chain = true)
|
* @author Lion Li
|
||||||
@Component
|
*/
|
||||||
@ConfigurationProperties("swagger")
|
@Data
|
||||||
public class SwaggerProperties {
|
@ConfigurationProperties("swagger")
|
||||||
/**
|
public class SwaggerProperties {
|
||||||
* 是否开启swagger
|
|
||||||
*/
|
/**
|
||||||
private Boolean enabled;
|
* 是否开启swagger
|
||||||
|
*/
|
||||||
/**
|
private Boolean enabled;
|
||||||
* swagger会解析的包路径
|
|
||||||
**/
|
/**
|
||||||
private String basePackage = "";
|
* swagger会解析的包路径
|
||||||
|
**/
|
||||||
/**
|
private String basePackage = "";
|
||||||
* swagger会解析的url规则
|
|
||||||
**/
|
/**
|
||||||
private List<String> basePath = new ArrayList<>();
|
* swagger会解析的url规则
|
||||||
|
**/
|
||||||
/**
|
private List<String> basePath = new ArrayList<>();
|
||||||
* 在basePath基础上需要排除的url规则
|
|
||||||
**/
|
/**
|
||||||
private List<String> excludePath = new ArrayList<>();
|
* 在basePath基础上需要排除的url规则
|
||||||
|
**/
|
||||||
/**
|
private List<String> excludePath = new ArrayList<>();
|
||||||
* 标题
|
|
||||||
**/
|
/**
|
||||||
private String title = "";
|
* 标题
|
||||||
|
**/
|
||||||
/**
|
private String title = "";
|
||||||
* 描述
|
|
||||||
**/
|
/**
|
||||||
private String description = "";
|
* 描述
|
||||||
|
**/
|
||||||
/**
|
private String description = "";
|
||||||
* 版本
|
|
||||||
**/
|
/**
|
||||||
private String version = "";
|
* 版本
|
||||||
|
**/
|
||||||
/**
|
private String version = "";
|
||||||
* 许可证
|
|
||||||
**/
|
/**
|
||||||
private String license = "";
|
* 许可证
|
||||||
|
**/
|
||||||
/**
|
private String license = "";
|
||||||
* 许可证URL
|
|
||||||
**/
|
/**
|
||||||
private String licenseUrl = "";
|
* 许可证URL
|
||||||
|
**/
|
||||||
/**
|
private String licenseUrl = "";
|
||||||
* 服务条款URL
|
|
||||||
**/
|
/**
|
||||||
private String termsOfServiceUrl = "";
|
* 服务条款URL
|
||||||
|
**/
|
||||||
/**
|
private String termsOfServiceUrl = "";
|
||||||
* host信息
|
|
||||||
**/
|
/**
|
||||||
private String host = "";
|
* host信息
|
||||||
|
**/
|
||||||
/**
|
private String host = "";
|
||||||
* 联系人信息
|
|
||||||
*/
|
/**
|
||||||
private Contact contact = new Contact();
|
* 联系人信息
|
||||||
|
*/
|
||||||
/**
|
private Contact contact = new Contact();
|
||||||
* 全局统一鉴权配置
|
|
||||||
**/
|
/**
|
||||||
private Authorization authorization = new Authorization();
|
* 全局统一鉴权配置
|
||||||
|
**/
|
||||||
@Data
|
private Authorization authorization = new Authorization();
|
||||||
@NoArgsConstructor
|
|
||||||
@Accessors(chain = true)
|
@Data
|
||||||
public static class Contact {
|
@NoArgsConstructor
|
||||||
/**
|
@Accessors(chain = true)
|
||||||
* 联系人
|
public static class Contact {
|
||||||
**/
|
|
||||||
private String name = "";
|
/**
|
||||||
/**
|
* 联系人
|
||||||
* 联系人url
|
**/
|
||||||
**/
|
private String name = "";
|
||||||
private String url = "";
|
/**
|
||||||
/**
|
* 联系人url
|
||||||
* 联系人email
|
**/
|
||||||
**/
|
private String url = "";
|
||||||
private String email = "";
|
/**
|
||||||
|
* 联系人email
|
||||||
}
|
**/
|
||||||
|
private String email = "";
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
}
|
||||||
@Accessors(chain = true)
|
|
||||||
public static class Authorization {
|
@Data
|
||||||
/**
|
@NoArgsConstructor
|
||||||
* 鉴权策略ID,需要和SecurityReferences ID保持一致
|
@Accessors(chain = true)
|
||||||
*/
|
public static class Authorization {
|
||||||
private String name = "";
|
|
||||||
|
/**
|
||||||
/**
|
* 鉴权策略ID,需要和SecurityReferences ID保持一致
|
||||||
* 需要开启鉴权URL的正则
|
*/
|
||||||
*/
|
private String name = "";
|
||||||
private String authRegex = "^.*$";
|
|
||||||
|
/**
|
||||||
/**
|
* 需要开启鉴权URL的正则
|
||||||
* 鉴权作用域列表
|
*/
|
||||||
*/
|
private String authRegex = "^.*$";
|
||||||
private List<AuthorizationScope> authorizationScopeList = new ArrayList<>();
|
|
||||||
|
/**
|
||||||
private List<String> tokenUrlList = new ArrayList<>();
|
* 鉴权作用域列表
|
||||||
|
*/
|
||||||
}
|
private List<AuthorizationScope> authorizationScopeList = new ArrayList<>();
|
||||||
|
|
||||||
@Data
|
private List<String> tokenUrlList = new ArrayList<>();
|
||||||
@NoArgsConstructor
|
|
||||||
@Accessors(chain = true)
|
}
|
||||||
public static class AuthorizationScope {
|
|
||||||
/**
|
@Data
|
||||||
* 作用域名称
|
@NoArgsConstructor
|
||||||
*/
|
@Accessors(chain = true)
|
||||||
private String scope = "";
|
public static class AuthorizationScope {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 作用域描述
|
* 作用域名称
|
||||||
*/
|
*/
|
||||||
private String description = "";
|
private String scope = "";
|
||||||
|
|
||||||
}
|
/**
|
||||||
}
|
* 作用域描述
|
||||||
|
*/
|
||||||
|
private String description = "";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||||
com.ruoyi.common.swagger.config.SwaggerAutoConfiguration,\
|
com.ruoyi.common.swagger.config.SwaggerAutoConfiguration
|
||||||
com.ruoyi.common.swagger.config.SwaggerWebConfiguration
|
|
||||||
|
|
|
||||||
|
|
@ -74,18 +74,6 @@
|
||||||
<!-- <artifactId>ruoyi-common-loadbalancer</artifactId>-->
|
<!-- <artifactId>ruoyi-common-loadbalancer</artifactId>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<!-- Swagger -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.springfox</groupId>
|
|
||||||
<artifactId>springfox-swagger-ui</artifactId>
|
|
||||||
<version>${swagger.fox.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.springfox</groupId>
|
|
||||||
<artifactId>springfox-swagger2</artifactId>
|
|
||||||
<version>${swagger.fox.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
<artifactId>hutool-captcha</artifactId>
|
<artifactId>hutool-captcha</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
||||||
package com.ruoyi.gateway.config;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.cloud.gateway.config.GatewayProperties;
|
|
||||||
import org.springframework.cloud.gateway.route.RouteLocator;
|
|
||||||
import org.springframework.cloud.gateway.support.NameUtils;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.web.reactive.config.ResourceHandlerRegistry;
|
|
||||||
import org.springframework.web.reactive.config.WebFluxConfigurer;
|
|
||||||
import springfox.documentation.swagger.web.SwaggerResource;
|
|
||||||
import springfox.documentation.swagger.web.SwaggerResourcesProvider;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 聚合系统接口
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class SwaggerProvider implements SwaggerResourcesProvider, WebFluxConfigurer {
|
|
||||||
/**
|
|
||||||
* Swagger2默认的url后缀
|
|
||||||
*/
|
|
||||||
public static final String SWAGGER2URL = "/v2/api-docs";
|
|
||||||
/**
|
|
||||||
* 网关路由
|
|
||||||
*/
|
|
||||||
@Autowired
|
|
||||||
private RouteLocator routeLocator;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private GatewayProperties gatewayProperties;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 聚合其他服务接口
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<SwaggerResource> get() {
|
|
||||||
List<SwaggerResource> resourceList = new ArrayList<>();
|
|
||||||
List<String> routes = new ArrayList<>();
|
|
||||||
// 获取网关中配置的route
|
|
||||||
routeLocator.getRoutes().subscribe(route -> routes.add(route.getId()));
|
|
||||||
gatewayProperties.getRoutes().stream()
|
|
||||||
.filter(routeDefinition -> routes
|
|
||||||
.contains(routeDefinition.getId()))
|
|
||||||
.forEach(routeDefinition -> routeDefinition.getPredicates().stream()
|
|
||||||
.filter(predicateDefinition -> "Path".equalsIgnoreCase(predicateDefinition.getName()))
|
|
||||||
.filter(predicateDefinition -> !"ruoyi-auth".equalsIgnoreCase(routeDefinition.getId()))
|
|
||||||
.forEach(predicateDefinition -> resourceList
|
|
||||||
.add(swaggerResource(routeDefinition.getId(), predicateDefinition.getArgs()
|
|
||||||
.get(NameUtils.GENERATED_NAME_PREFIX + "0").replace("/**", SWAGGER2URL)))));
|
|
||||||
return resourceList;
|
|
||||||
}
|
|
||||||
|
|
||||||
private SwaggerResource swaggerResource(String name, String location) {
|
|
||||||
SwaggerResource swaggerResource = new SwaggerResource();
|
|
||||||
swaggerResource.setName(name);
|
|
||||||
swaggerResource.setLocation(location);
|
|
||||||
swaggerResource.setSwaggerVersion("2.0");
|
|
||||||
return swaggerResource;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
||||||
/** swagger-ui 地址 */
|
|
||||||
registry.addResourceHandler("/swagger-ui/**")
|
|
||||||
.addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
package com.ruoyi.gateway.handler;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import reactor.core.publisher.Mono;
|
|
||||||
import springfox.documentation.swagger.web.*;
|
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/swagger-resources")
|
|
||||||
public class SwaggerHandler {
|
|
||||||
@Autowired(required = false)
|
|
||||||
private SecurityConfiguration securityConfiguration;
|
|
||||||
|
|
||||||
@Autowired(required = false)
|
|
||||||
private UiConfiguration uiConfiguration;
|
|
||||||
|
|
||||||
private final SwaggerResourcesProvider swaggerResources;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public SwaggerHandler(SwaggerResourcesProvider swaggerResources) {
|
|
||||||
this.swaggerResources = swaggerResources;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/configuration/security")
|
|
||||||
public Mono<ResponseEntity<SecurityConfiguration>> securityConfiguration() {
|
|
||||||
return Mono.just(new ResponseEntity<>(
|
|
||||||
Optional.ofNullable(securityConfiguration).orElse(SecurityConfigurationBuilder.builder().build()),
|
|
||||||
HttpStatus.OK));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/configuration/ui")
|
|
||||||
public Mono<ResponseEntity<UiConfiguration>> uiConfiguration() {
|
|
||||||
return Mono.just(new ResponseEntity<>(
|
|
||||||
Optional.ofNullable(uiConfiguration).orElse(UiConfigurationBuilder.builder().build()), HttpStatus.OK));
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
@GetMapping("")
|
|
||||||
public Mono<ResponseEntity> swaggerResources() {
|
|
||||||
return Mono.just((new ResponseEntity<>(swaggerResources.get(), HttpStatus.OK)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- SpringCloud Alibaba Nacos -->
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.ruoyi.file;
|
package com.ruoyi.file;
|
||||||
|
|
||||||
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
|
|
||||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
@ -12,7 +11,6 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@EnableDubbo
|
@EnableDubbo
|
||||||
@EnableCustomSwagger2
|
|
||||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
||||||
public class RuoYiFileApplication {
|
public class RuoYiFileApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
|
||||||
|
|
@ -1,43 +1,45 @@
|
||||||
package com.ruoyi.file.controller;
|
package com.ruoyi.file.controller;
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
import com.ruoyi.common.core.utils.file.FileUtils;
|
import com.ruoyi.common.core.utils.file.FileUtils;
|
||||||
import com.ruoyi.file.api.domain.SysFile;
|
import com.ruoyi.file.api.domain.SysFile;
|
||||||
import com.ruoyi.file.service.ISysFileService;
|
import com.ruoyi.file.service.ISysFileService;
|
||||||
import org.slf4j.Logger;
|
import io.swagger.annotations.Api;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.Logger;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
/**
|
|
||||||
* 文件请求处理
|
/**
|
||||||
*
|
* 文件请求处理
|
||||||
* @author ruoyi
|
*
|
||||||
*/
|
* @author ruoyi
|
||||||
@RestController
|
*/
|
||||||
public class SysFileController {
|
@Api(tags = "文件处理")
|
||||||
private static final Logger log = LoggerFactory.getLogger(SysFileController.class);
|
@RestController
|
||||||
|
public class SysFileController {
|
||||||
@Autowired
|
private static final Logger log = LoggerFactory.getLogger(SysFileController.class);
|
||||||
private ISysFileService sysFileService;
|
|
||||||
|
@Autowired
|
||||||
/**
|
private ISysFileService sysFileService;
|
||||||
* 文件上传请求
|
|
||||||
*/
|
/**
|
||||||
@PostMapping("upload")
|
* 文件上传请求
|
||||||
public R<SysFile> upload(MultipartFile file) {
|
*/
|
||||||
try {
|
@PostMapping("upload")
|
||||||
// 上传并返回访问地址
|
public R<SysFile> upload(MultipartFile file) {
|
||||||
String url = sysFileService.uploadFile(file);
|
try {
|
||||||
SysFile sysFile = new SysFile();
|
// 上传并返回访问地址
|
||||||
sysFile.setName(FileUtils.getName(url));
|
String url = sysFileService.uploadFile(file);
|
||||||
sysFile.setUrl(url);
|
SysFile sysFile = new SysFile();
|
||||||
return R.ok(sysFile);
|
sysFile.setName(FileUtils.getName(url));
|
||||||
} catch (Exception e) {
|
sysFile.setUrl(url);
|
||||||
log.error("上传文件失败", e);
|
return R.ok(sysFile);
|
||||||
return R.fail(e.getMessage());
|
} catch (Exception e) {
|
||||||
}
|
log.error("上传文件失败", e);
|
||||||
}
|
return R.fail(e.getMessage());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,33 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 9300
|
port: 9300
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
# 应用名称
|
# 应用名称
|
||||||
name: ruoyi-file
|
name: ruoyi-file
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: @profiles.active@
|
active: @profiles.active@
|
||||||
|
|
||||||
--- # nacos 配置
|
--- # nacos 配置
|
||||||
spring:
|
spring:
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
# nacos 服务地址
|
# nacos 服务地址
|
||||||
server-addr: @nacos.server@
|
server-addr: @nacos.server@
|
||||||
discovery:
|
discovery:
|
||||||
# 注册组
|
# 注册组
|
||||||
group: @nacos.discovery.group@
|
group: @nacos.discovery.group@
|
||||||
namespace: ${spring.profiles.active}
|
namespace: ${spring.profiles.active}
|
||||||
config:
|
config:
|
||||||
# 配置组
|
# 配置组
|
||||||
group: @nacos.config.group@
|
group: @nacos.config.group@
|
||||||
namespace: ${spring.profiles.active}
|
namespace: ${spring.profiles.active}
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
shared-configs:
|
shared-configs:
|
||||||
- data-id: application.${spring.cloud.nacos.config.file-extension}
|
- data-id: application.${spring.cloud.nacos.config.file-extension}
|
||||||
refresh: true
|
refresh: true
|
||||||
|
|
|
||||||
|
|
@ -41,13 +41,6 @@
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Swagger UI -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.springfox</groupId>
|
|
||||||
<artifactId>springfox-swagger-ui</artifactId>
|
|
||||||
<version>${swagger.fox.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Apache Velocity -->
|
<!-- Apache Velocity -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.velocity</groupId>
|
<groupId>org.apache.velocity</groupId>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.ruoyi.gen;
|
package com.ruoyi.gen;
|
||||||
|
|
||||||
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
||||||
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
|
|
||||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
@ -12,7 +11,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@EnableCustomConfig
|
@EnableCustomConfig
|
||||||
@EnableCustomSwagger2
|
|
||||||
@EnableDubbo
|
@EnableDubbo
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class RuoYiGenApplication {
|
public class RuoYiGenApplication {
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import com.ruoyi.gen.domain.GenTable;
|
||||||
import com.ruoyi.gen.domain.GenTableColumn;
|
import com.ruoyi.gen.domain.GenTableColumn;
|
||||||
import com.ruoyi.gen.service.IGenTableColumnService;
|
import com.ruoyi.gen.service.IGenTableColumnService;
|
||||||
import com.ruoyi.gen.service.IGenTableService;
|
import com.ruoyi.gen.service.IGenTableService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -31,6 +32,7 @@ import java.util.Map;
|
||||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RequestMapping("/gen")
|
@RequestMapping("/gen")
|
||||||
@RestController
|
@RestController
|
||||||
|
@Api(tags = "代码生成")
|
||||||
public class GenController extends BaseController {
|
public class GenController extends BaseController {
|
||||||
|
|
||||||
private final IGenTableService genTableService;
|
private final IGenTableService genTableService;
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,35 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 9202
|
port: 9202
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
# 应用名称
|
# 应用名称
|
||||||
name: ruoyi-gen
|
name: ruoyi-gen
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: @profiles.active@
|
active: @profiles.active@
|
||||||
|
|
||||||
--- # nacos 配置
|
--- # nacos 配置
|
||||||
spring:
|
spring:
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
# nacos 服务地址
|
# nacos 服务地址
|
||||||
server-addr: @nacos.server@
|
server-addr: @nacos.server@
|
||||||
discovery:
|
discovery:
|
||||||
# 注册组
|
# 注册组
|
||||||
group: @nacos.discovery.group@
|
group: @nacos.discovery.group@
|
||||||
namespace: ${spring.profiles.active}
|
namespace: ${spring.profiles.active}
|
||||||
config:
|
config:
|
||||||
# 配置组
|
# 配置组
|
||||||
group: @nacos.config.group@
|
group: @nacos.config.group@
|
||||||
namespace: ${spring.profiles.active}
|
namespace: ${spring.profiles.active}
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
shared-configs:
|
shared-configs:
|
||||||
- data-id: application.${spring.cloud.nacos.config.file-extension}
|
- data-id: application.${spring.cloud.nacos.config.file-extension}
|
||||||
refresh: true
|
refresh: true
|
||||||
- data-id: datasource.${spring.cloud.nacos.config.file-extension}
|
- data-id: datasource.${spring.cloud.nacos.config.file-extension}
|
||||||
refresh: true
|
refresh: true
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- SpringCloud Alibaba Nacos -->
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
|
@ -29,25 +29,18 @@
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- SpringCloud Alibaba Sentinel -->
|
<!-- SpringCloud Alibaba Sentinel -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- SpringBoot Actuator -->
|
<!-- SpringBoot Actuator -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Swagger UI -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.springfox</groupId>
|
|
||||||
<artifactId>springfox-swagger-ui</artifactId>
|
|
||||||
<version>${swagger.fox.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Mysql Connector -->
|
<!-- Mysql Connector -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.ruoyi.system;
|
package com.ruoyi.system;
|
||||||
|
|
||||||
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
||||||
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
|
|
||||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
@ -12,7 +11,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@EnableCustomConfig
|
@EnableCustomConfig
|
||||||
@EnableCustomSwagger2
|
|
||||||
@EnableDubbo
|
@EnableDubbo
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class RuoYiSystemApplication {
|
public class RuoYiSystemApplication {
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,35 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 9201
|
port: 9201
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
# 应用名称
|
# 应用名称
|
||||||
name: ruoyi-system
|
name: ruoyi-system
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: @profiles.active@
|
active: @profiles.active@
|
||||||
|
|
||||||
--- # nacos 配置
|
--- # nacos 配置
|
||||||
spring:
|
spring:
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
# nacos 服务地址
|
# nacos 服务地址
|
||||||
server-addr: @nacos.server@
|
server-addr: @nacos.server@
|
||||||
discovery:
|
discovery:
|
||||||
# 注册组
|
# 注册组
|
||||||
group: @nacos.discovery.group@
|
group: @nacos.discovery.group@
|
||||||
namespace: ${spring.profiles.active}
|
namespace: ${spring.profiles.active}
|
||||||
config:
|
config:
|
||||||
# 配置组
|
# 配置组
|
||||||
group: @nacos.config.group@
|
group: @nacos.config.group@
|
||||||
namespace: ${spring.profiles.active}
|
namespace: ${spring.profiles.active}
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
shared-configs:
|
shared-configs:
|
||||||
- data-id: application.${spring.cloud.nacos.config.file-extension}
|
- data-id: application.${spring.cloud.nacos.config.file-extension}
|
||||||
refresh: true
|
refresh: true
|
||||||
- data-id: datasource.${spring.cloud.nacos.config.file-extension}
|
- data-id: datasource.${spring.cloud.nacos.config.file-extension}
|
||||||
refresh: true
|
refresh: true
|
||||||
|
|
|
||||||
|
|
@ -1,71 +0,0 @@
|
||||||
import request from '@/utils/request'
|
|
||||||
|
|
||||||
// 查询定时任务调度列表
|
|
||||||
export function listJob(query) {
|
|
||||||
return request({
|
|
||||||
url: '/schedule/job/list',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询定时任务调度详细
|
|
||||||
export function getJob(jobId) {
|
|
||||||
return request({
|
|
||||||
url: '/schedule/job/' + jobId,
|
|
||||||
method: 'get'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 新增定时任务调度
|
|
||||||
export function addJob(data) {
|
|
||||||
return request({
|
|
||||||
url: '/schedule/job',
|
|
||||||
method: 'post',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 修改定时任务调度
|
|
||||||
export function updateJob(data) {
|
|
||||||
return request({
|
|
||||||
url: '/schedule/job',
|
|
||||||
method: 'put',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除定时任务调度
|
|
||||||
export function delJob(jobId) {
|
|
||||||
return request({
|
|
||||||
url: '/schedule/job/' + jobId,
|
|
||||||
method: 'delete'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 任务状态修改
|
|
||||||
export function changeJobStatus(jobId, status) {
|
|
||||||
const data = {
|
|
||||||
jobId,
|
|
||||||
status
|
|
||||||
}
|
|
||||||
return request({
|
|
||||||
url: '/schedule/job/changeStatus',
|
|
||||||
method: 'put',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 定时任务立即执行一次
|
|
||||||
export function runJob(jobId, jobGroup) {
|
|
||||||
const data = {
|
|
||||||
jobId,
|
|
||||||
jobGroup
|
|
||||||
}
|
|
||||||
return request({
|
|
||||||
url: '/schedule/job/run',
|
|
||||||
method: 'put',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
import request from '@/utils/request'
|
|
||||||
|
|
||||||
// 查询调度日志列表
|
|
||||||
export function listJobLog(query) {
|
|
||||||
return request({
|
|
||||||
url: '/schedule/job/log/list',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除调度日志
|
|
||||||
export function delJobLog(jobLogId) {
|
|
||||||
return request({
|
|
||||||
url: '/schedule/job/log/' + jobLogId,
|
|
||||||
method: 'delete'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 清空调度日志
|
|
||||||
export function cleanJobLog() {
|
|
||||||
return request({
|
|
||||||
url: '/schedule/job/log/clean',
|
|
||||||
method: 'delete'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'RuoYiDoc',
|
name: 'RuoYi-Cloud-Plus-Wiki',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
url: 'http://doc.ruoyi.vip/ruoyi-cloud'
|
url: 'https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus/wikis'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'RuoYiGit',
|
name: 'RuoYi-Cloud-Plus-Git',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
url: 'https://gitee.com/y_project/RuoYi-Cloud'
|
url: 'https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
||||||
|
|
@ -1,171 +1,157 @@
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import Router from 'vue-router'
|
import Router from 'vue-router'
|
||||||
|
|
||||||
Vue.use(Router)
|
Vue.use(Router)
|
||||||
|
|
||||||
/* Layout */
|
/* Layout */
|
||||||
import Layout from '@/layout'
|
import Layout from '@/layout'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: 路由配置项
|
* Note: 路由配置项
|
||||||
*
|
*
|
||||||
* hidden: true // 当设置 true 的时候该路由不会再侧边栏出现 如401,login等页面,或者如一些编辑页面/edit/1
|
* hidden: true // 当设置 true 的时候该路由不会再侧边栏出现 如401,login等页面,或者如一些编辑页面/edit/1
|
||||||
* alwaysShow: true // 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
|
* alwaysShow: true // 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
|
||||||
* // 只有一个时,会将那个子路由当做根路由显示在侧边栏--如引导页面
|
* // 只有一个时,会将那个子路由当做根路由显示在侧边栏--如引导页面
|
||||||
* // 若你想不管路由下面的 children 声明的个数都显示你的根路由
|
* // 若你想不管路由下面的 children 声明的个数都显示你的根路由
|
||||||
* // 你可以设置 alwaysShow: true,这样它就会忽略之前定义的规则,一直显示根路由
|
* // 你可以设置 alwaysShow: true,这样它就会忽略之前定义的规则,一直显示根路由
|
||||||
* redirect: noRedirect // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
|
* redirect: noRedirect // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
|
||||||
* name:'router-name' // 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
|
* name:'router-name' // 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
|
||||||
* query: '{"id": 1, "name": "ry"}' // 访问路由的默认传递参数
|
* query: '{"id": 1, "name": "ry"}' // 访问路由的默认传递参数
|
||||||
* roles: ['admin', 'common'] // 访问路由的角色权限
|
* roles: ['admin', 'common'] // 访问路由的角色权限
|
||||||
* permissions: ['a:a:a', 'b:b:b'] // 访问路由的菜单权限
|
* permissions: ['a:a:a', 'b:b:b'] // 访问路由的菜单权限
|
||||||
* meta : {
|
* meta : {
|
||||||
noCache: true // 如果设置为true,则不会被 <keep-alive> 缓存(默认 false)
|
noCache: true // 如果设置为true,则不会被 <keep-alive> 缓存(默认 false)
|
||||||
title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
|
title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
|
||||||
icon: 'svg-name' // 设置该路由的图标,对应路径src/assets/icons/svg
|
icon: 'svg-name' // 设置该路由的图标,对应路径src/assets/icons/svg
|
||||||
breadcrumb: false // 如果设置为false,则不会在breadcrumb面包屑中显示
|
breadcrumb: false // 如果设置为false,则不会在breadcrumb面包屑中显示
|
||||||
activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
|
activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// 公共路由
|
// 公共路由
|
||||||
export const constantRoutes = [
|
export const constantRoutes = [
|
||||||
{
|
{
|
||||||
path: '/redirect',
|
path: '/redirect',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/redirect/:path(.*)',
|
path: '/redirect/:path(.*)',
|
||||||
component: () => import('@/views/redirect')
|
component: () => import('@/views/redirect')
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/login',
|
path: '/login',
|
||||||
component: () => import('@/views/login'),
|
component: () => import('@/views/login'),
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/register',
|
path: '/register',
|
||||||
component: () => import('@/views/register'),
|
component: () => import('@/views/register'),
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/404',
|
path: '/404',
|
||||||
component: () => import('@/views/error/404'),
|
component: () => import('@/views/error/404'),
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/401',
|
path: '/401',
|
||||||
component: () => import('@/views/error/401'),
|
component: () => import('@/views/error/401'),
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: 'index',
|
redirect: 'index',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'index',
|
path: 'index',
|
||||||
component: () => import('@/views/index'),
|
component: () => import('@/views/index'),
|
||||||
name: 'Index',
|
name: 'Index',
|
||||||
meta: { title: '首页', icon: 'dashboard', affix: true }
|
meta: { title: '首页', icon: 'dashboard', affix: true }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/user',
|
path: '/user',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
redirect: 'noredirect',
|
redirect: 'noredirect',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'profile',
|
path: 'profile',
|
||||||
component: () => import('@/views/system/user/profile/index'),
|
component: () => import('@/views/system/user/profile/index'),
|
||||||
name: 'Profile',
|
name: 'Profile',
|
||||||
meta: { title: '个人中心', icon: 'user' }
|
meta: { title: '个人中心', icon: 'user' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
// 动态路由,基于用户权限动态去加载
|
// 动态路由,基于用户权限动态去加载
|
||||||
export const dynamicRoutes = [
|
export const dynamicRoutes = [
|
||||||
{
|
{
|
||||||
path: '/system/user-auth',
|
path: '/system/user-auth',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
permissions: ['system:user:edit'],
|
permissions: ['system:user:edit'],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'role/:userId(\\d+)',
|
path: 'role/:userId(\\d+)',
|
||||||
component: () => import('@/views/system/user/authRole'),
|
component: () => import('@/views/system/user/authRole'),
|
||||||
name: 'AuthRole',
|
name: 'AuthRole',
|
||||||
meta: { title: '分配角色', activeMenu: '/system/user' }
|
meta: { title: '分配角色', activeMenu: '/system/user' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/system/role-auth',
|
path: '/system/role-auth',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
permissions: ['system:role:edit'],
|
permissions: ['system:role:edit'],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'user/:roleId(\\d+)',
|
path: 'user/:roleId(\\d+)',
|
||||||
component: () => import('@/views/system/role/authUser'),
|
component: () => import('@/views/system/role/authUser'),
|
||||||
name: 'AuthUser',
|
name: 'AuthUser',
|
||||||
meta: { title: '分配用户', activeMenu: '/system/role' }
|
meta: { title: '分配用户', activeMenu: '/system/role' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/system/dict-data',
|
path: '/system/dict-data',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
permissions: ['system:dict:list'],
|
permissions: ['system:dict:list'],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'index/:dictId(\\d+)',
|
path: 'index/:dictId(\\d+)',
|
||||||
component: () => import('@/views/system/dict/data'),
|
component: () => import('@/views/system/dict/data'),
|
||||||
name: 'Data',
|
name: 'Data',
|
||||||
meta: { title: '字典数据', activeMenu: '/system/dict' }
|
meta: { title: '字典数据', activeMenu: '/system/dict' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/monitor/job-log',
|
path: '/tool/gen-edit',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
permissions: ['monitor:job:list'],
|
permissions: ['tool:gen:edit'],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'index',
|
path: 'index',
|
||||||
component: () => import('@/views/monitor/job/log'),
|
component: () => import('@/views/tool/gen/editTable'),
|
||||||
name: 'JobLog',
|
name: 'GenEdit',
|
||||||
meta: { title: '调度日志', activeMenu: '/monitor/job' }
|
meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
{
|
]
|
||||||
path: '/tool/gen-edit',
|
|
||||||
component: Layout,
|
export default new Router({
|
||||||
hidden: true,
|
mode: 'history', // 去掉url中的#
|
||||||
permissions: ['tool:gen:edit'],
|
scrollBehavior: () => ({ y: 0 }),
|
||||||
children: [
|
routes: constantRoutes
|
||||||
{
|
})
|
||||||
path: 'index',
|
|
||||||
component: () => import('@/views/tool/gen/editTable'),
|
|
||||||
name: 'GenEdit',
|
|
||||||
meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
export default new Router({
|
|
||||||
mode: 'history', // 去掉url中的#
|
|
||||||
scrollBehavior: () => ({ y: 0 }),
|
|
||||||
routes: constantRoutes
|
|
||||||
})
|
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,9 @@
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<p>
|
<p>
|
||||||
<i class="el-icon-s-promotion"></i> 官网:<el-link
|
<i class="el-icon-s-promotion"></i> 官网:<el-link
|
||||||
href="http://www.ruoyi.vip"
|
href="https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>http://www.ruoyi.vip</el-link
|
>https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus</el-link
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,516 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="app-container">
|
|
||||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
|
||||||
<el-form-item label="任务名称" prop="jobName">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.jobName"
|
|
||||||
placeholder="请输入任务名称"
|
|
||||||
clearable
|
|
||||||
size="small"
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="任务组名" prop="jobGroup">
|
|
||||||
<el-select v-model="queryParams.jobGroup" placeholder="请选择任务组名" clearable size="small">
|
|
||||||
<el-option
|
|
||||||
v-for="dict in dict.type.sys_job_group"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="任务状态" prop="status">
|
|
||||||
<el-select v-model="queryParams.status" placeholder="请选择任务状态" clearable size="small">
|
|
||||||
<el-option
|
|
||||||
v-for="dict in dict.type.sys_job_status"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
plain
|
|
||||||
icon="el-icon-plus"
|
|
||||||
size="mini"
|
|
||||||
@click="handleAdd"
|
|
||||||
v-hasPermi="['monitor:job:add']"
|
|
||||||
>新增</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="success"
|
|
||||||
plain
|
|
||||||
icon="el-icon-edit"
|
|
||||||
size="mini"
|
|
||||||
:disabled="single"
|
|
||||||
@click="handleUpdate"
|
|
||||||
v-hasPermi="['monitor:job:edit']"
|
|
||||||
>修改</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
plain
|
|
||||||
icon="el-icon-delete"
|
|
||||||
size="mini"
|
|
||||||
:disabled="multiple"
|
|
||||||
@click="handleDelete"
|
|
||||||
v-hasPermi="['monitor:job:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="warning"
|
|
||||||
plain
|
|
||||||
icon="el-icon-download"
|
|
||||||
size="mini"
|
|
||||||
@click="handleExport"
|
|
||||||
v-hasPermi="['monitor:job:export']"
|
|
||||||
>导出</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="info"
|
|
||||||
plain
|
|
||||||
icon="el-icon-s-operation"
|
|
||||||
size="mini"
|
|
||||||
@click="handleJobLog"
|
|
||||||
v-hasPermi="['monitor:job:query']"
|
|
||||||
>日志</el-button>
|
|
||||||
</el-col>
|
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="jobList" @selection-change="handleSelectionChange">
|
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
|
||||||
<el-table-column label="任务编号" width="100" align="center" prop="jobId" />
|
|
||||||
<el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" />
|
|
||||||
<el-table-column label="任务组名" align="center" prop="jobGroup">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<dict-tag :options="dict.type.sys_job_group" :value="scope.row.jobGroup"/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" />
|
|
||||||
<el-table-column label="cron执行表达式" align="center" prop="cronExpression" :show-overflow-tooltip="true" />
|
|
||||||
<el-table-column label="状态" align="center">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-switch
|
|
||||||
v-model="scope.row.status"
|
|
||||||
active-value="0"
|
|
||||||
inactive-value="1"
|
|
||||||
@change="handleStatusChange(scope.row)"
|
|
||||||
></el-switch>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
|
||||||
type="text"
|
|
||||||
icon="el-icon-edit"
|
|
||||||
@click="handleUpdate(scope.row)"
|
|
||||||
v-hasPermi="['monitor:job:edit']"
|
|
||||||
>修改</el-button>
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
|
||||||
type="text"
|
|
||||||
icon="el-icon-delete"
|
|
||||||
@click="handleDelete(scope.row)"
|
|
||||||
v-hasPermi="['monitor:job:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
<el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['monitor:job:changeStatus', 'monitor:job:query']">
|
|
||||||
<span class="el-dropdown-link">
|
|
||||||
<i class="el-icon-d-arrow-right el-icon--right"></i>更多
|
|
||||||
</span>
|
|
||||||
<el-dropdown-menu slot="dropdown">
|
|
||||||
<el-dropdown-item command="handleRun" icon="el-icon-caret-right"
|
|
||||||
v-hasPermi="['monitor:job:changeStatus']">执行一次</el-dropdown-item>
|
|
||||||
<el-dropdown-item command="handleView" icon="el-icon-view"
|
|
||||||
v-hasPermi="['monitor:job:query']">任务详细</el-dropdown-item>
|
|
||||||
<el-dropdown-item command="handleJobLog" icon="el-icon-s-operation"
|
|
||||||
v-hasPermi="['monitor:job:query']">调度日志</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
|
||||||
</el-dropdown>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
|
|
||||||
<pagination
|
|
||||||
v-show="total>0"
|
|
||||||
:total="total"
|
|
||||||
:page.sync="queryParams.pageNum"
|
|
||||||
:limit.sync="queryParams.pageSize"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 添加或修改定时任务对话框 -->
|
|
||||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="任务名称" prop="jobName">
|
|
||||||
<el-input v-model="form.jobName" placeholder="请输入任务名称" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="任务分组" prop="jobGroup">
|
|
||||||
<el-select v-model="form.jobGroup" placeholder="请选择">
|
|
||||||
<el-option
|
|
||||||
v-for="dict in dict.type.sys_job_group"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-form-item prop="invokeTarget">
|
|
||||||
<span slot="label">
|
|
||||||
调用方法
|
|
||||||
<el-tooltip placement="top">
|
|
||||||
<div slot="content">
|
|
||||||
Bean调用示例:ryTask.ryParams('ry')
|
|
||||||
<br />Class类调用示例:com.ruoyi.quartz.task.RyTask.ryParams('ry')
|
|
||||||
<br />参数说明:支持字符串,布尔类型,长整型,浮点型,整型
|
|
||||||
</div>
|
|
||||||
<i class="el-icon-question"></i>
|
|
||||||
</el-tooltip>
|
|
||||||
</span>
|
|
||||||
<el-input v-model="form.invokeTarget" placeholder="请输入调用目标字符串" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-form-item label="cron表达式" prop="cronExpression">
|
|
||||||
<el-input v-model="form.cronExpression" placeholder="请输入cron执行表达式">
|
|
||||||
<template slot="append">
|
|
||||||
<el-button type="primary" @click="handleShowCron">
|
|
||||||
生成表达式
|
|
||||||
<i class="el-icon-time el-icon--right"></i>
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
</el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-form-item label="执行策略" prop="misfirePolicy">
|
|
||||||
<el-radio-group v-model="form.misfirePolicy" size="small">
|
|
||||||
<el-radio-button label="1">立即执行</el-radio-button>
|
|
||||||
<el-radio-button label="2">执行一次</el-radio-button>
|
|
||||||
<el-radio-button label="3">放弃执行</el-radio-button>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="是否并发" prop="concurrent">
|
|
||||||
<el-radio-group v-model="form.concurrent" size="small">
|
|
||||||
<el-radio-button label="0">允许</el-radio-button>
|
|
||||||
<el-radio-button label="1">禁止</el-radio-button>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="状态">
|
|
||||||
<el-radio-group v-model="form.status">
|
|
||||||
<el-radio
|
|
||||||
v-for="dict in dict.type.sys_job_status"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.value"
|
|
||||||
>{{dict.label}}</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-form>
|
|
||||||
<div slot="footer" class="dialog-footer">
|
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
||||||
<el-button @click="cancel">取 消</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
|
|
||||||
<el-dialog title="Cron表达式生成器" :visible.sync="openCron" append-to-body destroy-on-close class="scrollbar">
|
|
||||||
<crontab @hide="openCron=false" @fill="crontabFill" :expression="expression"></crontab>
|
|
||||||
</el-dialog>
|
|
||||||
|
|
||||||
<!-- 任务日志详细 -->
|
|
||||||
<el-dialog title="任务详细" :visible.sync="openView" width="700px" append-to-body>
|
|
||||||
<el-form ref="form" :model="form" label-width="120px" size="mini">
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="任务编号:">{{ form.jobId }}</el-form-item>
|
|
||||||
<el-form-item label="任务名称:">{{ form.jobName }}</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="任务分组:">{{ jobGroupFormat(form) }}</el-form-item>
|
|
||||||
<el-form-item label="创建时间:">{{ form.createTime }}</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="cron表达式:">{{ form.cronExpression }}</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="下次执行时间:">{{ parseTime(form.nextValidTime) }}</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-form-item label="调用目标方法:">{{ form.invokeTarget }}</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="任务状态:">
|
|
||||||
<div v-if="form.status == 0">正常</div>
|
|
||||||
<div v-else-if="form.status == 1">失败</div>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="是否并发:">
|
|
||||||
<div v-if="form.concurrent == 0">允许</div>
|
|
||||||
<div v-else-if="form.concurrent == 1">禁止</div>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="执行策略:">
|
|
||||||
<div v-if="form.misfirePolicy == 0">默认策略</div>
|
|
||||||
<div v-else-if="form.misfirePolicy == 1">立即执行</div>
|
|
||||||
<div v-else-if="form.misfirePolicy == 2">执行一次</div>
|
|
||||||
<div v-else-if="form.misfirePolicy == 3">放弃执行</div>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-form>
|
|
||||||
<div slot="footer" class="dialog-footer">
|
|
||||||
<el-button @click="openView = false">关 闭</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { listJob, getJob, delJob, addJob, updateJob, runJob, changeJobStatus } from "@/api/monitor/job";
|
|
||||||
import Crontab from '@/components/Crontab'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: { Crontab },
|
|
||||||
name: "Job",
|
|
||||||
dicts: ['sys_job_group', 'sys_job_status'],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
// 遮罩层
|
|
||||||
loading: true,
|
|
||||||
// 选中数组
|
|
||||||
ids: [],
|
|
||||||
// 非单个禁用
|
|
||||||
single: true,
|
|
||||||
// 非多个禁用
|
|
||||||
multiple: true,
|
|
||||||
// 显示搜索条件
|
|
||||||
showSearch: true,
|
|
||||||
// 总条数
|
|
||||||
total: 0,
|
|
||||||
// 定时任务表格数据
|
|
||||||
jobList: [],
|
|
||||||
// 弹出层标题
|
|
||||||
title: "",
|
|
||||||
// 是否显示弹出层
|
|
||||||
open: false,
|
|
||||||
// 是否显示详细弹出层
|
|
||||||
openView: false,
|
|
||||||
// 是否显示Cron表达式弹出层
|
|
||||||
openCron: false,
|
|
||||||
// 传入的表达式
|
|
||||||
expression: "",
|
|
||||||
// 查询参数
|
|
||||||
queryParams: {
|
|
||||||
pageNum: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
jobName: undefined,
|
|
||||||
jobGroup: undefined,
|
|
||||||
status: undefined
|
|
||||||
},
|
|
||||||
// 表单参数
|
|
||||||
form: {},
|
|
||||||
// 表单校验
|
|
||||||
rules: {
|
|
||||||
jobName: [
|
|
||||||
{ required: true, message: "任务名称不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
invokeTarget: [
|
|
||||||
{ required: true, message: "调用目标字符串不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
cronExpression: [
|
|
||||||
{ required: true, message: "cron执行表达式不能为空", trigger: "blur" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.getList();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
/** 查询定时任务列表 */
|
|
||||||
getList() {
|
|
||||||
this.loading = true;
|
|
||||||
listJob(this.queryParams).then(response => {
|
|
||||||
this.jobList = response.rows;
|
|
||||||
this.total = response.total;
|
|
||||||
this.loading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 任务组名字典翻译
|
|
||||||
jobGroupFormat(row, column) {
|
|
||||||
return this.selectDictLabel(this.dict.type.sys_job_group, row.jobGroup);
|
|
||||||
},
|
|
||||||
// 取消按钮
|
|
||||||
cancel() {
|
|
||||||
this.open = false;
|
|
||||||
this.reset();
|
|
||||||
},
|
|
||||||
// 表单重置
|
|
||||||
reset() {
|
|
||||||
this.form = {
|
|
||||||
jobId: undefined,
|
|
||||||
jobName: undefined,
|
|
||||||
jobGroup: undefined,
|
|
||||||
invokeTarget: undefined,
|
|
||||||
cronExpression: undefined,
|
|
||||||
misfirePolicy: 1,
|
|
||||||
concurrent: 1,
|
|
||||||
status: "0"
|
|
||||||
};
|
|
||||||
this.resetForm("form");
|
|
||||||
},
|
|
||||||
/** 搜索按钮操作 */
|
|
||||||
handleQuery() {
|
|
||||||
this.queryParams.pageNum = 1;
|
|
||||||
this.getList();
|
|
||||||
},
|
|
||||||
/** 重置按钮操作 */
|
|
||||||
resetQuery() {
|
|
||||||
this.resetForm("queryForm");
|
|
||||||
this.handleQuery();
|
|
||||||
},
|
|
||||||
// 多选框选中数据
|
|
||||||
handleSelectionChange(selection) {
|
|
||||||
this.ids = selection.map(item => item.jobId);
|
|
||||||
this.single = selection.length != 1;
|
|
||||||
this.multiple = !selection.length;
|
|
||||||
},
|
|
||||||
// 更多操作触发
|
|
||||||
handleCommand(command, row) {
|
|
||||||
switch (command) {
|
|
||||||
case "handleRun":
|
|
||||||
this.handleRun(row);
|
|
||||||
break;
|
|
||||||
case "handleView":
|
|
||||||
this.handleView(row);
|
|
||||||
break;
|
|
||||||
case "handleJobLog":
|
|
||||||
this.handleJobLog(row);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 任务状态修改
|
|
||||||
handleStatusChange(row) {
|
|
||||||
let text = row.status === "0" ? "启用" : "停用";
|
|
||||||
this.$modal.confirm('确认要"' + text + '""' + row.jobName + '"任务吗?').then(function() {
|
|
||||||
return changeJobStatus(row.jobId, row.status);
|
|
||||||
}).then(() => {
|
|
||||||
this.$modal.msgSuccess(text + "成功");
|
|
||||||
}).catch(function() {
|
|
||||||
row.status = row.status === "0" ? "1" : "0";
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/* 立即执行一次 */
|
|
||||||
handleRun(row) {
|
|
||||||
this.$modal.confirm('确认要立即执行一次"' + row.jobName + '"任务吗?').then(function() {
|
|
||||||
return runJob(row.jobId, row.jobGroup);
|
|
||||||
}).then(() => {
|
|
||||||
this.$modal.msgSuccess("执行成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
},
|
|
||||||
/** 任务详细信息 */
|
|
||||||
handleView(row) {
|
|
||||||
getJob(row.jobId).then(response => {
|
|
||||||
this.form = response.data;
|
|
||||||
this.openView = true;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** cron表达式按钮操作 */
|
|
||||||
handleShowCron() {
|
|
||||||
this.expression = this.form.cronExpression;
|
|
||||||
this.openCron = true;
|
|
||||||
},
|
|
||||||
/** 确定后回传值 */
|
|
||||||
crontabFill(value) {
|
|
||||||
this.form.cronExpression = value;
|
|
||||||
},
|
|
||||||
/** 任务日志列表查询 */
|
|
||||||
handleJobLog(row) {
|
|
||||||
const jobId = row.jobId || 0;
|
|
||||||
this.$router.push({ path: '/monitor/job-log/index', query: { jobId: jobId } })
|
|
||||||
},
|
|
||||||
/** 新增按钮操作 */
|
|
||||||
handleAdd() {
|
|
||||||
this.reset();
|
|
||||||
this.open = true;
|
|
||||||
this.title = "添加任务";
|
|
||||||
},
|
|
||||||
/** 修改按钮操作 */
|
|
||||||
handleUpdate(row) {
|
|
||||||
this.reset();
|
|
||||||
const jobId = row.jobId || this.ids;
|
|
||||||
getJob(jobId).then(response => {
|
|
||||||
this.form = response.data;
|
|
||||||
this.open = true;
|
|
||||||
this.title = "修改任务";
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 提交按钮 */
|
|
||||||
submitForm: function() {
|
|
||||||
this.$refs["form"].validate(valid => {
|
|
||||||
if (valid) {
|
|
||||||
if (this.form.jobId != undefined) {
|
|
||||||
updateJob(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("修改成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
addJob(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("新增成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 删除按钮操作 */
|
|
||||||
handleDelete(row) {
|
|
||||||
const jobIds = row.jobId || this.ids;
|
|
||||||
this.$modal.confirm('是否确认删除定时任务编号为"' + jobIds + '"的数据项?').then(function() {
|
|
||||||
return delJob(jobIds);
|
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.$modal.msgSuccess("删除成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
},
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
handleExport() {
|
|
||||||
this.download('schedule/job/export', {
|
|
||||||
...this.queryParams
|
|
||||||
}, `job_${new Date().getTime()}.xlsx`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
@ -1,299 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="app-container">
|
|
||||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
|
||||||
<el-form-item label="任务名称" prop="jobName">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.jobName"
|
|
||||||
placeholder="请输入任务名称"
|
|
||||||
clearable
|
|
||||||
size="small"
|
|
||||||
style="width: 240px"
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="任务组名" prop="jobGroup">
|
|
||||||
<el-select
|
|
||||||
v-model="queryParams.jobGroup"
|
|
||||||
placeholder="请任务组名"
|
|
||||||
clearable
|
|
||||||
size="small"
|
|
||||||
style="width: 240px"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="dict in dict.type.sys_job_group"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="执行状态" prop="status">
|
|
||||||
<el-select
|
|
||||||
v-model="queryParams.status"
|
|
||||||
placeholder="请选择执行状态"
|
|
||||||
clearable
|
|
||||||
size="small"
|
|
||||||
style="width: 240px"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="dict in dict.type.sys_common_status"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="执行时间">
|
|
||||||
<el-date-picker
|
|
||||||
v-model="dateRange"
|
|
||||||
size="small"
|
|
||||||
style="width: 240px"
|
|
||||||
value-format="yyyy-MM-dd"
|
|
||||||
type="daterange"
|
|
||||||
range-separator="-"
|
|
||||||
start-placeholder="开始日期"
|
|
||||||
end-placeholder="结束日期"
|
|
||||||
></el-date-picker>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
plain
|
|
||||||
icon="el-icon-delete"
|
|
||||||
size="mini"
|
|
||||||
:disabled="multiple"
|
|
||||||
@click="handleDelete"
|
|
||||||
v-hasPermi="['monitor:job:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
plain
|
|
||||||
icon="el-icon-delete"
|
|
||||||
size="mini"
|
|
||||||
@click="handleClean"
|
|
||||||
v-hasPermi="['monitor:job:remove']"
|
|
||||||
>清空</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="warning"
|
|
||||||
plain
|
|
||||||
icon="el-icon-download"
|
|
||||||
size="mini"
|
|
||||||
@click="handleExport"
|
|
||||||
v-hasPermi="['monitor:job:export']"
|
|
||||||
>导出</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="warning"
|
|
||||||
plain
|
|
||||||
icon="el-icon-close"
|
|
||||||
size="mini"
|
|
||||||
@click="handleClose"
|
|
||||||
>关闭</el-button>
|
|
||||||
</el-col>
|
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="jobLogList" @selection-change="handleSelectionChange">
|
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
|
||||||
<el-table-column label="日志编号" width="80" align="center" prop="jobLogId" />
|
|
||||||
<el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" />
|
|
||||||
<el-table-column label="任务组名" align="center" prop="jobGroup" :show-overflow-tooltip="true">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<dict-tag :options="dict.type.sys_job_group" :value="scope.row.jobGroup"/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" />
|
|
||||||
<el-table-column label="日志信息" align="center" prop="jobMessage" :show-overflow-tooltip="true" />
|
|
||||||
<el-table-column label="执行状态" align="center" prop="status">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<dict-tag :options="dict.type.sys_common_status" :value="scope.row.status"/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="执行时间" align="center" prop="createTime" width="180">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
|
||||||
type="text"
|
|
||||||
icon="el-icon-view"
|
|
||||||
@click="handleView(scope.row)"
|
|
||||||
v-hasPermi="['monitor:job:query']"
|
|
||||||
>详细</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
|
|
||||||
<pagination
|
|
||||||
v-show="total>0"
|
|
||||||
:total="total"
|
|
||||||
:page.sync="queryParams.pageNum"
|
|
||||||
:limit.sync="queryParams.pageSize"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 调度日志详细 -->
|
|
||||||
<el-dialog title="调度日志详细" :visible.sync="open" width="700px" append-to-body>
|
|
||||||
<el-form ref="form" :model="form" label-width="100px" size="mini">
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="日志序号:">{{ form.jobLogId }}</el-form-item>
|
|
||||||
<el-form-item label="任务名称:">{{ form.jobName }}</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="任务分组:">{{ form.jobGroup }}</el-form-item>
|
|
||||||
<el-form-item label="执行时间:">{{ form.createTime }}</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-form-item label="调用方法:">{{ form.invokeTarget }}</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-form-item label="日志信息:">{{ form.jobMessage }}</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-form-item label="执行状态:">
|
|
||||||
<div v-if="form.status == 0">正常</div>
|
|
||||||
<div v-else-if="form.status == 1">失败</div>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-form-item label="异常信息:" v-if="form.status == 1">{{ form.exceptionInfo }}</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-form>
|
|
||||||
<div slot="footer" class="dialog-footer">
|
|
||||||
<el-button @click="open = false">关 闭</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { getJob} from "@/api/monitor/job";
|
|
||||||
import { listJobLog, delJobLog, cleanJobLog } from "@/api/monitor/jobLog";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "JobLog",
|
|
||||||
dicts: ['sys_common_status', 'sys_job_group'],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
// 遮罩层
|
|
||||||
loading: true,
|
|
||||||
// 选中数组
|
|
||||||
ids: [],
|
|
||||||
// 非多个禁用
|
|
||||||
multiple: true,
|
|
||||||
// 显示搜索条件
|
|
||||||
showSearch: true,
|
|
||||||
// 总条数
|
|
||||||
total: 0,
|
|
||||||
// 调度日志表格数据
|
|
||||||
jobLogList: [],
|
|
||||||
// 是否显示弹出层
|
|
||||||
open: false,
|
|
||||||
// 日期范围
|
|
||||||
dateRange: [],
|
|
||||||
// 表单参数
|
|
||||||
form: {},
|
|
||||||
// 查询参数
|
|
||||||
queryParams: {
|
|
||||||
pageNum: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
jobName: undefined,
|
|
||||||
jobGroup: undefined,
|
|
||||||
status: undefined
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
const jobId = this.$route.query.jobId;
|
|
||||||
if (jobId !== undefined && jobId != 0) {
|
|
||||||
getJob(jobId).then(response => {
|
|
||||||
this.queryParams.jobName = response.data.jobName;
|
|
||||||
this.queryParams.jobGroup = response.data.jobGroup;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.getList();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
/** 查询调度日志列表 */
|
|
||||||
getList() {
|
|
||||||
this.loading = true;
|
|
||||||
listJobLog(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
|
||||||
this.jobLogList = response.rows;
|
|
||||||
this.total = response.total;
|
|
||||||
this.loading = false;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
// 返回按钮
|
|
||||||
handleClose() {
|
|
||||||
const obj = { path: "/monitor/job" };
|
|
||||||
this.$tab.closeOpenPage(obj);
|
|
||||||
},
|
|
||||||
/** 搜索按钮操作 */
|
|
||||||
handleQuery() {
|
|
||||||
this.queryParams.pageNum = 1;
|
|
||||||
this.getList();
|
|
||||||
},
|
|
||||||
/** 重置按钮操作 */
|
|
||||||
resetQuery() {
|
|
||||||
this.dateRange = [];
|
|
||||||
this.resetForm("queryForm");
|
|
||||||
this.handleQuery();
|
|
||||||
},
|
|
||||||
// 多选框选中数据
|
|
||||||
handleSelectionChange(selection) {
|
|
||||||
this.ids = selection.map(item => item.jobLogId);
|
|
||||||
this.multiple = !selection.length;
|
|
||||||
},
|
|
||||||
/** 详细按钮操作 */
|
|
||||||
handleView(row) {
|
|
||||||
this.open = true;
|
|
||||||
this.form = row;
|
|
||||||
},
|
|
||||||
/** 删除按钮操作 */
|
|
||||||
handleDelete(row) {
|
|
||||||
const jobLogIds = this.ids;
|
|
||||||
this.$modal.confirm('是否确认删除调度日志编号为"' + jobLogIds + '"的数据项?').then(function() {
|
|
||||||
return delJobLog(jobLogIds);
|
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.$modal.msgSuccess("删除成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
},
|
|
||||||
/** 清空按钮操作 */
|
|
||||||
handleClean() {
|
|
||||||
this.$modal.confirm('是否确认清空所有调度日志数据项?').then(function() {
|
|
||||||
return cleanJobLog();
|
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.$modal.msgSuccess("清空成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
},
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
handleExport() {
|
|
||||||
this.download('schedule/job/log/export', {
|
|
||||||
...this.queryParams
|
|
||||||
}, `log_${new Date().getTime()}.xlsx`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
<modules>
|
<modules>
|
||||||
<module>ruoyi-monitor</module>
|
<module>ruoyi-monitor</module>
|
||||||
<module>ruoyi-xxl-job-admin</module>
|
<module>ruoyi-xxl-job-admin</module>
|
||||||
|
<module>ruoyi-doc</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>ruoyi-visual</artifactId>
|
<artifactId>ruoyi-visual</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-visual</artifactId>
|
||||||
|
<version>0.3.0</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>ruoyi-doc</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos Config -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringBoot Actuator -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- knife4j -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
|
<artifactId>knife4j-aggregation-spring-boot-starter</artifactId>
|
||||||
|
<version>${knife4j-aggregation.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<!-- docker -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.spotify</groupId>
|
||||||
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
|
<version>${docker.plugin.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<imageName>${docker.namespace}/${project.artifactId}:${project.version}</imageName>
|
||||||
|
<dockerDirectory>${project.basedir}</dockerDirectory>
|
||||||
|
<dockerHost>${docker.registry.host}</dockerHost>
|
||||||
|
<registryUrl>${docker.registry.url}</registryUrl>
|
||||||
|
<serverId>${docker.registry.url}</serverId>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<targetPath>/</targetPath>
|
||||||
|
<directory>${project.build.directory}</directory>
|
||||||
|
<include>${project.build.finalName}.jar</include>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.ruoyi.doc;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文档服务
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@SpringBootApplication
|
||||||
|
public class RuoyiDocApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(RuoyiDocApplication.class, args);
|
||||||
|
System.out.println("(♥◠‿◠)ノ゙ 文档中心 启动成功 ლ(´ڡ`ლ)゙ ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
server:
|
||||||
|
port: 18000
|
||||||
|
|
||||||
|
# knife4j聚合配置
|
||||||
|
knife4j:
|
||||||
|
enableAggregation: true
|
||||||
|
# cloud模式
|
||||||
|
cloud:
|
||||||
|
# 是否启用
|
||||||
|
enable: true
|
||||||
|
# 网关地址
|
||||||
|
gatewayUri: 127.0.0.1:8080
|
||||||
|
# 需要聚合的服务集合
|
||||||
|
routes:
|
||||||
|
- name: 系统服务
|
||||||
|
uri: ${knife4j.cloud.gatewayUri}
|
||||||
|
location: /system/v2/api-docs
|
||||||
|
- name: 代码生成
|
||||||
|
uri: ${knife4j.cloud.gatewayUri}
|
||||||
|
location: /code/v2/api-docs
|
||||||
|
- name: 文件服务
|
||||||
|
uri: ${knife4j.cloud.gatewayUri}
|
||||||
|
location: /file/v2/api-docs
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 9300
|
||||||
|
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: ruoyi-doc
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: @profiles.active@
|
||||||
|
|
||||||
|
--- # nacos 配置
|
||||||
|
spring:
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
# nacos 服务地址
|
||||||
|
server-addr: @nacos.server@
|
||||||
|
discovery:
|
||||||
|
# 注册组
|
||||||
|
group: @nacos.discovery.group@
|
||||||
|
namespace: ${spring.profiles.active}
|
||||||
|
config:
|
||||||
|
# 配置组
|
||||||
|
group: @nacos.config.group@
|
||||||
|
namespace: ${spring.profiles.active}
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
- data-id: application.${spring.cloud.nacos.config.file-extension}
|
||||||
|
refresh: true
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="logs/ruoyi-doc"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="console.log.pattern"
|
||||||
|
value="%red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}%n) - %msg%n"/>
|
||||||
|
<property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"/>
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${console.log.pattern}</pattern>
|
||||||
|
<charset>utf-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="file_console" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/console.log</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/console.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大 1天 -->
|
||||||
|
<maxHistory>1</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
<charset>utf-8</charset>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统日志输出 -->
|
||||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/info.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/error.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.ruoyi" level="info"/>
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn"/>
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="console"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info"/>
|
||||||
|
<appender-ref ref="file_error"/>
|
||||||
|
<appender-ref ref="file_console"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
||||||
|
|
@ -174,13 +174,13 @@ insert into sys_menu values('106', '参数设置', '1', '7', 'config',
|
||||||
insert into sys_menu values('107', '通知公告', '1', '8', 'notice', 'system/notice/index', '', 1, 0, 'C', '0', '0', 'system:notice:list', 'message', 'admin', sysdate(), '', null, '通知公告菜单');
|
insert into sys_menu values('107', '通知公告', '1', '8', 'notice', 'system/notice/index', '', 1, 0, 'C', '0', '0', 'system:notice:list', 'message', 'admin', sysdate(), '', null, '通知公告菜单');
|
||||||
insert into sys_menu values('108', '日志管理', '1', '9', 'log', '', '', 1, 0, 'M', '0', '0', '', 'log', 'admin', sysdate(), '', null, '日志管理菜单');
|
insert into sys_menu values('108', '日志管理', '1', '9', 'log', '', '', 1, 0, 'M', '0', '0', '', 'log', 'admin', sysdate(), '', null, '日志管理菜单');
|
||||||
insert into sys_menu values('109', '在线用户', '2', '1', 'online', 'monitor/online/index', '', 1, 0, 'C', '0', '0', 'monitor:online:list', 'online', 'admin', sysdate(), '', null, '在线用户菜单');
|
insert into sys_menu values('109', '在线用户', '2', '1', 'online', 'monitor/online/index', '', 1, 0, 'C', '0', '0', 'monitor:online:list', 'online', 'admin', sysdate(), '', null, '在线用户菜单');
|
||||||
insert into sys_menu values('110', 'XxlJob控制台', '2', '2', 'http://localhost:9900', '', '', 0, 0, 'C', '0', '0', 'monitor:job:list', 'job', 'admin', sysdate(), '', null, '定时任务菜单');
|
insert into sys_menu values('110', 'XxlJob控制台', '2', '2', 'http://localhost:9900', '', '', 0, 0, 'C', '0', '0', 'monitor:job:list', 'job', 'admin', sysdate(), '', null, '定时任务菜单');
|
||||||
insert into sys_menu values('111', 'Sentinel控制台', '2', '3', 'http://localhost:8718', '', '', 0, 0, 'C', '0', '0', 'monitor:sentinel:list', 'sentinel', 'admin', sysdate(), '', null, '流量控制菜单');
|
insert into sys_menu values('111', 'Sentinel控制台', '2', '3', 'http://localhost:8718', '', '', 0, 0, 'C', '0', '0', 'monitor:sentinel:list', 'sentinel', 'admin', sysdate(), '', null, '流量控制菜单');
|
||||||
insert into sys_menu values('112', 'Nacos控制台', '2', '4', 'http://localhost:8848/nacos', '', '', 0, 0, 'C', '0', '0', 'monitor:nacos:list', 'nacos', 'admin', sysdate(), '', null, '服务治理菜单');
|
insert into sys_menu values('112', 'Nacos控制台', '2', '4', 'http://localhost:8848/nacos', '', '', 0, 0, 'C', '0', '0', 'monitor:nacos:list', 'nacos', 'admin', sysdate(), '', null, '服务治理菜单');
|
||||||
insert into sys_menu values('113', 'Admin控制台', '2', '5', 'http://localhost:9100/login', '', '', 0, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', sysdate(), '', null, '服务监控菜单');
|
insert into sys_menu values('113', 'Admin控制台', '2', '5', 'http://localhost:9100/login', '', '', 0, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', sysdate(), '', null, '服务监控菜单');
|
||||||
insert into sys_menu values('114', '表单构建', '3', '1', 'build', 'tool/build/index', '', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', sysdate(), '', null, '表单构建菜单');
|
insert into sys_menu values('114', '表单构建', '3', '1', 'build', 'tool/build/index', '', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', sysdate(), '', null, '表单构建菜单');
|
||||||
insert into sys_menu values('115', '代码生成', '3', '2', 'gen', 'tool/gen/index', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', sysdate(), '', null, '代码生成菜单');
|
insert into sys_menu values('115', '代码生成', '3', '2', 'gen', 'tool/gen/index', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', sysdate(), '', null, '代码生成菜单');
|
||||||
insert into sys_menu values('116', '系统接口', '3', '3', 'http://localhost:8080/swagger-ui/index.html', '', '', 0, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', sysdate(), '', null, '系统接口菜单');
|
insert into sys_menu values('116', '系统接口', '3', '3', 'http://localhost:18000/doc.html', '', '', 0, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', sysdate(), '', null, '系统接口菜单');
|
||||||
-- 三级菜单
|
-- 三级菜单
|
||||||
insert into sys_menu values('500', '操作日志', '108', '1', 'operlog', 'system/operlog/index', '', 1, 0, 'C', '0', '0', 'system:operlog:list', 'form', 'admin', sysdate(), '', null, '操作日志菜单');
|
insert into sys_menu values('500', '操作日志', '108', '1', 'operlog', 'system/operlog/index', '', 1, 0, 'C', '0', '0', 'system:operlog:list', 'form', 'admin', sysdate(), '', null, '操作日志菜单');
|
||||||
insert into sys_menu values('501', '登录日志', '108', '2', 'logininfor', 'system/logininfor/index', '', 1, 0, 'C', '0', '0', 'system:logininfor:list', 'logininfor', 'admin', sysdate(), '', null, '登录日志菜单');
|
insert into sys_menu values('501', '登录日志', '108', '2', 'logininfor', 'system/logininfor/index', '', 1, 0, 'C', '0', '0', 'system:logininfor:list', 'logininfor', 'admin', sysdate(), '', null, '登录日志菜单');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue