当迁移到冷区时不记录srId
This commit is contained in:
parent
fa7f06433d
commit
f69551e872
|
@ -17,8 +17,10 @@ import org.springframework.stereotype.Component;
|
||||||
import com.base.TaskOperateData;
|
import com.base.TaskOperateData;
|
||||||
import com.platform.dao.DataInfoDao;
|
import com.platform.dao.DataInfoDao;
|
||||||
import com.platform.dao.DataInfoMoveTmpDao;
|
import com.platform.dao.DataInfoMoveTmpDao;
|
||||||
|
import com.platform.dao.VolumeDao;
|
||||||
import com.platform.entities.DataInfoEntity;
|
import com.platform.entities.DataInfoEntity;
|
||||||
import com.platform.entities.DataInfoEntityMoveTmp;
|
import com.platform.entities.DataInfoEntityMoveTmp;
|
||||||
|
import com.platform.entities.VolumeInitEntity;
|
||||||
import com.platform.glusterfs.CheckoutMD5;
|
import com.platform.glusterfs.CheckoutMD5;
|
||||||
import com.platform.http.gfs.CopyData;
|
import com.platform.http.gfs.CopyData;
|
||||||
import com.platform.glusterfs.ShowData;
|
import com.platform.glusterfs.ShowData;
|
||||||
|
@ -52,6 +54,9 @@ public class ThreadMoveData{
|
||||||
@Resource(name = "dataInfoMoveTmpDao")
|
@Resource(name = "dataInfoMoveTmpDao")
|
||||||
private DataInfoMoveTmpDao dataInfoMoveTmpDao;
|
private DataInfoMoveTmpDao dataInfoMoveTmpDao;
|
||||||
|
|
||||||
|
@Resource(name = "volumeDao")
|
||||||
|
private VolumeDao volumeDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看数据
|
* 查看数据
|
||||||
*/
|
*/
|
||||||
|
@ -67,7 +72,15 @@ public class ThreadMoveData{
|
||||||
@Scheduled(fixedDelay = 4000)
|
@Scheduled(fixedDelay = 4000)
|
||||||
public void moveDataByWebGfs(){
|
public void moveDataByWebGfs(){
|
||||||
List<DataInfoEntityMoveTmp> result = new ArrayList<DataInfoEntityMoveTmp>();
|
List<DataInfoEntityMoveTmp> result = new ArrayList<DataInfoEntityMoveTmp>();
|
||||||
|
Map<String, String> volumeMap = new HashMap<String, String>();
|
||||||
|
try {
|
||||||
|
List<VolumeInitEntity> volumeList = volumeDao.findAll();
|
||||||
|
for (VolumeInitEntity volumeInitEntity : volumeList) {
|
||||||
|
volumeMap.put(volumeInitEntity.getPath(), volumeInitEntity.getMark());
|
||||||
|
}
|
||||||
|
} catch (Exception e1) {
|
||||||
|
log.error(e1);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
result = dataInfoMoveTmpDao.findAll();
|
result = dataInfoMoveTmpDao.findAll();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -77,7 +90,7 @@ public class ThreadMoveData{
|
||||||
List<DataInfoEntityMoveTmp> insertData = this.doMoveService(result);
|
List<DataInfoEntityMoveTmp> insertData = this.doMoveService(result);
|
||||||
if (insertData.size() > 0) {
|
if (insertData.size() > 0) {
|
||||||
for (DataInfoEntityMoveTmp dataInfoEntityMoveTmp : insertData) {
|
for (DataInfoEntityMoveTmp dataInfoEntityMoveTmp : insertData) {
|
||||||
this.makeDataInfo(dataInfoEntityMoveTmp);
|
this.makeDataInfo(dataInfoEntityMoveTmp, volumeMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -374,7 +387,7 @@ public class ThreadMoveData{
|
||||||
return data4Insert;
|
return data4Insert;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int makeDataInfo(DataInfoEntityMoveTmp dataMove){
|
private int makeDataInfo(DataInfoEntityMoveTmp dataMove, Map<String, String> volumeMap){
|
||||||
try{
|
try{
|
||||||
// 判断 迁移数据的status是否改为 2
|
// 判断 迁移数据的status是否改为 2
|
||||||
DataInfoEntityMoveTmp movetmp = dataInfoMoveTmpDao.findById(dataMove.getId());
|
DataInfoEntityMoveTmp movetmp = dataInfoMoveTmpDao.findById(dataMove.getId());
|
||||||
|
@ -398,15 +411,19 @@ public class ThreadMoveData{
|
||||||
data.setVolumePath(dataMove.getDstPath());
|
data.setVolumePath(dataMove.getDstPath());
|
||||||
}else {
|
}else {
|
||||||
data.setVolumePath(dataMove.getDstVolumePath());
|
data.setVolumePath(dataMove.getDstVolumePath());
|
||||||
|
String mark = volumeMap.get(dataMove.getDstVolumePath());
|
||||||
|
// hot :0
|
||||||
|
if("0".equals(mark)){
|
||||||
|
if (movetmp.getFkid() > 0) {
|
||||||
|
data.setSrcId(movetmp.getFkid());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
data.setSrcId(dataMove.getFkid());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
data.setPayResult(dataMove.getPayResult());
|
data.setPayResult(dataMove.getPayResult());
|
||||||
data.setExecResult(dataMove.getExecResult());
|
data.setExecResult(dataMove.getExecResult());
|
||||||
if (movetmp.getFkid() > 0) {
|
|
||||||
data.setSrcId(movetmp.getFkid());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
data.setSrcId(dataMove.getFkid());
|
|
||||||
}
|
|
||||||
data.setId(0);
|
data.setId(0);
|
||||||
try {
|
try {
|
||||||
if (dataInfoDao.countByDataPath(data) == 0) {
|
if (dataInfoDao.countByDataPath(data) == 0) {
|
||||||
|
|
Loading…
Reference in New Issue