1:添加星汉的hive数据源
2:修改调用日志查询的类为spring管理 3:删除无用的账号密码解密
This commit is contained in:
@@ -8,7 +8,6 @@ import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
|
||||
|
||||
|
||||
public class PropertyPlaceholderConfigurerCrypt extends PropertyPlaceholderConfigurer {
|
||||
|
||||
@Override
|
||||
@@ -16,89 +15,29 @@ public class PropertyPlaceholderConfigurerCrypt extends PropertyPlaceholderConfi
|
||||
throws BeansException {
|
||||
|
||||
try {
|
||||
String productPassword = props.getProperty("jdbc.product.password");
|
||||
String productScretKey = props.getProperty("jdbc.product.key");
|
||||
if (null != productPassword) {
|
||||
props.setProperty("jdbc.product.password",
|
||||
new String(AESUtil.decrypt(Base64.decodeBase64(productPassword), productScretKey)));
|
||||
}
|
||||
|
||||
String devlopPassword = props.getProperty("jdbc.devlop.password");
|
||||
String devlopScretKey = props.getProperty("jdbc.devlop.key");
|
||||
if (null != devlopPassword) {
|
||||
props.setProperty("jdbc.devlop.password",
|
||||
new String(AESUtil.decrypt(Base64.decodeBase64(devlopPassword), devlopScretKey)));
|
||||
}
|
||||
|
||||
// mysql
|
||||
String logPassword = props.getProperty("jdbc.log.password");
|
||||
String logScretKey = props.getProperty("jdbc.log.key");
|
||||
if (null != logPassword) {
|
||||
props.setProperty("jdbc.log.password",
|
||||
new String(AESUtil.decrypt(Base64.decodeBase64(logPassword), logScretKey)));
|
||||
}
|
||||
|
||||
// 日志A版
|
||||
String logAPassword = props.getProperty("jdbc.logA.password");
|
||||
String logAScretKey = props.getProperty("jdbc.logA.key");
|
||||
if (null != logAPassword) {
|
||||
props.setProperty("jdbc.logA.password",
|
||||
new String(AESUtil.decrypt(Base64.decodeBase64(logAPassword), logAScretKey)));
|
||||
}
|
||||
// 日志A版
|
||||
String logCPassword = props.getProperty("jdbc.logC.password");
|
||||
String logCScretKey = props.getProperty("jdbc.logC.key");
|
||||
if (null != logAPassword) {
|
||||
props.setProperty("jdbc.logC.password",
|
||||
new String(AESUtil.decrypt(Base64.decodeBase64(logCPassword), logCScretKey)));
|
||||
}
|
||||
|
||||
|
||||
// 测试使用,后期会删除
|
||||
String testPassword = props.getProperty("jdbc.test.password");
|
||||
String testScretKey = props.getProperty("jdbc.test.key");
|
||||
if (null != testPassword) {
|
||||
props.setProperty("jdbc.test.password",
|
||||
new String(AESUtil.decrypt(Base64.decodeBase64(testPassword), testScretKey)));
|
||||
}
|
||||
|
||||
String jkPzPassword = props.getProperty("jdbc.jk.password");
|
||||
String jkPzScretKey = props.getProperty("jdbc.jk.key");
|
||||
if (null != jkPzPassword) {
|
||||
props.setProperty("jdbc.jk.password",
|
||||
new String(AESUtil.decrypt(Base64.decodeBase64(jkPzPassword), jkPzScretKey)));
|
||||
}
|
||||
//A版hive库
|
||||
String hiveAPassword = props.getProperty("jdbc.hiveA.password");
|
||||
String hiveAScretKey = props.getProperty("jdbc.hiveA.key");
|
||||
if (null != hiveAPassword) {
|
||||
props.setProperty("jdbc.hiveA.password",
|
||||
new String(AESUtil.decrypt(Base64.decodeBase64(hiveAPassword), hiveAScretKey)));
|
||||
}
|
||||
|
||||
//B版hive库
|
||||
String hiveBPassword = props.getProperty("jdbc.hiveB.password");
|
||||
String hiveBScretKey = props.getProperty("jdbc.hiveB.key");
|
||||
if (null != hiveBPassword) {
|
||||
props.setProperty("jdbc.hiveB.password",
|
||||
new String(AESUtil.decrypt(Base64.decodeBase64(hiveBPassword), hiveBScretKey)));
|
||||
}
|
||||
|
||||
//神通数据库库
|
||||
String clusterPassword = props.getProperty("jdbc.log.cluster.password");
|
||||
String clusterScretKey = props.getProperty("jdbc.log.cluster.key");
|
||||
if (null != clusterPassword) {
|
||||
props.setProperty("jdbc.log.cluster.password",
|
||||
new String(AESUtil.decrypt(Base64.decodeBase64(clusterPassword), clusterScretKey)));
|
||||
}
|
||||
|
||||
//clickhouse
|
||||
// clickhouse
|
||||
String clickHousePassword = props.getProperty("jdbc.clickhouse.password");
|
||||
String clickHouseScretKey = props.getProperty("jdbc.clickhouse.key");
|
||||
if (null != clickHousePassword) {
|
||||
props.setProperty("jdbc.clickhouse.password",
|
||||
new String(AESUtil.decrypt(Base64.decodeBase64(clickHousePassword), clickHouseScretKey)));
|
||||
}
|
||||
|
||||
// hive
|
||||
String hivePassword = props.getProperty("jdbc.hive.password");
|
||||
String hiveScretKey = props.getProperty("jdbc.hive.key");
|
||||
if (null != clickHousePassword) {
|
||||
props.setProperty("jdbc.hive.password",
|
||||
new String(AESUtil.decrypt(Base64.decodeBase64(hivePassword), hiveScretKey)));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.nis.util;
|
||||
package com.nis.web.dao.impl;
|
||||
|
||||
import java.beans.BeanInfo;
|
||||
import java.beans.Introspector;
|
||||
@@ -20,9 +20,11 @@ import org.apache.ibatis.mapping.ResultMapping;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
import com.zdjizhi.utils.StringUtil;
|
||||
|
||||
@@ -42,6 +44,7 @@ import com.zdjizhi.utils.StringUtil;
|
||||
* @date 2018年8月20日
|
||||
*
|
||||
*/
|
||||
@Repository
|
||||
public class LogJDBCByDruid {
|
||||
private final static Logger logger = LoggerFactory.getLogger(LogJDBCByDruid.class);
|
||||
static DruidDataSource datasource = null;
|
||||
@@ -2,9 +2,6 @@ package com.nis.web.service;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -14,13 +11,13 @@ import java.util.Map;
|
||||
import org.apache.ibatis.mapping.ResultMap;
|
||||
import org.apache.ibatis.mapping.ResultMapping;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.LogJDBCByDruid;
|
||||
import com.nis.web.dao.impl.LogJDBCByDruid;
|
||||
import com.zdjizhi.utils.StringUtil;
|
||||
|
||||
/**
|
||||
@@ -33,10 +30,9 @@ import com.zdjizhi.utils.StringUtil;
|
||||
public class LogDataService {
|
||||
// private final static Logger logger =
|
||||
// LoggerFactory.getLogger(LogDataService.class);
|
||||
static DruidDataSource datasource = null;
|
||||
Connection conn = null;
|
||||
ResultSet rs = null;
|
||||
Statement st = null;
|
||||
|
||||
@Autowired
|
||||
private LogJDBCByDruid logJDBCByDruid;
|
||||
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
private static SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMdd");
|
||||
private static Map<String, Map<String, String>> col2col = new HashMap<String, Map<String, String>>();
|
||||
@@ -189,7 +185,7 @@ public class LogDataService {
|
||||
}
|
||||
Integer startNum = (page.getPageNo() - 1) * page.getPageSize();
|
||||
StringBuffer foundTimeSql = new StringBuffer();
|
||||
foundTimeSql.append("select distinct found_time from " + tableName + " where ");
|
||||
foundTimeSql.append("select found_time from " + tableName + " where ");
|
||||
if (whereSB.length() == 0) {// 没有其他查询条件只有默认的found_time条件
|
||||
if (whereFoundTime.length() > 0) {
|
||||
int indexOf = whereFoundTime.indexOf("and") + "and".length();
|
||||
@@ -365,10 +361,11 @@ public class LogDataService {
|
||||
*/
|
||||
private <T> void searchFromDataCenter(Page<T> page, Object bean, StringBuffer selSql, StringBuffer countSql)
|
||||
throws Exception {
|
||||
new LogJDBCByDruid().getTableData(page, selSql.toString(), bean.getClass());
|
||||
// new LogJDBCByDruid().getTableData(page, selSql.toString(), bean.getClass());
|
||||
logJDBCByDruid.getTableData(page, selSql.toString(), bean.getClass());
|
||||
if (Constants.ISOPENLOGCOUNTANDLAST) {
|
||||
if (page.getList() != null && page.getList().size() > 0) {
|
||||
new LogJDBCByDruid().getCount(page, countSql.toString().toLowerCase());
|
||||
logJDBCByDruid.getCount(page, countSql.toString().toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import com.nis.domain.restful.ConfigPzIdSource;
|
||||
import com.zdjizhi.utils.StringUtil;
|
||||
import com.nis.web.dao.ConfigPzIdDao;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIConversion.Static;
|
||||
|
||||
/**
|
||||
* @ClassName:ConfigPzIdService
|
||||
|
||||
Reference in New Issue
Block a user