Commit cc5052ed by 陶光胜

Merge branch 'developer' into 'master'

Developer

See merge request !37
parents c76034d3 4debf60f
......@@ -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 {
......@@ -92,7 +94,7 @@ public class HiveHelper implements ApplicationContextAware {
e.printStackTrace();
}
}
return null;
throw new RuntimeException("获取连接异常");
} // TRY CATCH OVER
}
......@@ -107,6 +109,7 @@ public class HiveHelper implements ApplicationContextAware {
conn = balaDownloadSource.getConnection();
return conn;
} catch (Exception ex) {
DingtalkMessageUtil.sendAlertMessage("获取bala下载连接告警:获取连接超时", "https://oapi.dingtalk.com/robot/send?access_token=157ad00c2b6491f2f0aac1d89121e4bd2d82d9d33cad0596b88dacfdc12fe455");
ex.printStackTrace();
if (conn != null) {
try {
......@@ -115,7 +118,7 @@ public class HiveHelper implements ApplicationContextAware {
e.printStackTrace();
}
}
return null;
throw new RuntimeException("获取连接异常");
} // TRY CATCH OVER
}
......
......@@ -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;
......@@ -544,16 +546,30 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
log.debug("自助指标当前正在执行的任务为:", JSON.toJSONString(taskConditions.get(i)));
if (taskConditions.get(i).getBuildPermitted().equals(Global.YES)
&& !taskConditions.get(i).getEnterpriseIds().contains("ff8080816dd0385e016ddca436d01fe1")) {
condition = taskConditions.remove(i); // 移除并获取第一个任务条件
break;
try{
connection = HiveHelper.getDownloadHiveConnection();
condition = taskConditions.remove(i); // 移除并获取第一个任务条件
break;
}catch (Exception e){
log.debug("获取连接异常:", e.getMessage());
e.printStackTrace();
continue;
}
} // IF OVER
} // FOR OVER
Connection 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 +586,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;
......@@ -578,16 +595,32 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
log.debug("自助指标当前正在执行的任务为:", JSON.toJSONString(taskConditions.get(i)));
if (taskConditions.get(i).getBuildPermitted().equals(Global.YES)
&& taskConditions.get(i).getEnterpriseIds().contains("ff8080816dd0385e016ddca436d01fe1")) {
condition = taskConditions.remove(i); // 移除并获取第一个任务条件
break;
try{
connection = HiveHelper.getBalaDownloadHiveConnection();
condition = taskConditions.remove(i); // 移除并获取第一个任务条件
break;
}catch (Exception e){
log.debug("获取连接异常:", e.getMessage());
e.printStackTrace();
continue;
}
} // IF OVER
} // FOR OVER
Connection 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);
......@@ -612,6 +645,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
condition.getAuthStoreIdList());
log.debug("runDownloadTask.run", "获取商户连接:" + task.getId());
log.debug("sql-", task.getId() + "-" + fullQuery);
if (conn != null) {
try {
Statement stat = conn.createStatement();
......@@ -752,7 +786,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
if (!task.getApplyId().equals("")) {
// String applyStatusText = HttpUtils.doGet("http://www.gicdev.com/api-admin/apply-info?type=2&applyId=" + task.getApplyId());
String applyStatusText = HttpUtils.doGet(url + task.getApplyId());
log.debug("runApplyTask.run", "查询自助指标查询 " + task.getId() + " 审核状态码" + applyStatusText);
//log.debug("runApplyTask.run", "查询自助指标查询 " + task.getId() + " 审核状态码" + applyStatusText);
if(StringUtils.isBlank(applyStatusText)){
break;
}
......
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