Skip to content

Commit

Permalink
Merge pull request #3 from guoshiqiufeng/dev
Browse files Browse the repository at this point in the history
1.5.0
  • Loading branch information
guoshiqiufeng authored Nov 24, 2021
2 parents 3b53380 + b09e02d commit 32a129a
Show file tree
Hide file tree
Showing 124 changed files with 661 additions and 495 deletions.
36 changes: 10 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,24 @@
[![License](http://img.shields.io/:license-apache-brightgreen.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
#### 介绍
内核框架
#### 异常
用户异常 1
业务异常 2
第三方异常 3
#### 代码
采用阿里巴巴代码规范,使用`spring-javaformat`格式化代码
#### 模块
- [x] kernel-core [01]
- [x] kernel-db [02]
- [x] kernel-jwt [03]
- [x] kernel-core [01] [使用说明](kernel-core/README.md)
- [x] kernel-db [02] [使用说明](kernel-db/README.md)
- [x] kernel-jwt [03] [使用说明](kernel-jwt/README.md)

- [x] kernel-cache [10]
- [x] kernel-cache [10] [使用说明](kernel-cache/README.md)
- [x] kernel-validator [11]
- [x] kernel-security [12]
- [x] kernel-auth [13]

- [x] kernel-file [20]
- [x] kernel-email [21]
- [x] kernel-sms [22]
- [x] kernel-file [20] [使用说明](kernel-file/README.md)
- [x] kernel-email [21] [使用说明](kernel-email/README.md)
- [x] kernel-sms [22] [使用说明](kernel-sms/README.md)
- [x] kernel-push [23]


- [ ] kernel-excel [30]
- [x] kernel-excel [30]

#### ToDo
- [ ] kernel-sms 添加多签名切换
Expand All @@ -33,19 +30,6 @@
- [ ] 文档
#### 安装教程
使用maven进行依赖安装
#### 使用说明

##### kernel-email

[使用说明](kernel-email/README.md)

##### kernel-file

[使用说明](kernel-file/README.md)

##### kernel-sms

[使用说明](kernel-sms/README.md)

#### 参与贡献

Expand Down
3 changes: 2 additions & 1 deletion kernel-all-spring-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
<parent>
<groupId>com.gitee.fubluesky.kernel</groupId>
<artifactId>kernel</artifactId>
<version>1.4.4</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>kernel-all-spring-boot-starter</artifactId>
<version>1.5.0</version>
<description>spring-boot 依赖引用</description>
<inceptionYear>2021-Now</inceptionYear>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion kernel-auth/auth-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>com.gitee.fubluesky.kernel</groupId>
<artifactId>kernel-auth</artifactId>
<version>1.4.4</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ public interface AuthConstants {
/**
* auth模块的名称
*/
String AUTH_MODULE_NAME = "kernel-auth";
String MODULE_NAME = "kernel-auth";

/**
* 异常枚举的步进值
*/
String AUTH_EXCEPTION_STEP_CODE = "11";
String EXCEPTION_STEP_CODE = "11";

/**
* 缓存前缀
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
public class AuthException extends ServiceException {

public AuthException(AbstractExceptionEnum exception) {
super(AuthConstants.AUTH_MODULE_NAME, exception);
super(AuthConstants.MODULE_NAME, exception);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package com.gitee.fubluesky.kernel.auth.api.exception.enums;

import com.gitee.fubluesky.kernel.auth.api.constants.AuthConstants;
import com.gitee.fubluesky.kernel.core.constants.CoreConstants;
import com.gitee.fubluesky.kernel.core.enums.ErrorType;
import com.gitee.fubluesky.kernel.core.exception.AbstractExceptionEnum;

/**
Expand All @@ -30,38 +30,34 @@ public enum AuthExceptionEnum implements AbstractExceptionEnum {
/**
* 登录失效
*/
AUTH_EXPIRED_ERROR(CoreConstants.BUSINESS_ERROR_TYPE_CODE, AuthConstants.AUTH_EXCEPTION_STEP_CODE + "01",
"当前登录失效,请重新登录"),
AUTH_EXPIRED_ERROR(ErrorType.BUSINESS_ERROR.getCode(), AuthConstants.EXCEPTION_STEP_CODE + "01", "当前登录失效,请重新登录"),

/**
* 刷新token
*/
AUTH_TOKEN_ERROR(CoreConstants.BUSINESS_ERROR_TYPE_CODE, AuthConstants.AUTH_EXCEPTION_STEP_CODE + "02",
"token有误,请刷新token"),
AUTH_TOKEN_ERROR(ErrorType.BUSINESS_ERROR.getCode(), AuthConstants.EXCEPTION_STEP_CODE + "02", "token有误,请刷新token"),

/**
* 账号或密码为空
*/
USERNAME_PASSWORD_EMPTY(CoreConstants.USER_OPERATION_ERROR_TYPE_CODE, AuthConstants.AUTH_EXCEPTION_STEP_CODE + "03",
USERNAME_PASSWORD_EMPTY(ErrorType.USER_OPERATION_ERROR.getCode(), AuthConstants.EXCEPTION_STEP_CODE + "03",
"账号或密码为空"),

/**
* 账号或密码错误
*/
USERNAME_PASSWORD_ERROR(CoreConstants.USER_OPERATION_ERROR_TYPE_CODE, AuthConstants.AUTH_EXCEPTION_STEP_CODE + "04",
USERNAME_PASSWORD_ERROR(ErrorType.USER_OPERATION_ERROR.getCode(), AuthConstants.EXCEPTION_STEP_CODE + "04",
"账号或密码错误"),

/**
* 验证码为空
*/
CAPTCHA_EMPTY(CoreConstants.USER_OPERATION_ERROR_TYPE_CODE, AuthConstants.AUTH_EXCEPTION_STEP_CODE + "05",
"验证码不能为空"),
CAPTCHA_EMPTY(ErrorType.USER_OPERATION_ERROR.getCode(), AuthConstants.EXCEPTION_STEP_CODE + "05", "验证码不能为空"),

/**
* 验证码有误
*/
CAPTCHA_ERROR(CoreConstants.USER_OPERATION_ERROR_TYPE_CODE, AuthConstants.AUTH_EXCEPTION_STEP_CODE + "06",
"验证码有误"),;
CAPTCHA_ERROR(ErrorType.USER_OPERATION_ERROR.getCode(), AuthConstants.EXCEPTION_STEP_CODE + "06", "验证码有误"),;

/**
* 异常分类 用户端异常: 1 业务异常: 2 第三方异常: 3
Expand Down
2 changes: 1 addition & 1 deletion kernel-auth/auth-sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>com.gitee.fubluesky.kernel</groupId>
<artifactId>kernel-auth</artifactId>
<version>1.4.4</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import com.gitee.fubluesky.kernel.cache.api.CacheOperatorApi;
import com.gitee.fubluesky.kernel.core.util.HttpServletUtil;
import com.gitee.fubluesky.kernel.jwt.api.JwtApi;
import com.gitee.fubluesky.kernel.jwt.api.pojo.payload.DefaultJwtPayload;
import com.gitee.fubluesky.kernel.jwt.api.pojo.DefaultJwtPayload;
import com.gitee.fubluesky.kernel.security.api.CaptchaApi;
import com.gitee.fubluesky.kernel.security.api.pojo.CaptchaProperties;
import org.apache.commons.lang3.StringUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import com.gitee.fubluesky.kernel.cache.api.CacheOperatorApi;
import com.gitee.fubluesky.kernel.core.util.HttpServletUtil;
import com.gitee.fubluesky.kernel.jwt.api.JwtApi;
import com.gitee.fubluesky.kernel.jwt.api.pojo.payload.DefaultJwtPayload;
import com.gitee.fubluesky.kernel.jwt.api.pojo.DefaultJwtPayload;
import org.apache.commons.lang3.StringUtils;

import javax.servlet.http.Cookie;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.gitee.fubluesky.kernel.auth.utils.SpringContextUtils;
import com.gitee.fubluesky.kernel.cache.redis.AbstractRedisCacheOperator;
import com.gitee.fubluesky.kernel.core.constants.CoreConstants;
import com.gitee.fubluesky.kernel.jwt.api.pojo.config.JwtConfig;
import com.gitee.fubluesky.kernel.jwt.api.pojo.JwtProperties;
import org.springframework.data.redis.core.RedisTemplate;

/**
Expand All @@ -37,8 +37,8 @@ public LoginUserRedisCache(RedisTemplate<String, LoginUser> redisTemplate) {

@Override
public void add(String key, LoginUser value) {
JwtConfig jwtConfig = SpringContextUtils.getBean(JwtConfig.class);
int day = jwtConfig.getRefresh();
JwtProperties jwtProperties = SpringContextUtils.getBean(JwtProperties.class);
int day = jwtProperties.getRefresh();
long exp = 60 * 60 * 24L * day;
super.add(key, value, exp);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.gitee.fubluesky.kernel.auth.utils.SpringContextUtils;
import com.gitee.fubluesky.kernel.cache.redis.AbstractRedisCacheOperator;
import com.gitee.fubluesky.kernel.core.constants.CoreConstants;
import com.gitee.fubluesky.kernel.jwt.api.pojo.config.JwtConfig;
import com.gitee.fubluesky.kernel.jwt.api.pojo.JwtProperties;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.util.DigestUtils;

Expand All @@ -38,8 +38,8 @@ public LoginUserTokenRedisCache(RedisTemplate<String, LoginUser> redisTemplate)

@Override
public void add(String key, LoginUser value) {
JwtConfig jwtConfig = SpringContextUtils.getBean(JwtConfig.class);
int day = jwtConfig.getRefresh();
JwtProperties jwtProperties = SpringContextUtils.getBean(JwtProperties.class);
int day = jwtProperties.getRefresh();
long exp = 60 * 60 * 24L * day;
super.add(key, value, exp);
}
Expand Down
2 changes: 1 addition & 1 deletion kernel-auth/auth-spring-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>com.gitee.fubluesky.kernel</groupId>
<artifactId>kernel-auth</artifactId>
<version>1.4.4</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion kernel-auth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>com.gitee.fubluesky.kernel</groupId>
<artifactId>kernel</artifactId>
<version>1.4.4</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
8 changes: 8 additions & 0 deletions kernel-cache/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# kernel-cache

#### 介绍
缓存相关封装

##### cache-redis-spring-boot-starter

[使用说明](cache-redis-spring-boot-starter/README.md)
2 changes: 1 addition & 1 deletion kernel-cache/cache-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>com.gitee.fubluesky.kernel</groupId>
<artifactId>kernel-cache</artifactId>
<version>1.4.4</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ public interface CacheConstants {
/**
* 缓存模块的名称
*/
String CACHE_MODULE_NAME = "kernel-cache";
String MODULE_NAME = "kernel-cache";

/**
* 缓存模块的异常步进值
*/
String CACHE_EXCEPTION_STEP_CODE = "10";
String EXCEPTION_STEP_CODE = "10";

/**
* 默认object对象缓存的缓存前缀
*/
String OBJECT_CACHE_PREFIX = "OBJECTS:";
String OBJECT_CACHE_PREFIX = "object:";

/**
* 默认String对象缓存的缓存前缀
*/
String STRING_CACHE_PREFIX = "STRINGS:";
String STRING_CACHE_PREFIX = "string:";

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
public class CacheException extends ServiceException {

public CacheException(AbstractExceptionEnum exception) {
super(CacheConstants.CACHE_MODULE_NAME, exception);
super(CacheConstants.MODULE_NAME, exception);
}

}
89 changes: 89 additions & 0 deletions kernel-cache/cache-redis-spring-boot-starter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# cache-redis-spring-boot-starter

#### 介绍
redis 缓存服务

#### 安装教程
使用maven进行依赖安装

pom添加依赖

```xml
<dependency>
<groupId>com.gitee.fubluesky.kernel</groupId>
<artifactId>cache-redis-spring-boot-starter</artifactId>
<version>1.5.0</version>
</dependency>
```

#### 使用说明

##### **配置**

正常配置redis使用参数

##### 使用
缓存对象
```java
public class TestRedisCache extends AbstractRedisCacheOperator<String> {

public TestRedisCache(RedisTemplate<String, String> redisTemplate) {
super(redisTemplate);
}

/**
* 获取缓存的前缀
* @return 缓存前缀
*/
@Override
public String getKeyPrefix() {
return "test:";
}

}

```
自动注入
```java
@Configuration
public class CacheConfiguration {

@Bean
public RedisTemplate<String, String> testRedisTemplate(
RedisConnectionFactory redisConnectionFactory) {
return RedisCacheUtils.getObjectRedisTemplate(redisConnectionFactory);
}

@Autowired
private RedisTemplate<String, String> testRedisTemplate;

@Bean
public TestRedisCache testRedisCache() {
return new TestRedisCache(testRedisTemplate);
}

}

```
使用
```java

@RestController
public class TestController {

@Autowired
private TestRedisCache testRedisCache;

@GetMapping("/test/set")
public String set(@RequestParam("key") String key) {
testRedisCache.add(key, "test");
return "test";
}

@GetMapping("/test/get")
@ResponseBody
public String get(@RequestParam("key") String key) {
return testRedisCache.get(key);
}
}
```
2 changes: 1 addition & 1 deletion kernel-cache/cache-redis-spring-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>com.gitee.fubluesky.kernel</groupId>
<artifactId>kernel-cache</artifactId>
<version>1.4.4</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Loading

0 comments on commit 32a129a

Please sign in to comment.