qianlishi 3 years ago
commit 4a9636e5a3

@ -99,6 +99,28 @@
<version>1.2.6</version>
</dependency>
<!--kudu impala驱动-->
<dependency>
<groupId>com.cloudera</groupId>
<artifactId>ImpalaJDBC41</artifactId>
<version>2.5.41</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/ImpalaJDBC41.jar</systemPath>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-jdbc</artifactId>
<version>1.2.1</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty.aggregate</groupId>
<artifactId>jetty-all</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<resources>

@ -36,6 +36,10 @@ public class TokenFilter implements Filter {
HttpServletResponse response = (HttpServletResponse) servletResponse;
String uri = request.getRequestURI();
if(uri.equals("/")){
response.sendRedirect("/index.html");
return;
}
if (!uri.startsWith("/login")
&& !uri.startsWith("/static")
&& !uri.startsWith("/file/download/")

@ -25,6 +25,7 @@ import com.anjiplus.template.gaea.business.modules.dataSource.service.DataSource
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -43,6 +44,7 @@ import java.util.stream.Collectors;
**/
@Service
//@RequiredArgsConstructor
@Slf4j
public class DataSetServiceImpl implements DataSetService {
@Autowired
@ -128,6 +130,7 @@ public class DataSetServiceImpl implements DataSetService {
JSONObject jsonObject = jsonArray.getJSONObject(0);
dto.setSetParamList(jsonObject.keySet());
} catch (Exception e) {
log.error("{}",e);
}
}
return dto;

@ -42,7 +42,8 @@ public class JdbcUtil {
pool.setMaxWait(2000); //获取连接的最大等待时间,单位毫秒
pool.setPoolPreparedStatements(true); //缓存PreparedStatement默认false
pool.setMaxOpenPreparedStatements(20); //缓存PreparedStatement的最大数量默认-1不缓存。大于0时会自动开启缓存PreparedStatement所以可以省略上一句代码
pool.setConnectionErrorRetryAttempts(0);
pool.setBreakAfterAcquireFailure(true);
map.put(dataSource.getId(), pool);
log.info("创建连接池成功:{}", dataSource.getJdbcUrl());
}
@ -63,7 +64,7 @@ public class JdbcUtil {
map.remove(id);
}
} catch (Exception e) {
log.error(e.toString());
log.error("{}",e);
} finally {
}
}

@ -102,6 +102,7 @@ public class DataSourceServiceImpl implements DataSourceService {
default:
throw BusinessExceptionBuilder.build(ResponseCode.DATA_SOURCE_TYPE_DOES_NOT_MATCH_TEMPORARILY);
}
log.info("测试连接成功:{}", JSONObject.toJSONString(connectionParam));
return true;
}
@ -175,6 +176,7 @@ public class DataSourceServiceImpl implements DataSourceService {
try {
exchange = restTemplate.exchange(dto.getApiUrl(), HttpMethod.valueOf(dto.getMethod()), entity, JSONObject.class);
} catch (Exception e) {
log.error("{}",e);
throw BusinessExceptionBuilder.build(ResponseCode.DATA_SOURCE_CONNECTION_FAILED, e.getMessage());
}
if (exchange.getStatusCode().isError()) {
@ -201,6 +203,7 @@ public class DataSourceServiceImpl implements DataSourceService {
result.add(jsonObject);
}
} catch (Exception e) {
log.error("{}",e);
throw BusinessExceptionBuilder.build(ResponseCode.ANALYSIS_DATA_ERROR, e.getMessage());
}
return result;
@ -230,6 +233,7 @@ public class DataSourceServiceImpl implements DataSourceService {
Object value = rs.getObject(t);
jo.put(t, value);
} catch (SQLException throwable) {
log.error("{}",throwable);
throw BusinessExceptionBuilder.build(ResponseCode.EXECUTE_SQL_ERROR, throwable.getMessage());
}
});
@ -237,11 +241,15 @@ public class DataSourceServiceImpl implements DataSourceService {
}
return list;
} catch (Exception throwable) {
log.error("{}",throwable);
throw BusinessExceptionBuilder.build(ResponseCode.EXECUTE_SQL_ERROR, throwable.getMessage());
} finally {
try {
if (pooledConnection != null) {
pooledConnection.close();
}
} catch (SQLException throwable) {
log.error("{}",throwable);
throw BusinessExceptionBuilder.build(ResponseCode.DATA_SOURCE_CONNECTION_FAILED, throwable.getMessage());
}
}
@ -261,6 +269,7 @@ public class DataSourceServiceImpl implements DataSourceService {
try {
exchange = restTemplate.exchange(dto.getApiUrl(), HttpMethod.valueOf(dto.getMethod()), entity, JSONObject.class);
} catch (Exception e) {
log.error("{}",e);
throw BusinessExceptionBuilder.build(ResponseCode.DATA_SOURCE_CONNECTION_FAILED, e.getMessage());
}
if (exchange.getStatusCode().isError()) {
@ -285,6 +294,7 @@ public class DataSourceServiceImpl implements DataSourceService {
log.info("数据库测试连接成功:{}", catalog);
unPooledConnection.close();
} catch (Exception e) {
log.error("{}",e);
throw BusinessExceptionBuilder.build(ResponseCode.DATA_SOURCE_CONNECTION_FAILED, e.getMessage());
}
}

@ -12,6 +12,7 @@ import com.anjiplus.template.gaea.business.modules.user.service.UserService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -23,6 +24,7 @@ import java.util.Map;
* Created by raodeming on 2021/6/23.
*/
@Service
@Slf4j
public class UserServiceImpl implements UserService {
@Autowired
@ -58,6 +60,7 @@ public class UserServiceImpl implements UserService {
String token = jwtBean.createToken(username, uuid);
cacheHelper.stringSetExpire(username, token, 3600);
map.put("token", token);
map.put("username", username);
}
return map;
@ -79,7 +82,7 @@ public class UserServiceImpl implements UserService {
}
return result.toString();
} catch (Exception e) {
e.printStackTrace();
log.error("{}",e);
}
return "";
}

@ -0,0 +1,4 @@
/*
kudu
*/
UPDATE `aj_report`.`gaea_dict_item` SET `dict_code` = 'SOURCE_TYPE', `item_name` = 'kudu impala', `item_value` = 'kudu_impala', `item_extend` = '[{\"label\":\"driverName\",\"value\":\"com.cloudera.impala.jdbc41.Driver\",\"labelValue\":\"驱动类\"},{\"label\":\"jdbcUrl\",\"value\":\"jdbc:impala://10.108.3.111:21050/ods\",\"labelValue\":\"连接串\"},{\"label\":\"username\",\"value\":\"\",\"labelValue\":\"用户名\"},{\"label\":\"password\",\"value\":\"\",\"labelValue\":\"密码\"}]', `enabled` = 1, `locale` = 'zh', `remark` = NULL, `sort` = 2, `create_by` = 'admin', `create_time` = '2021-03-23 10:54:08', `update_by` = 'admin', `update_time` = '2021-04-01 09:18:09', `version` = 3 WHERE `id` = 133;
Loading…
Cancel
Save