style: 应用 Spotless 代码格式化
- 对所有 Java 源文件应用统一的代码格式化 - 统一缩进为 4 个空格 - 清理尾随空白字符和文件末尾换行 - 优化导入语句组织 - 总计格式化 654 个 Java 文件 有问题可以回滚或者找我聊
This commit is contained in:
@@ -3,11 +3,10 @@ package com.starry.common.config;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONReader;
|
||||
import com.alibaba.fastjson2.JSONWriter;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.data.redis.serializer.SerializationException;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.data.redis.serializer.SerializationException;
|
||||
|
||||
/**
|
||||
* Redis使用FastJson序列化
|
||||
|
||||
@@ -7,8 +7,7 @@ import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* redis 配置
|
||||
* @author admin redis 配置
|
||||
* @since 2022/10/18
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.starry.common.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
@@ -10,13 +12,8 @@ import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* swagger配置
|
||||
* @author admin swagger配置
|
||||
* @since 2021/9/1
|
||||
*/
|
||||
@Configuration
|
||||
@@ -26,19 +23,12 @@ public class Swagger2Config {
|
||||
@Bean(value = "defaultApi2")
|
||||
public Docket defaultApi2() {
|
||||
Docket docket = new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(new ApiInfoBuilder()
|
||||
.title("接口文档")
|
||||
.description("# 接口文档")
|
||||
.termsOfServiceUrl("http://www.xx.com/")
|
||||
.contact("277769738@qq.com")
|
||||
.version("1.0")
|
||||
.build())
|
||||
.apiInfo(new ApiInfoBuilder().title("接口文档").description("# 接口文档")
|
||||
.termsOfServiceUrl("http://www.xx.com/").contact("277769738@qq.com").version("1.0").build())
|
||||
// 分组名称
|
||||
.groupName("2.X版本")
|
||||
.select()
|
||||
.groupName("2.X版本").select()
|
||||
// 这里指定Controller扫描包路径
|
||||
.apis(RequestHandlerSelectors.basePackage("com.starry.admin.modules"))
|
||||
.paths(PathSelectors.any())
|
||||
.apis(RequestHandlerSelectors.basePackage("com.starry.admin.modules")).paths(PathSelectors.any())
|
||||
.build();
|
||||
return docket;
|
||||
}
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
package com.starry.common.config;
|
||||
|
||||
|
||||
import com.starry.common.utils.ThreadsUtils;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* 线程池配置
|
||||
* @author admin 线程池配置
|
||||
* @since 2022/7/25
|
||||
*/
|
||||
@Configuration
|
||||
@@ -53,7 +50,8 @@ public class ThreadPoolConfig {
|
||||
*/
|
||||
@Bean(name = "scheduledExecutorService")
|
||||
protected ScheduledExecutorService scheduledExecutorService() {
|
||||
return new ScheduledThreadPoolExecutor(corePoolSize, new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build(),
|
||||
return new ScheduledThreadPoolExecutor(corePoolSize,
|
||||
new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build(),
|
||||
new ThreadPoolExecutor.CallerRunsPolicy()) {
|
||||
@Override
|
||||
protected void afterExecute(Runnable r, Throwable t) {
|
||||
@@ -63,5 +61,4 @@ public class ThreadPoolConfig {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
package com.starry.common.config.typehandler;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.MappedJdbcTypes;
|
||||
import org.apache.ibatis.type.MappedTypes;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* 存储到数据库, 将LONG数组转换成字符串;
|
||||
* 从数据库获取数据, 将字符串转为LONG数组.
|
||||
* 存储到数据库, 将LONG数组转换成字符串; 从数据库获取数据, 将字符串转为LONG数组.
|
||||
*/
|
||||
@MappedTypes({Long[].class})
|
||||
@MappedJdbcTypes({JdbcType.VARCHAR})
|
||||
@@ -22,26 +20,23 @@ public class ArrayLongTypeHandler extends BaseTypeHandler<Long[]> {
|
||||
private static final Long[] l = new Long[]{};
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i,
|
||||
Long[] parameter, JdbcType jdbcType) throws SQLException {
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, Long[] parameter, JdbcType jdbcType)
|
||||
throws SQLException {
|
||||
ps.setString(i, JSONUtil.toJsonStr(parameter));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long[] getNullableResult(ResultSet rs, String columnName)
|
||||
throws SQLException {
|
||||
public Long[] getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
return JSONUtil.parseArray(rs.getString(columnName)).toArray(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long[] getNullableResult(ResultSet rs, int columnIndex)
|
||||
throws SQLException {
|
||||
public Long[] getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
return JSONUtil.parseArray(rs.getString(columnIndex)).toArray(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long[] getNullableResult(CallableStatement cs, int columnIndex)
|
||||
throws SQLException {
|
||||
public Long[] getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
return JSONUtil.parseArray(cs.getString(columnIndex)).toArray(l);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
package com.starry.common.config.typehandler;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.MappedJdbcTypes;
|
||||
import org.apache.ibatis.type.MappedTypes;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* 存储到数据库, 将String数组转换成字符串;
|
||||
* 从数据库获取数据, 将字符串转为LONG数组.
|
||||
* 存储到数据库, 将String数组转换成字符串; 从数据库获取数据, 将字符串转为LONG数组.
|
||||
*/
|
||||
@MappedTypes({String[].class})
|
||||
@MappedJdbcTypes({JdbcType.VARCHAR})
|
||||
@@ -22,26 +20,23 @@ public class ArrayStringTypeHandler extends BaseTypeHandler<String[]> {
|
||||
private static final String[] l = new String[]{};
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i,
|
||||
String[] parameter, JdbcType jdbcType) throws SQLException {
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, String[] parameter, JdbcType jdbcType)
|
||||
throws SQLException {
|
||||
ps.setString(i, JSONUtil.toJsonStr(parameter));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getNullableResult(ResultSet rs, String columnName)
|
||||
throws SQLException {
|
||||
public String[] getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
return JSONUtil.parseArray(rs.getString(columnName)).toArray(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getNullableResult(ResultSet rs, int columnIndex)
|
||||
throws SQLException {
|
||||
public String[] getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
return JSONUtil.parseArray(rs.getString(columnIndex)).toArray(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getNullableResult(CallableStatement cs, int columnIndex)
|
||||
throws SQLException {
|
||||
public String[] getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
return JSONUtil.parseArray(cs.getString(columnIndex)).toArray(l);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,34 +2,31 @@ package com.starry.common.config.typehandler;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.MappedJdbcTypes;
|
||||
import org.apache.ibatis.type.MappedTypes;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* 存储到数据库, 将JSON对象转换成字符串;
|
||||
* 从数据库获取数据, 将字符串转为JSON对象.
|
||||
* 存储到数据库, 将JSON对象转换成字符串; 从数据库获取数据, 将字符串转为JSON对象.
|
||||
*/
|
||||
@MappedTypes({JSONObject.class})
|
||||
@MappedJdbcTypes({JdbcType.VARCHAR})
|
||||
public class JsonTypeHandler extends BaseTypeHandler<JSONObject> {
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, JSONObject parameter,
|
||||
JdbcType jdbcType) throws SQLException {
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, JSONObject parameter, JdbcType jdbcType)
|
||||
throws SQLException {
|
||||
|
||||
ps.setString(i, JSONUtil.toJsonStr(parameter));
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getNullableResult(ResultSet rs, String columnName)
|
||||
throws SQLException {
|
||||
public JSONObject getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
|
||||
return JSONUtil.parseObj(rs.getString(columnName)).toBean(JSONObject.class);
|
||||
}
|
||||
@@ -41,8 +38,7 @@ public class JsonTypeHandler extends BaseTypeHandler<JSONObject> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getNullableResult(CallableStatement cs, int columnIndex)
|
||||
throws SQLException {
|
||||
public JSONObject getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
|
||||
return JSONUtil.parseObj(cs.getString(columnIndex)).toBean(JSONObject.class);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user