|
|
@ -33,11 +33,9 @@ import org.springframework.web.client.RestClientException;
|
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.sql.Connection;
|
|
|
|
import java.sql.*;
|
|
|
|
import java.sql.PreparedStatement;
|
|
|
|
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
|
|
|
|
import java.sql.SQLException;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
@ -243,7 +241,9 @@ public class DataSourceServiceImpl implements DataSourceService {
|
|
|
|
columns.forEach(t -> {
|
|
|
|
columns.forEach(t -> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Object value = rs.getObject(t);
|
|
|
|
Object value = rs.getObject(t);
|
|
|
|
jo.put(t, value);
|
|
|
|
//数据类型转换
|
|
|
|
|
|
|
|
Object result = dealResult(value);
|
|
|
|
|
|
|
|
jo.put(t, result);
|
|
|
|
} catch (SQLException throwable) {
|
|
|
|
} catch (SQLException throwable) {
|
|
|
|
log.error("error",throwable);
|
|
|
|
log.error("error",throwable);
|
|
|
|
throw BusinessExceptionBuilder.build(ResponseCode.EXECUTE_SQL_ERROR, throwable.getMessage());
|
|
|
|
throw BusinessExceptionBuilder.build(ResponseCode.EXECUTE_SQL_ERROR, throwable.getMessage());
|
|
|
@ -267,6 +267,26 @@ public class DataSourceServiceImpl implements DataSourceService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 解决sql返回值 类型问题
|
|
|
|
|
|
|
|
* (through reference chain: java.util.HashMap["pageData"]->java.util.ArrayList[0]->java.util.HashMap["UPDATE_TIME"]->oracle.sql.TIMESTAMP["stream"])
|
|
|
|
|
|
|
|
* @param result
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
* @throws SQLException
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private Object dealResult(Object result) throws SQLException {
|
|
|
|
|
|
|
|
if (null == result) {
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String type = result.getClass().getName();
|
|
|
|
|
|
|
|
if ("oracle.sql.TIMESTAMP".equals(type)) {
|
|
|
|
|
|
|
|
//oracle.sql.TIMESTAMP处理逻辑
|
|
|
|
|
|
|
|
return new Date((Long) JSONObject.toJSON(result));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* http 执行获取数据
|
|
|
|
* http 执行获取数据
|
|
|
|
*
|
|
|
|
*
|
|
|
|