Compare commits

...

10 Commits
0.8.3 ... 0.8.5

Author SHA1 Message Date
曾文豪
32fb562775 publish 0.8.5 2023-03-14 14:20:56 +08:00
曾文豪
af50468743 perf: 调整token校验 2023-03-14 14:20:23 +08:00
曾文豪
cab794ecc4 Merge branch 'test-uploadDir' into 'master'
GlobalConfig新加uploadDir配置

See merge request tiesheng/tiesheng!2
2023-03-14 06:10:02 +00:00
‘毛文春’
0c511940aa GlobalConfig新加uploadDir配置 2023-03-14 14:03:53 +08:00
‘毛文春’
60dea50e43 修改 过滤不要需要验证的接口(path) 2023-03-14 14:01:11 +08:00
‘毛文春’
cbfeb09a22 修改 过滤不要需要验证的接口(path) 2023-03-13 17:45:29 +08:00
曾文豪
ef97488ea0 publish 0.8.4 2023-03-09 15:58:41 +08:00
曾文豪
8873053c06 perf: 优化脱敏工具,修复父类中脱敏注解无效的bug 2023-03-09 15:58:05 +08:00
曾文豪
a65ea27485 perf: 优化代码 2023-03-08 09:02:13 +08:00
曾文豪
4343601da1 perf: 更新changelog 2023-03-08 08:58:38 +08:00
21 changed files with 106 additions and 52 deletions

View File

@@ -1,3 +1,10 @@
## 0.8.3
### 调整
> 1优化返回数据加密
> 2上传文件接口调整统一为**application/json**格式;
## 0.8.0
### 调整

20
pom.xml
View File

@@ -6,7 +6,7 @@
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.3</version>
<version>0.8.5</version>
<packaging>pom</packaging>
<name>springboot-parent</name>
<description>杭州铁晟科技有限公司基础依赖</description>
@@ -57,55 +57,55 @@
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-database</artifactId>
<version>0.8.3</version>
<version>0.8.5</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-login</artifactId>
<version>0.8.3</version>
<version>0.8.5</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-web</artifactId>
<version>0.8.3</version>
<version>0.8.5</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-util</artifactId>
<version>0.8.3</version>
<version>0.8.5</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-platform</artifactId>
<version>0.8.3</version>
<version>0.8.5</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-message</artifactId>
<version>0.8.3</version>
<version>0.8.5</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-encrypt</artifactId>
<version>0.8.3</version>
<version>0.8.5</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-annotation</artifactId>
<version>0.8.3</version>
<version>0.8.5</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-poi</artifactId>
<version>0.8.3</version>
<version>0.8.5</version>
</dependency>
<dependency>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.3</version>
<version>0.8.5</version>
</parent>
<artifactId>springboot-ademo</artifactId>

View File

@@ -41,7 +41,6 @@ public class TestController {
@RequestMapping("/index")
@TokenIgnore
public ApiResp<String> index() {
TokenBean tokenBean = new TokenBean("11", "", "fdfd");
@@ -67,7 +66,6 @@ public class TestController {
@RequestMapping("/export")
@TokenIgnore
public ApiResp<String> export() {
// List<TestFile> list = new ArrayList<>();
@@ -102,7 +100,9 @@ public class TestController {
@TokenIgnore
public ApiResp<List<TestFile>> desensitize() {
TestFile file = new TestFile("11111");
file.setTest("111111");
TestFile file1 = new TestFile("22222");
file1.setTest("22222");
return ApiResp.respOK(CollUtil.newArrayList(file, file1));
}

View File

@@ -1,27 +1,21 @@
package com.tiesheng.demo.pojos;
import com.tiesheng.annotation.desensitize.Desensitize;
import com.tiesheng.poi.pojos.PoiWriteBase;
public class TestFile implements PoiWriteBase {
public class TestFile extends TestParent implements PoiWriteBase {
@Desensitize()
private String test;
private String name;
public TestFile(String test) {
this.test = test;
public TestFile(String name) {
this.name = name;
}
///////////////////////////////////////////////////////////////////////////
// setter、getter
///////////////////////////////////////////////////////////////////////////
public String getTest() {
return test;
public String getName() {
return name;
}
public void setTest(String test) {
this.test = test;
public void setName(String name) {
this.name = name;
}
}

View File

@@ -0,0 +1,33 @@
package com.tiesheng.demo.pojos;
import com.tiesheng.annotation.desensitize.Desensitize;
import com.tiesheng.poi.pojos.PoiWriteBase;
public class TestParent implements PoiWriteBase {
private String id;
@Desensitize()
private String test;
///////////////////////////////////////////////////////////////////////////
// setter、getter
///////////////////////////////////////////////////////////////////////////
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTest() {
return test;
}
public void setTest(String test) {
this.test = test;
}
}

View File

@@ -20,3 +20,7 @@ spring:
logging:
file:
name: runtime/logs/tiesheng.log
tiesheng:
token:
ignore-paths:
- /test/index

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.3</version>
<version>0.8.5</version>
</parent>
<artifactId>springboot-annotation</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.3</version>
<version>0.8.5</version>
</parent>
<artifactId>springboot-database</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.3</version>
<version>0.8.5</version>
</parent>
<artifactId>springboot-encrypt</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.3</version>
<version>0.8.5</version>
</parent>
<artifactId>springboot-login</artifactId>

View File

@@ -1,5 +1,6 @@
package com.tiesheng.login.config.token;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import com.tiesheng.annotation.token.TokenIgnore;
import com.tiesheng.util.ServletKit;
@@ -50,8 +51,18 @@ public class TsTokenAspect {
// 过滤不要需要验证的接口path
String requestURI = ServletKit.getRequest().getRequestURI();
if (StrUtil.startWithAnyIgnoreCase(requestURI, tsTokenConfig.getIgnorePaths())) {
return;
String[] ignorePaths = tsTokenConfig.getIgnorePaths();
if (ObjUtil.isNotEmpty(ignorePaths)) {
for (String path : ignorePaths) {
if (path.contains("/**") &&
StrUtil.startWith(requestURI, path.replace("/**", ""))) {
// 通配路径
return;
} else if (requestURI.equals(path)) {
// 完整路径
return;
}
}
}
// 过滤不要需要验证的接口(注解)

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.3</version>
<version>0.8.5</version>
</parent>
<artifactId>springboot-message</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.3</version>
<version>0.8.5</version>
</parent>
<artifactId>springboot-platform</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.3</version>
<version>0.8.5</version>
</parent>
<artifactId>springboot-poi</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.3</version>
<version>0.8.5</version>
</parent>
<artifactId>springboot-util</artifactId>

View File

@@ -1,16 +1,12 @@
package com.tiesheng.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeFilter;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.tiesheng.util.config.desensitize.DesensitizeValueFilter;
import com.tiesheng.util.config.DesensitizeValueFilter;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class CommonUtil {
@@ -40,13 +36,10 @@ public class CommonUtil {
*/
public static String writeJsonString(Object value) throws IOException {
FastJsonConfig fastJsonConfig = fastJsonConfig();
SerializeFilter[] globalFilters = fastJsonConfig.getSerializeFilters();
List<SerializeFilter> allFilters = new ArrayList(Arrays.asList(globalFilters));
ByteArrayOutputStream outnew = new ByteArrayOutputStream();
JSON.writeJSONStringWithFastJsonConfig(outnew, fastJsonConfig.getCharset(),
value, fastJsonConfig.getSerializeConfig(),
allFilters.toArray(new SerializeFilter[allFilters.size()]),
fastJsonConfig.getSerializeFilters(),
fastJsonConfig.getDateFormat(), JSON.DEFAULT_GENERATE_FEATURE,
fastJsonConfig.getSerializerFeatures());
return outnew.toString();

View File

@@ -1,7 +1,7 @@
package com.tiesheng.util.config.desensitize;
package com.tiesheng.util.config;
import cn.hutool.core.util.ClassUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.serializer.ValueFilter;
import com.tiesheng.annotation.desensitize.Desensitize;
@@ -21,7 +21,7 @@ public class DesensitizeValueFilter implements ValueFilter {
return value;
}
Field field = ClassUtil.getDeclaredField(object.getClass(), name);
Field field = ReflectUtil.getField(object.getClass(), name);
if (ObjectUtil.isEmpty(field)) {
return value;
}

View File

@@ -23,6 +23,7 @@ public class GlobalConfig {
private String host;
private String service;
private String version;
private String uploadDir = System.getProperty("user.dir");
///////////////////////////////////////////////////////////////////////////
// 逻辑方法
@@ -80,6 +81,15 @@ public class GlobalConfig {
// setter\getter
///////////////////////////////////////////////////////////////////////////
public String getUploadDir() {
return uploadDir;
}
public void setUploadDir(String uploadDir) {
this.uploadDir = uploadDir;
}
public String getHost() {
return host;
}

View File

@@ -5,7 +5,9 @@ import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.CharUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import cn.hutool.http.HttpUtil;
import com.tiesheng.util.config.GlobalConfig;
public class FileUploadPath {
@@ -46,7 +48,7 @@ public class FileUploadPath {
}
pathBean.setHttpPath(tempPath);
String tempAbs = String.format("%s/static%s", System.getProperty("user.dir"), tempPath);
String tempAbs = String.format("%s/static%s", SpringUtil.getBean(GlobalConfig.class).getUploadDir(), tempPath);
tempAbs = FileUtil.normalize(tempAbs);
pathBean.setAbsolutePath(tempAbs);

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.3</version>
<version>0.8.5</version>
</parent>
<artifactId>springboot-web</artifactId>