|
|
|
@ -3,9 +3,12 @@ package com.platform.service;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
import org.apache.log4j.Logger;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
|
|
|
|
|
|
@ -13,13 +16,21 @@ import com.base.CustomException;
|
|
|
|
|
import com.platform.dao.DataInfoDao;
|
|
|
|
|
import com.platform.entities.DataInfoEntity;
|
|
|
|
|
import com.platform.entities.PagerOptions;
|
|
|
|
|
import com.platform.glusterfs.RemoveData;
|
|
|
|
|
import com.platform.utils.Bean2MapUtils;
|
|
|
|
|
import com.platform.utils.Configs;
|
|
|
|
|
|
|
|
|
|
@Service(value = "dataInfoService")
|
|
|
|
|
public class DataInfoServiceImp implements DataInfoService {
|
|
|
|
|
|
|
|
|
|
/** log4j */
|
|
|
|
|
public static Logger log = Configs.DAILY_ROLLING_LOGGER;
|
|
|
|
|
|
|
|
|
|
@Resource(name = "dataInfoDao")
|
|
|
|
|
private DataInfoDao dfdDao;
|
|
|
|
|
|
|
|
|
|
private RemoveData removedata = new RemoveData();
|
|
|
|
|
|
|
|
|
|
public void setDfdDao(DataInfoDao dfdDao) {
|
|
|
|
|
this.dfdDao = dfdDao;
|
|
|
|
|
}
|
|
|
|
@ -70,9 +81,24 @@ public class DataInfoServiceImp implements DataInfoService {
|
|
|
|
|
//数据在不在?
|
|
|
|
|
List<String> paths = dfdDao.getIdIsExist(ids);
|
|
|
|
|
if(paths.size()>0){
|
|
|
|
|
//删除文件操作
|
|
|
|
|
//TODO 删除文件操作
|
|
|
|
|
Pattern pattern = Pattern
|
|
|
|
|
.compile("\\/$");
|
|
|
|
|
for (int i = 0; i < paths.size(); i++) {
|
|
|
|
|
System.out.println(paths.get(i));
|
|
|
|
|
String folderPath = paths.get(i);
|
|
|
|
|
Matcher matcher = pattern.matcher(folderPath);
|
|
|
|
|
String tailPath = "";
|
|
|
|
|
if (matcher.find()) {
|
|
|
|
|
tailPath = matcher.group();
|
|
|
|
|
}
|
|
|
|
|
folderPath = folderPath.substring(0, folderPath.length()-tailPath.length());
|
|
|
|
|
int res = removedata.deleteFolder(folderPath);
|
|
|
|
|
if (res != 1) {
|
|
|
|
|
log.error( folderPath+ " 删除失败!\n");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
log.info( folderPath+ " 删除成功!\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//删除数据库记录
|
|
|
|
|
dfdDao.removes(ids);
|
|
|
|
|