...
|
...
|
@@ -35,7 +35,11 @@ public class ShowSer { |
|
|
|
|
|
public ConcurrentHashMap<String, List<Integer>> sknDirsListMap = new ConcurrentHashMap<String, List<Integer>>();
|
|
|
|
|
|
public ConcurrentHashMap<String, Integer> samplesMap = new ConcurrentHashMap<String, Integer>();
|
|
|
public ConcurrentHashMap<String, Integer> samplesMap = new ConcurrentHashMap<>();
|
|
|
|
|
|
/*public Set<String> updateSet =Collections.synchronizedSet(new HashSet<>());*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public PhotoViewObj fetchCurentPhotos(String currentDir, int skip) {
|
...
|
...
|
@@ -196,11 +200,20 @@ public class ShowSer { |
|
|
List<String> pList = readFileByIndex(pInfo,startIndex,endIndex);
|
|
|
List<String> nList = readFileByIndex(nInfo,startIndex,endIndex);
|
|
|
String readUrl = "/show/readAli?file=";
|
|
|
String updateFilePath = sampleDir+"/update.info";
|
|
|
Set<Integer> updateSet = getUpdateFileInfo(updateFilePath);
|
|
|
for(int i = 0 ; i< qList.size(); i++){
|
|
|
int itemIndex = startIndex + i;//所在的行 以0为起始
|
|
|
boolean flag = false;
|
|
|
if(updateSet.contains(itemIndex)){
|
|
|
flag = true;
|
|
|
}
|
|
|
SampleViewObj sampleViewObj = new SampleViewObj(
|
|
|
readUrl+ URLEncoder.encode(qList.get(i)),
|
|
|
readUrl+ URLEncoder.encode(pList.get(i)),
|
|
|
readUrl+ URLEncoder.encode(nList.get(i)));
|
|
|
readUrl+ URLEncoder.encode(nList.get(i)),
|
|
|
itemIndex,
|
|
|
flag);
|
|
|
pageList.add(sampleViewObj);
|
|
|
}
|
|
|
} catch (IOException e) {
|
...
|
...
|
@@ -211,6 +224,28 @@ public class ShowSer { |
|
|
LineIterator.closeQuietly(nInfo);
|
|
|
}
|
|
|
return pageList;
|
|
|
|
|
|
}
|
|
|
|
|
|
//读取updateFile文件
|
|
|
private Set<Integer> getUpdateFileInfo(String updateFilePath) {
|
|
|
Set<Integer> set = new HashSet<>();
|
|
|
LineIterator lineIterator = null;
|
|
|
try {
|
|
|
lineIterator = FileUtils.lineIterator(new File(updateFilePath));
|
|
|
while (lineIterator.hasNext()){
|
|
|
String s = lineIterator.next();
|
|
|
if(StringUtils.isEmpty(s))continue;
|
|
|
int value = Integer.valueOf(s);
|
|
|
set.add(value);
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}finally {
|
|
|
LineIterator.closeQuietly(lineIterator);
|
|
|
}
|
|
|
|
|
|
return set;
|
|
|
}
|
|
|
|
|
|
//读取文件
|
...
|
...
|
@@ -252,10 +287,39 @@ public class ShowSer { |
|
|
return count;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* public static void main(String[] args) {
|
|
|
ShowSer s = new ShowSer();
|
|
|
s.fetchSamplesByPage("E:\\0419", 94, 2);
|
|
|
}*/
|
|
|
/**
|
|
|
* 更新 update.info 文件
|
|
|
*
|
|
|
* @param file
|
|
|
* @param content
|
|
|
* @param flag --true ,当前行号写入文件 false --当前行 移出文件
|
|
|
*/
|
|
|
|
|
|
public boolean modifyFile(File file, int content, boolean flag) {
|
|
|
if(flag){
|
|
|
try {//追加写入文件
|
|
|
FileUtils.writeLines(file,"utf-8",Arrays.asList(content), true);
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
return false;
|
|
|
}
|
|
|
}/*else {//从文件中移出
|
|
|
LineIterator lineIterator = null;
|
|
|
try {
|
|
|
lineIterator = FileUtils.lineIterator(file);
|
|
|
while (lineIterator.hasNext()) {
|
|
|
int s = Integer.valueOf(lineIterator.next());
|
|
|
if (s == content) {
|
|
|
lineIterator.remove();
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
return false;
|
|
|
}
|
|
|
}*/
|
|
|
return true;
|
|
|
}
|
|
|
} |
...
|
...
|
|