fix:优化特殊图片的逻辑

上级 bd30c07b
......@@ -49,9 +49,7 @@ public class FileContainsUtil {
* 图片白名单
*/
private static final List<String> PIC_PATH_WHITELISTS = Arrays.asList(
"image-20231023195334369.png", "logo.png"
, "image-20230601124308164.png"
, "image-20230822102858692.png"
"image-20231107143410634.png"
);
public static void main(String[] args) throws Exception {
......@@ -82,7 +80,7 @@ public class FileContainsUtil {
* @param isNotExist
*/
private static void moreThread(List<List<String>> groupedPicNames, List<String> isNotExist) {
// 创建并启动4个线程来处理每个组的任务
// 创建并启动6个线程来处理每个组的任务
List<Thread> threads = new ArrayList<>();
for (int i = 0; i < 6; i++) {
final List<String> group = groupedPicNames.get(i);
......@@ -90,31 +88,26 @@ public class FileContainsUtil {
// 在这里执行处理图片组的任务
if (CollectionUtil.isNotEmpty(group)) {
for (String picName : group) {
// 处理图片文件 picName
//是白名单里面的图片,直接忽略
for (String picPathWhitelist : PIC_PATH_WHITELISTS) {
if (picPathWhitelist.contains(picName)) {
continue;
if (!PIC_PATH_WHITELISTS.contains(picName)) {
//默认不存在
IS_EXIST.set(false);
//包含某个字符串
try {
traverseFolder(BLOG_FOLDER1, picName);
traverseFolder(BLOG_FOLDER2, picName);
traverseFolder(BLOG_FOLDER3, picName);
} catch (Exception e) {
e.printStackTrace();
}
//文件不存在
if (!IS_EXIST.get()) {
isNotExist.add(picName);
deletePic(PIC_PATH + picName);
}
}
//默认不存在
IS_EXIST.set(false);
//包含某个字符串
try {
traverseFolder(BLOG_FOLDER1, picName);
traverseFolder(BLOG_FOLDER2, picName);
traverseFolder(BLOG_FOLDER3, picName);
} catch (Exception e) {
e.printStackTrace();
}
//文件不存在
if (!IS_EXIST.get()) {
isNotExist.add(picName);
deletePic(PIC_PATH + picName);
}
}
}
});
thread.start();
threads.add(thread);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册