parent
58a26d8951
commit
e40646b6c9
38 changed files with 847 additions and 633 deletions
@ -1,76 +0,0 @@ |
||||
<?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>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-parent</artifactId> |
||||
<version>2.1.8.RELEASE</version> |
||||
<relativePath/> <!-- lookup parent from repository --> |
||||
</parent> |
||||
<groupId>com.daqing.financial</groupId> |
||||
<artifactId>dq-financial-guarantee</artifactId> |
||||
<version>0.0.1-SNAPSHOT</version> |
||||
<name>dq-financial-guarantee</name> |
||||
<description>大庆智慧金融平台-担保业务服务</description> |
||||
|
||||
<properties> |
||||
<java.version>1.8</java.version> |
||||
<spring-cloud.version>Greenwich.SR3</spring-cloud.version> |
||||
</properties> |
||||
|
||||
<dependencies> |
||||
<!-- <dependency> |
||||
<groupId>com.daqing.framework</groupId> |
||||
<artifactId>dq-framework-common</artifactId> |
||||
<version>1.0-SNAPSHOT</version> |
||||
</dependency>--> |
||||
<dependency> |
||||
<groupId>com.daqing.framework</groupId> |
||||
<artifactId>dq-framework-model</artifactId> |
||||
<version>1.0-SNAPSHOT</version> |
||||
</dependency> |
||||
<!-- <dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-web</artifactId> |
||||
</dependency>--> |
||||
<dependency> |
||||
<groupId>org.springframework.cloud</groupId> |
||||
<artifactId>spring-cloud-starter-openfeign</artifactId> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-test</artifactId> |
||||
<scope>test</scope> |
||||
<exclusions> |
||||
<exclusion> |
||||
<groupId>org.junit.vintage</groupId> |
||||
<artifactId>junit-vintage-engine</artifactId> |
||||
</exclusion> |
||||
</exclusions> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
<dependencyManagement> |
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>org.springframework.cloud</groupId> |
||||
<artifactId>spring-cloud-dependencies</artifactId> |
||||
<version>${spring-cloud.version}</version> |
||||
<type>pom</type> |
||||
<scope>import</scope> |
||||
</dependency> |
||||
</dependencies> |
||||
</dependencyManagement> |
||||
|
||||
<build> |
||||
<plugins> |
||||
<plugin> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-maven-plugin</artifactId> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
|
||||
</project> |
@ -1,13 +0,0 @@ |
||||
package com.daqing.financial.guarantee; |
||||
|
||||
import org.springframework.boot.SpringApplication; |
||||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
|
||||
@SpringBootApplication |
||||
public class DqFinancialGuaranteeApplication { |
||||
|
||||
public static void main(String[] args) { |
||||
SpringApplication.run(DqFinancialGuaranteeApplication.class, args); |
||||
} |
||||
|
||||
} |
@ -1,47 +0,0 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
||||
<configuration> |
||||
<!--定义日志文件的存储地址,使用绝对路径--> |
||||
<property name="LOG_HOME" value="d:/logs/daqing/guarantee"/> |
||||
|
||||
<!-- Console 输出设置 --> |
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
||||
<encoder> |
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> |
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> |
||||
<charset>utf8</charset> |
||||
</encoder> |
||||
</appender> |
||||
|
||||
<!-- 按照每天生成日志文件 --> |
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<!--日志文件输出的文件名--> |
||||
<fileNamePattern>${LOG_HOME}/guarantee.%d{yyyy-MM-dd}.log</fileNamePattern> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> |
||||
</encoder> |
||||
</appender> |
||||
|
||||
<!-- 异步输出 --> |
||||
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender"> |
||||
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 --> |
||||
<discardingThreshold>0</discardingThreshold> |
||||
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 --> |
||||
<queueSize>512</queueSize> |
||||
<!-- 添加附加的appender,最多只能添加一个 --> |
||||
<appender-ref ref="FILE"/> |
||||
</appender> |
||||
|
||||
|
||||
<logger name="org.apache.ibatis.cache.decorators.LoggingCache" level="DEBUG" additivity="false"> |
||||
<appender-ref ref="CONSOLE"/> |
||||
</logger> |
||||
<logger name="org.springframework.boot" level="DEBUG"/> |
||||
<root level="info"> |
||||
<!--<appender-ref ref="ASYNC"/>--> |
||||
<appender-ref ref="FILE"/> |
||||
<appender-ref ref="CONSOLE"/> |
||||
</root> |
||||
</configuration> |
@ -1,13 +0,0 @@ |
||||
package com.daqing.financial.guarantee; |
||||
|
||||
import org.junit.Test; |
||||
import org.springframework.boot.test.context.SpringBootTest; |
||||
|
||||
@SpringBootTest |
||||
class DqFinancialGuaranteeApplicationTests { |
||||
|
||||
@Test |
||||
void contextLoads() { |
||||
} |
||||
|
||||
} |
@ -0,0 +1,64 @@ |
||||
package com.daqing.financial.hrauth; |
||||
|
||||
import org.springframework.beans.factory.DisposableBean; |
||||
import org.springframework.context.ApplicationContext; |
||||
import org.springframework.context.ApplicationContextAware; |
||||
import org.springframework.context.annotation.Lazy; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
@Component |
||||
@Lazy(false) |
||||
public class SpringContextHolder implements ApplicationContextAware, DisposableBean { |
||||
|
||||
private static ApplicationContext applicationContext = null; |
||||
|
||||
|
||||
/** |
||||
* 取得存储在静态变量中的ApplicationContext. |
||||
*/ |
||||
public static ApplicationContext getApplicationContext() { |
||||
return applicationContext; |
||||
} |
||||
|
||||
/** |
||||
* 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型. |
||||
*/ |
||||
@SuppressWarnings("unchecked") |
||||
public static <T> T getBean(String name) { |
||||
return (T) applicationContext.getBean(name); |
||||
} |
||||
|
||||
/** |
||||
* 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型. |
||||
*/ |
||||
public static <T> T getBean(Class<T> requiredType) { |
||||
return applicationContext.getBean(requiredType); |
||||
} |
||||
|
||||
public static <T> T getBean(String name, Class<T> clazz) { |
||||
return getApplicationContext().getBean(name, clazz); |
||||
} |
||||
|
||||
/** |
||||
* 清除SpringContextHolder中的ApplicationContext为Null. |
||||
*/ |
||||
public static void clearHolder() { |
||||
applicationContext = null; |
||||
} |
||||
|
||||
/** |
||||
* 实现ApplicationContextAware接口, 注入Context到静态变量中. |
||||
*/ |
||||
@Override |
||||
public void setApplicationContext(ApplicationContext appContext) { |
||||
applicationContext = appContext; |
||||
} |
||||
|
||||
/** |
||||
* 实现DisposableBean接口, 在Context关闭时清理静态变量. |
||||
*/ |
||||
@Override |
||||
public void destroy() { |
||||
SpringContextHolder.clearHolder(); |
||||
} |
||||
} |
@ -1,109 +1,109 @@ |
||||
package com.daqing.financial.hrauth.config; |
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.http.HttpMethod; |
||||
import org.springframework.security.authentication.AuthenticationManager; |
||||
import org.springframework.security.crypto.password.PasswordEncoder; |
||||
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; |
||||
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter; |
||||
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; |
||||
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer; |
||||
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer; |
||||
import org.springframework.security.oauth2.provider.ClientDetailsService; |
||||
import org.springframework.security.oauth2.provider.code.AuthorizationCodeServices; |
||||
import org.springframework.security.oauth2.provider.code.InMemoryAuthorizationCodeServices; |
||||
import org.springframework.security.oauth2.provider.token.AuthorizationServerTokenServices; |
||||
import org.springframework.security.oauth2.provider.token.DefaultTokenServices; |
||||
import org.springframework.security.oauth2.provider.token.TokenStore; |
||||
|
||||
/** |
||||
* 配置OAuth2.0授权服务器 |
||||
* |
||||
* @auther River |
||||
* @date 2020/9/21 17:49 |
||||
*/ |
||||
@Configuration |
||||
@EnableAuthorizationServer |
||||
public class AuthorizationServer extends AuthorizationServerConfigurerAdapter { |
||||
|
||||
@Autowired |
||||
private TokenStore tokenStore; |
||||
|
||||
@Autowired |
||||
private ClientDetailsService clientDetailsService; |
||||
|
||||
@Autowired |
||||
private AuthenticationManager authenticationManager; |
||||
|
||||
@Autowired |
||||
private AuthorizationCodeServices authorizationCodeServices; |
||||
@Autowired |
||||
public PasswordEncoder passwordEncoder; |
||||
|
||||
/** |
||||
* 配置令牌的安全约束(允许哪些请求访问) |
||||
*/ |
||||
@Override |
||||
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception { |
||||
security |
||||
.tokenKeyAccess("permitAll()") // 公开提供公钥加密的端点(就是使用jwt令牌的时候需要的)
|
||||
.checkTokenAccess("permitAll()") // 校验令牌
|
||||
.allowFormAuthenticationForClients(); //允许表单提交,允许客户端访问 OAuth2 授权接口,否则请求 token 会返回 401。
|
||||
} |
||||
|
||||
/** |
||||
* 配置支持哪些客户端访问 |
||||
*/ |
||||
@Override |
||||
public void configure(ClientDetailsServiceConfigurer clients) throws Exception { |
||||
clients.inMemory() |
||||
.withClient("order-client") |
||||
.secret(passwordEncoder.encode("order-secret-8888")) |
||||
.authorizedGrantTypes("refresh_token", "authorization_code", "password") |
||||
.accessTokenValiditySeconds(3600) |
||||
.scopes("all") |
||||
.and() |
||||
.withClient("user-client") |
||||
.secret(passwordEncoder.encode("user-secret-8888")) |
||||
.authorizedGrantTypes("refresh_token", "authorization_code", "password") |
||||
.accessTokenValiditySeconds(3600) |
||||
.scopes("all"); |
||||
} |
||||
|
||||
/** |
||||
* 配置令牌(token)的访问端点 |
||||
*/ |
||||
@Override |
||||
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { |
||||
endpoints |
||||
.authenticationManager(authenticationManager) // 密码模式需要
|
||||
.authorizationCodeServices(authorizationCodeServices) // 授权码模式需要
|
||||
.tokenServices(tokenServices()) // 令牌的管理方式
|
||||
.allowedTokenEndpointRequestMethods(HttpMethod.POST); // 允许的请求方式
|
||||
} |
||||
|
||||
/** |
||||
* 令牌服务 |
||||
*/ |
||||
@Bean |
||||
public AuthorizationServerTokenServices tokenServices(){ |
||||
DefaultTokenServices service = new DefaultTokenServices(); |
||||
service.setClientDetailsService(clientDetailsService); // 客户端信息的服务
|
||||
service.setSupportRefreshToken(true); // 是否产生刷新令牌
|
||||
service.setTokenStore(tokenStore); // 令牌的存储策略
|
||||
service.setAccessTokenValiditySeconds(7200); // 令牌有效期
|
||||
service.setRefreshTokenValiditySeconds(259200); // 刷新令牌有效期
|
||||
return service; |
||||
} |
||||
|
||||
/** |
||||
* 授权码服务(设置授权码模式的授权码如何存取,暂时在内存,后期在数据库) |
||||
*/ |
||||
@Bean |
||||
public AuthorizationCodeServices authorizationCodeServices(){ |
||||
|
||||
return new InMemoryAuthorizationCodeServices(); |
||||
} |
||||
} |
||||
//package com.daqing.financial.hrauth.config;
|
||||
//
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.http.HttpMethod;
|
||||
//import org.springframework.security.authentication.AuthenticationManager;
|
||||
//import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
//import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
|
||||
//import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
|
||||
//import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
|
||||
//import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;
|
||||
//import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer;
|
||||
//import org.springframework.security.oauth2.provider.ClientDetailsService;
|
||||
//import org.springframework.security.oauth2.provider.code.AuthorizationCodeServices;
|
||||
//import org.springframework.security.oauth2.provider.code.InMemoryAuthorizationCodeServices;
|
||||
//import org.springframework.security.oauth2.provider.token.AuthorizationServerTokenServices;
|
||||
//import org.springframework.security.oauth2.provider.token.DefaultTokenServices;
|
||||
//import org.springframework.security.oauth2.provider.token.TokenStore;
|
||||
//
|
||||
///**
|
||||
// * 配置OAuth2.0授权服务器
|
||||
// *
|
||||
// * @auther River
|
||||
// * @date 2020/9/21 17:49
|
||||
// */
|
||||
//@Configuration
|
||||
//@EnableAuthorizationServer
|
||||
//public class AuthorizationServer extends AuthorizationServerConfigurerAdapter {
|
||||
//
|
||||
// @Autowired
|
||||
// private TokenStore tokenStore;
|
||||
//
|
||||
// @Autowired
|
||||
// private ClientDetailsService clientDetailsService;
|
||||
//
|
||||
// @Autowired
|
||||
// private AuthenticationManager authenticationManager;
|
||||
//
|
||||
// @Autowired
|
||||
// private AuthorizationCodeServices authorizationCodeServices;
|
||||
// @Autowired
|
||||
// public PasswordEncoder passwordEncoder;
|
||||
//
|
||||
// /**
|
||||
// * 配置令牌的安全约束(允许哪些请求访问)
|
||||
// */
|
||||
// @Override
|
||||
// public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
|
||||
// security
|
||||
// .tokenKeyAccess("permitAll()") // 公开提供公钥加密的端点(就是使用jwt令牌的时候需要的)
|
||||
// .checkTokenAccess("permitAll()") // 校验令牌
|
||||
// .allowFormAuthenticationForClients(); //允许表单提交,允许客户端访问 OAuth2 授权接口,否则请求 token 会返回 401。
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 配置支持哪些客户端访问
|
||||
// */
|
||||
// @Override
|
||||
// public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
|
||||
// clients.inMemory()
|
||||
// .withClient("order-client")
|
||||
// .secret(passwordEncoder.encode("order-secret-8888"))
|
||||
// .authorizedGrantTypes("refresh_token", "authorization_code", "password")
|
||||
// .accessTokenValiditySeconds(3600)
|
||||
// .scopes("all")
|
||||
// .and()
|
||||
// .withClient("user-client")
|
||||
// .secret(passwordEncoder.encode("user-secret-8888"))
|
||||
// .authorizedGrantTypes("refresh_token", "authorization_code", "password")
|
||||
// .accessTokenValiditySeconds(3600)
|
||||
// .scopes("all");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 配置令牌(token)的访问端点
|
||||
// */
|
||||
// @Override
|
||||
// public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
|
||||
// endpoints
|
||||
// .authenticationManager(authenticationManager) // 密码模式需要
|
||||
// .authorizationCodeServices(authorizationCodeServices) // 授权码模式需要
|
||||
// .tokenServices(tokenServices()) // 令牌的管理方式
|
||||
// .allowedTokenEndpointRequestMethods(HttpMethod.POST); // 允许的请求方式
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 令牌服务
|
||||
// */
|
||||
// @Bean
|
||||
// public AuthorizationServerTokenServices tokenServices(){
|
||||
// DefaultTokenServices service = new DefaultTokenServices();
|
||||
// service.setClientDetailsService(clientDetailsService); // 客户端信息的服务
|
||||
// service.setSupportRefreshToken(true); // 是否产生刷新令牌
|
||||
// service.setTokenStore(tokenStore); // 令牌的存储策略
|
||||
// service.setAccessTokenValiditySeconds(7200); // 令牌有效期
|
||||
// service.setRefreshTokenValiditySeconds(259200); // 刷新令牌有效期
|
||||
// return service;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 授权码服务(设置授权码模式的授权码如何存取,暂时在内存,后期在数据库)
|
||||
// */
|
||||
// @Bean
|
||||
// public AuthorizationCodeServices authorizationCodeServices(){
|
||||
//
|
||||
// return new InMemoryAuthorizationCodeServices();
|
||||
// }
|
||||
//}
|
||||
|
@ -1,67 +1,67 @@ |
||||
package com.daqing.financial.hrauth.config; |
||||
|
||||
import com.daqing.financial.hrauth.service.impl.UserLoginServiceImpl; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.security.authentication.AuthenticationManager; |
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; |
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; |
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; |
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
||||
import org.springframework.security.crypto.password.PasswordEncoder; |
||||
|
||||
/** |
||||
* @auther River |
||||
* @date 2020/9/22 10:26 |
||||
*/ |
||||
@Configuration |
||||
@EnableWebSecurity // 开启security
|
||||
public class SecurityConfig extends WebSecurityConfigurerAdapter { |
||||
|
||||
/** |
||||
* 不能直接new对象,否则会在注入之前被拦截器拦截 |
||||
*/ |
||||
@Bean |
||||
public UserLoginServiceImpl customerLoginService(){ |
||||
|
||||
return new UserLoginServiceImpl(); |
||||
} |
||||
|
||||
// 定义用户信息(查询用户信息),security帮助我们查询,但是需要告诉他如何去查询
|
||||
@Override |
||||
protected void configure(AuthenticationManagerBuilder auth) throws Exception { |
||||
|
||||
auth.userDetailsService(customerLoginService()); |
||||
} |
||||
|
||||
|
||||
// 密码编码器,比对密码的方式
|
||||
@Bean |
||||
public PasswordEncoder passwordEncoder(){ |
||||
|
||||
return new BCryptPasswordEncoder(); |
||||
} |
||||
|
||||
/** |
||||
* 认证管理器 |
||||
*/ |
||||
@Override |
||||
@Bean |
||||
public AuthenticationManager authenticationManagerBean() throws Exception { |
||||
|
||||
return super.authenticationManagerBean(); |
||||
} |
||||
|
||||
// 安全拦截机制
|
||||
@Override |
||||
protected void configure(HttpSecurity http) throws Exception { |
||||
http.authorizeRequests() |
||||
.antMatchers("/*").authenticated() // 该路径下所有请求都会被拦截
|
||||
.anyRequest().permitAll() // 其余的请求可以通过
|
||||
.and() |
||||
.formLogin() // 允许表单认证
|
||||
.successForwardUrl("/customerLogin/loginSuccess"); // 登录成功跳转路径
|
||||
} |
||||
} |
||||
|
||||
//package com.daqing.financial.hrauth.config;
|
||||
//
|
||||
//import com.daqing.financial.hrauth.service.impl.UserLoginServiceImpl;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.security.authentication.AuthenticationManager;
|
||||
//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
//import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
//import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
//
|
||||
///**
|
||||
// * @auther River
|
||||
// * @date 2020/9/22 10:26
|
||||
// */
|
||||
//@Configuration
|
||||
//@EnableWebSecurity // 开启security
|
||||
//public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
//
|
||||
// /**
|
||||
// * 不能直接new对象,否则会在注入之前被拦截器拦截
|
||||
// */
|
||||
// @Bean
|
||||
// public UserLoginServiceImpl customerLoginService(){
|
||||
//
|
||||
// return new UserLoginServiceImpl();
|
||||
// }
|
||||
//
|
||||
// // 定义用户信息(查询用户信息),security帮助我们查询,但是需要告诉他如何去查询
|
||||
// @Override
|
||||
// protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
//
|
||||
// auth.userDetailsService(customerLoginService());
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // 密码编码器,比对密码的方式
|
||||
// @Bean
|
||||
// public PasswordEncoder passwordEncoder(){
|
||||
//
|
||||
// return new BCryptPasswordEncoder();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 认证管理器
|
||||
// */
|
||||
// @Override
|
||||
// @Bean
|
||||
// public AuthenticationManager authenticationManagerBean() throws Exception {
|
||||
//
|
||||
// return super.authenticationManagerBean();
|
||||
// }
|
||||
//
|
||||
// // 安全拦截机制
|
||||
// @Override
|
||||
// protected void configure(HttpSecurity http) throws Exception {
|
||||
// http.authorizeRequests()
|
||||
// .antMatchers("/*").authenticated() // 该路径下所有请求都会被拦截
|
||||
// .anyRequest().permitAll() // 其余的请求可以通过
|
||||
// .and()
|
||||
// .formLogin() // 允许表单认证
|
||||
// .successForwardUrl("/customerLogin/loginSuccess"); // 登录成功跳转路径
|
||||
// }
|
||||
//}
|
||||
//
|
||||
|
@ -1,22 +1,22 @@ |
||||
package com.daqing.financial.hrauth.config; |
||||
|
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.security.oauth2.provider.token.TokenStore; |
||||
import org.springframework.security.oauth2.provider.token.store.InMemoryTokenStore; |
||||
|
||||
/** |
||||
* 令牌配置类 |
||||
* |
||||
* @auther River |
||||
* @date 2020/9/22 9:54 |
||||
*/ |
||||
@Configuration |
||||
public class TokenConfig { |
||||
|
||||
@Bean |
||||
public TokenStore tokenStore(){ |
||||
// 内存生成,普通令牌
|
||||
return new InMemoryTokenStore(); |
||||
} |
||||
} |
||||
//package com.daqing.financial.hrauth.config;
|
||||
//
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.security.oauth2.provider.token.TokenStore;
|
||||
//import org.springframework.security.oauth2.provider.token.store.InMemoryTokenStore;
|
||||
//
|
||||
///**
|
||||
// * 令牌配置类
|
||||
// *
|
||||
// * @auther River
|
||||
// * @date 2020/9/22 9:54
|
||||
// */
|
||||
//@Configuration
|
||||
//public class TokenConfig {
|
||||
//
|
||||
// @Bean
|
||||
// public TokenStore tokenStore(){
|
||||
// // 内存生成,普通令牌
|
||||
// return new InMemoryTokenStore();
|
||||
// }
|
||||
//}
|
||||
|
@ -0,0 +1,71 @@ |
||||
package com.daqing.financial.hrauth.util; |
||||
|
||||
|
||||
import com.auth0.jwt.JWT; |
||||
import com.auth0.jwt.algorithms.Algorithm; |
||||
import com.daqing.financial.hrauth.SpringContextHolder; |
||||
|
||||
import java.util.Date; |
||||
import java.util.Set; |
||||
|
||||
/** |
||||
* @author zcw |
||||
* @version 1.0 |
||||
* @date 2019/11/23 11:06 |
||||
* @description jwt工具类 |
||||
*/ |
||||
public class JwtUtil { |
||||
|
||||
private final static Algorithm algorithm = SpringContextHolder.getBean("algorithm", Algorithm.class); |
||||
|
||||
//private final static OdcProperties properties = SpringContextHolder.getBean("odcProperties", OdcProperties.class);
|
||||
|
||||
/** |
||||
* 创建token |
||||
* |
||||
* @param userId; |
||||
* @param timeout; 单位是秒 |
||||
*/ |
||||
public static String createJwtToken(Long userId, long timeout) { |
||||
return JWT.create() |
||||
.withClaim("member", userId) |
||||
.withExpiresAt(new Date(System.currentTimeMillis() + timeout * 1000)) |
||||
.sign(algorithm); |
||||
} |
||||
|
||||
/** |
||||
* token正确且有效,则返回userId |
||||
*/ |
||||
public static Long verifyToken(String token) { |
||||
try { |
||||
String noBearerToken = token.replaceFirst("Bearer ", ""); |
||||
Long userId = JWT.require(algorithm) |
||||
.build() |
||||
.verify(noBearerToken) |
||||
.getClaim("member") |
||||
.asLong(); |
||||
if (RedisUtil.get(getRedisKey(userId, noBearerToken)) != null) { |
||||
return userId; |
||||
} |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
return null; |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public static String getRedisKey(Long userId, String token) { |
||||
return String.format("dq:token:%d:%s", userId, token); |
||||
} |
||||
|
||||
public static void putTokenToRedis(Long userId, String token, long times) { |
||||
RedisUtil.setEx(getRedisKey(userId, token), "nothing", times); |
||||
} |
||||
|
||||
public static void removeTokenByUserId(Long userId) { |
||||
Set<String> tokenSet = RedisUtil.keys(getRedisKey(userId, "*")); |
||||
for (String key : tokenSet) { |
||||
RedisUtil.del(key); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,298 @@ |
||||
package com.daqing.financial.hrauth.util; |
||||
|
||||
|
||||
import com.daqing.financial.hrauth.SpringContextHolder; |
||||
import org.springframework.data.redis.core.HashOperations; |
||||
import org.springframework.data.redis.core.ListOperations; |
||||
import org.springframework.data.redis.core.StringRedisTemplate; |
||||
import org.springframework.data.redis.core.ValueOperations; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.Set; |
||||
import java.util.concurrent.TimeUnit; |
||||
|
||||
/** |
||||
* redis工具类 |
||||
*/ |
||||
public class RedisUtil { |
||||
|
||||
private final static StringRedisTemplate stringRedisTemplate = SpringContextHolder.getBean("stringRedisTemplate"); |
||||
|
||||
/** |
||||
* 匹配key |
||||
*/ |
||||
public static Set<String> keys(String pattern) { |
||||
return stringRedisTemplate.keys(pattern); |
||||
} |
||||
|
||||
/** |
||||
* 删除一个key |
||||
*/ |
||||
public static void del(String key) { |
||||
stringRedisTemplate.delete(key); |
||||
} |
||||
|
||||
/** |
||||
* 批量删除key |
||||
*/ |
||||
public static void delByPattern(String pattern) { |
||||
Set<String> keySet = keys(pattern); |
||||
stringRedisTemplate.delete(keySet); |
||||
} |
||||
|
||||
/** |
||||
* 设置过期时间,单位为秒 |
||||
*/ |
||||
public static boolean expire(String key, long seconds) { |
||||
return stringRedisTemplate.expire(key, seconds, TimeUnit.SECONDS); |
||||
} |
||||
|
||||
/** |
||||
* 获取自动过期时间 |
||||
*/ |
||||
public static long ttl(String key) { |
||||
return stringRedisTemplate.getExpire(key, TimeUnit.SECONDS); |
||||
} |
||||
|
||||
/** |
||||
* 移除过期时间 |
||||
*/ |
||||
public static boolean persist(String key) { |
||||
return stringRedisTemplate.persist(key); |
||||
} |
||||
|
||||
/////// String 操作
|
||||
|
||||
/** |
||||
* 给key赋值 |
||||
*/ |
||||
public static void set(String key, String value) { |
||||
ValueOperations<String, String> op = stringRedisTemplate.opsForValue(); |
||||
op.set(key, value); |
||||
} |
||||
|
||||
/** |
||||
* 给key赋值,并设置过期时间,单位为秒 |
||||
*/ |
||||
public static void setEx(String key, String value, long seconds) { |
||||
set(key, value); |
||||
expire(key, seconds); |
||||
} |
||||
|
||||
/** |
||||
* 将key的值加num |
||||
*/ |
||||
public static void incrBy(String key, long num) { |
||||
ValueOperations<String, String> op = stringRedisTemplate.opsForValue(); |
||||
op.increment(key, num); |
||||
} |
||||
|
||||
/** |
||||
* 获取key的值 |
||||
*/ |
||||
public static String get(String key) { |
||||
ValueOperations<String, String> op = stringRedisTemplate.opsForValue(); |
||||
return op.get(key); |
||||
} |
||||
|
||||
/////// list操作
|
||||
|
||||
/** |
||||
* 插入到表头 |
||||
*/ |
||||
public static void lPush(String key, String... values) { |
||||
ListOperations<String, String> listOp = stringRedisTemplate.opsForList(); |
||||
listOp.leftPushAll(key, values); |
||||
} |
||||
|
||||
/** |
||||
* 移除第一个 |
||||
*/ |
||||
public static String rPop(String key) { |
||||
ListOperations<String, String> listOp = stringRedisTemplate.opsForList(); |
||||
return listOp.rightPop(key); |
||||
} |
||||
|
||||
/** |
||||
* 获取list所有 |
||||
* |
||||
* @param key |
||||
* @param start |
||||
* @param end |
||||
* @return |
||||
*/ |
||||
public static List<String> lRange(String key, int start, int end) { |
||||
ListOperations<String, String> opsForList = stringRedisTemplate.opsForList(); |
||||
return opsForList.range(key, start, end); |
||||
} |
||||
|
||||
/////// hash
|
||||
|
||||
/* |
||||
* public static void hset(String key,String hashKey,String value){ |
||||
* HashOperations<String,String,String> opsForHash = |
||||
* stringRedisTemplate.opsForHash(); opsForHash.put(key, hashKey, value); } |
||||
*/ |
||||
/////// set
|
||||
/////// sorted set
|
||||
|
||||
/** |
||||
* 存放list |
||||
* @param key |
||||
* @param list |
||||
*/ |
||||
public static void setList(String key, List<String> list){ |
||||
ListOperations<String, String> opsForList = stringRedisTemplate.opsForList(); |
||||
opsForList.leftPushAll(key, list); |
||||
} |
||||
|
||||
/** |
||||
* HashGet |
||||
* @param key 键 不能为null |
||||
* @param item 项 不能为null |
||||
* @return 值 |
||||
*/ |
||||
public static Object hGet(String key,String item){ |
||||
HashOperations<String, Object, Object> mapOp = stringRedisTemplate.opsForHash(); |
||||
return mapOp.get(key, item); |
||||
} |
||||
|
||||
/** |
||||
* 获取hashKey对应的所有键值 |
||||
* @param key 键 |
||||
* @return 对应的多个键值 |
||||
*/ |
||||
public static Map<Object,Object> hmGet(String key){ |
||||
HashOperations<String, Object, Object> mapOp = stringRedisTemplate.opsForHash(); |
||||
return mapOp.entries(key); |
||||
} |
||||
|
||||
/** |
||||
* HashSet |
||||
* @param key 键 |
||||
* @param map 对应多个键值 |
||||
* @return true 成功 false 失败 |
||||
*/ |
||||
public static boolean hmSet(String key, Map<String,Object> map){ |
||||
try { |
||||
HashOperations<String, Object, Object> mapOp = stringRedisTemplate.opsForHash(); |
||||
mapOp.putAll(key, map); |
||||
return true; |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* HashSet 并设置时间 |
||||
* @param key 键 |
||||
* @param map 对应多个键值 |
||||
* @param time 时间(秒) |
||||
* @return true成功 false失败 |
||||
*/ |
||||
public static boolean hmset(String key, Map<String,Object> map, long time){ |
||||
try { |
||||
HashOperations<String, Object, Object> mapOp = stringRedisTemplate.opsForHash(); |
||||
mapOp.putAll(key, map); |
||||
if(time>0){ |
||||
expire(key, time); |
||||
} |
||||
return true; |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 向一张hash表中放入数据,如果不存在将创建 |
||||
* @param key 键 |
||||
* @param item 项 |
||||
* @param value 值 |
||||
* @return true 成功 false失败 |
||||
*/ |
||||
public static boolean hset(String key,String item,Object value) { |
||||
try { |
||||
HashOperations<String, Object, Object> mapOp = stringRedisTemplate.opsForHash(); |
||||
mapOp.put(key, item, value); |
||||
return true; |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 向一张hash表中放入数据,如果不存在将创建 |
||||
* @param key 键 |
||||
* @param item 项 |
||||
* @param value 值 |
||||
* @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间 |
||||
* @return true 成功 false失败 |
||||
*/ |
||||
public static boolean hset(String key,String item,Object value,long time) { |
||||
try { |
||||
HashOperations<String, Object, Object> mapOp = stringRedisTemplate.opsForHash(); |
||||
mapOp.put(key, item, value); |
||||
if(time>0){ |
||||
expire(key, time); |
||||
} |
||||
return true; |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 删除hash表中的值 |
||||
* @param key 键 不能为null |
||||
* @param item 项 可以使多个 不能为null |
||||
*/ |
||||
public static void hdel(String key, Object... item){ |
||||
HashOperations<String, Object, Object> mapOp = stringRedisTemplate.opsForHash(); |
||||
|
||||
mapOp.delete(key,item); |
||||
} |
||||
|
||||
/** |
||||
* 判断hash表中是否有该项的值 |
||||
* @param key 键 不能为null |
||||
* @param item 项 不能为null |
||||
* @return true 存在 false不存在 |
||||
*/ |
||||
public static boolean hHasKey(String key, String item){ |
||||
HashOperations<String, Object, Object> mapOp = stringRedisTemplate.opsForHash(); |
||||
|
||||
return mapOp.hasKey(key, item); |
||||
} |
||||
|
||||
/** |
||||
* hash递增 如果不存在,就会创建一个 并把新增后的值返回 |
||||
* @param key 键 |
||||
* @param item 项 |
||||
* @param by 要增加几(大于0) |
||||
* @return |
||||
*/ |
||||
public static double hincr(String key, String item,double by){ |
||||
HashOperations<String, Object, Object> mapOp = stringRedisTemplate.opsForHash(); |
||||
|
||||
return mapOp.increment(key, item, by); |
||||
} |
||||
|
||||
/** |
||||
* hash递减 |
||||
* @param key 键 |
||||
* @param item 项 |
||||
* @param by 要减少记(小于0) |
||||
* @return |
||||
*/ |
||||
public static double hdecr(String key, String item,double by){ |
||||
HashOperations<String, Object, Object> mapOp = stringRedisTemplate.opsForHash(); |
||||
|
||||
return mapOp.increment(key, item,-by); |
||||
} |
||||
|
||||
} |
@ -1,13 +1,13 @@ |
||||
package com.daqing.financial.hrauth; |
||||
|
||||
import org.junit.Test; |
||||
import org.springframework.boot.test.context.SpringBootTest; |
||||
|
||||
@SpringBootTest |
||||
class DqFinancialHrmsAuthApplicationTests { |
||||
|
||||
@Test |
||||
void contextLoads() { |
||||
} |
||||
|
||||
} |
||||
//package com.daqing.financial.hrauth;
|
||||
//
|
||||
//import org.junit.Test;
|
||||
//import org.springframework.boot.test.context.SpringBootTest;
|
||||
//
|
||||
//@SpringBootTest
|
||||
//class DqFinancialHrmsAuthApplicationTests {
|
||||
//
|
||||
// @Test
|
||||
// void contextLoads() {
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
@ -1,76 +0,0 @@ |
||||
<?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>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-parent</artifactId> |
||||
<version>2.1.8.RELEASE</version> |
||||
<relativePath/> <!-- lookup parent from repository --> |
||||
</parent> |
||||
<groupId>com.daqing.financial</groupId> |
||||
<artifactId>dq-financial-workflow</artifactId> |
||||
<version>0.0.1-SNAPSHOT</version> |
||||
<name>dq-financial-workflow</name> |
||||
<description>大庆智慧金融平台-工作流服务</description> |
||||
|
||||
<properties> |
||||
<java.version>1.8</java.version> |
||||
<spring-cloud.version>Greenwich.SR3</spring-cloud.version> |
||||
</properties> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>com.daqing.framework</groupId> |
||||
<artifactId>dq-framework-common</artifactId> |
||||
<version>1.0-SNAPSHOT</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.daqing.framework</groupId> |
||||
<artifactId>dq-framework-model</artifactId> |
||||
<version>1.0-SNAPSHOT</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-web</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.cloud</groupId> |
||||
<artifactId>spring-cloud-starter-openfeign</artifactId> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-test</artifactId> |
||||
<scope>test</scope> |
||||
<exclusions> |
||||
<exclusion> |
||||
<groupId>org.junit.vintage</groupId> |
||||
<artifactId>junit-vintage-engine</artifactId> |
||||
</exclusion> |
||||
</exclusions> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
<dependencyManagement> |
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>org.springframework.cloud</groupId> |
||||
<artifactId>spring-cloud-dependencies</artifactId> |
||||
<version>${spring-cloud.version}</version> |
||||
<type>pom</type> |
||||
<scope>import</scope> |
||||
</dependency> |
||||
</dependencies> |
||||
</dependencyManagement> |
||||
|
||||
<build> |
||||
<plugins> |
||||
<plugin> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-maven-plugin</artifactId> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
|
||||
</project> |
@ -1,13 +0,0 @@ |
||||
package com.daqing.financial.workflow; |
||||
|
||||
import org.springframework.boot.SpringApplication; |
||||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
|
||||
@SpringBootApplication |
||||
public class DqFinancialWorkflowApplication { |
||||
|
||||
public static void main(String[] args) { |
||||
SpringApplication.run(DqFinancialWorkflowApplication.class, args); |
||||
} |
||||
|
||||
} |
@ -1,47 +0,0 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
||||
<configuration> |
||||
<!--定义日志文件的存储地址,使用绝对路径--> |
||||
<property name="LOG_HOME" value="d:/logs/daqing/workflow"/> |
||||
|
||||
<!-- Console 输出设置 --> |
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
||||
<encoder> |
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> |
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> |
||||
<charset>utf8</charset> |
||||
</encoder> |
||||
</appender> |
||||
|
||||
<!-- 按照每天生成日志文件 --> |
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<!--日志文件输出的文件名--> |
||||
<fileNamePattern>${LOG_HOME}/workflow.%d{yyyy-MM-dd}.log</fileNamePattern> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> |
||||
</encoder> |
||||
</appender> |
||||
|
||||
<!-- 异步输出 --> |
||||
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender"> |
||||
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 --> |
||||
<discardingThreshold>0</discardingThreshold> |
||||
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 --> |
||||
<queueSize>512</queueSize> |
||||
<!-- 添加附加的appender,最多只能添加一个 --> |
||||
<appender-ref ref="FILE"/> |
||||
</appender> |
||||
|
||||
|
||||
<logger name="org.apache.ibatis.cache.decorators.LoggingCache" level="DEBUG" additivity="false"> |
||||
<appender-ref ref="CONSOLE"/> |
||||
</logger> |
||||
<logger name="org.springframework.boot" level="DEBUG"/> |
||||
<root level="info"> |
||||
<!--<appender-ref ref="ASYNC"/>--> |
||||
<appender-ref ref="FILE"/> |
||||
<appender-ref ref="CONSOLE"/> |
||||
</root> |
||||
</configuration> |
@ -1,13 +0,0 @@ |
||||
package com.daqing.financial.workflow; |
||||
|
||||
import org.junit.Test; |
||||
import org.springframework.boot.test.context.SpringBootTest; |
||||
|
||||
@SpringBootTest |
||||
class DqFinancialWorkflowApplicationTests { |
||||
|
||||
@Test |
||||
void contextLoads() { |
||||
} |
||||
|
||||
} |
@ -0,0 +1,20 @@ |
||||
|
||||
package com.daqing.framework.util; |
||||
|
||||
import org.springframework.util.DigestUtils; |
||||
|
||||
/** |
||||
* @author zcw |
||||
* @version 1.0 |
||||
* @date 2020/1/6 17:03 |
||||
* @description md5工具类 |
||||
*/ |
||||
public class Md5Util { |
||||
|
||||
public static String md5(String str) { |
||||
if (str == null) { |
||||
return null; |
||||
} |
||||
return DigestUtils.md5DigestAsHex(str.getBytes()); |
||||
} |
||||
} |
Binary file not shown.
@ -0,0 +1,23 @@ |
||||
package com.daqing.framework.domain.hrms.request; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class LoginRequest { |
||||
|
||||
@ApiModelProperty(value = "手机号码") |
||||
private String phone; |
||||
|
||||
@ApiModelProperty(value = "登录类型(1:手机号 2:微信登录)") |
||||
private int type; |
||||
|
||||
@ApiModelProperty(value = "微信唯一编号") |
||||
private String wechatId; |
||||
|
||||
@ApiModelProperty(value = "密码") |
||||
private String password; |
||||
|
||||
@ApiModelProperty(value = "登录十天有效 1:有效 2:不处理") |
||||
private int tenDayEffective; |
||||
} |
@ -0,0 +1,12 @@ |
||||
package com.daqing.framework.domain.hrms.response; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class LoginResponse { |
||||
@ApiModelProperty(value = "用户名") |
||||
private String account; |
||||
@ApiModelProperty("token令牌") |
||||
private String token; |
||||
} |
@ -1,25 +0,0 @@ |
||||
package com.daqing.financial.gateway.exception; |
||||
|
||||
import com.daqing.financial.gateway.util.ResultCodeEnum; |
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class DqException extends RuntimeException { |
||||
|
||||
private int code; |
||||
|
||||
private ResultCodeEnum resultCodeEnum; |
||||
|
||||
public DqException(ResultCodeEnum codeEnum) { |
||||
super(codeEnum.getRemark()); |
||||
code = codeEnum.getCode(); |
||||
} |
||||
|
||||
public int getCode() { |
||||
return code; |
||||
} |
||||
|
||||
public ResultCodeEnum getResultCodeEnum() { |
||||
return resultCodeEnum; |
||||
} |
||||
} |
@ -1,62 +0,0 @@ |
||||
package com.daqing.financial.gateway.util; |
||||
|
||||
public enum ResultCodeEnum { |
||||
|
||||
SUCCESS(0, "请求成功"), |
||||
BAD_REQUEST(400, "错误请求"), |
||||
UN_AUTHORIZATION(401, "未授权"), |
||||
SERVER_EXCEPTION(500, "服务器异常"), |
||||
|
||||
ACCOUNT_NOT_EXIST(10000, "账号不存在"), |
||||
ACCOUNT_NOT_BIND(10001, "账号未绑定钱包"), |
||||
ACCOUNT_NOT_ACTIVE(10002, "账号未激活"), |
||||
ACCOUNT_EXIST(10003, "账号已存在,请登录"), |
||||
COIN_ADDRESS_IS_NOT_EXIST(10004, "该币种地址不存在"), |
||||
COIN_NAME_IS_NOT_EXIST(10005, "该币种不存在"), |
||||
|
||||
WALLET_BAD_PARAM(10100, "非法参数,禁止访问他人账号"), |
||||
WALLET_NOT_ENOUGH(10101, "可用余额不足"), |
||||
SUB_ACCOUNT_NOT_ALLOW_WITHDRAW(10102, "子账号不允许提币"), |
||||
USER_NAME_ALREADY_EXISTS(10103,"用户名已存在"), |
||||
USER_EMAIL_ALREADY_EXISTS(10104,"邮箱已存在"), |
||||
INVITATION_CODE_NOT_EXIST(10105,"邀请码不存在"), |
||||
DEVICE_EXIST(10106,"设备号相同"), |
||||
LOGINPASSWORD_ERROR(10107,"登录密码错误"), |
||||
ACCOUNT_DISABLED(10108,"账号已禁用"), |
||||
USER_NAME_IS_ENABLE(10109,"用户名不存在"), |
||||
USER_IS_ACTIVE(10111,"该用户已激活"), |
||||
PAY_PASSWORD_IS_ERROR(10112,"支付密码错误"), |
||||
USER_IS_ACTIVE_MAX(10113,"您的激活次数已上线"), |
||||
WITHDRAW_IS_ENABLE(10114,"该币种已关闭提币通道"), |
||||
WITHDRAW_IS_NOT_BEGIN_TIME(10115,"未到提币时间"), |
||||
WITHDRAW_IS_SUPER_END_TIME(10116,"提币时间已过"), |
||||
WITHDRAW_MIN_ERROR(10117,"不能小于最小提币金额"), |
||||
WITHDRAW_MAX_ERROR(10118,"不能大于最大提币金额"), |
||||
WITHDRAW_MAX_TODAY(10120,"当日提币金额已上限"), |
||||
TRANSFER_IS_ENABLE(10121,"该币种已关闭转账通道"), |
||||
TRANSFER_MIN_ERROR(10122,"不能小于最小转账金额"), |
||||
TRANSFER_MAX_ERROR(10123,"不能大于最大转账金额"), |
||||
TRANSFER_MAX_TODAY(10124,"当日转账金额已上限"), |
||||
USERNAME_AND_EMAIL_ERROR(10125,"用户名和邮箱不匹配"), |
||||
EMAIL_CODE_IS_ERROR(10126,"验证码错误"), |
||||
PAY_PASSWORD_IS_NULL(10127,"请先设置支付密码"), |
||||
CHAIN_IS_ERROR(10128,"链上异常请联系管理员"); |
||||
|
||||
|
||||
|
||||
private final int code; |
||||
private final String remark; |
||||
|
||||
ResultCodeEnum(int code, String remark) { |
||||
this.code = code; |
||||
this.remark = remark; |
||||
} |
||||
|
||||
public int getCode() { |
||||
return code; |
||||
} |
||||
|
||||
public String getRemark() { |
||||
return remark; |
||||
} |
||||
} |
@ -1 +1 @@ |
||||
jwt.ignoreUrlList=/api/hrms/employee/list,/route-api/refresh |
||||
jwt.ignoreUrlList=/api/hrms/employee/list,/apiHrmsAuth/hrms/auth/userlogin/login |
Loading…
Reference in new issue