抽取的修改

This commit is contained in:
chenlw 2016-12-13 10:00:22 +08:00
parent 536d81c915
commit 6762b1c185
1 changed files with 44 additions and 21 deletions

View File

@ -131,13 +131,6 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
dataInfoDao.updateExtract(data);
}
} catch (Exception e) {
// sql日志记录时间
FileOperateHelper.fileWrite(
Configs.EXTRACT_LOG_LOCALTION
+ collectOracle.getName() + ".log",
"\r\n 汇总结束 \r\n"
+ DateForm.date2StringBysecond(new Date())
+ "\r\n");
String cmd = "kubectl label --overwrite rc " + replicasName
+ " isExtract=0";
Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
@ -148,6 +141,27 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
dataInfoDao.updateExtract(data);
log.error(Custom4exception.OracleSQL_Except, e);
}
finally{
String msg = "汇总结束";
if (2 != data.getExtractStatus()) {
msg +=" 汇总有异常!状态重置为待汇总 ";
data.setExtractStatus(0);
dataInfoDao.updateExtract(data);
DataInfoEntity tmpdata = dataInfoDao.findById(data.getId());
data.setId(tmpdata.getSrcId());
dataInfoDao.updateExtract(data);
}
// sql日志记录时间
FileOperateHelper
.fileWrite(
Configs.EXTRACT_LOG_LOCALTION
+ collectOracle.getName()
+ ".log",
"\r\n "+msg+" >>>>>>> "
+ DateForm
.date2StringBysecond(new Date())
+ "\r\n\r\n\n");
}
}
isSuccess = true;
} catch (Exception e) {
@ -183,7 +197,6 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
List<OracleConnectorParams> dataInfolist,
GatherOracleInfo oracleConnect) throws Exception {
boolean isSuccess = false;
try {
// map转 bean(汇总库信息-带tableName的)
GatherOracleInfo oracleModel = oracleConnect;
// 采集库连接参数
@ -224,10 +237,10 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
Configs.EXTRACT_STANDARD_LOG_LOCALTION
+ collectOracle.getName()
+ ".log",
"\r\n 开始抽取标准表 \r\n"
"\r\n 开始抽取标准表 \r\n "
+ DateForm
.date2StringBysecond(new Date())
+ "\r\n");
+ "\n\r\n");
List<String> rList = Constant.ganymedSSH
.execCmdWaitAcquiescent(cmd);
StringBuffer sb = new StringBuffer();
@ -238,7 +251,7 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
// "isExtract", "1");
// //更新oracle汇总状态0标示为未汇总1标示汇总中2标示汇总完成
oracleExtract.createStandardDBLink(conn, collectOracle); // 创建dblink
oracleExtract.createTableSpace(conn, collectOracle,
oracleExtract.createStardardTableSpace(conn, collectOracle,
oracleModel); // 创建表空间
oracleExtract.createOnlyUser(conn, collectOracle,
oracleModel);// 创建 抽取标准表的 用户并授权
@ -314,13 +327,7 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
}
}
} catch (Exception e) {
// sql日志记录时间
FileOperateHelper.fileWrite(
Configs.EXTRACT_STANDARD_LOG_LOCALTION
+ collectOracle.getName() + ".log",
"\r\n 抽取标准表结束 \r\n"
+ DateForm.date2StringBysecond(new Date())
+ "\r\n");
String cmd = "kubectl annotate --overwrite rc "
+ replicasName + " standardExtractStatus=0";
Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
@ -331,11 +338,27 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
dataInfoDao.update(data);
log.error(Custom4exception.OracleSQL_Except, e);
}
finally{
String msg = "抽取标准表结束";
if (!"2".equals(data.getStandardExtractStatus())) {
msg +=" 抽取有异常!状态重置为待抽取 ";
data.setStandardExtractStatus("0");
dataInfoDao.update(data);
DataInfoEntity tmpdata = dataInfoDao.findById(data.getId());
data.setId(tmpdata.getSrcId());
dataInfoDao.update(data);
}
// sql日志记录时间
// sql日志记录时间
FileOperateHelper.fileWrite(
Configs.EXTRACT_STANDARD_LOG_LOCALTION
+ collectOracle.getName() + ".log",
" "+msg+" >>>>> "
+ DateForm.date2StringBysecond(new Date())
+ "\r\n\r\n\n");
}
}
isSuccess = true;
} catch (Exception e) {
log.error(Custom4exception.OracleSQL_Except, e);
}
return isSuccess;
}