Compare commits
54 Commits
master
...
test-modul
Author | SHA1 | Date |
---|---|---|
tiger_zhou | deb02d753e | |
tiger_zhou | 9080f7331c | |
tiger_zhou | 55a5b31dee | |
tiger_zhou | 6838e18531 | |
weizhihong | 0396b88c2b | |
weizhihong | b8cae4edfa | |
weizhihong | 01cd3adc46 | |
weizhihong | 0d1d726d69 | |
weizhihong | 5eeb1997b9 | |
weizhihong | 3490b1e7dc | |
weizhihong | 3371b87a43 | |
tiger_zhou | 5ab8b74e9b | |
tiger_zhou | 46ceb6599d | |
weizhihong | f1aeee553c | |
tiger_zhou | ecbcd20f0d | |
tiger_zhou | 1c745a4af3 | |
tiger_zhou | 4e4307d587 | |
tiger_zhou | ba90df0c21 | |
tiger_zhou | 135eef69e4 | |
tiger_zhou | 45bdd630d9 | |
tiger_zhou | 04db1a64f3 | |
tiger_zhou | 8e1e468b6b | |
tiger_zhou | 8704a5cbb8 | |
tiger_zhou | 853a2d80f2 | |
weizhihong | c7e5abcf57 | |
weizhihong | c5b31292a2 | |
weizhihong | 12c898cdd8 | |
tiger_zhou | 254bed7451 | |
tiger_zhou | 9b0af3f764 | |
tiger_zhou | e85106ec08 | |
tiger_zhou | dcaeea1b3d | |
tiger_zhou | a51274f20f | |
tiger_zhou | 566378c4f8 | |
weizhihong | b555ca2ac3 | |
weizhihong | 7e3bff68ff | |
weizhihong | e8438adcb7 | |
tiger_zhou | c095ab84c2 | |
tiger_zhou | eda2131f26 | |
tiger_zhou | 5b2a704468 | |
tiger_zhou | 1ce9312497 | |
tiger_zhou | 05fa2609b7 | |
weizhihong | bbb8c7588b | |
walker | e21af8c413 | |
walker | 8ff3e3218c | |
tiger_zhou | 8728d9ffa0 | |
tiger_zhou | 94c07b26dc | |
tiger_zhou | 9b12e5adcb | |
joylink_zhangsai | 2a9d51d629 | |
thesai | daec9c8aaf | |
joylink_zhangsai | d703a3e128 | |
joylink_zhangsai | 9656fdb80e | |
joylink_zhangsai | 7fad4fd3ae | |
walker-sheng | 9426e4ddeb | |
walker-sheng | 4628dc3fcb |
|
@ -0,0 +1,6 @@
|
||||||
|
[submodule "ecs"]
|
||||||
|
path = ecs
|
||||||
|
url = https://git.code.tencent.com/joylink-common/ecs.git
|
||||||
|
[submodule "jl-rtss-simulation/NCC/ncc-message"]
|
||||||
|
path = jl-rtss-simulation/NCC/ncc-message
|
||||||
|
url = https://git.code.tencent.com/lian-cbtc/NCC/ncc-message.git
|
|
@ -1,117 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2007-present the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
import java.net.*;
|
|
||||||
import java.io.*;
|
|
||||||
import java.nio.channels.*;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class MavenWrapperDownloader {
|
|
||||||
|
|
||||||
private static final String WRAPPER_VERSION = "0.5.6";
|
|
||||||
/**
|
|
||||||
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
|
|
||||||
*/
|
|
||||||
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
|
|
||||||
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
|
|
||||||
* use instead of the default one.
|
|
||||||
*/
|
|
||||||
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
|
|
||||||
".mvn/wrapper/maven-wrapper.properties";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Path where the maven-wrapper.jar will be saved to.
|
|
||||||
*/
|
|
||||||
private static final String MAVEN_WRAPPER_JAR_PATH =
|
|
||||||
".mvn/wrapper/maven-wrapper.jar";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name of the property which should be used to override the default download url for the wrapper.
|
|
||||||
*/
|
|
||||||
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
|
|
||||||
|
|
||||||
public static void main(String args[]) {
|
|
||||||
System.out.println("- Downloader started");
|
|
||||||
File baseDirectory = new File(args[0]);
|
|
||||||
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
|
|
||||||
|
|
||||||
// If the maven-wrapper.properties exists, read it and check if it contains a custom
|
|
||||||
// wrapperUrl parameter.
|
|
||||||
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
|
|
||||||
String url = DEFAULT_DOWNLOAD_URL;
|
|
||||||
if(mavenWrapperPropertyFile.exists()) {
|
|
||||||
FileInputStream mavenWrapperPropertyFileInputStream = null;
|
|
||||||
try {
|
|
||||||
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
|
|
||||||
Properties mavenWrapperProperties = new Properties();
|
|
||||||
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
|
|
||||||
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
|
|
||||||
} catch (IOException e) {
|
|
||||||
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if(mavenWrapperPropertyFileInputStream != null) {
|
|
||||||
mavenWrapperPropertyFileInputStream.close();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
// Ignore ...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
System.out.println("- Downloading from: " + url);
|
|
||||||
|
|
||||||
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
|
|
||||||
if(!outputFile.getParentFile().exists()) {
|
|
||||||
if(!outputFile.getParentFile().mkdirs()) {
|
|
||||||
System.out.println(
|
|
||||||
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
|
|
||||||
try {
|
|
||||||
downloadFileFromURL(url, outputFile);
|
|
||||||
System.out.println("Done");
|
|
||||||
System.exit(0);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
System.out.println("- Error downloading");
|
|
||||||
e.printStackTrace();
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
|
|
||||||
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
|
|
||||||
String username = System.getenv("MVNW_USERNAME");
|
|
||||||
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
|
|
||||||
Authenticator.setDefault(new Authenticator() {
|
|
||||||
@Override
|
|
||||||
protected PasswordAuthentication getPasswordAuthentication() {
|
|
||||||
return new PasswordAuthentication(username, password);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
URL website = new URL(urlString);
|
|
||||||
ReadableByteChannel rbc;
|
|
||||||
rbc = Channels.newChannel(website.openStream());
|
|
||||||
FileOutputStream fos = new FileOutputStream(destination);
|
|
||||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
|
||||||
fos.close();
|
|
||||||
rbc.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Binary file not shown.
|
@ -1,2 +0,0 @@
|
||||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
|
|
||||||
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
# 项目说明
|
||||||
|
轨道交通服务
|
||||||
|
此项目有git子模块,拉取代码后需执行git submodule init && git submodule update来拉取更新ecs代码
|
||||||
|
|
||||||
|
# 开发运行说明
|
||||||
|
代码修改可以直接使用IDEA的build工具(未测试),子模块的yml配置文件修改需要重新运行顶级的package,进行重新打包,否则不生效
|
||||||
|
|
||||||
|
# 路线图
|
||||||
|
- jenkins打包发布需要调整
|
||||||
|
- 登录相关代码重新在auth模块实现
|
||||||
|
- 白名单数据库管理
|
||||||
|
- 使用jwt实现免登录
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 26e482c846b3bdc21061c55036a446d21db00dbb
|
|
@ -0,0 +1,33 @@
|
||||||
|
HELP.md
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
|
@ -0,0 +1,2 @@
|
||||||
|
# 项目说明
|
||||||
|
轨道交通认证
|
|
@ -0,0 +1,73 @@
|
||||||
|
<?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>club.joylink.rtss</groupId>
|
||||||
|
<artifactId>rtss-server</artifactId>
|
||||||
|
<version>0.1</version>
|
||||||
|
</parent>
|
||||||
|
<groupId>club.joylink.rtss</groupId>
|
||||||
|
<artifactId>auth</artifactId>
|
||||||
|
<version>0.1</version>
|
||||||
|
<name>auth</name>
|
||||||
|
<description>轨道交通认证模块</description>
|
||||||
|
<properties>
|
||||||
|
<java.version>17</java.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Swagger UI -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-ui</artifactId>
|
||||||
|
<version>1.6.13</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- mybatis plus -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-generator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.velocity</groupId>
|
||||||
|
<artifactId>velocity-engine-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**/*.xml</include>
|
||||||
|
<include>**/*.yml</include>
|
||||||
|
<include>app.key</include>
|
||||||
|
<include>app.pub</include>
|
||||||
|
</includes>
|
||||||
|
<filtering>false</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,27 @@
|
||||||
|
package club.joylink.rtss.auth.configuration;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 此模块配置文件加载
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class AuthConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public static PropertySourcesPlaceholderConfigurer properties() {
|
||||||
|
PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
|
||||||
|
YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
|
||||||
|
yaml.setResources(new ClassPathResource("application-auth.yml"));
|
||||||
|
configurer.setProperties(yaml.getObject());
|
||||||
|
// yaml.getObject().forEach((k, v) -> {
|
||||||
|
// System.out.println(String.format("%s->%s", k, v));
|
||||||
|
// });
|
||||||
|
return configurer;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package club.joylink.rtss.auth.configuration;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.cors.CorsConfigurationSource;
|
||||||
|
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||||
|
import org.springframework.web.filter.CorsFilter;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class CorsConfiguration {
|
||||||
|
|
||||||
|
private org.springframework.web.cors.CorsConfiguration buildConfig() {
|
||||||
|
org.springframework.web.cors.CorsConfiguration corsConfiguration = new org.springframework.web.cors.CorsConfiguration();
|
||||||
|
corsConfiguration.addAllowedOriginPattern("*");
|
||||||
|
corsConfiguration.addAllowedHeader("*"); // 2
|
||||||
|
corsConfiguration.addAllowedMethod("*"); // 3
|
||||||
|
corsConfiguration.setAllowCredentials(true);
|
||||||
|
// 暴露 header 中的其他属性给客户端应用程序
|
||||||
|
corsConfiguration.setExposedHeaders(Arrays.asList(
|
||||||
|
"Authorization",
|
||||||
|
"Access-Control-Allow-Origin",
|
||||||
|
"Access-Control-Allow-Credentials"
|
||||||
|
));
|
||||||
|
return corsConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public CorsConfigurationSource corsConfigurationSource() {
|
||||||
|
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||||
|
source.registerCorsConfiguration("/**", buildConfig()); // 4
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public CorsFilter corsFilter() {
|
||||||
|
return new CorsFilter(corsConfigurationSource());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package club.joylink.rtss.auth.configuration;
|
||||||
|
|
||||||
|
import club.joylink.rtss.auth.util.EncryptUtil;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class EnctryptPassCode implements PasswordEncoder {
|
||||||
|
@Override
|
||||||
|
public String encode(CharSequence rawPassword) {
|
||||||
|
return EncryptUtil.md5(rawPassword.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean matches(CharSequence rawPassword, String encodedPassword) {
|
||||||
|
|
||||||
|
return Objects.equals(EncryptUtil.md5(rawPassword.toString()),encodedPassword);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package club.joylink.rtss.auth.configuration;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.security.core.AuthenticationException;
|
||||||
|
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||||
|
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class MyBasicAuthenticationEntryPoint implements AuthenticationEntryPoint {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
|
||||||
|
log.error("登录认证异常", authException);
|
||||||
|
response.addHeader("WWW-Authenticate", "Basic ");
|
||||||
|
response.sendError(HttpStatus.UNAUTHORIZED.value(), authException.getMessage());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,155 @@
|
||||||
|
package club.joylink.rtss.auth.configuration;
|
||||||
|
|
||||||
|
import club.joylink.rtss.auth.repository.IRtsAuthWhiteRepository;
|
||||||
|
import club.joylink.rtss.auth.service.DbUserDetailsService;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.nimbusds.jose.jwk.JWK;
|
||||||
|
import com.nimbusds.jose.jwk.JWKSet;
|
||||||
|
import com.nimbusds.jose.jwk.RSAKey;
|
||||||
|
import com.nimbusds.jose.jwk.source.ImmutableJWKSet;
|
||||||
|
import com.nimbusds.jose.jwk.source.JWKSource;
|
||||||
|
import com.nimbusds.jose.proc.SecurityContext;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.security.config.Customizer;
|
||||||
|
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer;
|
||||||
|
import org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer;
|
||||||
|
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
import org.springframework.security.oauth2.jwt.JwtDecoder;
|
||||||
|
import org.springframework.security.oauth2.jwt.JwtEncoder;
|
||||||
|
import org.springframework.security.oauth2.jwt.NimbusJwtDecoder;
|
||||||
|
import org.springframework.security.oauth2.jwt.NimbusJwtEncoder;
|
||||||
|
import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationConverter;
|
||||||
|
import org.springframework.security.oauth2.server.resource.authentication.JwtGrantedAuthoritiesConverter;
|
||||||
|
import org.springframework.security.oauth2.server.resource.web.BearerTokenAuthenticationEntryPoint;
|
||||||
|
import org.springframework.security.oauth2.server.resource.web.access.BearerTokenAccessDeniedHandler;
|
||||||
|
import org.springframework.security.web.SecurityFilterChain;
|
||||||
|
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
|
||||||
|
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||||
|
import org.springframework.web.cors.CorsConfigurationSource;
|
||||||
|
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.security.interfaces.RSAPrivateKey;
|
||||||
|
import java.security.interfaces.RSAPublicKey;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全、权限相关配置
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@EnableMethodSecurity
|
||||||
|
@EnableWebSecurity
|
||||||
|
public class SpringSecurityConfiguration {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JWT编解码器的PublicKey
|
||||||
|
*/
|
||||||
|
@Value("${jwt.public.key}")
|
||||||
|
RSAPublicKey key;
|
||||||
|
/**
|
||||||
|
* JWT编解码器的PrivateKey
|
||||||
|
*/
|
||||||
|
@Value("${jwt.private.key}")
|
||||||
|
RSAPrivateKey priv;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CorsConfigurationSource corsConfigurationSource;
|
||||||
|
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public SecurityFilterChain securityFilterChain(HttpSecurity http, DbUserDetailsService userDetailsService, IRtsAuthWhiteRepository whiteRepository) throws Exception {
|
||||||
|
// @formatter:off
|
||||||
|
List<String> NoAuthList = whiteRepository.queryList().stream().map(d->d.getUri()).toList();
|
||||||
|
http.authorizeHttpRequests((authorize) -> authorize
|
||||||
|
.antMatchers(HttpMethod.OPTIONS).permitAll()
|
||||||
|
.antMatchers(NoAuthList.toArray(String[]::new)).permitAll()
|
||||||
|
.anyRequest().authenticated()
|
||||||
|
)
|
||||||
|
.formLogin(d->d.loginProcessingUrl("/testLogin").passwordParameter("password").usernameParameter("username")
|
||||||
|
.successHandler(new AuthenticationSuccessHandler() {
|
||||||
|
@Override
|
||||||
|
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
|
||||||
|
|
||||||
|
System.out.println(request.getParameter("project"));
|
||||||
|
System.out.println("aaaaaaaaaaaaaaaaaaaaa");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
).userDetailsService(userDetailsService)
|
||||||
|
.cors(corsConfig -> corsConfig.configurationSource(corsConfigurationSource))
|
||||||
|
.csrf((csrf) -> csrf.disable())
|
||||||
|
// .httpBasic(configure -> configure.authenticationEntryPoint(new MyBasicAuthenticationEntryPoint()))
|
||||||
|
.oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt)
|
||||||
|
|
||||||
|
.sessionManagement((session) -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
||||||
|
.exceptionHandling((exceptions) -> exceptions
|
||||||
|
.authenticationEntryPoint(new BearerTokenAuthenticationEntryPoint())
|
||||||
|
// .defaultAuthenticationEntryPointFor(new MyBasicAuthenticationEntryPoint(),
|
||||||
|
// new AntPathRequestMatcher("/api/auth/token", null))
|
||||||
|
.defaultAuthenticationEntryPointFor(new BearerTokenAuthenticationEntryPoint(),
|
||||||
|
new AntPathRequestMatcher("/api/**", null))
|
||||||
|
.accessDeniedHandler(new BearerTokenAccessDeniedHandler())
|
||||||
|
);
|
||||||
|
// @formatter:on
|
||||||
|
SecurityFilterChain filterChain = http.build();
|
||||||
|
return filterChain;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public JwtAuthenticationConverter jwtAuthenticationConverter() {
|
||||||
|
JwtGrantedAuthoritiesConverter grantedAuthoritiesConverter = new JwtGrantedAuthoritiesConverter();
|
||||||
|
grantedAuthoritiesConverter.setAuthorityPrefix("");//取消jwt的默认前缀SCOPE_
|
||||||
|
|
||||||
|
JwtAuthenticationConverter jwtAuthenticationConverter = new JwtAuthenticationConverter();
|
||||||
|
jwtAuthenticationConverter.setJwtGrantedAuthoritiesConverter(grantedAuthoritiesConverter);
|
||||||
|
return jwtAuthenticationConverter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spring Security用户username/password认证使用的password编码器
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public PasswordEncoder passwordEncoder() {
|
||||||
|
// return new BCryptPasswordEncoder(13);
|
||||||
|
return new EnctryptPassCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JWT解码器
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public JwtDecoder jwtDecoder() {
|
||||||
|
return NimbusJwtDecoder.withPublicKey(this.key).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JWT编码器
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public JwtEncoder jwtEncoder() {
|
||||||
|
JWK jwk = new RSAKey.Builder(this.key).privateKey(this.priv).build();
|
||||||
|
JWKSource<SecurityContext> jwks = new ImmutableJWKSet<>(new JWKSet(jwk));
|
||||||
|
return new NimbusJwtEncoder(jwks);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package club.joylink.rtss.auth.controller;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
|
import org.springframework.security.oauth2.jwt.JwtClaimsSet;
|
||||||
|
import org.springframework.security.oauth2.jwt.JwtEncoder;
|
||||||
|
import org.springframework.security.oauth2.jwt.JwtEncoderParameters;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限接口
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/auth")
|
||||||
|
@SecurityRequirement(name = "basic")
|
||||||
|
public class AuthController {
|
||||||
|
|
||||||
|
final JwtEncoder jwtEncoder;
|
||||||
|
|
||||||
|
public AuthController(JwtEncoder jwtEncoder) {
|
||||||
|
this.jwtEncoder = jwtEncoder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/token")
|
||||||
|
public String getToken(Authentication authentication) {
|
||||||
|
Instant now = Instant.now();
|
||||||
|
long expiry = 3 * 24 * 60 * 60L;
|
||||||
|
// @formatter:off
|
||||||
|
String scope = authentication.getAuthorities().stream()
|
||||||
|
.map(GrantedAuthority::getAuthority)
|
||||||
|
.collect(Collectors.joining(" "));
|
||||||
|
JwtClaimsSet claims = JwtClaimsSet.builder()
|
||||||
|
.issuer("self")
|
||||||
|
.issuedAt(now)
|
||||||
|
.expiresAt(now.plusSeconds(expiry))
|
||||||
|
.subject(authentication.getName())//此处实际为用户id(数据库记录id)
|
||||||
|
.claim("scope", scope)
|
||||||
|
.build();
|
||||||
|
// @formatter:on
|
||||||
|
try {
|
||||||
|
final String token = this.jwtEncoder.encode(JwtEncoderParameters.from(claims)).getTokenValue();
|
||||||
|
return token;
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
package club.joylink.rtss.auth.controller;
|
||||||
|
|
||||||
|
import club.joylink.rtss.auth.configuration.SpringSecurityConfiguration;
|
||||||
|
import club.joylink.rtss.auth.dto.AutoWhiteDto;
|
||||||
|
import club.joylink.rtss.auth.repository.IRtsAuthWhiteRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.authorization.AuthorizationManager;
|
||||||
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer;
|
||||||
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
|
import org.springframework.security.web.SecurityFilterChain;
|
||||||
|
import org.springframework.security.web.access.intercept.AuthorizationFilter;
|
||||||
|
import org.springframework.security.web.access.intercept.RequestMatcherDelegatingAuthorizationManager;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.Filter;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author walker
|
||||||
|
* @since 2023-02-24
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/white")
|
||||||
|
public class RtsAuthWhiteController {
|
||||||
|
@Resource
|
||||||
|
private IRtsAuthWhiteRepository whiteRepository;
|
||||||
|
@PostMapping("/saveOrUpdate")
|
||||||
|
public void saveOrUpdate(@RequestBody AutoWhiteDto dto){
|
||||||
|
this.whiteRepository.saveOrUpdate(dto);
|
||||||
|
}
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public void delete(@PathVariable Long id){
|
||||||
|
this.whiteRepository.delete(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
public List<AutoWhiteDto> list(){
|
||||||
|
return this.whiteRepository.queryList();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
package club.joylink.rtss.auth.dto;
|
||||||
|
|
||||||
|
import club.joylink.rtss.auth.entity.RtsAuthWhite;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.cglib.beans.BeanCopier;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AutoWhiteDto implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 8893978464402061683L;
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过滤uri
|
||||||
|
*/
|
||||||
|
private String uri;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uri类型
|
||||||
|
*/
|
||||||
|
private AuthUriType uriType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String depict;
|
||||||
|
public static AutoWhiteDto convertDto(RtsAuthWhite white){
|
||||||
|
AutoWhiteDto dto = new AutoWhiteDto();
|
||||||
|
BeanCopier bc = BeanCopier.create(white.getClass(),dto.getClass(),false);
|
||||||
|
bc.copy(white,dto,null);
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<AutoWhiteDto> convertDtoList(List<RtsAuthWhite> whiteList){
|
||||||
|
List<AutoWhiteDto> dtoList = Lists.newArrayList();
|
||||||
|
for (RtsAuthWhite white : whiteList) {
|
||||||
|
dtoList.add(convertDto(white));
|
||||||
|
}
|
||||||
|
return dtoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public RtsAuthWhite convertBean(){
|
||||||
|
RtsAuthWhite b = new RtsAuthWhite();
|
||||||
|
BeanCopier bc = BeanCopier.create(this.getClass(),b.getClass(),false);
|
||||||
|
bc.copy(this,b,null);
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum AuthUriType{
|
||||||
|
HTTP,WS
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum AuthStatus{
|
||||||
|
VALID,INVALID
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package club.joylink.rtss.auth.entity;
|
||||||
|
|
||||||
|
import club.joylink.rtss.auth.dto.AutoWhiteDto;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author walker
|
||||||
|
* @since 2023-02-24
|
||||||
|
*/
|
||||||
|
@TableName("rts_auth_white")
|
||||||
|
@Data
|
||||||
|
public class RtsAuthWhite implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过滤uri
|
||||||
|
*/
|
||||||
|
private String uri;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uri类型
|
||||||
|
*/
|
||||||
|
private AutoWhiteDto.AuthUriType uriType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0=可用,1=不可用
|
||||||
|
*/
|
||||||
|
@TableLogic(value = "0",delval = "1")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String depict;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "RtsAuthWhite{" +
|
||||||
|
"id = " + id +
|
||||||
|
", uri = " + uri +
|
||||||
|
", uriType = " + uriType +
|
||||||
|
", createTime = " + createTime +
|
||||||
|
", updateTime = " + updateTime +
|
||||||
|
", status = " + status +
|
||||||
|
", depict = " + depict +
|
||||||
|
"}";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,271 @@
|
||||||
|
package club.joylink.rtss.auth.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 用户
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author walker
|
||||||
|
* @since 2023-02-21
|
||||||
|
*/
|
||||||
|
@TableName("sys_account")
|
||||||
|
public class SysAccount implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String account;
|
||||||
|
|
||||||
|
private String parentAccount;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属组织id
|
||||||
|
*/
|
||||||
|
private Long orgId;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
private String avatarPath;
|
||||||
|
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
private String nationcode;
|
||||||
|
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
private String wxId;
|
||||||
|
|
||||||
|
private String wxUnionId;
|
||||||
|
|
||||||
|
private String wmOpenId;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
private String roles;
|
||||||
|
|
||||||
|
private String source;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新用户id
|
||||||
|
*/
|
||||||
|
private Long updateUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccount() {
|
||||||
|
return account;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccount(String account) {
|
||||||
|
this.account = account;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParentAccount() {
|
||||||
|
return parentAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentAccount(String parentAccount) {
|
||||||
|
this.parentAccount = parentAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getOrgId() {
|
||||||
|
return orgId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrgId(Long orgId) {
|
||||||
|
this.orgId = orgId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNickname() {
|
||||||
|
return nickname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNickname(String nickname) {
|
||||||
|
this.nickname = nickname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAvatarPath() {
|
||||||
|
return avatarPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAvatarPath(String avatarPath) {
|
||||||
|
this.avatarPath = avatarPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMobile() {
|
||||||
|
return mobile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMobile(String mobile) {
|
||||||
|
this.mobile = mobile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNationcode() {
|
||||||
|
return nationcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNationcode(String nationcode) {
|
||||||
|
this.nationcode = nationcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWxId() {
|
||||||
|
return wxId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWxId(String wxId) {
|
||||||
|
this.wxId = wxId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWxUnionId() {
|
||||||
|
return wxUnionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWxUnionId(String wxUnionId) {
|
||||||
|
this.wxUnionId = wxUnionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWmOpenId() {
|
||||||
|
return wmOpenId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWmOpenId(String wmOpenId) {
|
||||||
|
this.wmOpenId = wmOpenId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoles() {
|
||||||
|
return roles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoles(String roles) {
|
||||||
|
this.roles = roles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSource(String source) {
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(LocalDateTime createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUpdateUserId() {
|
||||||
|
return updateUserId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateUserId(Long updateUserId) {
|
||||||
|
this.updateUserId = updateUserId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getUpdateTime() {
|
||||||
|
return updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateTime(LocalDateTime updateTime) {
|
||||||
|
this.updateTime = updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "SysAccount{" +
|
||||||
|
"id = " + id +
|
||||||
|
", account = " + account +
|
||||||
|
", parentAccount = " + parentAccount +
|
||||||
|
", type = " + type +
|
||||||
|
", orgId = " + orgId +
|
||||||
|
", name = " + name +
|
||||||
|
", nickname = " + nickname +
|
||||||
|
", avatarPath = " + avatarPath +
|
||||||
|
", password = " + password +
|
||||||
|
", mobile = " + mobile +
|
||||||
|
", nationcode = " + nationcode +
|
||||||
|
", email = " + email +
|
||||||
|
", wxId = " + wxId +
|
||||||
|
", wxUnionId = " + wxUnionId +
|
||||||
|
", wmOpenId = " + wmOpenId +
|
||||||
|
", status = " + status +
|
||||||
|
", roles = " + roles +
|
||||||
|
", source = " + source +
|
||||||
|
", createTime = " + createTime +
|
||||||
|
", updateUserId = " + updateUserId +
|
||||||
|
", updateTime = " + updateTime +
|
||||||
|
"}";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,100 @@
|
||||||
|
package club.joylink.rtss.auth.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 用户登陆信息表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author walker
|
||||||
|
* @since 2023-02-21
|
||||||
|
*/
|
||||||
|
@TableName("sys_account_login")
|
||||||
|
public class SysAccountLogin implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
private String client;
|
||||||
|
|
||||||
|
private String project;
|
||||||
|
|
||||||
|
private String device;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登陆时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime loginTime;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(Long userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClient() {
|
||||||
|
return client;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClient(String client) {
|
||||||
|
this.client = client;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProject() {
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProject(String project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDevice() {
|
||||||
|
return device;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDevice(String device) {
|
||||||
|
this.device = device;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getLoginTime() {
|
||||||
|
return loginTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLoginTime(LocalDateTime loginTime) {
|
||||||
|
this.loginTime = loginTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "SysAccountLogin{" +
|
||||||
|
"id = " + id +
|
||||||
|
", userId = " + userId +
|
||||||
|
", client = " + client +
|
||||||
|
", project = " + project +
|
||||||
|
", device = " + device +
|
||||||
|
", loginTime = " + loginTime +
|
||||||
|
"}";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package club.joylink.rtss.auth.exception;
|
||||||
|
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
public class BaseException extends RuntimeException {
|
||||||
|
|
||||||
|
private IExceptionMessage exceptionMessage;
|
||||||
|
|
||||||
|
public BaseException(IExceptionMessage exceptionMessage) {
|
||||||
|
super(exceptionMessage.getMessage());
|
||||||
|
this.exceptionMessage = exceptionMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseException(IExceptionMessage exceptionMessage, String message) {
|
||||||
|
super(message);
|
||||||
|
this.exceptionMessage = exceptionMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseException(IExceptionMessage exceptionMessage, Throwable cause) {
|
||||||
|
super(exceptionMessage.getMessage(), cause);
|
||||||
|
this.exceptionMessage = exceptionMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseException(IExceptionMessage exceptionMessage, String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
this.exceptionMessage = exceptionMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return this.exceptionMessage.getCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVoMessage() {
|
||||||
|
if (StringUtils.hasText(super.getMessage())) {
|
||||||
|
return super.getMessage();
|
||||||
|
}
|
||||||
|
return this.exceptionMessage.getMessage();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,228 @@
|
||||||
|
package club.joylink.rtss.auth.exception;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public interface ExceptionAssert {
|
||||||
|
|
||||||
|
BaseException exception();
|
||||||
|
|
||||||
|
BaseException exception(Throwable t);
|
||||||
|
|
||||||
|
BaseException exception(String message);
|
||||||
|
|
||||||
|
BaseException exception(String message, Throwable t);
|
||||||
|
|
||||||
|
default void fail() {
|
||||||
|
throw exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
default void fail(String message) {
|
||||||
|
throw exception(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
default void assertNotNull(Object object) {
|
||||||
|
if (object == null) {
|
||||||
|
throw exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default void assertNotNull(Object object, String message) {
|
||||||
|
if (object == null) {
|
||||||
|
throw exception(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default void assertNotNull(Object object, TextValue message) {
|
||||||
|
if (object == null) {
|
||||||
|
throw exception(message.text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default void assertNull(Object object) {
|
||||||
|
if (object != null) {
|
||||||
|
throw exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default void assertNull(Object object, String message) {
|
||||||
|
if (object != null) {
|
||||||
|
throw exception(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default void assertNull(Object object, TextValue message) {
|
||||||
|
if (object != null) {
|
||||||
|
throw exception(message.text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default void assertTrue(boolean expression) {
|
||||||
|
if (!expression) {
|
||||||
|
throw exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default void assertTrue(boolean expression, String message) {
|
||||||
|
if (!expression) {
|
||||||
|
throw exception(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default void assertTrue(boolean expression, TextValue message) {
|
||||||
|
if (!expression) {
|
||||||
|
throw exception(message.text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default void assertNotTrue(boolean expression) {
|
||||||
|
if (expression) {
|
||||||
|
throw exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default void assertNotTrue(boolean expression, String message) {
|
||||||
|
if (expression) {
|
||||||
|
throw exception(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default void assertNotTrue(boolean expression, TextValue message) {
|
||||||
|
if (expression) {
|
||||||
|
throw exception(message.text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default void assertCollectionEmpty(Collection<?> collection) {
|
||||||
|
if (!CollectionUtils.isEmpty(collection)) {
|
||||||
|
throw exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default void assertCollectionEmpty(Collection<?> collection, String message) {
|
||||||
|
if (!CollectionUtils.isEmpty(collection)) {
|
||||||
|
throw exception(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default void assertCollectionEmpty(Collection<?> collection, TextValue message) {
|
||||||
|
if (!CollectionUtils.isEmpty(collection)) {
|
||||||
|
throw exception(message.text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default void assertCollectionNotEmpty(Collection<?> collection) {
|
||||||
|
if (CollectionUtils.isEmpty(collection)) {
|
||||||
|
throw exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default void assertCollectionNotEmpty(Collection<?> collection, String message) {
|
||||||
|
if (CollectionUtils.isEmpty(collection)) {
|
||||||
|
throw exception(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default void assertCollectionNotEmpty(Collection<?> collection, TextValue message) {
|
||||||
|
if (CollectionUtils.isEmpty(collection)) {
|
||||||
|
throw exception(message.text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default void assertMapEmpty(Map<?, ?> map) {
|
||||||
|
if (!CollectionUtils.isEmpty(map)) {
|
||||||
|
throw exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default void assertMapEmpty(Map<?, ?> map, String message) {
|
||||||
|
if (!CollectionUtils.isEmpty(map)) {
|
||||||
|
throw exception(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default void assertMapEmpty(Map<?, ?> map, TextValue message) {
|
||||||
|
if (!CollectionUtils.isEmpty(map)) {
|
||||||
|
throw exception(message.text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default void assertMapNotEmpty(Map<?, ?> map) {
|
||||||
|
if (CollectionUtils.isEmpty(map)) {
|
||||||
|
throw exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default void assertMapNotEmpty(Map<?, ?> map, String message) {
|
||||||
|
if (CollectionUtils.isEmpty(map)) {
|
||||||
|
throw exception(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default void assertMapNotEmpty(Map<?, ?> map, TextValue message) {
|
||||||
|
if (CollectionUtils.isEmpty(map)) {
|
||||||
|
throw exception(message.text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default void assertEquals(Object o1, Object o2) {
|
||||||
|
if (!Objects.equals(o1, o2)) {
|
||||||
|
throw exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default void assertEquals(Object o1, Object o2, String message) {
|
||||||
|
if (!Objects.equals(o1, o2)) {
|
||||||
|
throw exception(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default void assertEquals(Object o1, Object o2, TextValue message) {
|
||||||
|
if (!Objects.equals(o1, o2)) {
|
||||||
|
throw exception(message.text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default void assertNotEquals(Object o1, Object o2) {
|
||||||
|
if (Objects.equals(o1, o2)) {
|
||||||
|
throw exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default void assertNotEquals(Object o1, Object o2, String message) {
|
||||||
|
if (Objects.equals(o1, o2)) {
|
||||||
|
throw exception(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default void assertNotEquals(Object o1, Object o2, TextValue message) {
|
||||||
|
if (Objects.equals(o1, o2)) {
|
||||||
|
throw exception(message.text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default void assertHasText(String str) {
|
||||||
|
if (!StringUtils.hasText(str)) {
|
||||||
|
throw exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default void assertHasText(String str, String message) {
|
||||||
|
if (!StringUtils.hasText(str)) {
|
||||||
|
throw exception(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default void assertHasText(String str, TextValue message) {
|
||||||
|
if (!StringUtils.hasText(str)) {
|
||||||
|
throw exception(message.text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default void assertNotHasText(String str) {
|
||||||
|
if (StringUtils.hasText(str)) {
|
||||||
|
throw exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default void assertNotHasText(String str, String message) {
|
||||||
|
if (StringUtils.hasText(str)) {
|
||||||
|
throw exception(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default void assertNotHasText(String str, TextValue message) {
|
||||||
|
if (StringUtils.hasText(str)) {
|
||||||
|
throw exception(message.text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@FunctionalInterface
|
||||||
|
public static interface TextValue{
|
||||||
|
String text();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.exception;
|
package club.joylink.rtss.auth.exception;
|
||||||
|
|
||||||
public interface IExceptionMessage {
|
public interface IExceptionMessage {
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package club.joylink.rtss.auth.exception;
|
||||||
|
|
||||||
|
public class ServerException extends BaseException {
|
||||||
|
public ServerException(IExceptionMessage exceptionMessage) {
|
||||||
|
super(exceptionMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerException(IExceptionMessage exceptionMessage, String message) {
|
||||||
|
super(exceptionMessage, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerException(IExceptionMessage exceptionMessage, Throwable cause) {
|
||||||
|
super(exceptionMessage, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerException(IExceptionMessage exceptionMessage, String message, Throwable cause) {
|
||||||
|
super(exceptionMessage, message, cause);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package club.joylink.rtss.auth.exception;
|
||||||
|
|
||||||
|
public interface ServerExceptionAssert extends IExceptionMessage, ExceptionAssert {
|
||||||
|
|
||||||
|
default BaseException exception() {
|
||||||
|
return new ServerException(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
default BaseException exception(Throwable t) {
|
||||||
|
return new ServerException(this, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
default BaseException exception(String message) {
|
||||||
|
return new ServerException(this, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
default BaseException exception(String message, Throwable t) {
|
||||||
|
return new ServerException(this, message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package club.joylink.rtss.auth.exception;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum ServerExceptionAssertEnum implements ServerExceptionAssert {
|
||||||
|
DataNotExist(4000, "data not exist"),
|
||||||
|
FieldMustUnique(4001, "the unique filed repeat"),
|
||||||
|
RuntimeException(4002,"system runtime exception")
|
||||||
|
;
|
||||||
|
|
||||||
|
int code;
|
||||||
|
|
||||||
|
String message;
|
||||||
|
|
||||||
|
ServerExceptionAssertEnum(int code, String message) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package club.joylink.rtss.auth.mapper;
|
||||||
|
|
||||||
|
import club.joylink.rtss.auth.entity.RtsAuthWhite;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author walker
|
||||||
|
* @since 2023-02-24
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface RtsAuthWhiteMapper extends BaseMapper<RtsAuthWhite> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package club.joylink.rtss.auth.mapper;
|
||||||
|
|
||||||
|
import club.joylink.rtss.auth.entity.SysAccountLogin;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 用户登陆信息表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author walker
|
||||||
|
* @since 2023-02-21
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SysAccountLoginMapper extends BaseMapper<SysAccountLogin> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package club.joylink.rtss.auth.mapper;
|
||||||
|
|
||||||
|
import club.joylink.rtss.auth.entity.SysAccount;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 用户 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author walker
|
||||||
|
* @since 2023-02-21
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SysAccountMapper extends BaseMapper<SysAccount> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package club.joylink.rtss.auth.repository;
|
||||||
|
|
||||||
|
import club.joylink.rtss.auth.dto.AutoWhiteDto;
|
||||||
|
import club.joylink.rtss.auth.entity.RtsAuthWhite;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author walker
|
||||||
|
* @since 2023-02-24
|
||||||
|
*/
|
||||||
|
public interface IRtsAuthWhiteRepository extends IService<RtsAuthWhite> {
|
||||||
|
void saveOrUpdate(AutoWhiteDto dto);
|
||||||
|
void delete(Long id);
|
||||||
|
|
||||||
|
AutoWhiteDto findById(Long id);
|
||||||
|
List<AutoWhiteDto> queryList();
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package club.joylink.rtss.auth.repository;
|
||||||
|
|
||||||
|
import club.joylink.rtss.auth.entity.SysAccountLogin;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 用户登陆信息表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author walker
|
||||||
|
* @since 2023-02-21
|
||||||
|
*/
|
||||||
|
public interface ISysAccountLoginRepository extends IService<SysAccountLogin> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package club.joylink.rtss.auth.repository;
|
||||||
|
|
||||||
|
import club.joylink.rtss.auth.entity.SysAccount;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 用户 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author walker
|
||||||
|
* @since 2023-02-21
|
||||||
|
*/
|
||||||
|
public interface ISysAccountRepository extends IService<SysAccount> {
|
||||||
|
|
||||||
|
SysAccount queryBy(String login);
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
package club.joylink.rtss.auth.repository.impl;
|
||||||
|
|
||||||
|
import club.joylink.rtss.auth.dto.AutoWhiteDto;
|
||||||
|
import club.joylink.rtss.auth.entity.RtsAuthWhite;
|
||||||
|
import club.joylink.rtss.auth.exception.ServerExceptionAssertEnum;
|
||||||
|
import club.joylink.rtss.auth.mapper.RtsAuthWhiteMapper;
|
||||||
|
import club.joylink.rtss.auth.repository.IRtsAuthWhiteRepository;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author walker
|
||||||
|
* @since 2023-02-24
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class RtsAuthWhiteRepository extends ServiceImpl<RtsAuthWhiteMapper, RtsAuthWhite> implements IRtsAuthWhiteRepository {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveOrUpdate(AutoWhiteDto dto) {
|
||||||
|
RtsAuthWhite bean = dto.convertBean();
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
bean.setCreateTime(now);
|
||||||
|
bean.setUpdateTime(now);
|
||||||
|
bean.setStatus(AutoWhiteDto.AuthStatus.INVALID.ordinal());
|
||||||
|
if(Objects.nonNull(bean.getId())){
|
||||||
|
RtsAuthWhite tmp = this.find(bean.getId());
|
||||||
|
tmp.setUpdateTime(now);
|
||||||
|
this.updateById(tmp);
|
||||||
|
}else{
|
||||||
|
this.save(bean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(Long id) {
|
||||||
|
this.find(id);
|
||||||
|
this.removeById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private RtsAuthWhite find(Long id){
|
||||||
|
RtsAuthWhite white = this.getById(id);
|
||||||
|
ServerExceptionAssertEnum.DataNotExist.assertTrue(Objects.nonNull(white),"未找到对应的数据");
|
||||||
|
return white;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public AutoWhiteDto findById(Long id) {
|
||||||
|
RtsAuthWhite white = this.find(id);
|
||||||
|
return AutoWhiteDto.convertDto(white);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AutoWhiteDto> queryList() {
|
||||||
|
QueryWrapper<RtsAuthWhite> queryWrapper = new QueryWrapper<>();
|
||||||
|
List<RtsAuthWhite> list = this.baseMapper.selectList(queryWrapper);
|
||||||
|
return AutoWhiteDto.convertDtoList(list);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package club.joylink.rtss.auth.repository.impl;
|
||||||
|
|
||||||
|
import club.joylink.rtss.auth.entity.SysAccountLogin;
|
||||||
|
import club.joylink.rtss.auth.mapper.SysAccountLoginMapper;
|
||||||
|
import club.joylink.rtss.auth.repository.ISysAccountLoginRepository;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 用户登陆信息表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author walker
|
||||||
|
* @since 2023-02-21
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysAccountLoginRepository extends ServiceImpl<SysAccountLoginMapper, SysAccountLogin> implements ISysAccountLoginRepository {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package club.joylink.rtss.auth.repository.impl;
|
||||||
|
|
||||||
|
import club.joylink.rtss.auth.entity.SysAccount;
|
||||||
|
import club.joylink.rtss.auth.exception.ServerExceptionAssertEnum;
|
||||||
|
import club.joylink.rtss.auth.mapper.SysAccountMapper;
|
||||||
|
import club.joylink.rtss.auth.repository.ISysAccountRepository;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 用户 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author walker
|
||||||
|
* @since 2023-02-21
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysAccountRepository extends ServiceImpl<SysAccountMapper, SysAccount> implements ISysAccountRepository {
|
||||||
|
|
||||||
|
SysAccountMapper sysAccountMapper;
|
||||||
|
|
||||||
|
public SysAccountRepository(SysAccountMapper sysAccountMapper) {
|
||||||
|
this.sysAccountMapper = sysAccountMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysAccount queryBy(String login) {
|
||||||
|
SysAccount account = this.getOne(Wrappers.<SysAccount>lambdaQuery().eq(SysAccount::getMobile, login));
|
||||||
|
return account;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package club.joylink.rtss.auth.service;
|
||||||
|
|
||||||
|
import club.joylink.rtss.auth.entity.SysAccount;
|
||||||
|
import club.joylink.rtss.auth.repository.ISysAccountRepository;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.config.core.GrantedAuthorityDefaults;
|
||||||
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
|
import org.springframework.security.core.authority.AuthorityUtils;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||||
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spring Security的UserDetailsService实现
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class DbUserDetailsService implements UserDetailsService {
|
||||||
|
private ISysAccountRepository userRepository;
|
||||||
|
public DbUserDetailsService(ISysAccountRepository userRepository) {
|
||||||
|
this.userRepository = userRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||||
|
try {
|
||||||
|
SysAccount userInfo = this.userRepository.queryBy(username);
|
||||||
|
if (userInfo == null) {
|
||||||
|
throw new UsernameNotFoundException(String.format("未找到mobile=%s的用户", username));
|
||||||
|
}
|
||||||
|
|
||||||
|
return org.springframework.security.core.userdetails.User
|
||||||
|
.withUsername(userInfo.getId().toString())
|
||||||
|
.password(userInfo.getPassword())
|
||||||
|
// .password(this.passwordEncoder.encode(userInfo.getPassword()))
|
||||||
|
.authorities(AuthorityUtils.createAuthorityList("MOBILE"))
|
||||||
|
.build();
|
||||||
|
} catch (UsernameNotFoundException e) {
|
||||||
|
throw e;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("根据username加载用户异常", e);
|
||||||
|
throw new UsernameNotFoundException("加载用户未知异常", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package club.joylink.rtss.auth.service;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
|
import org.springframework.security.oauth2.jwt.JwtClaimsSet;
|
||||||
|
import org.springframework.security.oauth2.jwt.JwtEncoder;
|
||||||
|
import org.springframework.security.oauth2.jwt.JwtEncoderParameters;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class JwtService {
|
||||||
|
final JwtEncoder jwtEncoder;
|
||||||
|
|
||||||
|
public JwtService(JwtEncoder jwtEncoder) {
|
||||||
|
this.jwtEncoder = jwtEncoder;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class UserInfo {
|
||||||
|
String id;
|
||||||
|
List<String> roles;
|
||||||
|
|
||||||
|
public UserInfo(String id, List<String> roles) {
|
||||||
|
this.id = id;
|
||||||
|
this.roles = roles;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建jwt
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String buildToken(UserInfo userInfo) {
|
||||||
|
Instant now = Instant.now();
|
||||||
|
long expiry = 3 * 24 * 60 * 60L;
|
||||||
|
// @formatter:off
|
||||||
|
String scope = userInfo.getRoles().stream()
|
||||||
|
.collect(Collectors.joining(" "));
|
||||||
|
JwtClaimsSet claims = JwtClaimsSet.builder()
|
||||||
|
.issuer("self")
|
||||||
|
.issuedAt(now)
|
||||||
|
.expiresAt(now.plusSeconds(expiry))
|
||||||
|
.subject(userInfo.getId())//此处实际为用户id(数据库记录id)
|
||||||
|
.claim("scope", scope)
|
||||||
|
.claim("userinfo", userInfo)
|
||||||
|
.build();
|
||||||
|
// @formatter:on
|
||||||
|
try {
|
||||||
|
final String token = this.jwtEncoder.encode(JwtEncoderParameters.from(claims)).getTokenValue();
|
||||||
|
return token;
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.util;
|
package club.joylink.rtss.auth.util;
|
||||||
|
|
||||||
import javax.crypto.Mac;
|
import javax.crypto.Mac;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
|
@ -0,0 +1,3 @@
|
||||||
|
-----BEGIN PRIVATE KEY-----
|
||||||
|
MIIEugIBADANBgkqhkiG9w0BAQEFAASCBKQwggSgAgEAAoIBAQCk16Ov5gy35qzQzVUkv44FQSJp+xD73eMh0NeETTboZ4SJyQ3AIfvNQAiTSvNA6lKY4gpPxSveddmRPIbp1gVM6CKzZF7EWs6ZR9UxM7RECLrloGiVRUv3q5vbtIxMNTyMLsLtc5+PE6ZsvoeOEAUzXtoPZXbg0enWfs/qfxVaEr3c7riSXF5S0Df0gUsquRF7+CNAdr2GEDMJjtEKl7pDRk8IsiMVpuupmfhOhSveiK316Uc1D8jLIugKHZ62jAPGXbkLML30gIILWKFFEZLabvw04fZUCJq01ijRbRwLJG9Z/AnIWTk1gMfH8oIZc5R0sI389IEAYyiL9r04joCFAgMBAAECgf8/fKzUifMJdakyLV7TL6ksZSeVwowOMyD46UjNp5SbDr9Tzbx55DmvY9Tx7efKXtgu6I1adg29vQj5wbT6g8nyK4YpmZM4uiOmSGtsatQn9G6bpv6xE4/gIhLIJDkN94N/cc1nnk3iEzeegOxhxmat+w/HKJMYLLharoTY8OeGQIb9XwDppt2y1+gFXJvEG9jGb/lIZ4xLMqQfOi0T9PHooLRgjqUQ07JZHPELlLLKohDwsRXMHkDmXiCYQ7P58+hjgBLzxNr3WmpuRISLewjjCa0XWbfxrFhY8HOYIQZNBjeNmVwANsAlMlqnjjv4sfCBlHg7LA6qMfEyONy2zlECgYEAziDvMEd3EHeUJMf+Macicdgfh29zWlyPYI7u5lzCjUqy6po7Q1uFYP7SPetO8mnX0j9pbZC3Zr05TCdXc4jdccKze58j1u+zPAYxX5I2LY0T5BsQOCT4/Oa11QBE0cJSA/wy+XLMpJ8+UIs7dirMFUMjWAMwvu4De7wfsu0IIf0CgYEAzLmKNS6EjeY1GhnZs8uuvtjr5XPQ3G22WAj5g/SjaDNZ5JC1+Ag5G5Iwd262Pa6LCPXRvVGnG3FvVqIk60aHoatqY5zJA+6cCdD1OHhGJTzrPfVmcWkiNpstHqD0w8l4QGhwd8O/0IDJm4NN7bW3WTttHIBz/ElqiWoG4YEG+ykCgYBSTrJTy+WOLMF54mXs+7j0ToFgei9MgLM7sjdQwu9ordA9f3J0lgHvVjErSl+OypbEPE/j0Sp6mspbT0ZLOvZ5q24xybzs4W/nYu2qJN7/V1r+9ZOHZ7QIgDNRJzdTrs1DDBxqoN14SqH+VWpb6ADv6IwfY76+LpozeU4LCzz5HQKBgHuuR/HzJX+4qTIYle5KSkrgMDuR6YeR/IxY960hmar1AwTT7CtphF7ExeURjKXdEgAayliOwN8Se8oh8R32oTApp/+AE+z9NWW0yMER4IbUs+XdoMM5WcMVon+Ti+vQhoaa0f940iQ7+hCqleTbWGZfQX7rl6a+D8/urzODSN1pAoGAdui4nehVY7HyH9JH/Td3ZhW4SAB9U4cfNUFt+MaEDdrtxgJ5tP5NEDjIa1q0f3tdfL/WssBT0ti9thjGn2cHROE/ZlaTQR0riwgbFgLpvtQh0t4nth8RPF17+XsMDL1VGSyartYc+g+dUVubyH2PMIxPfoZCWvQSYX13YfF2Zbk=
|
||||||
|
-----END PRIVATE KEY-----
|
|
@ -0,0 +1,3 @@
|
||||||
|
-----BEGIN PUBLIC KEY-----
|
||||||
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApNejr+YMt+as0M1VJL+OBUEiafsQ+93jIdDXhE026GeEickNwCH7zUAIk0rzQOpSmOIKT8Ur3nXZkTyG6dYFTOgis2RexFrOmUfVMTO0RAi65aBolUVL96ub27SMTDU8jC7C7XOfjxOmbL6HjhAFM17aD2V24NHp1n7P6n8VWhK93O64klxeUtA39IFLKrkRe/gjQHa9hhAzCY7RCpe6Q0ZPCLIjFabrqZn4ToUr3oit9elHNQ/IyyLoCh2etowDxl25CzC99ICCC1ihRRGS2m78NOH2VAiatNYo0W0cCyRvWfwJyFk5NYDHx/KCGXOUdLCN/PSBAGMoi/a9OI6AhQIDAQAB
|
||||||
|
-----END PUBLIC KEY-----
|
|
@ -0,0 +1,9 @@
|
||||||
|
jwt:
|
||||||
|
private.key: classpath:app.key
|
||||||
|
public.key: classpath:app.pub
|
||||||
|
|
||||||
|
mybatis-plus:
|
||||||
|
type-aliases-package: club.joylink.rtss.auth.mapper
|
||||||
|
mapper-locations: classpath:mapper/auth/*.xml
|
||||||
|
configuration:
|
||||||
|
map-underscore-to-camel-case: true
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="club.joylink.rtss.auth.mapper.SysAccountLoginMapper">
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="club.joylink.rtss.auth.mapper.SysAccountMapper">
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,96 @@
|
||||||
|
package club.joylink.rtss.auth;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.generator.FastAutoGenerator;
|
||||||
|
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
|
||||||
|
import com.baomidou.mybatisplus.generator.config.OutputFile;
|
||||||
|
import com.baomidou.mybatisplus.generator.config.rules.DateType;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.NonNull;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MybatisPlusAutoGenerator {
|
||||||
|
|
||||||
|
public static final DataSourceConfig.Builder DATA_SOURCE_CONFIG = new DataSourceConfig
|
||||||
|
.Builder("jdbc:mysql://192.168.3.233:3306/joylink?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai",
|
||||||
|
"root", "joylink0503")
|
||||||
|
;
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
GeneratorModule generatorModule = GeneratorModule.SimulationNcc;
|
||||||
|
String[] tableNames = new String[]{"rts_ncc_map_data"};
|
||||||
|
// String baseDir = String.join(File.separator, Arrays.asList(System.getProperty("user.dir"), "jl-rtss-auth", "src", "main"));
|
||||||
|
String baseDir = generatorModule.projectPath;
|
||||||
|
String outBaseDir = baseDir + File.separator + "java";
|
||||||
|
String xmlDir = baseDir + File.separator + "resources" + File.separator + "mapper";
|
||||||
|
System.out.println(outBaseDir);
|
||||||
|
FastAutoGenerator.create(DATA_SOURCE_CONFIG)
|
||||||
|
.globalConfig(builder -> {
|
||||||
|
builder.author("walker")
|
||||||
|
.disableOpenDir() // 生成完毕不打开目录
|
||||||
|
.dateType(DateType.TIME_PACK) // 使用java8的日期时间对象
|
||||||
|
.outputDir(outBaseDir);
|
||||||
|
})
|
||||||
|
.packageConfig(builder -> {
|
||||||
|
builder.parent(generatorModule.rootPackAges)
|
||||||
|
.service("repository")
|
||||||
|
.serviceImpl("repository.impl")
|
||||||
|
.pathInfo(Collections.singletonMap(OutputFile.xml, xmlDir));
|
||||||
|
})
|
||||||
|
.strategyConfig(builder -> {
|
||||||
|
|
||||||
|
builder.addInclude(tableNames);
|
||||||
|
// entity生成策略
|
||||||
|
builder.entityBuilder()
|
||||||
|
.enableLombok()
|
||||||
|
.enableFileOverride(); // 覆盖旧文件
|
||||||
|
// mapper生成策略
|
||||||
|
builder.mapperBuilder()
|
||||||
|
.mapperAnnotation(Mapper.class); // 生成Mapper注解
|
||||||
|
//.enableFileOverride(); // 覆盖旧文件
|
||||||
|
// service生成策略
|
||||||
|
builder.serviceBuilder()
|
||||||
|
// .enableFileOverride() // 覆盖旧文件
|
||||||
|
.formatServiceFileName("I%sRepository")
|
||||||
|
.formatServiceImplFileName("%sRepository")
|
||||||
|
;
|
||||||
|
// controller生成策略
|
||||||
|
builder.controllerBuilder()
|
||||||
|
.enableRestStyle(); // 改为使用RestController注解,支持Rest接口
|
||||||
|
})
|
||||||
|
// 可自定义模板
|
||||||
|
// .templateConfig(builder -> {
|
||||||
|
//
|
||||||
|
// })
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GeneratorModule{
|
||||||
|
Auth("club.joylink.rtss.auth",new String[]{"jl-rtss-auth"})
|
||||||
|
,SimulationNcc("club.joylink.rtss.simulation.ncc",new String[]{"jl-rtss-simulation","ncc"});
|
||||||
|
GeneratorModule(String d,String[] p){
|
||||||
|
this.rootPackAges = d;
|
||||||
|
List<String> projectDir = new ArrayList<>();
|
||||||
|
for (String s : p) {
|
||||||
|
projectDir.add(s);
|
||||||
|
}
|
||||||
|
projectDir.add(0,System.getProperty("user.dir"));
|
||||||
|
projectDir.add("src");
|
||||||
|
projectDir.add("main");
|
||||||
|
this.projectPath = String.join(File.separator, projectDir);
|
||||||
|
|
||||||
|
}
|
||||||
|
private String rootPackAges;
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package club.joylink.rtss.auth;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
public class Tests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void basicAuth() {
|
||||||
|
String name = "17791995809";
|
||||||
|
String password = "123456";
|
||||||
|
String ba = Base64.getEncoder().encodeToString(String.format("%s:%s", name, password).getBytes(StandardCharsets.UTF_8));
|
||||||
|
System.out.println(ba);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,228 @@
|
||||||
|
<?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>club.joylink.rtss</groupId>
|
||||||
|
<artifactId>rtss-server</artifactId>
|
||||||
|
<version>0.1</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>manage</artifactId>
|
||||||
|
<version>0.1</version>
|
||||||
|
<name>manage</name>
|
||||||
|
<description> Rail transit simulation system</description>
|
||||||
|
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<java.version>17</java.version>
|
||||||
|
<pagehelper.version>4.1.1</pagehelper.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>club.joylink.rtss</groupId>
|
||||||
|
<artifactId>auth</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>club.joylink.rtss</groupId>
|
||||||
|
<artifactId>NCC</artifactId>
|
||||||
|
<version>0.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-mail</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- javax.validation -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.validation</groupId>
|
||||||
|
<artifactId>validation-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--spring切面aop依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.netty</groupId>
|
||||||
|
<artifactId>netty-all</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.digitalpetri.modbus</groupId>
|
||||||
|
<artifactId>modbus-codec</artifactId>
|
||||||
|
<version>1.1.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 硬件检测依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.oshi</groupId>
|
||||||
|
<artifactId>oshi-core-java11</artifactId>
|
||||||
|
<version>5.7.5</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.wechatpay-apiv3</groupId>
|
||||||
|
<artifactId>wechatpay-apache-httpclient</artifactId>
|
||||||
|
<version>0.2.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<version>31.1-jre</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.minio</groupId>
|
||||||
|
<artifactId>minio</artifactId>
|
||||||
|
<version>8.4.4</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<version>4.9.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>joda-time</groupId>
|
||||||
|
<artifactId>joda-time</artifactId>
|
||||||
|
<version>2.10.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.belerweb</groupId>
|
||||||
|
<artifactId>pinyin4j</artifactId>
|
||||||
|
<version>2.5.0</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- iscs -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.protobuf</groupId>
|
||||||
|
<artifactId>protobuf-java</artifactId>
|
||||||
|
<version>3.19.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>${maven-compiler-plugin.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<source>${java.version}</source>
|
||||||
|
<target>${java.version}</target>
|
||||||
|
<encoding>${project.build.sourceEncoding}</encoding>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
<version>${maven.resources.plugin.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<encoding>${project.build.sourceEncoding}</encoding>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy-resources</id>
|
||||||
|
<phase>validate</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-resources</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${basedir}/target/classes</outputDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>${basedir}/../jl-rtss-auth/src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>${basedir}/../jl-rtss-simulation/ISCS/src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<mainClass>club.joylink.rtss.manage.RtssApplication</mainClass>
|
||||||
|
<layout>ZIP</layout>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.github.shalousun</groupId>
|
||||||
|
<artifactId>smart-doc-maven-plugin</artifactId>
|
||||||
|
<version>2.1.9</version>
|
||||||
|
<configuration>
|
||||||
|
<!--指定生成文档的使用的配置文件,配置文件放在自己的项目中-->
|
||||||
|
<configFile>./src/main/resources/smart-doc.json</configFile>
|
||||||
|
<!--smart-doc实现自动分析依赖树加载第三方依赖的源码,如果一些框架依赖库加载不到导致报错,这时请使用excludes排除掉-->
|
||||||
|
<!-- <excludes>-->
|
||||||
|
<!-- <!–格式为:groupId:artifactId;参考如下–>-->
|
||||||
|
<!-- <exclude>com.alibaba:fastjson</exclude>-->
|
||||||
|
<!-- </excludes>-->
|
||||||
|
<!-- <!–自1.0.8版本开始,插件提供includes支持,配置了includes后插件会按照用户配置加载而不是自动加载,因此使用时需要注意–>-->
|
||||||
|
<!-- <!–smart-doc能自动分析依赖树加载所有依赖源码,原则上会影响文档构建效率,因此你可以使用includes来让插件加载你配置的组件–>-->
|
||||||
|
<!-- <includes>-->
|
||||||
|
<!-- <!–格式为:groupId:artifactId;参考如下–>-->
|
||||||
|
<!-- <include>com.alibaba:fastjson</include>-->
|
||||||
|
<!-- </includes>-->
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<!--如果不需要在执行编译时启动smart-doc,则将phase注释掉-->
|
||||||
|
<!-- <phase>compile</phase>-->
|
||||||
|
<goals>
|
||||||
|
<!--smart-doc提供了html、openapi、markdown等goal,可按需配置-->
|
||||||
|
<goal>html</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss;
|
package club.joylink.rtss.manage;
|
||||||
|
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
|
@ -6,10 +6,11 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.cache.annotation.EnableCaching;
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication(scanBasePackages = {"club.joylink.rtss"})
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@EnableCaching
|
@EnableCaching
|
||||||
@MapperScan(basePackages = {"club.joylink.rtss.dao","club.joylink.rtss.iscs.dao"})
|
@MapperScan(basePackages = {"club.joylink.rtss.manage.dao",
|
||||||
|
"club.joylink.rtss.*.mapper","club.joylink.rtss.simulation.*.mapper"})
|
||||||
//@EnableRetry
|
//@EnableRetry
|
||||||
public class RtssApplication {
|
public class RtssApplication {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package club.joylink.rtss.configuration;
|
package club.joylink.rtss.manage.configuration;
|
||||||
|
|
||||||
import club.joylink.rtss.entity.project.Project;
|
import club.joylink.rtss.manage.entity.project.Project;
|
||||||
import org.springframework.cache.interceptor.KeyGenerator;
|
import org.springframework.cache.interceptor.KeyGenerator;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.configuration;
|
package club.joylink.rtss.manage.configuration;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.core.convert.converter.Converter;
|
import org.springframework.core.convert.converter.Converter;
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.configuration;
|
package club.joylink.rtss.manage.configuration;
|
||||||
|
|
||||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.configuration;
|
package club.joylink.rtss.manage.configuration;
|
||||||
|
|
||||||
import io.minio.MinioClient;
|
import io.minio.MinioClient;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
|
@ -1,6 +1,6 @@
|
||||||
package club.joylink.rtss.configuration;
|
package club.joylink.rtss.manage.configuration;
|
||||||
|
|
||||||
import club.joylink.rtss.wechat.converter.WxMappingJackson2HttpMessageConverter;
|
import club.joylink.rtss.manage.wechat.converter.WxMappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
import org.springframework.http.client.ClientHttpRequestFactory;
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.configuration;
|
package club.joylink.rtss.manage.configuration;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
|
@ -1,7 +1,7 @@
|
||||||
package club.joylink.rtss.configuration;
|
package club.joylink.rtss.manage.configuration;
|
||||||
|
|
||||||
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
import club.joylink.rtss.manage.controller.advice.AuthenticateInterceptor;
|
||||||
import club.joylink.rtss.controller.advice.LicenseInterceptor;
|
import club.joylink.rtss.manage.controller.advice.LicenseInterceptor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.format.FormatterRegistry;
|
import org.springframework.format.FormatterRegistry;
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.configuration.configProp;
|
package club.joylink.rtss.manage.configuration.configProp;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.configuration.configProp;
|
package club.joylink.rtss.manage.configuration.configProp;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.configuration.configProp;
|
package club.joylink.rtss.manage.configuration.configProp;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.configuration.configProp;
|
package club.joylink.rtss.manage.configuration.configProp;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.configuration.configProp;
|
package club.joylink.rtss.manage.configuration.configProp;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.configuration.configProp;
|
package club.joylink.rtss.manage.configuration.configProp;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.configuration.configProp;
|
package club.joylink.rtss.manage.configuration.configProp;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
public interface BusinessConsts {
|
public interface BusinessConsts {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.manage.exception.BusinessExceptionAssertEnum;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 方向标签枚举
|
* 方向标签枚举
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
public enum IscsSystem {
|
public enum IscsSystem {
|
||||||
PA,
|
PA,
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目
|
* 项目
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目
|
* 项目
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
public interface ServicePath {
|
public interface ServicePath {
|
||||||
String MAIN = "https://joylink.club/jlcloud";
|
String MAIN = "https://joylink.club/jlcloud";
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
public enum SortDirection {
|
public enum SortDirection {
|
||||||
/**
|
/**
|
|
@ -1,6 +1,6 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.manage.exception.BusinessExceptionAssertEnum;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
|
@ -1,6 +1,6 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.manage.exception.BusinessExceptionAssertEnum;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package club.joylink.rtss.constants;
|
package club.joylink.rtss.manage.constants;
|
||||||
|
|
||||||
public interface WxConstants {
|
public interface WxConstants {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package club.joylink.rtss.controller;
|
package club.joylink.rtss.manage.controller;
|
||||||
|
|
||||||
import club.joylink.rtss.services.CgyRecordService;
|
import club.joylink.rtss.manage.services.CgyRecordService;
|
||||||
import club.joylink.rtss.vo.client.CgyRecordVO;
|
import club.joylink.rtss.manage.vo.client.CgyRecordVO;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
@ -1,15 +1,15 @@
|
||||||
package club.joylink.rtss.controller;
|
package club.joylink.rtss.manage.controller;
|
||||||
|
|
||||||
import club.joylink.rtss.constants.RoleEnum;
|
import club.joylink.rtss.manage.constants.RoleEnum;
|
||||||
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
import club.joylink.rtss.manage.controller.advice.AuthenticateInterceptor;
|
||||||
import club.joylink.rtss.controller.advice.Role;
|
import club.joylink.rtss.manage.controller.advice.Role;
|
||||||
import club.joylink.rtss.services.org.*;
|
import club.joylink.rtss.manage.services.org.*;
|
||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.manage.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.manage.vo.LoginUserInfoVO;
|
||||||
import club.joylink.rtss.vo.client.LessonVO;
|
import club.joylink.rtss.manage.vo.client.LessonVO;
|
||||||
import club.joylink.rtss.vo.client.Node;
|
import club.joylink.rtss.manage.vo.client.Node;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.manage.vo.client.PageVO;
|
||||||
import club.joylink.rtss.vo.client.org.*;
|
import club.joylink.rtss.manage.vo.client.org.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -18,7 +18,7 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组织成员管理接口
|
* 组织成员管理接口
|
||||||
* 这些接口逐渐废弃,新接口加在这里{@link club.joylink.rtss.controller.org.OrgController}
|
* 这些接口逐渐废弃,新接口加在这里{@link club.joylink.rtss.manage.controller.org.OrgController}
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/company")
|
@RequestMapping("/api/company")
|
|
@ -1,14 +1,14 @@
|
||||||
package club.joylink.rtss.controller;
|
package club.joylink.rtss.manage.controller;
|
||||||
|
|
||||||
import club.joylink.rtss.constants.Project;
|
import club.joylink.rtss.manage.constants.Project;
|
||||||
import club.joylink.rtss.controller.org.OrgProjectController;
|
import club.joylink.rtss.manage.controller.org.OrgProjectController;
|
||||||
import club.joylink.rtss.controller.paper.PaperCompositionController;
|
import club.joylink.rtss.manage.controller.paper.PaperCompositionController;
|
||||||
import club.joylink.rtss.controller.publish.MapFunctionController;
|
import club.joylink.rtss.manage.controller.publish.MapFunctionController;
|
||||||
import club.joylink.rtss.controller.user.UserController;
|
import club.joylink.rtss.manage.controller.user.UserController;
|
||||||
import club.joylink.rtss.dao.MapDataDAO;
|
import club.joylink.rtss.manage.dao.MapDataDAO;
|
||||||
import club.joylink.rtss.dao.MapInfoDAO;
|
import club.joylink.rtss.manage.dao.MapInfoDAO;
|
||||||
import club.joylink.rtss.dao.OrgDAO;
|
import club.joylink.rtss.manage.dao.OrgDAO;
|
||||||
import club.joylink.rtss.entity.*;
|
import club.joylink.rtss.manage.entity.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
@ -1,10 +1,10 @@
|
||||||
package club.joylink.rtss.controller;
|
package club.joylink.rtss.manage.controller;
|
||||||
|
|
||||||
import club.joylink.rtss.services.file.IFileManagerService;
|
import club.joylink.rtss.manage.services.file.IFileManagerService;
|
||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.manage.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.client.file.FileBindingVO;
|
import club.joylink.rtss.manage.vo.client.file.FileBindingVO;
|
||||||
import club.joylink.rtss.vo.client.file.FileQueryVO;
|
import club.joylink.rtss.manage.vo.client.file.FileQueryVO;
|
||||||
import club.joylink.rtss.vo.client.file.FileVO;
|
import club.joylink.rtss.manage.vo.client.file.FileVO;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
|
@ -1,15 +1,15 @@
|
||||||
package club.joylink.rtss.controller;
|
package club.joylink.rtss.manage.controller;
|
||||||
|
|
||||||
import club.joylink.rtss.services.ILearnService;
|
import club.joylink.rtss.manage.services.ILearnService;
|
||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.manage.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
import club.joylink.rtss.manage.vo.client.PageQueryVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.manage.vo.client.PageVO;
|
||||||
import club.joylink.rtss.vo.client.learn.*;
|
import club.joylink.rtss.manage.vo.client.learn.*;
|
||||||
import club.joylink.rtss.vo.client.post.LearnMessageCreateVO;
|
import club.joylink.rtss.manage.vo.client.post.LearnMessageCreateVO;
|
||||||
import club.joylink.rtss.vo.client.post.LearnMessagePagedQueryVO;
|
import club.joylink.rtss.manage.vo.client.post.LearnMessagePagedQueryVO;
|
||||||
import club.joylink.rtss.vo.client.post.LearnMessageVO;
|
import club.joylink.rtss.manage.vo.client.post.LearnMessageVO;
|
||||||
import club.joylink.rtss.vo.client.post.LearnPostPagedQueryVO;
|
import club.joylink.rtss.manage.vo.client.post.LearnPostPagedQueryVO;
|
||||||
import club.joylink.rtss.vo.client.validGroup.LearnCommentCreateCheck;
|
import club.joylink.rtss.manage.vo.client.validGroup.LearnCommentCreateCheck;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
|
@ -1,14 +1,14 @@
|
||||||
package club.joylink.rtss.controller;
|
package club.joylink.rtss.manage.controller;
|
||||||
|
|
||||||
import club.joylink.rtss.exception.BaseException;
|
import club.joylink.rtss.manage.exception.BaseException;
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.manage.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.services.auth.IAuthenticateService;
|
import club.joylink.rtss.manage.services.auth.IAuthenticateService;
|
||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.manage.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.manage.vo.LoginUserInfoVO;
|
||||||
import club.joylink.rtss.vo.client.LoginStatusVO;
|
import club.joylink.rtss.manage.vo.client.LoginStatusVO;
|
||||||
import club.joylink.rtss.vo.client.LoginUserVO;
|
import club.joylink.rtss.manage.vo.client.LoginUserVO;
|
||||||
import club.joylink.rtss.vo.client.validGroup.LoginInfoCheck;
|
import club.joylink.rtss.manage.vo.client.validGroup.LoginInfoCheck;
|
||||||
import club.joylink.rtss.vo.client.validGroup.ThirdLoginInfoCheck;
|
import club.joylink.rtss.manage.vo.client.validGroup.ThirdLoginInfoCheck;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
|
@ -1,10 +1,10 @@
|
||||||
package club.joylink.rtss.controller;
|
package club.joylink.rtss.manage.controller;
|
||||||
|
|
||||||
import club.joylink.rtss.services.IMap3dModelService;
|
import club.joylink.rtss.manage.services.IMap3dModelService;
|
||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.manage.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.client.map.Map3dModelCreateVO;
|
import club.joylink.rtss.manage.vo.client.map.Map3dModelCreateVO;
|
||||||
import club.joylink.rtss.vo.client.map.Map3dModelUpdateVO;
|
import club.joylink.rtss.manage.vo.client.map.Map3dModelUpdateVO;
|
||||||
import club.joylink.rtss.vo.client.map.Map3dModelVO;
|
import club.joylink.rtss.manage.vo.client.map.Map3dModelVO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
|
@ -1,7 +1,7 @@
|
||||||
package club.joylink.rtss.controller;
|
package club.joylink.rtss.manage.controller;
|
||||||
|
|
||||||
import club.joylink.rtss.services.draftData.DraftMapDataHandleService;
|
import club.joylink.rtss.manage.services.draftData.DraftMapDataHandleService;
|
||||||
import club.joylink.rtss.services.publishData.PublishMapDataHandler;
|
import club.joylink.rtss.manage.services.publishData.PublishMapDataHandler;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
|
@ -1,10 +1,10 @@
|
||||||
package club.joylink.rtss.controller;
|
package club.joylink.rtss.manage.controller;
|
||||||
|
|
||||||
import club.joylink.rtss.entity.minio.MinioFileInfo;
|
import club.joylink.rtss.manage.entity.minio.MinioFileInfo;
|
||||||
import club.joylink.rtss.services.MinioService;
|
import club.joylink.rtss.manage.services.MinioService;
|
||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.manage.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.manage.vo.client.PageVO;
|
||||||
import club.joylink.rtss.vo.minio.MinioFilePageVO;
|
import club.joylink.rtss.manage.vo.minio.MinioFilePageVO;
|
||||||
import io.minio.http.Method;
|
import io.minio.http.Method;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue