publish 0.6.2
This commit is contained in:
20
pom.xml
20
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.6.2</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>springboot-parent</name>
|
<name>springboot-parent</name>
|
||||||
<description>杭州铁晟科技有限公司基础依赖</description>
|
<description>杭州铁晟科技有限公司基础依赖</description>
|
||||||
@@ -57,55 +57,55 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-database</artifactId>
|
<artifactId>springboot-database</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.6.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.6.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.6.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.6.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.6.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-message</artifactId>
|
<artifactId>springboot-message</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.6.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-encrypt</artifactId>
|
<artifactId>springboot-encrypt</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.6.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.6.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-poi</artifactId>
|
<artifactId>springboot-poi</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.6.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.6.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-ademo</artifactId>
|
<artifactId>springboot-ademo</artifactId>
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.tiesheng.demo.controller;
|
package com.tiesheng.demo.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.hutool.log.LogFactory;
|
import cn.hutool.log.LogFactory;
|
||||||
import com.tiesheng.annotation.token.TokenIgnore;
|
import com.tiesheng.annotation.token.TokenIgnore;
|
||||||
|
import com.tiesheng.demo.pojos.TestFile;
|
||||||
import com.tiesheng.login.config.token.TsTokenConfig;
|
import com.tiesheng.login.config.token.TsTokenConfig;
|
||||||
import com.tiesheng.login.config.token.bean.TokenBean;
|
import com.tiesheng.login.config.token.bean.TokenBean;
|
||||||
import com.tiesheng.message.config.aliyun.AliyunSmsConfig;
|
import com.tiesheng.message.config.aliyun.AliyunSmsConfig;
|
||||||
@@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hao
|
* @author hao
|
||||||
@@ -92,4 +95,13 @@ public class TestController {
|
|||||||
return ApiResp.respOK(search);
|
return ApiResp.respOK(search);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping("desensitize")
|
||||||
|
@TokenIgnore
|
||||||
|
public ApiResp<List<TestFile>> desensitize() {
|
||||||
|
TestFile file = new TestFile("11111");
|
||||||
|
TestFile file1 = new TestFile("22222");
|
||||||
|
return ApiResp.respOK(CollUtil.newArrayList(file, file1));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,27 @@
|
|||||||
//package com.tiesheng.demo.pojos;
|
package com.tiesheng.demo.pojos;
|
||||||
//
|
|
||||||
//import com.alibaba.excel.annotation.ExcelProperty;
|
import com.tiesheng.annotation.desensitize.Desensitize;
|
||||||
//import com.tiesheng.poi.pojos.PoiWriteBase;
|
import com.tiesheng.poi.pojos.PoiWriteBase;
|
||||||
//
|
|
||||||
//public class TestFile implements PoiWriteBase {
|
public class TestFile implements PoiWriteBase {
|
||||||
//
|
|
||||||
//
|
|
||||||
// @ExcelProperty("测试")
|
@Desensitize()
|
||||||
// private String test;
|
private String test;
|
||||||
//
|
|
||||||
// public TestFile(String test) {
|
public TestFile(String test) {
|
||||||
// this.test = test;
|
this.test = test;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// ///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// // setter、getter
|
// setter、getter
|
||||||
// ///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
//
|
|
||||||
// public String getTest() {
|
public String getTest() {
|
||||||
// return test;
|
return test;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// public void setTest(String test) {
|
public void setTest(String test) {
|
||||||
// this.test = test;
|
this.test = test;
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.6.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.tiesheng.annotation.desensitize;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hao
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface Desensitize {
|
||||||
|
|
||||||
|
int prefix() default 1;
|
||||||
|
|
||||||
|
int suffix() default 1;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.6.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-database</artifactId>
|
<artifactId>springboot-database</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.6.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-encrypt</artifactId>
|
<artifactId>springboot-encrypt</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.6.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.6.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-message</artifactId>
|
<artifactId>springboot-message</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.6.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.6.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-poi</artifactId>
|
<artifactId>springboot-poi</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.6.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.6.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.tiesheng.core.config.desensitize;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.serializer.ValueFilter;
|
||||||
|
import com.tiesheng.annotation.desensitize.Desensitize;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
public class ValueDesensitizeFilter implements ValueFilter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object process(Object object, String name, Object value) {
|
||||||
|
if (ObjectUtil.isEmpty(value) || !(value instanceof String)) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Field field = object.getClass().getDeclaredField(name);
|
||||||
|
Desensitize desensitize = field.getAnnotation(Desensitize.class);
|
||||||
|
if (String.class != field.getType() || ObjectUtil.isEmpty(desensitize)) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
String originVal = String.valueOf(value);
|
||||||
|
return StrUtil.hide(originVal, desensitize.prefix(), StrUtil.length(originVal) - desensitize.suffix());
|
||||||
|
} catch (NoSuchFieldException ignored) {
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.tiesheng.core.config.json;
|
|||||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||||
import com.alibaba.fastjson.support.config.FastJsonConfig;
|
import com.alibaba.fastjson.support.config.FastJsonConfig;
|
||||||
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
||||||
|
import com.tiesheng.core.config.desensitize.ValueDesensitizeFilter;
|
||||||
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@@ -30,6 +31,7 @@ public class FastJsonMessageConverter {
|
|||||||
SerializerFeature.WriteNullStringAsEmpty,
|
SerializerFeature.WriteNullStringAsEmpty,
|
||||||
SerializerFeature.WriteEnumUsingName);
|
SerializerFeature.WriteEnumUsingName);
|
||||||
config.setDateFormat("yyyy-MM-dd HH:mm:ss");
|
config.setDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
config.setSerializeFilters(new ValueDesensitizeFilter());
|
||||||
|
|
||||||
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
|
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
|
||||||
fastConverter.setFastJsonConfig(config);
|
fastConverter.setFastJsonConfig(config);
|
||||||
|
|||||||
Reference in New Issue
Block a user