多线程抽取的修改

This commit is contained in:
chenlw 2016-12-28 11:21:39 +08:00
parent e9d99467d3
commit 5b979bf7ec
4 changed files with 34 additions and 14 deletions

View File

@ -199,7 +199,11 @@ public class CheckoutServiceImpl implements ICheckoutService {
resultList.addAll(noDataList);
int listSize = resultList.size();
for (int i = 0; i < listSize; i++) {
resultList.get(i).setId(i);
CheckoutEntity obj = resultList.get(i);
if (null != obj && "y".equals(obj.getCollUpdate())) {
obj.setCollUpdate("");
}
obj.setId(i);
}
return resultList;
}

View File

@ -264,8 +264,6 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
if (Constant.CHECKOUT_STATUS_THREE.equals(tmpdata
.getPayResultLast())
|| Constant.CHECKOUT_STATUS_FIVE
.equals(tmpdata.getPayResultLast())
|| Constant.CHECKOUT_STATUS_SIX
.equals(tmpdata.getPayResultLast())) {
// 抽取中
data.setPayResultLast(Constant.CHECKOUT_STATUS_SIX);
@ -289,8 +287,6 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
if (Constant.CHECKOUT_STATUS_THREE.equals(tmpdata
.getExecResultLast())
|| Constant.CHECKOUT_STATUS_FIVE
.equals(tmpdata.getExecResultLast())
|| Constant.CHECKOUT_STATUS_SIX
.equals(tmpdata.getExecResultLast())) {
// 抽取中
data.setExecResultLast(Constant.CHECKOUT_STATUS_SIX);

View File

@ -50,6 +50,7 @@ public class VolumeServiceImpl implements IVolumeService {
List<VolumeDataEntity> result = gfsService.getAllVolumes();
List<VolumeDataEntity> addVolumes = new ArrayList<VolumeDataEntity>();
VolumeDataEntity volumeTmp = null;
VolumeDataEntity volumeTmpMysql = entity;
if (null != result) {
boolean isExits = false;
//.trim() 去掉空格
@ -58,20 +59,21 @@ public class VolumeServiceImpl implements IVolumeService {
isExits = true;
//TODO 服务器上有该volume
volumeTmp = volumeOnServer;
volumeTmpMysql = volumeOnServer;
break;
}
}
//如果服务器上没有该volume
//如果服务器上没有该volume则新增volume
if (!isExits) {
addVolumes.add(entity);
}
}
//记录volume信息
VolumeInitEntity volInSql = new VolumeInitEntity();
volInSql.setName(entity.getName());
volInSql.setPath(entity.getPath());
volInSql.setMark(entity.getHot());
volInSql.setName(volumeTmpMysql.getName());
volInSql.setPath(volumeTmpMysql.getPath());
volInSql.setMark(volumeTmpMysql.getHot());
if (volMap.keySet().contains(volInSql.getPath())) {
VolumeInitEntity tmp = volMap.get(volInSql.getPath());
volInSql.setId(tmp.getId());

View File

@ -11,6 +11,8 @@ import java.sql.Connection;
import java.util.Date;
import java.util.List;
import org.apache.log4j.Logger;
import com.base.CustomException;
import com.platform.dao.DataInfoDao;
import com.platform.entities.CheckoutEntity;
@ -31,6 +33,8 @@ import com.platform.utils.FileOperateHelper;
*/
public class ThreadExtractStandardSqlServer extends Thread{
public final static Logger log = Configs.CONSOLE_LOGGER.getLogger(ThreadExtractStandardSqlServer.class);
/**
* 抽取
*/
@ -73,9 +77,10 @@ public class ThreadExtractStandardSqlServer extends Thread{
+ DateForm
.date2StringBysecond(new Date())
+ "\r\n");
// 查询最新的 数据记录
this.getDataByCk(element);
//如果校验成功的 进行 抽取----支付标准表
if (Constant.CHECKOUT_STATUS_FIVE.equals(element.getPayResultLast())
|| Constant.CHECKOUT_STATUS_SIX.equals(element.getPayResultLast())) {
if (Constant.CHECKOUT_STATUS_FIVE.equals(element.getPayResultLast())) {
String payFilePath = FileOperateHelper.addLastSeparator(element.getPath())+Constant.standard_pay
+ element.getAreaCode().toLowerCase()+"_" + element.getSysCode()+".sql";
DataInfoEntity data = new DataInfoEntity();
@ -134,9 +139,10 @@ public class ThreadExtractStandardSqlServer extends Thread{
e.printStackTrace();
}
}
// 查询最新的 数据记录
this.getDataByCk(element);
//如果校验成功的 进行 抽取----执行标准表
if (Constant.CHECKOUT_STATUS_FIVE.equals(element.getExecResultLast())
|| Constant.CHECKOUT_STATUS_SIX.equals(element.getExecResultLast())){
if (Constant.CHECKOUT_STATUS_FIVE.equals(element.getExecResultLast())){
String execFilePath = FileOperateHelper.addLastSeparator(element.getPath())+Constant.standard_indicate
+ element.getAreaCode().toLowerCase() +"_" + element.getSysCode()+".sql";
DataInfoEntity data = new DataInfoEntity();
@ -238,4 +244,16 @@ public class ThreadExtractStandardSqlServer extends Thread{
}
}
private void getDataByCk(CheckoutEntity element) {
DataInfoEntity data = null;
try {
data = dataInfoDao.findById(element.getDataId());
if (data != null) {
element.setPayResultLast(data.getPayResultLast());
element.setExecResultLast(data.getExecResultLast());
}
} catch (Exception e) {
log.error(e);
}
}
}