Commit 98a9893e by 陶光胜

取数平台调整

parent 3044c191
......@@ -4,6 +4,7 @@ import cn.medubi.client.utils.LogPak;
import com.alibaba.fastjson.JSON;
import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.ConfigService;
import com.gic.commons.util.DingtalkMessageUtil;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
......@@ -84,6 +85,7 @@ public class HiveHelper implements ApplicationContextAware {
conn = downloadSource.getConnection();
return conn;
} catch (Exception ex) {
DingtalkMessageUtil.sendAlertMessage("获取连接告警:获取连接超时", "https://oapi.dingtalk.com/robot/send?access_token=157ad00c2b6491f2f0aac1d89121e4bd2d82d9d33cad0596b88dacfdc12fe455");
ex.printStackTrace();
if (conn != null) {
try {
......
......@@ -29,6 +29,7 @@ import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.datanucleus.store.rdbms.datasource.dbcp.SQLNestedException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
......@@ -536,6 +537,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
downloadService.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
Connection connection = null;
try{
if (taskConditions != null && taskConditions.size() > 0) {
FlatQueryTaskCondition condition = null;
......@@ -548,12 +550,20 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
break;
} // IF OVER
} // FOR OVER
Connection connection = HiveHelper.getDownloadHiveConnection();
connection = HiveHelper.getDownloadHiveConnection();
takeFile(condition, connection);
} // 没有任务则忽略
}catch (Exception e){
log.debug("自助指标下载异常", e.getMessage());
e.printStackTrace();
} finally {
if(connection != null){
try {
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
}, interval*1000, interval*1000, TimeUnit.MILLISECONDS);
......@@ -570,6 +580,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
this.balaDownloadService.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
Connection connection = null;
try{
if (taskConditions != null && taskConditions.size() > 0) {
FlatQueryTaskCondition condition = null;
......@@ -582,12 +593,20 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
break;
} // IF OVER
} // FOR OVER
Connection connection = HiveHelper.getBalaDownloadHiveConnection();
connection = HiveHelper.getBalaDownloadHiveConnection();
takeFile(condition, connection);
} // 没有任务则忽略
}catch (Exception e){
log.debug("自助指标下载异常", e.getMessage());
e.printStackTrace();
} finally {
if(connection != null){
try {
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
}, interval*1000, interval*1000, TimeUnit.MILLISECONDS);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment