diff --git a/.gitignore b/.gitignore index 4916f7a2..d994f235 100644 --- a/.gitignore +++ b/.gitignore @@ -1,43 +1,45 @@ -###################################################################### -# Build Tools - -.gradle -/build/ -!gradle/wrapper/gradle-wrapper.jar - -target/ -!.mvn/wrapper/maven-wrapper.jar - -###################################################################### -# IDE - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -nbproject/private/ -build/* -nbbuild/ -dist/ -nbdist/ -.nb-gradle/ - -###################################################################### -# Others -*.log -*.xml.versionsBackup - -!*/build/*.java -!*/build/*.html -!*/build/*.xml \ No newline at end of file +###################################################################### +# Build Tools + +.gradle +/build/ +!gradle/wrapper/gradle-wrapper.jar + +target/ +!.mvn/wrapper/maven-wrapper.jar + +###################################################################### +# IDE + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +nbproject/private/ +build/* +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ + +###################################################################### +# Others +*.log +*.xml.versionsBackup + +!*/build/*.java +!*/build/*.html +!*/build/*.xml +/**/src/main/resources/.triggerFile +/**/**/src/main/resources/.triggerFile \ No newline at end of file diff --git a/pom.xml b/pom.xml index 392cd0c5..35fc79ed 100644 --- a/pom.xml +++ b/pom.xml @@ -1,237 +1,251 @@ - - - 4.0.0 - - com.ruoyi - ruoyi - 1.0.0 - - ruoyi - http://www.ruoyi.vip - 若依微服务系统 - - - 1.0.0 - UTF-8 - UTF-8 - 1.8 - 2.2.6.RELEASE - Hoxton.SR4 - 2.2.3 - 2.1.2 - 2.9.2 - 1.5.24 - 2.3.2 - 1.2.12 - 2.5 - 1.3.3 - 1.7 - 1.2.68 - 3.17 - 2.6.2 - 1.19 - - - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - com.alibaba.cloud - spring-cloud-alibaba-dependencies - 2.1.0.RELEASE - pom - import - - - - - org.springframework.boot - spring-boot-dependencies - ${spring-boot.version} - pom - import - - - - - de.codecentric - spring-boot-admin-starter-client - ${spring-boot-admin.version} - - - - - org.mybatis.spring.boot - mybatis-spring-boot-starter - ${spring-boot.mybatis} - - - - - io.swagger - swagger-models - ${swagger.core.version} - - - io.swagger - swagger-annotations - ${swagger.core.version} - - - - - com.github.penggle - kaptcha - ${kaptcha.version} - - - - - com.github.pagehelper - pagehelper-spring-boot-starter - ${pagehelper.boot.version} - - - - - commons-io - commons-io - ${commons.io.version} - - - - - org.apache.poi - poi-ooxml - ${poi.version} - - - - - commons-fileupload - commons-fileupload - ${commons.fileupload.version} - - - - - org.apache.velocity - velocity - ${velocity.version} - - - - - com.alibaba - fastjson - ${fastjson.version} - - - - - org.apache.commons - commons-pool2 - ${common-pool.version} - - - - - eu.bitwalker - UserAgentUtils - ${bitwalker.version} - - - - - com.ruoyi - ruoyi-common-core - ${ruoyi.version} - - - - - com.ruoyi - ruoyi-common-swagger - ${ruoyi.version} - - - - - com.ruoyi - ruoyi-common-security - ${ruoyi.version} - - - - - com.ruoyi - ruoyi-common-datascope - ${ruoyi.version} - - - - - com.ruoyi - ruoyi-common-log - ${ruoyi.version} - - - - - com.ruoyi - ruoyi-common-redis - ${ruoyi.version} - - - - - com.ruoyi - ruoyi-api-system - ${ruoyi.version} - - - - - - - ruoyi-auth - ruoyi-gateway - ruoyi-visual - ruoyi-modules - ruoyi-api - ruoyi-common - - pom - - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${java.version} - ${java.version} - ${project.build.sourceEncoding} - - - - - + + + 4.0.0 + + com.ruoyi + ruoyi + 1.0.0 + + ruoyi + http://www.ruoyi.vip + 若依微服务系统 + + + 1.0.0 + UTF-8 + UTF-8 + 1.8 + 2.2.6.RELEASE + Hoxton.SR4 + 2.2.3 + 2.1.2 + 2.9.2 + 1.5.24 + 2.3.2 + 1.2.12 + 2.5 + 1.3.3 + 1.7 + 1.2.68 + 3.17 + 2.6.2 + 1.19 + + + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + com.alibaba.cloud + spring-cloud-alibaba-dependencies + 2.1.0.RELEASE + pom + import + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + + + de.codecentric + spring-boot-admin-starter-client + ${spring-boot-admin.version} + + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + ${spring-boot.mybatis} + + + + + io.swagger + swagger-models + ${swagger.core.version} + + + io.swagger + swagger-annotations + ${swagger.core.version} + + + + + com.github.penggle + kaptcha + ${kaptcha.version} + + + + + com.github.pagehelper + pagehelper-spring-boot-starter + ${pagehelper.boot.version} + + + + + commons-io + commons-io + ${commons.io.version} + + + + + org.apache.poi + poi-ooxml + ${poi.version} + + + + + commons-fileupload + commons-fileupload + ${commons.fileupload.version} + + + + + org.apache.velocity + velocity + ${velocity.version} + + + + + com.alibaba + fastjson + ${fastjson.version} + + + + + org.apache.commons + commons-pool2 + ${common-pool.version} + + + + + eu.bitwalker + UserAgentUtils + ${bitwalker.version} + + + + + com.ruoyi + ruoyi-common-core + ${ruoyi.version} + + + + + com.ruoyi + ruoyi-common-swagger + ${ruoyi.version} + + + + + com.ruoyi + ruoyi-common-security + ${ruoyi.version} + + + + + com.ruoyi + ruoyi-common-datascope + ${ruoyi.version} + + + + + com.ruoyi + ruoyi-common-log + ${ruoyi.version} + + + + + com.ruoyi + ruoyi-common-redis + ${ruoyi.version} + + + + + com.ruoyi + ruoyi-api-system + ${ruoyi.version} + + + + com.alibaba + druid-spring-boot-starter + 1.1.14 + + + + org.projectlombok + lombok + 1.18.10 + + + + + + + + + ruoyi-auth + ruoyi-gateway + ruoyi-visual + ruoyi-modules + ruoyi-api + ruoyi-common + + pom + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + ${java.version} + ${java.version} + ${project.build.sourceEncoding} + + + + + \ No newline at end of file diff --git a/ruoyi-api/ruoyi-api-system/pom.xml b/ruoyi-api/ruoyi-api-system/pom.xml index 50333181..cbc04788 100644 --- a/ruoyi-api/ruoyi-api-system/pom.xml +++ b/ruoyi-api/ruoyi-api-system/pom.xml @@ -1,28 +1,33 @@ - - - - com.ruoyi - ruoyi-api - 1.0.0 - - 4.0.0 - - ruoyi-api-system - - - ruoyi-api-system系统接口模块 - - - - - - - com.ruoyi - ruoyi-common-core - - - - + + + + com.ruoyi + ruoyi-api + 1.0.0 + + 4.0.0 + + ruoyi-api-system + + + ruoyi-api-system系统接口模块 + + + + + + + com.ruoyi + ruoyi-common-core + + + + com.alibaba + druid-spring-boot-starter + + + + \ No newline at end of file diff --git a/ruoyi-auth/pom.xml b/ruoyi-auth/pom.xml index 26d58a6d..00e528cb 100644 --- a/ruoyi-auth/pom.xml +++ b/ruoyi-auth/pom.xml @@ -1,63 +1,74 @@ - - - com.ruoyi - ruoyi - 1.0.0 - - 4.0.0 - - ruoyi-auth - - - ruoyi-auth认证授权中心 - - - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-discovery - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-config - - - - - org.springframework.cloud - spring-cloud-starter-netflix-hystrix - - - - - org.springframework.boot - spring-boot-starter-web - - - - - mysql - mysql-connector-java - - - - - com.ruoyi - ruoyi-common-security - - - - - com.ruoyi - ruoyi-common-redis - - - - - + + + com.ruoyi + ruoyi + 1.0.0 + + 4.0.0 + + ruoyi-auth + + + ruoyi-auth认证授权中心 + + + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + + org.springframework.cloud + spring-cloud-starter-netflix-hystrix + + + + + org.springframework.boot + spring-boot-starter-web + + + + + mysql + mysql-connector-java + + + + + com.ruoyi + ruoyi-common-security + + + + + com.ruoyi + ruoyi-common-redis + + + + com.alibaba + druid-spring-boot-starter + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + + diff --git a/ruoyi-auth/src/main/java/com/ruoyi/auth/config/WebSecurityConfig.java b/ruoyi-auth/src/main/java/com/ruoyi/auth/config/WebSecurityConfig.java index a22e7bf7..2f59a631 100644 --- a/ruoyi-auth/src/main/java/com/ruoyi/auth/config/WebSecurityConfig.java +++ b/ruoyi-auth/src/main/java/com/ruoyi/auth/config/WebSecurityConfig.java @@ -1,68 +1,71 @@ -package com.ruoyi.auth.config; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Primary; -import org.springframework.core.annotation.Order; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.builders.WebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import org.springframework.security.crypto.password.PasswordEncoder; - -/** - * Security 安全认证相关配置 - * Oauth2依赖于Security 默认情况下WebSecurityConfig执行比ResourceServerConfig优先 - * - * @author ruoyi - */ -@Primary -@Order(90) -@Configuration -public class WebSecurityConfig extends WebSecurityConfigurerAdapter -{ - @Autowired - private UserDetailsService userDetailsService; - - @Bean - public PasswordEncoder passwordEncoder() - { - return new BCryptPasswordEncoder(); - } - - @Bean - @Override - public AuthenticationManager authenticationManagerBean() throws Exception - { - return super.authenticationManagerBean(); - } - - @Override - protected void configure(AuthenticationManagerBuilder auth) throws Exception - { - auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder()); - } - - @Override - protected void configure(HttpSecurity http) throws Exception - { - http - .authorizeRequests() - .antMatchers( - "/actuator/**", - "/token/**").permitAll() - .anyRequest().authenticated() - .and().csrf().disable(); - } - - /*** 设置不拦截规则 */ - @Override - public void configure(WebSecurity web) - { - web.ignoring().antMatchers("/css/**", "/js/**", "/plugins/**", "/favicon.ico"); - } -} +package com.ruoyi.auth.config; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.core.annotation.Order; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.builders.WebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; + +/** + * Security 安全认证相关配置 + * Oauth2依赖于Security 默认情况下WebSecurityConfig执行比ResourceServerConfig优先 + * + * @author ruoyi + */ +@Primary +@Order(90) +@Configuration +public class WebSecurityConfig extends WebSecurityConfigurerAdapter +{ + @Autowired + private UserDetailsService userDetailsService; + + @Bean + public PasswordEncoder passwordEncoder() + { + return new BCryptPasswordEncoder(); + } + + @Bean + @Override + public AuthenticationManager authenticationManagerBean() throws Exception + { + return super.authenticationManagerBean(); + } + + @Override + protected void configure(AuthenticationManagerBuilder auth) throws Exception + { + auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder()); + } + + @Override + protected void configure(HttpSecurity http) throws Exception + { + http.httpBasic().disable(); + + http + .authorizeRequests() + .antMatchers( + "/actuator/**", + "/token/**").permitAll() + .anyRequest().authenticated() + .and().csrf().disable(); + + } + + /*** 设置不拦截规则 */ + @Override + public void configure(WebSecurity web) + { + web.ignoring().antMatchers("/css/**", "/js/**", "/plugins/**", "/favicon.ico"); + } +} diff --git a/ruoyi-auth/src/main/java/com/ruoyi/auth/handler/AuthenticationFailureEvenHandler.java b/ruoyi-auth/src/main/java/com/ruoyi/auth/handler/AuthenticationFailureEvenHandler.java index 44553bf3..6130728d 100644 --- a/ruoyi-auth/src/main/java/com/ruoyi/auth/handler/AuthenticationFailureEvenHandler.java +++ b/ruoyi-auth/src/main/java/com/ruoyi/auth/handler/AuthenticationFailureEvenHandler.java @@ -1,33 +1,33 @@ -package com.ruoyi.auth.handler; - -import javax.servlet.http.HttpServletRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.AuthenticationException; -import org.springframework.stereotype.Component; -import com.ruoyi.common.core.utils.ServletUtils; -import com.ruoyi.common.security.handler.AbstractAuthenticationFailureEvenHandler; - -/** - * 认证失败处理 - * - * @author ruoyi - */ -@Component -public class AuthenticationFailureEvenHandler extends AbstractAuthenticationFailureEvenHandler -{ - private final Logger logger = LoggerFactory.getLogger(AuthenticationSuccessEventHandler.class); - - @Override - public void handle(AuthenticationException authenticationException, Authentication authentication) - { - HttpServletRequest request = ServletUtils.getRequest(); - - String url = request.getRequestURI(); - - String username = (String) authentication.getPrincipal(); - - logger.info("用户:{} 授权失败,url:{}", username, url); - } -} +package com.ruoyi.auth.handler; + +import javax.servlet.http.HttpServletRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.stereotype.Component; +import com.ruoyi.common.core.utils.ServletUtils; +import com.ruoyi.common.security.handler.AbstractAuthenticationFailureEvenHandler; + +/** + * 认证失败处理 + * + * @author ruoyi + */ +@Component +public class AuthenticationFailureEvenHandler extends AbstractAuthenticationFailureEvenHandler +{ + private final Logger logger = LoggerFactory.getLogger(AuthenticationFailureEvenHandler.class); + + @Override + public void handle(AuthenticationException authenticationException, Authentication authentication) + { + HttpServletRequest request = ServletUtils.getRequest(); + + String url = request.getRequestURI(); + + String username = (String) authentication.getPrincipal(); + + logger.info("用户:{} 授权失败,url:{}", username, url); + } +} diff --git a/ruoyi-auth/src/main/resources/bootstrap.yml b/ruoyi-auth/src/main/resources/bootstrap.yml index 037cd7a7..c6d470a1 100644 --- a/ruoyi-auth/src/main/resources/bootstrap.yml +++ b/ruoyi-auth/src/main/resources/bootstrap.yml @@ -1,24 +1,24 @@ -# Tomcat -server: - port: 9200 - -# Spring -spring: - application: - # 应用名称 - name: ruoyi-auth - profiles: - # 环境配置 - active: dev - cloud: - nacos: - discovery: - # 服务注册地址 - server-addr: 127.0.0.1:8848 - config: - # 配置中心地址 - server-addr: 127.0.0.1:8848 - # 配置文件格式 - file-extension: yml - # 共享配置 - shared-dataids: application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} +# Tomcat +server: + port: 9200 + +# Spring +spring: + application: + # 应用名称 + name: ruoyi-auth + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: 127.0.0.1:8848 + config: + # 配置中心地址 + server-addr: 127.0.0.1:8848 + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-dataids: application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} diff --git a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/component/RyResourceServerConfigurerAdapter.java b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/component/RyResourceServerConfigurerAdapter.java index 7e230230..a4cd2b48 100644 --- a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/component/RyResourceServerConfigurerAdapter.java +++ b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/component/RyResourceServerConfigurerAdapter.java @@ -1,64 +1,63 @@ -package com.ruoyi.common.security.component; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer; -import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; -import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer; -import org.springframework.security.oauth2.provider.token.DefaultAccessTokenConverter; -import org.springframework.security.oauth2.provider.token.RemoteTokenServices; -import org.springframework.security.oauth2.provider.token.UserAuthenticationConverter; -import org.springframework.security.web.access.AccessDeniedHandler; -import org.springframework.web.client.RestTemplate; -import com.ruoyi.common.security.component.properties.PermitAllUrlProperties; - -public class RyResourceServerConfigurerAdapter extends ResourceServerConfigurerAdapter -{ - @Autowired - protected ResourceAuthExceptionEntryPoint resourceAuthExceptionEntryPoint; - - @Autowired - protected RemoteTokenServices remoteTokenServices; - - @Autowired - private AccessDeniedHandler accessDeniedHandler; - - @Autowired - private PermitAllUrlProperties permitAllUrl; - - @Autowired - private RestTemplate lbRestTemplate; - - /** - * 默认的配置,对外暴露 - * - * @param httpSecurity - * @throws Exception - */ - @Override - public void configure(HttpSecurity httpSecurity) throws Exception - { - //允许使用iframe 嵌套,避免swagger-ui 不被加载的问题 - httpSecurity.headers().frameOptions().disable(); - ExpressionUrlAuthorizationConfigurer - .ExpressionInterceptUrlRegistry registry = httpSecurity - .authorizeRequests(); - permitAllUrl.getUrls() - .forEach(url -> registry.antMatchers(url).permitAll()); - registry.anyRequest().authenticated() - .and().csrf().disable(); - } - - @Override - public void configure(ResourceServerSecurityConfigurer resources) - { - DefaultAccessTokenConverter accessTokenConverter = new DefaultAccessTokenConverter(); - UserAuthenticationConverter userTokenConverter = new RyUserAuthenticationConverter(); - accessTokenConverter.setUserTokenConverter(userTokenConverter); - - remoteTokenServices.setRestTemplate(lbRestTemplate); - remoteTokenServices.setAccessTokenConverter(accessTokenConverter); - resources.authenticationEntryPoint(resourceAuthExceptionEntryPoint).accessDeniedHandler(accessDeniedHandler) - .tokenServices(remoteTokenServices); - } -} +package com.ruoyi.common.security.component; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer; +import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; +import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer; +import org.springframework.security.oauth2.provider.token.DefaultAccessTokenConverter; +import org.springframework.security.oauth2.provider.token.RemoteTokenServices; +import org.springframework.security.oauth2.provider.token.UserAuthenticationConverter; +import org.springframework.security.web.access.AccessDeniedHandler; +import org.springframework.web.client.RestTemplate; +import com.ruoyi.common.security.component.properties.PermitAllUrlProperties; + +public class RyResourceServerConfigurerAdapter extends ResourceServerConfigurerAdapter +{ + @Autowired + protected ResourceAuthExceptionEntryPoint resourceAuthExceptionEntryPoint; + + protected RemoteTokenServices remoteTokenServices = new RemoteTokenServices(); + + @Autowired + private AccessDeniedHandler accessDeniedHandler; + + @Autowired + private PermitAllUrlProperties permitAllUrl; + + @Autowired + private RestTemplate lbRestTemplate; + + /** + * 默认的配置,对外暴露 + * + * @param httpSecurity + * @throws Exception + */ + @Override + public void configure(HttpSecurity httpSecurity) throws Exception + { + //允许使用iframe 嵌套,避免swagger-ui 不被加载的问题 + httpSecurity.headers().frameOptions().disable(); + ExpressionUrlAuthorizationConfigurer + .ExpressionInterceptUrlRegistry registry = httpSecurity + .authorizeRequests(); + permitAllUrl.getUrls() + .forEach(url -> registry.antMatchers(url).permitAll()); + registry.anyRequest().authenticated() + .and().csrf().disable(); + } + + @Override + public void configure(ResourceServerSecurityConfigurer resources) + { + DefaultAccessTokenConverter accessTokenConverter = new DefaultAccessTokenConverter(); + UserAuthenticationConverter userTokenConverter = new RyUserAuthenticationConverter(); + accessTokenConverter.setUserTokenConverter(userTokenConverter); + + remoteTokenServices.setRestTemplate(lbRestTemplate); + remoteTokenServices.setAccessTokenConverter(accessTokenConverter); + resources.authenticationEntryPoint(resourceAuthExceptionEntryPoint).accessDeniedHandler(accessDeniedHandler) + .tokenServices(remoteTokenServices); + } +} diff --git a/ruoyi-gateway/pom.xml b/ruoyi-gateway/pom.xml index fdd8d39b..65f8127f 100644 --- a/ruoyi-gateway/pom.xml +++ b/ruoyi-gateway/pom.xml @@ -1,69 +1,86 @@ - - - com.ruoyi - ruoyi - 1.0.0 - - 4.0.0 - - ruoyi-gateway - - - ruoyi-gateway网关模块 - - - - - - - org.springframework.cloud - spring-cloud-starter-gateway - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-discovery - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-config - - - - - org.springframework.boot - spring-boot-starter-actuator - - - - - com.github.penggle - kaptcha - - - - - com.ruoyi - ruoyi-common-redis - - - - - io.springfox - springfox-swagger-ui - ${swagger.fox.version} - - - io.springfox - springfox-swagger2 - ${swagger.fox.version} - - - - - + + + com.ruoyi + ruoyi + 1.0.0 + + 4.0.0 + + ruoyi-gateway + + + ruoyi-gateway网关模块 + + + + + + + org.springframework.cloud + spring-cloud-starter-gateway + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.springframework.boot + spring-boot-starter-webflux + + + + + com.github.penggle + kaptcha + + + + + com.ruoyi + ruoyi-common-redis + + + + + io.springfox + springfox-swagger-ui + ${swagger.fox.version} + + + io.springfox + springfox-swagger2 + ${swagger.fox.version} + + + + org.projectlombok + lombok + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + + + diff --git a/ruoyi-gateway/src/main/resources/bootstrap.yml b/ruoyi-gateway/src/main/resources/bootstrap.yml index a8c53707..c4279013 100644 --- a/ruoyi-gateway/src/main/resources/bootstrap.yml +++ b/ruoyi-gateway/src/main/resources/bootstrap.yml @@ -1,24 +1,33 @@ -# Tomcat -server: - port: 8080 - -# Spring -spring: - application: - # 应用名称 - name: ruoyi-gateway - profiles: - # 环境配置 - active: dev - cloud: - nacos: - discovery: - # 服务注册地址 - server-addr: 127.0.0.1:8848 - config: - # 配置中心地址 - server-addr: 127.0.0.1:8848 - # 配置文件格式 - file-extension: yml - # 共享配置 - shared-dataids: application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} +# Tomcat +server: + port: 8080 + +# Spring +spring: + application: + # 应用名称 + name: ruoyi-gateway + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: 127.0.0.1:8848 + config: + # 配置中心地址 + server-addr: 127.0.0.1:8848 + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-dataids: application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + gateway: + routes: + - id: authRoute + uri: lb://ruoyi-auth + order: 10000 + predicates: + - Path=/auth/** + filters: + - StripPrefix=1 \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-job/pom.xml b/ruoyi-modules/ruoyi-job/pom.xml index b6395293..76ab77e8 100644 --- a/ruoyi-modules/ruoyi-job/pom.xml +++ b/ruoyi-modules/ruoyi-job/pom.xml @@ -1,88 +1,99 @@ - - - - com.ruoyi - ruoyi-modules - 1.0.0 - - 4.0.0 - - ruoyi-modules-job - - - ruoyi-modules-job定时任务 - - - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-discovery - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-config - - - - - org.springframework.cloud - spring-cloud-starter-netflix-hystrix - - - - - org.springframework.boot - spring-boot-starter-web - - - - - io.springfox - springfox-swagger-ui - ${swagger.fox.version} - - - - - org.quartz-scheduler - quartz - - - com.mchange - c3p0 - - - - - - - mysql - mysql-connector-java - - - - - com.ruoyi - ruoyi-common-security - - - - - com.ruoyi - ruoyi-common-log - - - - - com.ruoyi - ruoyi-common-swagger - - - + + + + com.ruoyi + ruoyi-modules + 1.0.0 + + 4.0.0 + + ruoyi-modules-job + + + ruoyi-modules-job定时任务 + + + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + + org.springframework.cloud + spring-cloud-starter-netflix-hystrix + + + + + org.springframework.boot + spring-boot-starter-web + + + + + io.springfox + springfox-swagger-ui + ${swagger.fox.version} + + + + + org.quartz-scheduler + quartz + + + com.mchange + c3p0 + + + + + + + mysql + mysql-connector-java + + + + + com.ruoyi + ruoyi-common-security + + + + + com.ruoyi + ruoyi-common-log + + + + + com.ruoyi + ruoyi-common-swagger + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/RuoYiJobApplication.java b/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/RuoYiJobApplication.java index 073ff282..34ab2aa5 100644 --- a/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/RuoYiJobApplication.java +++ b/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/RuoYiJobApplication.java @@ -1,36 +1,39 @@ -package com.ruoyi.job; - -import org.springframework.boot.SpringApplication; -import org.springframework.cloud.client.SpringCloudApplication; -import com.ruoyi.common.security.annotation.EnableCustomConfig; -import com.ruoyi.common.security.annotation.EnableRyFeignClients; -import com.ruoyi.common.security.annotation.EnableRyResourceServer; -import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2; - -/** - * 定时任务 - * - * @author ruoyi - */ -@EnableCustomConfig -@EnableCustomSwagger2 -@EnableRyFeignClients -@EnableRyResourceServer -@SpringCloudApplication -public class RuoYiJobApplication -{ - public static void main(String[] args) - { - SpringApplication.run(RuoYiJobApplication.class, args); - System.out.println("(♥◠‿◠)ノ゙ 定时任务模块启动成功 ლ(´ڡ`ლ)゙ \n" + - " .-------. ____ __ \n" + - " | _ _ \\ \\ \\ / / \n" + - " | ( ' ) | \\ _. / ' \n" + - " |(_ o _) / _( )_ .' \n" + - " | (_,_).' __ ___(_ o _)' \n" + - " | |\\ \\ | || |(_,_)' \n" + - " | | \\ `' /| `-' / \n" + - " | | \\ / \\ / \n" + - " ''-' `'-' `-..-' "); - } -} +package com.ruoyi.job; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.cloud.client.SpringCloudApplication; +import com.ruoyi.common.security.annotation.EnableCustomConfig; +import com.ruoyi.common.security.annotation.EnableRyFeignClients; +import com.ruoyi.common.security.annotation.EnableRyResourceServer; +import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; + +/** + * 定时任务 + * + * @author ruoyi + */ +@EnableCustomConfig +@EnableCustomSwagger2 +@EnableRyFeignClients +@EnableRyResourceServer +@SpringCloudApplication +@EnableDiscoveryClient +public class RuoYiJobApplication +{ + public static void main(String[] args) + { + SpringApplication.run(RuoYiJobApplication.class, args); + System.out.println("(♥◠‿◠)ノ゙ 定时任务模块启动成功 ლ(´ڡ`ლ)゙ \n" + + " .-------. ____ __ \n" + + " | _ _ \\ \\ \\ / / \n" + + " | ( ' ) | \\ _. / ' \n" + + " |(_ o _) / _( )_ .' \n" + + " | (_,_).' __ ___(_ o _)' \n" + + " | |\\ \\ | || |(_,_)' \n" + + " | | \\ `' /| `-' / \n" + + " | | \\ / \\ / \n" + + " ''-' `'-' `-..-' "); + } +} diff --git a/ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml index 480a180f..dbe88652 100644 --- a/ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml @@ -1,24 +1,28 @@ -# Tomcat -server: - port: 9203 - -# Spring -spring: - application: - # 应用名称 - name: ruoyi-job - profiles: - # 环境配置 - active: dev - cloud: - nacos: - discovery: - # 服务注册地址 - server-addr: 127.0.0.1:8848 - config: - # 配置中心地址 - server-addr: 127.0.0.1:8848 - # 配置文件格式 - file-extension: yml - # 共享配置 - shared-dataids: application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} +# Tomcat +server: + port: 9203 + +# Spring +spring: + application: + # 应用名称 + name: ruoyi-job + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: 127.0.0.1:8848 + config: + # 配置中心地址 + server-addr: 127.0.0.1:8848 + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-dataids: application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + +mybatis: + mapper-locations: classpath*:/**/*Mapper.xml + type-aliases-package: com.ruoyi.job.domain \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-system/pom.xml b/ruoyi-modules/ruoyi-system/pom.xml index 1436d6c1..594e59c1 100644 --- a/ruoyi-modules/ruoyi-system/pom.xml +++ b/ruoyi-modules/ruoyi-system/pom.xml @@ -1,82 +1,88 @@ - - - - com.ruoyi - ruoyi-modules - 1.0.0 - - 4.0.0 - - ruoyi-modules-system - - - ruoyi-modules-system系统模块 - - - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-discovery - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-config - - - - - org.springframework.cloud - spring-cloud-starter-netflix-hystrix - - - - - org.springframework.boot - spring-boot-starter-web - - - - - io.springfox - springfox-swagger-ui - ${swagger.fox.version} - - - - - mysql - mysql-connector-java - - - - - com.ruoyi - ruoyi-common-security - - - - - com.ruoyi - ruoyi-common-datascope - - - - - com.ruoyi - ruoyi-common-log - - - - - com.ruoyi - ruoyi-common-swagger - - - + + + + com.ruoyi + ruoyi-modules + 1.0.0 + + 4.0.0 + + ruoyi-modules-system + + + ruoyi-modules-system系统模块 + + + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + + org.springframework.cloud + spring-cloud-starter-netflix-hystrix + + + + + org.springframework.boot + spring-boot-starter-web + + + + + io.springfox + springfox-swagger-ui + ${swagger.fox.version} + + + + + mysql + mysql-connector-java + + + + + com.ruoyi + ruoyi-common-security + + + + + com.ruoyi + ruoyi-common-datascope + + + + + com.ruoyi + ruoyi-common-log + + + + + com.ruoyi + ruoyi-common-swagger + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml index 554d7979..71d1ecb3 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml @@ -1,24 +1,24 @@ -# Tomcat -server: - port: 9201 - -# Spring -spring: - application: - # 应用名称 - name: ruoyi-system - profiles: - # 环境配置 - active: dev - cloud: - nacos: - discovery: - # 服务注册地址 - server-addr: 127.0.0.1:8848 - config: - # 配置中心地址 - server-addr: 127.0.0.1:8848 - # 配置文件格式 - file-extension: yml - # 共享配置 - shared-dataids: application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} +# Tomcat +server: + port: 80 + +# Spring +spring: + application: + # 应用名称 + name: ruoyi-system + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: 127.0.0.1:8848 + config: + # 配置中心地址 + server-addr: 127.0.0.1:8848 + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-dataids: application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} diff --git a/ruoyi-ui/vue.config.js b/ruoyi-ui/vue.config.js index 5dce8d69..c4c3f576 100644 --- a/ruoyi-ui/vue.config.js +++ b/ruoyi-ui/vue.config.js @@ -1,130 +1,130 @@ -'use strict' -const path = require('path') -const defaultSettings = require('./src/settings.js') - -function resolve(dir) { - return path.join(__dirname, dir) -} - -const name = defaultSettings.title || '若依管理系统' // 标题 - -const port = process.env.port || process.env.npm_config_port || 80 // 端口 - -// vue.config.js 配置说明 -//官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions -// 这里只列一部分,具体配置参考文档 -module.exports = { - // 部署生产环境和开发环境下的URL。 - // 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上 - // 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。 - publicPath: process.env.NODE_ENV === "production" ? "/" : "/", - // 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist) - outputDir: 'dist', - // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下) - assetsDir: 'static', - // 是否开启eslint保存检测,有效值:ture | false | 'error' - lintOnSave: process.env.NODE_ENV === 'development', - // 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。 - productionSourceMap: false, - // webpack-dev-server 相关配置 - devServer: { - host: '0.0.0.0', - port: port, - proxy: { - // detail: https://cli.vuejs.org/config/#devserver-proxy - [process.env.VUE_APP_BASE_API]: { - target: `http://localhost:8080`, - changeOrigin: true, - pathRewrite: { - ['^' + process.env.VUE_APP_BASE_API]: '' - } - } - }, - disableHostCheck: true - }, - configureWebpack: { - name: name, - resolve: { - alias: { - '@': resolve('src') - } - } - }, - chainWebpack(config) { - config.plugins.delete('preload') // TODO: need test - config.plugins.delete('prefetch') // TODO: need test - - // set svg-sprite-loader - config.module - .rule('svg') - .exclude.add(resolve('src/assets/icons')) - .end() - config.module - .rule('icons') - .test(/\.svg$/) - .include.add(resolve('src/assets/icons')) - .end() - .use('svg-sprite-loader') - .loader('svg-sprite-loader') - .options({ - symbolId: 'icon-[name]' - }) - .end() - - // set preserveWhitespace - config.module - .rule('vue') - .use('vue-loader') - .loader('vue-loader') - .tap(options => { - options.compilerOptions.preserveWhitespace = true - return options - }) - .end() - - config - // https://webpack.js.org/configuration/devtool/#development - .when(process.env.NODE_ENV === 'development', - config => config.devtool('cheap-source-map') - ) - - config - .when(process.env.NODE_ENV !== 'development', - config => { - config - .plugin('ScriptExtHtmlWebpackPlugin') - .after('html') - .use('script-ext-html-webpack-plugin', [{ - // `runtime` must same as runtimeChunk name. default is `runtime` - inline: /runtime\..*\.js$/ - }]) - .end() - config - .optimization.splitChunks({ - chunks: 'all', - cacheGroups: { - libs: { - name: 'chunk-libs', - test: /[\\/]node_modules[\\/]/, - priority: 10, - chunks: 'initial' // only package third parties that are initially dependent - }, - elementUI: { - name: 'chunk-elementUI', // split elementUI into a single package - priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app - test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm - }, - commons: { - name: 'chunk-commons', - test: resolve('src/components'), // can customize your rules - minChunks: 3, // minimum common number - priority: 5, - reuseExistingChunk: true - } - } - }) - config.optimization.runtimeChunk('single') - } - ) - } -} +'use strict' +const path = require('path') +const defaultSettings = require('./src/settings.js') + +function resolve(dir) { + return path.join(__dirname, dir) +} + +const name = defaultSettings.title || '若依管理系统' // 标题 + +const port = process.env.port || process.env.npm_config_port || 80 // 端口 + +// vue.config.js 配置说明 +//官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions +// 这里只列一部分,具体配置参考文档 +module.exports = { + // 部署生产环境和开发环境下的URL。 + // 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上 + // 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。 + publicPath: process.env.NODE_ENV === "production" ? "/" : "/", + // 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist) + outputDir: 'dist', + // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下) + assetsDir: 'static', + // 是否开启eslint保存检测,有效值:ture | false | 'error' + lintOnSave: process.env.NODE_ENV === 'development', + // 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。 + productionSourceMap: false, + // webpack-dev-server 相关配置 + devServer: { + host: '0.0.0.0', + port: port, + proxy: { + // detail: https://cli.vuejs.org/config/#devserver-proxy + [process.env.VUE_APP_BASE_API]: { + target: `http://localhost:8080`, + changeOrigin: true, + pathRewrite: { + ['^' + process.env.VUE_APP_BASE_API]: '/' + } + } + }, + disableHostCheck: true + }, + configureWebpack: { + name: name, + resolve: { + alias: { + '@': resolve('src') + } + } + }, + chainWebpack(config) { + config.plugins.delete('preload') // TODO: need test + config.plugins.delete('prefetch') // TODO: need test + + // set svg-sprite-loader + config.module + .rule('svg') + .exclude.add(resolve('src/assets/icons')) + .end() + config.module + .rule('icons') + .test(/\.svg$/) + .include.add(resolve('src/assets/icons')) + .end() + .use('svg-sprite-loader') + .loader('svg-sprite-loader') + .options({ + symbolId: 'icon-[name]' + }) + .end() + + // set preserveWhitespace + config.module + .rule('vue') + .use('vue-loader') + .loader('vue-loader') + .tap(options => { + options.compilerOptions.preserveWhitespace = true + return options + }) + .end() + + config + // https://webpack.js.org/configuration/devtool/#development + .when(process.env.NODE_ENV === 'development', + config => config.devtool('cheap-source-map') + ) + + config + .when(process.env.NODE_ENV !== 'development', + config => { + config + .plugin('ScriptExtHtmlWebpackPlugin') + .after('html') + .use('script-ext-html-webpack-plugin', [{ + // `runtime` must same as runtimeChunk name. default is `runtime` + inline: /runtime\..*\.js$/ + }]) + .end() + config + .optimization.splitChunks({ + chunks: 'all', + cacheGroups: { + libs: { + name: 'chunk-libs', + test: /[\\/]node_modules[\\/]/, + priority: 10, + chunks: 'initial' // only package third parties that are initially dependent + }, + elementUI: { + name: 'chunk-elementUI', // split elementUI into a single package + priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app + test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm + }, + commons: { + name: 'chunk-commons', + test: resolve('src/components'), // can customize your rules + minChunks: 3, // minimum common number + priority: 5, + reuseExistingChunk: true + } + } + }) + config.optimization.runtimeChunk('single') + } + ) + } +}