diff --git a/report-core/pom.xml b/report-core/pom.xml index 3eec9398..ccfc264d 100644 --- a/report-core/pom.xml +++ b/report-core/pom.xml @@ -99,6 +99,28 @@ 1.2.6 + + + + com.cloudera + ImpalaJDBC41 + 2.5.41 + system + ${project.basedir}/src/main/resources/lib/ImpalaJDBC41.jar + + + + org.apache.hive + hive-jdbc + 1.2.1 + + + org.eclipse.jetty.aggregate + jetty-all + + + + diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/filter/TokenFilter.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/filter/TokenFilter.java index 5213807e..a3043c5e 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/filter/TokenFilter.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/filter/TokenFilter.java @@ -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/") diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataSet/service/impl/DataSetServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataSet/service/impl/DataSetServiceImpl.java index 6502db3b..8513640a 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataSet/service/impl/DataSetServiceImpl.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataSet/service/impl/DataSetServiceImpl.java @@ -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; diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataSource/pool/util/JdbcUtil.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataSource/pool/util/JdbcUtil.java index ecaeed9f..cbcf3957 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataSource/pool/util/JdbcUtil.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataSource/pool/util/JdbcUtil.java @@ -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 { } } diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataSource/service/impl/DataSourceServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataSource/service/impl/DataSourceServiceImpl.java index a4fb8141..29705d47 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataSource/service/impl/DataSourceServiceImpl.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataSource/service/impl/DataSourceServiceImpl.java @@ -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 { - pooledConnection.close(); + 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()); } } diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/user/service/impl/UserServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/user/service/impl/UserServiceImpl.java index 7a44d0c0..c4fe24c5 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/user/service/impl/UserServiceImpl.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/user/service/impl/UserServiceImpl.java @@ -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 ""; } diff --git a/report-core/src/main/resources/db/migration/V1.0.2__update_tables.sql b/report-core/src/main/resources/db/migration/V1.0.2__update_tables.sql new file mode 100644 index 00000000..b934a091 --- /dev/null +++ b/report-core/src/main/resources/db/migration/V1.0.2__update_tables.sql @@ -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;