编写实体类
parent
4079c01ff5
commit
e7b0cc27d2
|
@ -41,7 +41,12 @@
|
||||||
<version>3.17.4</version>
|
<version>3.17.4</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.28</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||||
<!-- <artifactId>spring-boot-starter-openapi</artifactId>-->
|
<!-- <artifactId>spring-boot-starter-openapi</artifactId>-->
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.muyu.access.data;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.access.data.base.BaseDataSource;
|
||||||
|
import com.muyu.access.data.mysql.MySqlDataSource;
|
||||||
|
import com.muyu.access.data.mysql.MySqlQuery;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/8/28
|
||||||
|
* @Description:
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public class Main {
|
||||||
|
|
||||||
|
public static void main (String[] args) {
|
||||||
|
BaseDataSource mySqlDataSource = new MySqlDataSource();
|
||||||
|
MySqlQuery mySqlQuery = new MySqlQuery();
|
||||||
|
mySqlQuery.setDataSourceId("1");
|
||||||
|
mySqlQuery.setSql("select age as 库.表.字段 from abc where name = :name");
|
||||||
|
mySqlQuery.setParams(
|
||||||
|
new HashMap<>(){{
|
||||||
|
put("name", "张三");
|
||||||
|
}}
|
||||||
|
);
|
||||||
|
mySqlDataSource.setQuery(mySqlQuery);
|
||||||
|
|
||||||
|
mySqlDataSource.getDataValue();
|
||||||
|
|
||||||
|
Thread.currentThread();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.muyu.access.data.base;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/8/28
|
||||||
|
* @Description: 数据接入抽象类
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public abstract class BaseDataAbsSource implements BaseDataSource {
|
||||||
|
|
||||||
|
|
||||||
|
public void setQuery(BaseQuery baseQuery){
|
||||||
|
BaseQueryHandler.set(baseQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T getQuery(){
|
||||||
|
return BaseQueryHandler.get();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.muyu.access.data.base;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/8/28
|
||||||
|
* @Description: 数据源基准
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public interface BaseDataSource {
|
||||||
|
|
||||||
|
|
||||||
|
public void setQuery(BaseQuery baseQuery);
|
||||||
|
|
||||||
|
public <T> T getQuery();
|
||||||
|
|
||||||
|
public DataValue getDataValue();
|
||||||
|
|
||||||
|
DataValue[] getRow();
|
||||||
|
|
||||||
|
DataValue[][] getRows();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.muyu.access.data.base;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/8/28
|
||||||
|
* @Description: 基础查询
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class BaseQuery {
|
||||||
|
|
||||||
|
private String dataSourceId;
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.muyu.access.data.base;
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/8/28
|
||||||
|
* @Description: 基础查询
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public class BaseQueryHandler {
|
||||||
|
|
||||||
|
private static final ThreadLocal<BaseQuery> BASE_QUERY_THREAD_LOCAL = new ThreadLocal<>();
|
||||||
|
|
||||||
|
public static void set(BaseQuery baseQuery){
|
||||||
|
BASE_QUERY_THREAD_LOCAL.set(baseQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T get(){
|
||||||
|
return (T) BASE_QUERY_THREAD_LOCAL.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.muyu.access.data.base;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/8/28
|
||||||
|
* @Description: 数据值
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DataValue {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String label;
|
||||||
|
/**
|
||||||
|
* 通常代表 Key,在Java集合框架中,K常用于表示键(Key)的类型,特别是在处理键值对的数据结构如Map时
|
||||||
|
*/
|
||||||
|
private String key;
|
||||||
|
/**
|
||||||
|
* 与K相对应,V常用于表示值(Value)的类型,在Map等键值对数据结构中,V表示与K相关联的值
|
||||||
|
*/
|
||||||
|
private Object value;
|
||||||
|
/**
|
||||||
|
* 在泛型中,T是一个占位符,用于表示任何具体的类型,它可以被替换为任何类型,如类、接口或基本类型
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.muyu.access.data.mysql;
|
||||||
|
|
||||||
|
import com.muyu.access.data.base.BaseDataAbsSource;
|
||||||
|
import com.muyu.access.data.base.DataValue;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/8/28
|
||||||
|
* @Description: mysql数据源
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
public class MySqlDataSource extends BaseDataAbsSource {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataValue getDataValue () {
|
||||||
|
MySqlQuery query = getQuery();
|
||||||
|
String dataSourceId = query.getDataSourceId();
|
||||||
|
Connection connection = null;
|
||||||
|
String sql = query.getSql();
|
||||||
|
Map<String, Object> queryParams = query.getParams();
|
||||||
|
log.info(sql);
|
||||||
|
log.info(queryParams);
|
||||||
|
|
||||||
|
try {
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement(sql);
|
||||||
|
ResultSet resultSet = preparedStatement.getResultSet();
|
||||||
|
if(resultSet.next()){
|
||||||
|
DataValue.builder()
|
||||||
|
.key(resultSet.getCursorName())
|
||||||
|
.label("")
|
||||||
|
.value(resultSet.getObject(resultSet.getCursorName(), String.class))
|
||||||
|
.type("String");
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataValue[] getRow () {
|
||||||
|
return new DataValue[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataValue[][] getRows () {
|
||||||
|
return new DataValue[0][];
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.muyu.access.data.mysql;
|
||||||
|
|
||||||
|
import com.muyu.access.data.base.BaseQuery;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/8/28
|
||||||
|
* @Description: mysql查询
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MySqlQuery extends BaseQuery {
|
||||||
|
|
||||||
|
private String sql;
|
||||||
|
|
||||||
|
private Map<String, Object> params;
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.muyu.access.data.redis;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.access.data.base.BaseDataAbsSource;
|
||||||
|
import com.muyu.access.data.base.DataValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/8/28
|
||||||
|
* @Description: Redis数据源
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public class RedisDataSource extends BaseDataAbsSource {
|
||||||
|
@Override
|
||||||
|
public DataValue getDataValue () {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataValue[] getRow () {
|
||||||
|
return new DataValue[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataValue[][] getRows () {
|
||||||
|
return new DataValue[0][];
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.muyu.access.data.redis;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.access.data.base.BaseQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/8/28
|
||||||
|
* @Description: redis查询
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public class RedisQuery extends BaseQuery {
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.muyu.basic;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.basic.handler.DataEngineHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/8/29
|
||||||
|
* @Description: 规则引擎基准
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public interface BasicEngine<V> {
|
||||||
|
|
||||||
|
public void set(V dataValue);
|
||||||
|
|
||||||
|
public V get();
|
||||||
|
|
||||||
|
public default void remove(){
|
||||||
|
DataEngineHandler.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void execution();
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.muyu.basic.abstracts;
|
||||||
|
|
||||||
|
import com.muyu.basic.BasicEngine;
|
||||||
|
import com.muyu.basic.handler.DataEngineRowHandler;
|
||||||
|
import com.muyu.core.domain.DataValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/8/29
|
||||||
|
* @Description: 数据值处理对象
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public abstract class DataEngineRowActuator implements BasicEngine<DataValue[]> {
|
||||||
|
|
||||||
|
public void set(DataValue[] dataValue){
|
||||||
|
DataEngineRowHandler.set(dataValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataValue[] get(){
|
||||||
|
return DataEngineRowHandler.get();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.muyu.basic.abstracts;
|
||||||
|
|
||||||
|
import com.muyu.basic.BasicEngine;
|
||||||
|
import com.muyu.basic.handler.DataEngineValueHandler;
|
||||||
|
import com.muyu.core.domain.DataValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/8/29
|
||||||
|
* @Description: 数据值处理对象
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public abstract class DataEngineValueActuator implements BasicEngine<DataValue> {
|
||||||
|
|
||||||
|
public void set(DataValue dataValue){
|
||||||
|
DataEngineValueHandler.set(dataValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataValue get(){
|
||||||
|
return DataEngineValueHandler.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execution () {
|
||||||
|
this.run();
|
||||||
|
this.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void run();
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.muyu.basic.handler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/8/29
|
||||||
|
* @Description: 规则引擎作用域
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DataEngineHandler {
|
||||||
|
|
||||||
|
private static final ThreadLocal<Object> dataEngineHandler = new ThreadLocal<>();
|
||||||
|
|
||||||
|
public static void set(final Object handler) {
|
||||||
|
dataEngineHandler.set(handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T get() {
|
||||||
|
return (T) dataEngineHandler.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void remove(){
|
||||||
|
dataEngineHandler.remove();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.muyu.basic.handler;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.core.domain.DataValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/8/29
|
||||||
|
* @Description: 数据记录/行作用域
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public class DataEngineRowHandler {
|
||||||
|
|
||||||
|
public static void set(DataValue[] dataValue){
|
||||||
|
DataEngineHandler.set(dataValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DataValue[] get(){
|
||||||
|
return DataEngineHandler.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.muyu.basic.handler;
|
||||||
|
|
||||||
|
import com.muyu.core.domain.DataValue;
|
||||||
|
import com.muyu.core.utils.Convert;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/8/29
|
||||||
|
* @Description: 数据值作用域
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public class DataEngineValueHandler {
|
||||||
|
|
||||||
|
public static void set(DataValue dataValue){
|
||||||
|
DataEngineHandler.set(dataValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DataValue get(){
|
||||||
|
return DataEngineHandler.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void remove(){
|
||||||
|
DataEngineHandler.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Object getValue(){
|
||||||
|
return get().getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Integer getIntegerValue(){
|
||||||
|
return Convert.toInt(getValue(), null);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.muyu.core.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/8/28
|
||||||
|
* @Description: 数据值
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DataValue {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String label;
|
||||||
|
/**
|
||||||
|
* 通常代表 Key,在Java集合框架中,K常用于表示键(Key)的类型,特别是在处理键值对的数据结构如Map时
|
||||||
|
*/
|
||||||
|
private String key;
|
||||||
|
/**
|
||||||
|
* 与K相对应,V常用于表示值(Value)的类型,在Map等键值对数据结构中,V表示与K相关联的值
|
||||||
|
*/
|
||||||
|
private Object value;
|
||||||
|
/**
|
||||||
|
* 在泛型中,T是一个占位符,用于表示任何具体的类型,它可以被替换为任何类型,如类、接口或基本类型
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.muyu.core.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/8/28
|
||||||
|
* @Description: 数据类型枚举
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public enum DataType {
|
||||||
|
VERCHAR("verchar", String.class);
|
||||||
|
|
||||||
|
private final String sourceType;
|
||||||
|
|
||||||
|
private final Class<?> targetType;
|
||||||
|
|
||||||
|
|
||||||
|
DataType (String sourceType, Class<?> targetType) {
|
||||||
|
this.sourceType = sourceType;
|
||||||
|
this.targetType = targetType;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,904 @@
|
||||||
|
package com.muyu.core.utils;
|
||||||
|
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.text.NumberFormat;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型转换器
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
*/
|
||||||
|
public class Convert {
|
||||||
|
/**
|
||||||
|
* 转换为字符串<br>
|
||||||
|
* 如果给定的值为null,或者转换失败,返回默认值<br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
* @param defaultValue 转换错误时的默认值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static String toStr (Object value, String defaultValue) {
|
||||||
|
if (null == value) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
if (value instanceof String) {
|
||||||
|
return (String) value;
|
||||||
|
}
|
||||||
|
return value.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为字符串<br>
|
||||||
|
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static String toStr (Object value) {
|
||||||
|
return toStr(value, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为字符<br>
|
||||||
|
* 如果给定的值为null,或者转换失败,返回默认值<br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
* @param defaultValue 转换错误时的默认值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Character toChar (Object value, Character defaultValue) {
|
||||||
|
if (null == value) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
if (value instanceof Character) {
|
||||||
|
return (Character) value;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String valueStr = toStr(value, null);
|
||||||
|
return StringUtils.isEmpty(valueStr) ? defaultValue : valueStr.charAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为字符<br>
|
||||||
|
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Character toChar (Object value) {
|
||||||
|
return toChar(value, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为byte<br>
|
||||||
|
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
* @param defaultValue 转换错误时的默认值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Byte toByte (Object value, Byte defaultValue) {
|
||||||
|
if (value == null) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
if (value instanceof Byte) {
|
||||||
|
return (Byte) value;
|
||||||
|
}
|
||||||
|
if (value instanceof Number) {
|
||||||
|
return ((Number) value).byteValue();
|
||||||
|
}
|
||||||
|
final String valueStr = toStr(value, null);
|
||||||
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return Byte.parseByte(valueStr);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为byte<br>
|
||||||
|
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Byte toByte (Object value) {
|
||||||
|
return toByte(value, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为Short<br>
|
||||||
|
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
* @param defaultValue 转换错误时的默认值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Short toShort (Object value, Short defaultValue) {
|
||||||
|
if (value == null) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
if (value instanceof Short) {
|
||||||
|
return (Short) value;
|
||||||
|
}
|
||||||
|
if (value instanceof Number) {
|
||||||
|
return ((Number) value).shortValue();
|
||||||
|
}
|
||||||
|
final String valueStr = toStr(value, null);
|
||||||
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return Short.parseShort(valueStr.trim());
|
||||||
|
} catch (Exception e) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为Short<br>
|
||||||
|
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Short toShort (Object value) {
|
||||||
|
return toShort(value, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为Number<br>
|
||||||
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
* @param defaultValue 转换错误时的默认值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Number toNumber (Object value, Number defaultValue) {
|
||||||
|
if (value == null) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
if (value instanceof Number) {
|
||||||
|
return (Number) value;
|
||||||
|
}
|
||||||
|
final String valueStr = toStr(value, null);
|
||||||
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return NumberFormat.getInstance().parse(valueStr);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为Number<br>
|
||||||
|
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Number toNumber (Object value) {
|
||||||
|
return toNumber(value, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为int<br>
|
||||||
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
* @param defaultValue 转换错误时的默认值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Integer toInt (Object value, Integer defaultValue) {
|
||||||
|
if (value == null) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
if (value instanceof Integer) {
|
||||||
|
return (Integer) value;
|
||||||
|
}
|
||||||
|
if (value instanceof Number) {
|
||||||
|
return ((Number) value).intValue();
|
||||||
|
}
|
||||||
|
final String valueStr = toStr(value, null);
|
||||||
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return Integer.parseInt(valueStr.trim());
|
||||||
|
} catch (Exception e) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为int<br>
|
||||||
|
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Integer toInt (Object value) {
|
||||||
|
return toInt(value, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为Integer数组<br>
|
||||||
|
*
|
||||||
|
* @param str 被转换的值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Integer[] toIntArray (String str) {
|
||||||
|
return toIntArray(",", str);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为Long数组<br>
|
||||||
|
*
|
||||||
|
* @param str 被转换的值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Long[] toLongArray (String str) {
|
||||||
|
return toLongArray(",", str);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为Integer数组<br>
|
||||||
|
*
|
||||||
|
* @param split 分隔符
|
||||||
|
* @param str 被转换的值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Integer[] toIntArray (String split, String str) {
|
||||||
|
if (StringUtils.isEmpty(str)) {
|
||||||
|
return new Integer[]{};
|
||||||
|
}
|
||||||
|
String[] arr = str.split(split);
|
||||||
|
final Integer[] ints = new Integer[arr.length];
|
||||||
|
for (int i = 0 ; i < arr.length ; i++) {
|
||||||
|
final Integer v = toInt(arr[i], 0);
|
||||||
|
ints[i] = v;
|
||||||
|
}
|
||||||
|
return ints;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为Long数组<br>
|
||||||
|
*
|
||||||
|
* @param split 分隔符
|
||||||
|
* @param str 被转换的值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Long[] toLongArray (String split, String str) {
|
||||||
|
if (StringUtils.isEmpty(str)) {
|
||||||
|
return new Long[]{};
|
||||||
|
}
|
||||||
|
String[] arr = str.split(split);
|
||||||
|
final Long[] longs = new Long[arr.length];
|
||||||
|
for (int i = 0 ; i < arr.length ; i++) {
|
||||||
|
final Long v = toLong(arr[i], null);
|
||||||
|
longs[i] = v;
|
||||||
|
}
|
||||||
|
return longs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为String数组<br>
|
||||||
|
*
|
||||||
|
* @param str 被转换的值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static String[] toStrArray (String str) {
|
||||||
|
return toStrArray(",", str);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为String数组<br>
|
||||||
|
*
|
||||||
|
* @param split 分隔符
|
||||||
|
* @param str 被转换的值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static String[] toStrArray (String split, String str) {
|
||||||
|
return str.split(split);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为long<br>
|
||||||
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
* @param defaultValue 转换错误时的默认值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Long toLong (Object value, Long defaultValue) {
|
||||||
|
if (value == null) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
if (value instanceof Long) {
|
||||||
|
return (Long) value;
|
||||||
|
}
|
||||||
|
if (value instanceof Number) {
|
||||||
|
return ((Number) value).longValue();
|
||||||
|
}
|
||||||
|
final String valueStr = toStr(value, null);
|
||||||
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// 支持科学计数法
|
||||||
|
return new BigDecimal(valueStr.trim()).longValue();
|
||||||
|
} catch (Exception e) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为long<br>
|
||||||
|
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Long toLong (Object value) {
|
||||||
|
return toLong(value, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为double<br>
|
||||||
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
* @param defaultValue 转换错误时的默认值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Double toDouble (Object value, Double defaultValue) {
|
||||||
|
if (value == null) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
if (value instanceof Double) {
|
||||||
|
return (Double) value;
|
||||||
|
}
|
||||||
|
if (value instanceof Number) {
|
||||||
|
return ((Number) value).doubleValue();
|
||||||
|
}
|
||||||
|
final String valueStr = toStr(value, null);
|
||||||
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// 支持科学计数法
|
||||||
|
return new BigDecimal(valueStr.trim()).doubleValue();
|
||||||
|
} catch (Exception e) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为double<br>
|
||||||
|
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Double toDouble (Object value) {
|
||||||
|
return toDouble(value, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为Float<br>
|
||||||
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
* @param defaultValue 转换错误时的默认值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Float toFloat (Object value, Float defaultValue) {
|
||||||
|
if (value == null) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
if (value instanceof Float) {
|
||||||
|
return (Float) value;
|
||||||
|
}
|
||||||
|
if (value instanceof Number) {
|
||||||
|
return ((Number) value).floatValue();
|
||||||
|
}
|
||||||
|
final String valueStr = toStr(value, null);
|
||||||
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return Float.parseFloat(valueStr.trim());
|
||||||
|
} catch (Exception e) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为Float<br>
|
||||||
|
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Float toFloat (Object value) {
|
||||||
|
return toFloat(value, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为boolean<br>
|
||||||
|
* String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
* @param defaultValue 转换错误时的默认值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Boolean toBool (Object value, Boolean defaultValue) {
|
||||||
|
if (value == null) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
if (value instanceof Boolean) {
|
||||||
|
return (Boolean) value;
|
||||||
|
}
|
||||||
|
String valueStr = toStr(value, null);
|
||||||
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
valueStr = valueStr.trim().toLowerCase();
|
||||||
|
switch (valueStr) {
|
||||||
|
case "true":
|
||||||
|
case "yes":
|
||||||
|
case "ok":
|
||||||
|
case "1":
|
||||||
|
return true;
|
||||||
|
case "false":
|
||||||
|
case "no":
|
||||||
|
case "0":
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为boolean<br>
|
||||||
|
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Boolean toBool (Object value) {
|
||||||
|
return toBool(value, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为Enum对象<br>
|
||||||
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
|
*
|
||||||
|
* @param clazz Enum的Class
|
||||||
|
* @param value 值
|
||||||
|
* @param defaultValue 默认值
|
||||||
|
*
|
||||||
|
* @return Enum
|
||||||
|
*/
|
||||||
|
public static <E extends Enum<E>> E toEnum (Class<E> clazz, Object value, E defaultValue) {
|
||||||
|
if (value == null) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
if (clazz.isAssignableFrom(value.getClass())) {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
E myE = (E) value;
|
||||||
|
return myE;
|
||||||
|
}
|
||||||
|
final String valueStr = toStr(value, null);
|
||||||
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return Enum.valueOf(clazz, valueStr);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为Enum对象<br>
|
||||||
|
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
|
||||||
|
*
|
||||||
|
* @param clazz Enum的Class
|
||||||
|
* @param value 值
|
||||||
|
*
|
||||||
|
* @return Enum
|
||||||
|
*/
|
||||||
|
public static <E extends Enum<E>> E toEnum (Class<E> clazz, Object value) {
|
||||||
|
return toEnum(clazz, value, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为BigInteger<br>
|
||||||
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
* @param defaultValue 转换错误时的默认值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static BigInteger toBigInteger (Object value, BigInteger defaultValue) {
|
||||||
|
if (value == null) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
if (value instanceof BigInteger) {
|
||||||
|
return (BigInteger) value;
|
||||||
|
}
|
||||||
|
if (value instanceof Long) {
|
||||||
|
return BigInteger.valueOf((Long) value);
|
||||||
|
}
|
||||||
|
final String valueStr = toStr(value, null);
|
||||||
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return new BigInteger(valueStr);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为BigInteger<br>
|
||||||
|
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static BigInteger toBigInteger (Object value) {
|
||||||
|
return toBigInteger(value, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为BigDecimal<br>
|
||||||
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
* @param defaultValue 转换错误时的默认值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static BigDecimal toBigDecimal (Object value, BigDecimal defaultValue) {
|
||||||
|
if (value == null) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
if (value instanceof BigDecimal) {
|
||||||
|
return (BigDecimal) value;
|
||||||
|
}
|
||||||
|
if (value instanceof Long) {
|
||||||
|
return new BigDecimal((Long) value);
|
||||||
|
}
|
||||||
|
if (value instanceof Double) {
|
||||||
|
return BigDecimal.valueOf((Double) value);
|
||||||
|
}
|
||||||
|
if (value instanceof Integer) {
|
||||||
|
return new BigDecimal((Integer) value);
|
||||||
|
}
|
||||||
|
final String valueStr = toStr(value, null);
|
||||||
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return new BigDecimal(valueStr);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为BigDecimal<br>
|
||||||
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
|
* 转换失败不会报错
|
||||||
|
*
|
||||||
|
* @param value 被转换的值
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static BigDecimal toBigDecimal (Object value) {
|
||||||
|
return toBigDecimal(value, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将对象转为字符串<br>
|
||||||
|
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
|
||||||
|
*
|
||||||
|
* @param obj 对象
|
||||||
|
*
|
||||||
|
* @return 字符串
|
||||||
|
*/
|
||||||
|
public static String utf8Str (Object obj) {
|
||||||
|
return str(obj, "UTF-8");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将对象转为字符串<br>
|
||||||
|
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
|
||||||
|
*
|
||||||
|
* @param obj 对象
|
||||||
|
* @param charsetName 字符集
|
||||||
|
*
|
||||||
|
* @return 字符串
|
||||||
|
*/
|
||||||
|
public static String str (Object obj, String charsetName) {
|
||||||
|
return str(obj, Charset.forName(charsetName));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将对象转为字符串<br>
|
||||||
|
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
|
||||||
|
*
|
||||||
|
* @param obj 对象
|
||||||
|
* @param charset 字符集
|
||||||
|
*
|
||||||
|
* @return 字符串
|
||||||
|
*/
|
||||||
|
public static String str (Object obj, Charset charset) {
|
||||||
|
if (null == obj) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj instanceof String) {
|
||||||
|
return (String) obj;
|
||||||
|
} else if (obj instanceof byte[] || obj instanceof Byte[]) {
|
||||||
|
if (obj instanceof byte[]) {
|
||||||
|
return str((byte[]) obj, charset);
|
||||||
|
} else {
|
||||||
|
Byte[] bytes = (Byte[]) obj;
|
||||||
|
int length = bytes.length;
|
||||||
|
byte[] dest = new byte[length];
|
||||||
|
for (int i = 0 ; i < length ; i++) {
|
||||||
|
dest[i] = bytes[i];
|
||||||
|
}
|
||||||
|
return str(dest, charset);
|
||||||
|
}
|
||||||
|
} else if (obj instanceof ByteBuffer) {
|
||||||
|
return str((ByteBuffer) obj, charset);
|
||||||
|
}
|
||||||
|
return obj.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将byte数组转为字符串
|
||||||
|
*
|
||||||
|
* @param bytes byte数组
|
||||||
|
* @param charset 字符集
|
||||||
|
*
|
||||||
|
* @return 字符串
|
||||||
|
*/
|
||||||
|
public static String str (byte[] bytes, String charset) {
|
||||||
|
return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解码字节码
|
||||||
|
*
|
||||||
|
* @param data 字符串
|
||||||
|
* @param charset 字符集,如果此字段为空,则解码的结果取决于平台
|
||||||
|
*
|
||||||
|
* @return 解码后的字符串
|
||||||
|
*/
|
||||||
|
public static String str (byte[] data, Charset charset) {
|
||||||
|
if (data == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null == charset) {
|
||||||
|
return new String(data);
|
||||||
|
}
|
||||||
|
return new String(data, charset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将编码的byteBuffer数据转换为字符串
|
||||||
|
*
|
||||||
|
* @param data 数据
|
||||||
|
* @param charset 字符集,如果为空使用当前系统字符集
|
||||||
|
*
|
||||||
|
* @return 字符串
|
||||||
|
*/
|
||||||
|
public static String str (ByteBuffer data, String charset) {
|
||||||
|
if (data == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str(data, Charset.forName(charset));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将编码的byteBuffer数据转换为字符串
|
||||||
|
*
|
||||||
|
* @param data 数据
|
||||||
|
* @param charset 字符集,如果为空使用当前系统字符集
|
||||||
|
*
|
||||||
|
* @return 字符串
|
||||||
|
*/
|
||||||
|
public static String str (ByteBuffer data, Charset charset) {
|
||||||
|
if (null == charset) {
|
||||||
|
charset = Charset.defaultCharset();
|
||||||
|
}
|
||||||
|
return charset.decode(data).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------- 全角半角转换
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 半角转全角
|
||||||
|
*
|
||||||
|
* @param input String.
|
||||||
|
*
|
||||||
|
* @return 全角字符串.
|
||||||
|
*/
|
||||||
|
public static String toSBC (String input) {
|
||||||
|
return toSBC(input, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 半角转全角
|
||||||
|
*
|
||||||
|
* @param input String
|
||||||
|
* @param notConvertSet 不替换的字符集合
|
||||||
|
*
|
||||||
|
* @return 全角字符串.
|
||||||
|
*/
|
||||||
|
public static String toSBC (String input, Set<Character> notConvertSet) {
|
||||||
|
char[] c = input.toCharArray();
|
||||||
|
for (int i = 0 ; i < c.length ; i++) {
|
||||||
|
if (null != notConvertSet && notConvertSet.contains(c[i])) {
|
||||||
|
// 跳过不替换的字符
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c[i] == ' ') {
|
||||||
|
c[i] = '\u3000';
|
||||||
|
} else if (c[i] < '\177') {
|
||||||
|
c[i] = (char) (c[i] + 65248);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new String(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全角转半角
|
||||||
|
*
|
||||||
|
* @param input String.
|
||||||
|
*
|
||||||
|
* @return 半角字符串
|
||||||
|
*/
|
||||||
|
public static String toDBC (String input) {
|
||||||
|
return toDBC(input, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 替换全角为半角
|
||||||
|
*
|
||||||
|
* @param text 文本
|
||||||
|
* @param notConvertSet 不替换的字符集合
|
||||||
|
*
|
||||||
|
* @return 替换后的字符
|
||||||
|
*/
|
||||||
|
public static String toDBC (String text, Set<Character> notConvertSet) {
|
||||||
|
char[] c = text.toCharArray();
|
||||||
|
for (int i = 0 ; i < c.length ; i++) {
|
||||||
|
if (null != notConvertSet && notConvertSet.contains(c[i])) {
|
||||||
|
// 跳过不替换的字符
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c[i] == '\u3000') {
|
||||||
|
c[i] = ' ';
|
||||||
|
} else if (c[i] > '\uFF00' && c[i] < '\uFF5F') {
|
||||||
|
c[i] = (char) (c[i] - 65248);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new String(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数字金额大写转换 先写个完整的然后将如零拾替换成零
|
||||||
|
*
|
||||||
|
* @param n 数字
|
||||||
|
*
|
||||||
|
* @return 中文大写数字
|
||||||
|
*/
|
||||||
|
public static String digitUppercase (double n) {
|
||||||
|
String[] fraction = {"角", "分"};
|
||||||
|
String[] digit = {"零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"};
|
||||||
|
String[][] unit = {{"元", "万", "亿"}, {"", "拾", "佰", "仟"}};
|
||||||
|
|
||||||
|
String head = n < 0 ? "负" : "";
|
||||||
|
n = Math.abs(n);
|
||||||
|
|
||||||
|
String s = "";
|
||||||
|
for (int i = 0 ; i < fraction.length ; i++) {
|
||||||
|
// 优化double计算精度丢失问题
|
||||||
|
BigDecimal nNum = new BigDecimal(n);
|
||||||
|
BigDecimal decimal = new BigDecimal(10);
|
||||||
|
BigDecimal scale = nNum.multiply(decimal).setScale(2, RoundingMode.HALF_EVEN);
|
||||||
|
double d = scale.doubleValue();
|
||||||
|
s += (digit[(int) (Math.floor(d * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", "");
|
||||||
|
}
|
||||||
|
if (s.length() < 1) {
|
||||||
|
s = "整";
|
||||||
|
}
|
||||||
|
int integerPart = (int) Math.floor(n);
|
||||||
|
|
||||||
|
for (int i = 0 ; i < unit[0].length && integerPart > 0 ; i++) {
|
||||||
|
String p = "";
|
||||||
|
for (int j = 0 ; j < unit[1].length && n > 0 ; j++) {
|
||||||
|
p = digit[integerPart % 10] + unit[1][j] + p;
|
||||||
|
integerPart = integerPart / 10;
|
||||||
|
}
|
||||||
|
s = p.replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i] + s;
|
||||||
|
}
|
||||||
|
return head + s.replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", "零元整");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,164 +0,0 @@
|
||||||
//package com.muyu.utils;
|
|
||||||
//
|
|
||||||
//import lombok.extern.log4j.Log4j2;
|
|
||||||
//import org.springframework.web.multipart.MultipartFile;
|
|
||||||
//
|
|
||||||
//import java.io.*;
|
|
||||||
//import java.time.LocalDateTime;
|
|
||||||
//import java.util.UUID;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * Oss服务调用
|
|
||||||
// */
|
|
||||||
//@Log4j2
|
|
||||||
//public class OssUtil {
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Endpoint 存储对象概述 阿里云主账号AccessKey,accessKeySecret拥有所有API的访问权限 访问路径前缀 存储对象概述
|
|
||||||
// */
|
|
||||||
// private static String endPoint = "oss-cn-beijing.aliyuncs.com";
|
|
||||||
// private static String accessKeyId = " LTAI5tFNfBpzEbLkntksCgwC";
|
|
||||||
// private static String accessKeySecret = "XmYwUEea6BpgssdLKXMlpdzCI42Pk7";
|
|
||||||
// private static String accessPre = "https://qdm123.oss-cn-beijing.aliyuncs.com/";
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * bucket名称
|
|
||||||
// *
|
|
||||||
// * @return
|
|
||||||
// */
|
|
||||||
// private static String bucketName = "qdm123";
|
|
||||||
//
|
|
||||||
// private static Oss ossClient;
|
|
||||||
//
|
|
||||||
// static {
|
|
||||||
// ossClient = new OSSClientBuilder().build(
|
|
||||||
// endPoint,
|
|
||||||
// accessKeyId,
|
|
||||||
// accessKeySecret);
|
|
||||||
// log.info("oss服务连接成功!");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 默认路径上传本地文件
|
|
||||||
// *
|
|
||||||
// * @param filePath
|
|
||||||
// */
|
|
||||||
// public static String uploadFile(String filePath) {
|
|
||||||
// return uploadFileForBucket(bucketName, getOssFilePath(filePath), filePath);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 默认路径上传multipartFile文件
|
|
||||||
// *
|
|
||||||
// * @param multipartFile
|
|
||||||
// */
|
|
||||||
// public static String uploadMultipartFile(MultipartFile multipartFile) {
|
|
||||||
// return uploadMultipartFile(bucketName, getOssFilePath(multipartFile.getOriginalFilename()), multipartFile);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 上传 multipartFile 类型文件
|
|
||||||
// *
|
|
||||||
// * @param bucketName
|
|
||||||
// * @param ossPath
|
|
||||||
// * @param multipartFile
|
|
||||||
// */
|
|
||||||
// public static String uploadMultipartFile(String bucketName, String ossPath, MultipartFile multipartFile) {
|
|
||||||
// InputStream inputStream = null;
|
|
||||||
// try {
|
|
||||||
// inputStream = multipartFile.getInputStream();
|
|
||||||
// } catch (IOException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// uploadFileInputStreamForBucket(bucketName, ossPath, inputStream);
|
|
||||||
// return accessPre + ossPath;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 使用File上传PutObject上传文件 ** 程序默认使用次方法上传
|
|
||||||
// *
|
|
||||||
// * @param bucketName 实例名称
|
|
||||||
// * @param ossPath oss存储路径
|
|
||||||
// * @param filePath 本地文件路径
|
|
||||||
// */
|
|
||||||
// public static String uploadFileForBucket(String bucketName, String ossPath, String filePath) {
|
|
||||||
// // 创建PutObjectRequest对象。
|
|
||||||
// PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, ossPath, new File(filePath));
|
|
||||||
//
|
|
||||||
// // 上传
|
|
||||||
// ossClient.putObject(putObjectRequest);
|
|
||||||
// return accessPre + ossPath;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 使用文件流上传到指定的bucket实例
|
|
||||||
// *
|
|
||||||
// * @param bucketName 实例名称
|
|
||||||
// * @param ossPath oss存储路径
|
|
||||||
// * @param filePath 本地文件路径
|
|
||||||
// */
|
|
||||||
// public static String uploadFileInputStreamForBucket(String bucketName, String ossPath, String filePath) {
|
|
||||||
//
|
|
||||||
// // 填写本地文件的完整路径。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件流。
|
|
||||||
// InputStream inputStream = null;
|
|
||||||
// try {
|
|
||||||
// inputStream = new FileInputStream(filePath);
|
|
||||||
// } catch (FileNotFoundException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// // 填写Bucket名称和Object完整路径。Object完整路径中不能包含Bucket名称。
|
|
||||||
// uploadFileInputStreamForBucket(bucketName, ossPath, inputStream);
|
|
||||||
// return accessPre + ossPath;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static void uploadFileInputStreamForBucket(String bucketName, String ossPath, InputStream inputStream) {
|
|
||||||
// ossClient.putObject(bucketName, ossPath, inputStream);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 下载
|
|
||||||
// *
|
|
||||||
// * @param ossFilePath
|
|
||||||
// * @param filePath
|
|
||||||
// */
|
|
||||||
// public static void downloadFile(String ossFilePath, String filePath) {
|
|
||||||
// downloadFileForBucket(bucketName, ossFilePath, filePath);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 下载
|
|
||||||
// *
|
|
||||||
// * @param bucketName 实例名称
|
|
||||||
// * @param ossFilePath oss存储路径
|
|
||||||
// * @param filePath 本地文件路径
|
|
||||||
// */
|
|
||||||
// public static void downloadFileForBucket(String bucketName, String ossFilePath, String filePath) {
|
|
||||||
// ossClient.getObject(new GetObjectRequest(bucketName, ossFilePath), new File(filePath));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * @return
|
|
||||||
// */
|
|
||||||
// public static String getOssDefaultPath() {
|
|
||||||
// LocalDateTime now = LocalDateTime.now();
|
|
||||||
// String url =
|
|
||||||
// now.getYear() + "/" +
|
|
||||||
// now.getMonth() + "/" +
|
|
||||||
// now.getDayOfMonth() + "/" +
|
|
||||||
// now.getHour() + "/" +
|
|
||||||
// now.getMinute() + "/";
|
|
||||||
// return url;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static String getOssFilePath(String filePath) {
|
|
||||||
// String fileSuf = filePath.substring(filePath.indexOf(".") + 1);
|
|
||||||
// return getOssDefaultPath() + UUID.randomUUID().toString() + "." + fileSuf;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
|
@ -4329,3 +4329,99 @@ Caused by: java.net.ConnectException: Connection refused: connect
|
||||||
at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:153)
|
at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:153)
|
||||||
at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:62)
|
at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:62)
|
||||||
... 91 common frames omitted
|
... 91 common frames omitted
|
||||||
|
20:05:03.185 [http-nio-9706-exec-1] ERROR c.m.c.s.h.GlobalExceptionHandler - [handleException,108] - 请求地址'/',发生系统异常.
|
||||||
|
org.springframework.web.servlet.resource.NoResourceFoundException: No static resource .
|
||||||
|
at org.springframework.web.servlet.resource.ResourceHttpRequestHandler.handleRequest(ResourceHttpRequestHandler.java:585)
|
||||||
|
at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:52)
|
||||||
|
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1089)
|
||||||
|
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979)
|
||||||
|
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014)
|
||||||
|
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903)
|
||||||
|
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:633)
|
||||||
|
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885)
|
||||||
|
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:723)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:195)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
|
||||||
|
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
|
||||||
|
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
|
||||||
|
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
|
||||||
|
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
|
||||||
|
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
|
||||||
|
at org.springframework.web.filter.ServerHttpObservationFilter.doFilterInternal(ServerHttpObservationFilter.java:109)
|
||||||
|
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
|
||||||
|
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
|
||||||
|
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
|
||||||
|
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)
|
||||||
|
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
|
||||||
|
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
|
||||||
|
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115)
|
||||||
|
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
|
||||||
|
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
|
||||||
|
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
|
||||||
|
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:389)
|
||||||
|
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
|
||||||
|
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896)
|
||||||
|
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1741)
|
||||||
|
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
|
||||||
|
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1190)
|
||||||
|
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
|
||||||
|
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63)
|
||||||
|
at java.base/java.lang.Thread.run(Thread.java:842)
|
||||||
|
20:05:05.049 [http-nio-9706-exec-3] ERROR c.m.c.s.h.GlobalExceptionHandler - [handleException,108] - 请求地址'/',发生系统异常.
|
||||||
|
org.springframework.web.servlet.resource.NoResourceFoundException: No static resource .
|
||||||
|
at org.springframework.web.servlet.resource.ResourceHttpRequestHandler.handleRequest(ResourceHttpRequestHandler.java:585)
|
||||||
|
at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:52)
|
||||||
|
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1089)
|
||||||
|
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979)
|
||||||
|
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014)
|
||||||
|
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903)
|
||||||
|
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:633)
|
||||||
|
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885)
|
||||||
|
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:723)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:195)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
|
||||||
|
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
|
||||||
|
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
|
||||||
|
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
|
||||||
|
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
|
||||||
|
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
|
||||||
|
at org.springframework.web.filter.ServerHttpObservationFilter.doFilterInternal(ServerHttpObservationFilter.java:109)
|
||||||
|
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
|
||||||
|
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
|
||||||
|
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
|
||||||
|
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
|
||||||
|
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)
|
||||||
|
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
|
||||||
|
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
|
||||||
|
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115)
|
||||||
|
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
|
||||||
|
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
|
||||||
|
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
|
||||||
|
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:389)
|
||||||
|
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
|
||||||
|
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896)
|
||||||
|
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1741)
|
||||||
|
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
|
||||||
|
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1190)
|
||||||
|
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
|
||||||
|
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63)
|
||||||
|
at java.base/java.lang.Thread.run(Thread.java:842)
|
||||||
|
|
|
@ -295,3 +295,90 @@ java.net.SocketException: Connection reset
|
||||||
14:38:39.121 [com.alibaba.nacos.client.remote.worker.1] INFO c.a.n.c.r.c.g.GrpcClient - [createNewManagedChannel,210] - grpc client connection server:47.116.184.54 ip,serverPort:9848,grpcTslConfig:{"sslProvider":"","enableTls":false,"mutualAuthEnable":false,"trustAll":false}
|
14:38:39.121 [com.alibaba.nacos.client.remote.worker.1] INFO c.a.n.c.r.c.g.GrpcClient - [createNewManagedChannel,210] - grpc client connection server:47.116.184.54 ip,serverPort:9848,grpcTslConfig:{"sslProvider":"","enableTls":false,"mutualAuthEnable":false,"trustAll":false}
|
||||||
14:38:39.494 [main] INFO c.a.d.p.DruidDataSource - [init,1002] - {dataSource-1,master} inited
|
14:38:39.494 [main] INFO c.a.d.p.DruidDataSource - [init,1002] - {dataSource-1,master} inited
|
||||||
14:38:39.496 [main] INFO o.a.c.c.StandardService - [log,173] - Stopping service [Tomcat]
|
14:38:39.496 [main] INFO o.a.c.c.StandardService - [log,173] - Stopping service [Tomcat]
|
||||||
|
20:03:27.953 [main] INFO c.m.EngineApplication - [logStartupProfileInfo,660] - The following 1 profile is active: "dev"
|
||||||
|
20:03:30.589 [main] INFO o.a.c.c.StandardService - [log,173] - Starting service [Tomcat]
|
||||||
|
20:03:30.590 [main] INFO o.a.c.c.StandardEngine - [log,173] - Starting Servlet engine: [Apache Tomcat/10.1.24]
|
||||||
|
20:03:30.667 [main] INFO o.a.c.c.C.[.[.[/] - [log,173] - Initializing Spring embedded WebApplicationContext
|
||||||
|
20:03:33.815 [main] INFO c.a.d.p.DruidDataSource - [init,1002] - {dataSource-1,master} inited
|
||||||
|
20:03:33.816 [main] INFO c.b.d.d.DynamicRoutingDataSource - [addDataSource,158] - dynamic-datasource - add a datasource named [master] success
|
||||||
|
20:03:33.816 [main] INFO c.b.d.d.DynamicRoutingDataSource - [afterPropertiesSet,241] - dynamic-datasource initial loaded [1] datasource,primary datasource named [master]
|
||||||
|
20:03:35.136 [main] INFO c.a.c.s.SentinelWebMvcConfigurer - [addInterceptors,52] - [Sentinel Starter] register SentinelWebInterceptor with urlPatterns: [/**].
|
||||||
|
20:03:42.675 [main] INFO c.a.n.client.naming - [initNamespaceForNaming,62] - initializer namespace from ans.namespace attribute : null
|
||||||
|
20:03:42.675 [main] INFO c.a.n.client.naming - [lambda$initNamespaceForNaming$0,66] - initializer namespace from ALIBABA_ALIWARE_NAMESPACE attribute :null
|
||||||
|
20:03:42.676 [main] INFO c.a.n.client.naming - [lambda$initNamespaceForNaming$1,73] - initializer namespace from namespace attribute :null
|
||||||
|
20:03:42.682 [main] INFO c.a.n.client.naming - [<init>,74] - FailoverDataSource type is class com.alibaba.nacos.client.naming.backups.datasource.DiskFailoverDataSource
|
||||||
|
20:03:42.686 [main] INFO c.a.n.p.a.s.c.ClientAuthPluginManager - [init,56] - [ClientAuthPluginManager] Load ClientAuthService com.alibaba.nacos.client.auth.impl.NacosClientAuthServiceImpl success.
|
||||||
|
20:03:42.686 [main] INFO c.a.n.p.a.s.c.ClientAuthPluginManager - [init,56] - [ClientAuthPluginManager] Load ClientAuthService com.alibaba.nacos.client.auth.ram.RamClientAuthServiceImpl success.
|
||||||
|
20:03:42.831 [main] INFO c.a.n.c.r.client - [lambda$createClient$0,118] - [RpcClientFactory] create a new rpc client of 6178c2e0-a658-41e8-95a8-d02c8b8a88ea
|
||||||
|
20:03:42.833 [main] INFO c.a.n.client.naming - [<init>,109] - Create naming rpc client for uuid->6178c2e0-a658-41e8-95a8-d02c8b8a88ea
|
||||||
|
20:03:42.834 [main] INFO c.a.n.c.r.client - [printIfInfoEnabled,63] - [6178c2e0-a658-41e8-95a8-d02c8b8a88ea] RpcClient init, ServerListFactory = com.alibaba.nacos.client.naming.core.ServerListManager
|
||||||
|
20:03:42.834 [main] INFO c.a.n.c.r.client - [printIfInfoEnabled,63] - [6178c2e0-a658-41e8-95a8-d02c8b8a88ea] Registry connection listener to current client:com.alibaba.nacos.client.naming.remote.gprc.redo.NamingGrpcRedoService
|
||||||
|
20:03:42.834 [main] INFO c.a.n.c.r.client - [printIfInfoEnabled,63] - [6178c2e0-a658-41e8-95a8-d02c8b8a88ea] Register server push request handler:com.alibaba.nacos.client.naming.remote.gprc.NamingPushRequestHandler
|
||||||
|
20:03:42.834 [main] INFO c.a.n.c.r.client - [printIfInfoEnabled,63] - [6178c2e0-a658-41e8-95a8-d02c8b8a88ea] Try to connect to server on start up, server: {serverIp = '47.116.184.54', server main port = 8848}
|
||||||
|
20:03:42.835 [main] INFO c.a.n.c.r.c.g.GrpcClient - [createNewManagedChannel,210] - grpc client connection server:47.116.184.54 ip,serverPort:9848,grpcTslConfig:{"sslProvider":"","enableTls":false,"mutualAuthEnable":false,"trustAll":false}
|
||||||
|
20:03:43.034 [main] INFO c.a.n.c.r.client - [printIfInfoEnabled,63] - [6178c2e0-a658-41e8-95a8-d02c8b8a88ea] Success to connect to server [47.116.184.54:8848] on start up, connectionId = 1725451443486_139.224.212.27_62956
|
||||||
|
20:03:43.034 [main] INFO c.a.n.c.r.client - [printIfInfoEnabled,63] - [6178c2e0-a658-41e8-95a8-d02c8b8a88ea] Register server push request handler:com.alibaba.nacos.common.remote.client.RpcClient$ConnectResetRequestHandler
|
||||||
|
20:03:43.034 [com.alibaba.nacos.client.remote.worker.0] INFO c.a.n.c.r.client - [printIfInfoEnabled,63] - [6178c2e0-a658-41e8-95a8-d02c8b8a88ea] Notify connected event to listeners.
|
||||||
|
20:03:43.034 [main] INFO c.a.n.c.r.client - [printIfInfoEnabled,63] - [6178c2e0-a658-41e8-95a8-d02c8b8a88ea] Register server push request handler:com.alibaba.nacos.common.remote.client.RpcClient$$Lambda$575/0x000002698150ab60
|
||||||
|
20:03:43.034 [com.alibaba.nacos.client.remote.worker.0] INFO c.a.n.client.naming - [onConnected,90] - Grpc connection connect
|
||||||
|
20:03:43.036 [main] INFO c.a.n.client.naming - [registerService,133] - [REGISTER-SERVICE] cloud-2112 registering service cloud-engine with instance Instance{instanceId='null', ip='192.168.52.1', port=9706, weight=1.0, healthy=true, enabled=true, ephemeral=true, clusterName='DEFAULT', serviceName='null', metadata={IPv6=[2409:891f:8f45:476:2757:da74:cc8d:2026], preserved.register.source=SPRING_CLOUD}}
|
||||||
|
20:03:43.094 [main] INFO c.a.c.n.r.NacosServiceRegistry - [register,76] - nacos registry, DEFAULT_GROUP cloud-engine 192.168.52.1:9706 register finished
|
||||||
|
20:03:44.302 [main] INFO c.m.EngineApplication - [logStarted,56] - Started EngineApplication in 21.88 seconds (process running for 22.909)
|
||||||
|
20:03:44.311 [main] INFO c.a.n.c.c.i.CacheData - [initNotifyWarnTimeout,72] - config listener notify warn timeout millis use default 60000 millis
|
||||||
|
20:03:44.311 [main] INFO c.a.n.c.c.i.CacheData - [<clinit>,99] - nacos.cache.data.init.snapshot = true
|
||||||
|
20:03:44.312 [main] INFO c.a.n.c.c.i.ClientWorker - [addCacheDataIfAbsent,416] - [fixed-cloud-2112-47.116.184.54_8848] [subscribe] cloud-engine.yml+DEFAULT_GROUP+cloud-2112
|
||||||
|
20:03:44.323 [main] INFO c.a.n.c.c.i.CacheData - [addListener,236] - [fixed-cloud-2112-47.116.184.54_8848] [add-listener] ok, tenant=cloud-2112, dataId=cloud-engine.yml, group=DEFAULT_GROUP, cnt=1
|
||||||
|
20:03:44.323 [main] INFO c.a.c.n.r.NacosContextRefresher - [registerNacosListener,131] - [Nacos Config] Listening config: dataId=cloud-engine.yml, group=DEFAULT_GROUP
|
||||||
|
20:03:44.324 [main] INFO c.a.n.c.c.i.ClientWorker - [addCacheDataIfAbsent,416] - [fixed-cloud-2112-47.116.184.54_8848] [subscribe] cloud-engine+DEFAULT_GROUP+cloud-2112
|
||||||
|
20:03:44.324 [main] INFO c.a.n.c.c.i.CacheData - [addListener,236] - [fixed-cloud-2112-47.116.184.54_8848] [add-listener] ok, tenant=cloud-2112, dataId=cloud-engine, group=DEFAULT_GROUP, cnt=1
|
||||||
|
20:03:44.324 [main] INFO c.a.c.n.r.NacosContextRefresher - [registerNacosListener,131] - [Nacos Config] Listening config: dataId=cloud-engine, group=DEFAULT_GROUP
|
||||||
|
20:03:44.326 [main] INFO c.a.n.c.c.i.ClientWorker - [addCacheDataIfAbsent,416] - [fixed-cloud-2112-47.116.184.54_8848] [subscribe] cloud-engine-dev.yml+DEFAULT_GROUP+cloud-2112
|
||||||
|
20:03:44.326 [main] INFO c.a.n.c.c.i.CacheData - [addListener,236] - [fixed-cloud-2112-47.116.184.54_8848] [add-listener] ok, tenant=cloud-2112, dataId=cloud-engine-dev.yml, group=DEFAULT_GROUP, cnt=1
|
||||||
|
20:03:44.326 [main] INFO c.a.c.n.r.NacosContextRefresher - [registerNacosListener,131] - [Nacos Config] Listening config: dataId=cloud-engine-dev.yml, group=DEFAULT_GROUP
|
||||||
|
20:03:44.552 [RMI TCP Connection(3)-172.16.0.8] INFO o.a.c.c.C.[.[.[/] - [log,173] - Initializing Spring DispatcherServlet 'dispatcherServlet'
|
||||||
|
20:04:21.817 [SpringApplicationShutdownHook] INFO c.a.c.n.r.NacosServiceRegistry - [deregister,95] - De-registering from Nacos Server now...
|
||||||
|
20:04:21.817 [SpringApplicationShutdownHook] INFO c.a.n.client.naming - [deregisterService,272] - [DEREGISTER-SERVICE] cloud-2112 deregistering service cloud-engine with instance: Instance{instanceId='null', ip='192.168.52.1', port=9706, weight=1.0, healthy=true, enabled=true, ephemeral=true, clusterName='DEFAULT', serviceName='null', metadata={}}
|
||||||
|
20:04:38.922 [main] INFO c.m.EngineApplication - [logStartupProfileInfo,660] - The following 1 profile is active: "dev"
|
||||||
|
20:04:41.759 [main] INFO o.a.c.c.StandardService - [log,173] - Starting service [Tomcat]
|
||||||
|
20:04:41.759 [main] INFO o.a.c.c.StandardEngine - [log,173] - Starting Servlet engine: [Apache Tomcat/10.1.24]
|
||||||
|
20:04:41.848 [main] INFO o.a.c.c.C.[.[.[/] - [log,173] - Initializing Spring embedded WebApplicationContext
|
||||||
|
20:04:47.480 [main] INFO c.a.d.p.DruidDataSource - [init,1002] - {dataSource-1,master} inited
|
||||||
|
20:04:47.482 [main] INFO c.b.d.d.DynamicRoutingDataSource - [addDataSource,158] - dynamic-datasource - add a datasource named [master] success
|
||||||
|
20:04:47.482 [main] INFO c.b.d.d.DynamicRoutingDataSource - [afterPropertiesSet,241] - dynamic-datasource initial loaded [1] datasource,primary datasource named [master]
|
||||||
|
20:04:48.944 [main] INFO c.a.c.s.SentinelWebMvcConfigurer - [addInterceptors,52] - [Sentinel Starter] register SentinelWebInterceptor with urlPatterns: [/**].
|
||||||
|
20:04:58.416 [main] INFO c.a.n.client.naming - [initNamespaceForNaming,62] - initializer namespace from ans.namespace attribute : null
|
||||||
|
20:04:58.417 [main] INFO c.a.n.client.naming - [lambda$initNamespaceForNaming$0,66] - initializer namespace from ALIBABA_ALIWARE_NAMESPACE attribute :null
|
||||||
|
20:04:58.417 [main] INFO c.a.n.client.naming - [lambda$initNamespaceForNaming$1,73] - initializer namespace from namespace attribute :null
|
||||||
|
20:04:58.423 [main] INFO c.a.n.client.naming - [<init>,74] - FailoverDataSource type is class com.alibaba.nacos.client.naming.backups.datasource.DiskFailoverDataSource
|
||||||
|
20:04:58.427 [main] INFO c.a.n.p.a.s.c.ClientAuthPluginManager - [init,56] - [ClientAuthPluginManager] Load ClientAuthService com.alibaba.nacos.client.auth.impl.NacosClientAuthServiceImpl success.
|
||||||
|
20:04:58.427 [main] INFO c.a.n.p.a.s.c.ClientAuthPluginManager - [init,56] - [ClientAuthPluginManager] Load ClientAuthService com.alibaba.nacos.client.auth.ram.RamClientAuthServiceImpl success.
|
||||||
|
20:04:58.606 [main] INFO c.a.n.c.r.client - [lambda$createClient$0,118] - [RpcClientFactory] create a new rpc client of 896004a8-f144-4fbe-8d5e-da2375cd8aac
|
||||||
|
20:04:58.609 [main] INFO c.a.n.client.naming - [<init>,109] - Create naming rpc client for uuid->896004a8-f144-4fbe-8d5e-da2375cd8aac
|
||||||
|
20:04:58.609 [main] INFO c.a.n.c.r.client - [printIfInfoEnabled,63] - [896004a8-f144-4fbe-8d5e-da2375cd8aac] RpcClient init, ServerListFactory = com.alibaba.nacos.client.naming.core.ServerListManager
|
||||||
|
20:04:58.609 [main] INFO c.a.n.c.r.client - [printIfInfoEnabled,63] - [896004a8-f144-4fbe-8d5e-da2375cd8aac] Registry connection listener to current client:com.alibaba.nacos.client.naming.remote.gprc.redo.NamingGrpcRedoService
|
||||||
|
20:04:58.610 [main] INFO c.a.n.c.r.client - [printIfInfoEnabled,63] - [896004a8-f144-4fbe-8d5e-da2375cd8aac] Register server push request handler:com.alibaba.nacos.client.naming.remote.gprc.NamingPushRequestHandler
|
||||||
|
20:04:58.610 [main] INFO c.a.n.c.r.client - [printIfInfoEnabled,63] - [896004a8-f144-4fbe-8d5e-da2375cd8aac] Try to connect to server on start up, server: {serverIp = '47.116.184.54', server main port = 8848}
|
||||||
|
20:04:58.610 [main] INFO c.a.n.c.r.c.g.GrpcClient - [createNewManagedChannel,210] - grpc client connection server:47.116.184.54 ip,serverPort:9848,grpcTslConfig:{"sslProvider":"","enableTls":false,"mutualAuthEnable":false,"trustAll":false}
|
||||||
|
20:04:58.814 [main] INFO c.a.n.c.r.client - [printIfInfoEnabled,63] - [896004a8-f144-4fbe-8d5e-da2375cd8aac] Success to connect to server [47.116.184.54:8848] on start up, connectionId = 1725451519251_139.224.212.27_63224
|
||||||
|
20:04:58.814 [main] INFO c.a.n.c.r.client - [printIfInfoEnabled,63] - [896004a8-f144-4fbe-8d5e-da2375cd8aac] Register server push request handler:com.alibaba.nacos.common.remote.client.RpcClient$ConnectResetRequestHandler
|
||||||
|
20:04:58.814 [com.alibaba.nacos.client.remote.worker.0] INFO c.a.n.c.r.client - [printIfInfoEnabled,63] - [896004a8-f144-4fbe-8d5e-da2375cd8aac] Notify connected event to listeners.
|
||||||
|
20:04:58.814 [main] INFO c.a.n.c.r.client - [printIfInfoEnabled,63] - [896004a8-f144-4fbe-8d5e-da2375cd8aac] Register server push request handler:com.alibaba.nacos.common.remote.client.RpcClient$$Lambda$575/0x000002d1314d2da0
|
||||||
|
20:04:58.814 [com.alibaba.nacos.client.remote.worker.0] INFO c.a.n.client.naming - [onConnected,90] - Grpc connection connect
|
||||||
|
20:04:58.815 [main] INFO c.a.n.client.naming - [registerService,133] - [REGISTER-SERVICE] cloud-2112 registering service cloud-engine with instance Instance{instanceId='null', ip='192.168.52.1', port=9706, weight=1.0, healthy=true, enabled=true, ephemeral=true, clusterName='DEFAULT', serviceName='null', metadata={IPv6=[2409:891f:8f45:476:2757:da74:cc8d:2026], preserved.register.source=SPRING_CLOUD}}
|
||||||
|
20:04:58.880 [main] INFO c.a.c.n.r.NacosServiceRegistry - [register,76] - nacos registry, DEFAULT_GROUP cloud-engine 192.168.52.1:9706 register finished
|
||||||
|
20:05:00.090 [main] INFO c.m.EngineApplication - [logStarted,56] - Started EngineApplication in 27.017 seconds (process running for 28.033)
|
||||||
|
20:05:00.101 [main] INFO c.a.n.c.c.i.CacheData - [initNotifyWarnTimeout,72] - config listener notify warn timeout millis use default 60000 millis
|
||||||
|
20:05:00.101 [main] INFO c.a.n.c.c.i.CacheData - [<clinit>,99] - nacos.cache.data.init.snapshot = true
|
||||||
|
20:05:00.102 [main] INFO c.a.n.c.c.i.ClientWorker - [addCacheDataIfAbsent,416] - [fixed-cloud-2112-47.116.184.54_8848] [subscribe] cloud-engine.yml+DEFAULT_GROUP+cloud-2112
|
||||||
|
20:05:00.113 [main] INFO c.a.n.c.c.i.CacheData - [addListener,236] - [fixed-cloud-2112-47.116.184.54_8848] [add-listener] ok, tenant=cloud-2112, dataId=cloud-engine.yml, group=DEFAULT_GROUP, cnt=1
|
||||||
|
20:05:00.114 [main] INFO c.a.c.n.r.NacosContextRefresher - [registerNacosListener,131] - [Nacos Config] Listening config: dataId=cloud-engine.yml, group=DEFAULT_GROUP
|
||||||
|
20:05:00.114 [main] INFO c.a.n.c.c.i.ClientWorker - [addCacheDataIfAbsent,416] - [fixed-cloud-2112-47.116.184.54_8848] [subscribe] cloud-engine+DEFAULT_GROUP+cloud-2112
|
||||||
|
20:05:00.114 [main] INFO c.a.n.c.c.i.CacheData - [addListener,236] - [fixed-cloud-2112-47.116.184.54_8848] [add-listener] ok, tenant=cloud-2112, dataId=cloud-engine, group=DEFAULT_GROUP, cnt=1
|
||||||
|
20:05:00.115 [main] INFO c.a.c.n.r.NacosContextRefresher - [registerNacosListener,131] - [Nacos Config] Listening config: dataId=cloud-engine, group=DEFAULT_GROUP
|
||||||
|
20:05:00.117 [main] INFO c.a.n.c.c.i.ClientWorker - [addCacheDataIfAbsent,416] - [fixed-cloud-2112-47.116.184.54_8848] [subscribe] cloud-engine-dev.yml+DEFAULT_GROUP+cloud-2112
|
||||||
|
20:05:00.117 [main] INFO c.a.n.c.c.i.CacheData - [addListener,236] - [fixed-cloud-2112-47.116.184.54_8848] [add-listener] ok, tenant=cloud-2112, dataId=cloud-engine-dev.yml, group=DEFAULT_GROUP, cnt=1
|
||||||
|
20:05:00.117 [main] INFO c.a.c.n.r.NacosContextRefresher - [registerNacosListener,131] - [Nacos Config] Listening config: dataId=cloud-engine-dev.yml, group=DEFAULT_GROUP
|
||||||
|
20:05:00.372 [RMI TCP Connection(6)-172.16.0.8] INFO o.a.c.c.C.[.[.[/] - [log,173] - Initializing Spring DispatcherServlet 'dispatcherServlet'
|
||||||
|
20:05:10.198 [http-nio-9706-exec-4] INFO o.s.a.AbstractOpenApiResource - [getOpenApi,369] - Init duration for springdoc-openapi is: 415 ms
|
||||||
|
20:05:15.375 [SpringApplicationShutdownHook] INFO c.a.c.n.r.NacosServiceRegistry - [deregister,95] - De-registering from Nacos Server now...
|
||||||
|
20:05:15.375 [SpringApplicationShutdownHook] INFO c.a.n.client.naming - [deregisterService,272] - [DEREGISTER-SERVICE] cloud-2112 deregistering service cloud-engine with instance: Instance{instanceId='null', ip='192.168.52.1', port=9706, weight=1.0, healthy=true, enabled=true, ephemeral=true, clusterName='DEFAULT', serviceName='null', metadata={}}
|
||||||
|
|
Loading…
Reference in New Issue