热区汇总抽取
This commit is contained in:
parent
2bd489878d
commit
8ebf310700
|
@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
|
|||
import com.base.Custom4exception;
|
||||
import com.base.CustomException;
|
||||
import com.platform.dao.DataInfoDao;
|
||||
import com.platform.dao.IHotDataInfoDao;
|
||||
import com.platform.entities.DataInfoEntity;
|
||||
import com.platform.entities.GatherOracleInfo;
|
||||
import com.platform.entities.OracleConnectorParams;
|
||||
|
@ -33,8 +34,8 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|||
public final static Logger log = Logger
|
||||
.getLogger(OracleExtractServiceImpl.class);
|
||||
|
||||
@Resource(name = "dataInfoDao")
|
||||
private DataInfoDao dataInfoDao;
|
||||
@Resource(name = "hotDataInfoDao")
|
||||
private IHotDataInfoDao hotDataInfoDao;
|
||||
|
||||
/**
|
||||
* kubernetes client
|
||||
|
@ -77,13 +78,13 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|||
}
|
||||
for (OracleConnectorParams collectOracle : datainfos) {
|
||||
String replicasName = collectOracle.getName();
|
||||
DataInfoEntity data = new DataInfoEntity();
|
||||
try {
|
||||
if (null != collectOracle.getDataId()
|
||||
&& !"".equals(collectOracle.getDataId())) {
|
||||
DataInfoEntity data = new DataInfoEntity();
|
||||
data.setId(Integer.valueOf(collectOracle.getDataId()));
|
||||
data.setExtractStatus(1);
|
||||
dataInfoDao.updateExtract(data);
|
||||
hotDataInfoDao.updateExtract(data);
|
||||
collectOracle.setName("J"
|
||||
+ collectOracle.getName().replace("-", "_"));
|
||||
String cmd = "kubectl label --overwrite rc "
|
||||
|
@ -125,11 +126,9 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|||
sb.append(string).append("\n");
|
||||
Configs.CONSOLE_LOGGER.info(sb.toString());
|
||||
data.setExtractStatus(2);
|
||||
dataInfoDao.updateExtract(data);
|
||||
hotDataInfoDao.updateExtract(data);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(Custom4exception.OracleSQL_Except, e);
|
||||
} finally {
|
||||
// sql日志记录时间:
|
||||
FileOperateHelper.fileWrite(
|
||||
Configs.EXTRACT_LOG_LOCALTION
|
||||
|
@ -138,8 +137,11 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|||
+ DateForm.date2StringBysecond(new Date())
|
||||
+ "\r\n");
|
||||
String cmd = "kubectl label --overwrite rc " + replicasName
|
||||
+ " isExtract=2";
|
||||
+ " isExtract=0";
|
||||
Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
|
||||
data.setExtractStatus(0);
|
||||
hotDataInfoDao.updateExtract(data);
|
||||
log.error(Custom4exception.OracleSQL_Except, e);
|
||||
}
|
||||
}
|
||||
isSuccess = true;
|
||||
|
@ -198,15 +200,15 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|||
}
|
||||
for (OracleConnectorParams collectOracle : datainfos) {
|
||||
String replicasName = collectOracle.getName();
|
||||
DataInfoEntity data = new DataInfoEntity();
|
||||
try {
|
||||
if (null != collectOracle.getDataId()
|
||||
&& !"".equals(collectOracle.getDataId())) {
|
||||
DataInfoEntity data = new DataInfoEntity();
|
||||
data.setId(Integer.valueOf(collectOracle.getDataId()));
|
||||
// 设置为 标准表 抽取中
|
||||
data.setCheckoutFlag(Constant.CHECKOUTFLAG_SIX);
|
||||
data.setStandardExtractStatus("1");
|
||||
dataInfoDao.update(data);
|
||||
hotDataInfoDao.update(data);
|
||||
collectOracle.setName("CQ"
|
||||
+ collectOracle.getName().replace("-", "_"));
|
||||
String cmd = "kubectl annotate --overwrite rc "
|
||||
|
@ -235,7 +237,7 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|||
oracleModel); // 创建表空间
|
||||
oracleExtract.createOnlyUser(conn, collectOracle,
|
||||
oracleModel);// 创建 抽取标准表的 用户并授权
|
||||
DataInfoEntity tmpdata = dataInfoDao.findById(data
|
||||
DataInfoEntity tmpdata = hotDataInfoDao.findById(data
|
||||
.getId());
|
||||
if (null != tmpdata) {
|
||||
if (Constant.CHECKOUT_STATUS_THREE.equals(tmpdata
|
||||
|
@ -246,7 +248,7 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|||
.equals(tmpdata.getPayResultLast())) {
|
||||
// 抽取中
|
||||
data.setPayResultLast(Constant.CHECKOUT_STATUS_SIX);
|
||||
dataInfoDao.update(data);
|
||||
hotDataInfoDao.update(data);
|
||||
boolean isExtrac = true;
|
||||
try {
|
||||
oracleExtract.extractStandardPayTable(conn,
|
||||
|
@ -254,13 +256,13 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|||
} catch (Exception e) {
|
||||
// 改回 校验存在的状态
|
||||
data.setPayResultLast(Constant.CHECKOUT_STATUS_THREE);
|
||||
dataInfoDao.update(data);
|
||||
hotDataInfoDao.update(data);
|
||||
isExtrac = false;
|
||||
}
|
||||
if (isExtrac) {
|
||||
// 抽取成功
|
||||
data.setPayResultLast(Constant.CHECKOUT_STATUS_SEVEN);
|
||||
dataInfoDao.update(data);
|
||||
hotDataInfoDao.update(data);
|
||||
}
|
||||
}
|
||||
if (Constant.CHECKOUT_STATUS_THREE.equals(tmpdata
|
||||
|
@ -271,7 +273,7 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|||
.equals(tmpdata.getExecResultLast())) {
|
||||
// 抽取中
|
||||
data.setExecResultLast(Constant.CHECKOUT_STATUS_SIX);
|
||||
dataInfoDao.update(data);
|
||||
hotDataInfoDao.update(data);
|
||||
boolean isExtrac = true;
|
||||
try {
|
||||
oracleExtract.extractStandardExecTable(
|
||||
|
@ -279,12 +281,12 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|||
} catch (Exception e) {
|
||||
// 改回 校验存在的状态
|
||||
data.setExecResultLast(Constant.CHECKOUT_STATUS_THREE);
|
||||
dataInfoDao.update(data);
|
||||
hotDataInfoDao.update(data);
|
||||
isExtrac = false;
|
||||
}
|
||||
if (isExtrac) {
|
||||
data.setExecResultLast(Constant.CHECKOUT_STATUS_SEVEN);
|
||||
dataInfoDao.update(data);
|
||||
hotDataInfoDao.update(data);
|
||||
}
|
||||
}
|
||||
// client.updateOrAddReplicasLabelById(collectOracle.getName(),
|
||||
|
@ -300,12 +302,10 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|||
Configs.CONSOLE_LOGGER.info(sb.toString());
|
||||
data.setCheckoutFlag(Constant.CHECKOUTFLAG_SEVEN);
|
||||
data.setStandardExtractStatus("2");
|
||||
dataInfoDao.update(data);
|
||||
hotDataInfoDao.update(data);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(Custom4exception.OracleSQL_Except, e);
|
||||
} finally {
|
||||
// sql日志记录时间:
|
||||
FileOperateHelper.fileWrite(
|
||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION
|
||||
|
@ -314,8 +314,11 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|||
+ DateForm.date2StringBysecond(new Date())
|
||||
+ "\r\n");
|
||||
String cmd = "kubectl annotate --overwrite rc "
|
||||
+ replicasName + " standardExtractStatus=2";
|
||||
+ replicasName + " standardExtractStatus=0";
|
||||
Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
|
||||
data.setStandardExtractStatus("0");
|
||||
hotDataInfoDao.update(data);
|
||||
log.error(Custom4exception.OracleSQL_Except, e);
|
||||
}
|
||||
}
|
||||
isSuccess = true;
|
||||
|
@ -333,7 +336,7 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|||
data.setCheckoutFlag(Constant.CHECKOUTFLAG_SIX);
|
||||
data.setExtractStatus(status);
|
||||
try {
|
||||
dataInfoDao.update(data);
|
||||
hotDataInfoDao.update(data);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
|
|
Loading…
Reference in New Issue