Commit 373a5a99 by jinfeng.wang

support idIosPkg、iosPkg

parent 088951b8
...@@ -9,9 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -9,9 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.*; import java.io.*;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
...@@ -51,7 +49,7 @@ public class TreeTagServiceImpl implements TreeTagService { ...@@ -51,7 +49,7 @@ public class TreeTagServiceImpl implements TreeTagService {
InputStreamReader read = new InputStreamReader(new FileInputStream(file), encoding); InputStreamReader read = new InputStreamReader(new FileInputStream(file), encoding);
BufferedReader bufferedReader = new BufferedReader(read); BufferedReader bufferedReader = new BufferedReader(read);
String lineTxt; String lineTxt;
List<TreeTag> list = new ArrayList<>(); Set<TreeTag> set = new HashSet<>();
while ((lineTxt = bufferedReader.readLine()) != null) { while ((lineTxt = bufferedReader.readLine()) != null) {
TreeTag treeTag = new TreeTag(); TreeTag treeTag = new TreeTag();
...@@ -85,19 +83,19 @@ public class TreeTagServiceImpl implements TreeTagService { ...@@ -85,19 +83,19 @@ public class TreeTagServiceImpl implements TreeTagService {
treeTag.setThirdTag(""); treeTag.setThirdTag("");
} }
treeTag.setUpdateTime(new Date()); treeTag.setUpdateTime(new Date());
list.add(treeTag); set.add(treeTag);
if (idIosPkgPtn.matcher(packageName).matches()) { if (idIosPkgPtn.matcher(packageName).matches()) {
treeTag.setPackageName(packageName.replace("id", "")); treeTag.setPackageName(packageName.replace("id", ""));
list.add(treeTag); set.add(treeTag);
} }
if (iosPkgPtn.matcher(packageName).matches()) { if (iosPkgPtn.matcher(packageName).matches()) {
treeTag.setPackageName("id" + packageName); treeTag.setPackageName("id" + packageName);
list.add(treeTag); set.add(treeTag);
} }
} }
bufferedReader.close(); bufferedReader.close();
read.close(); read.close();
if (batchInsert(list)) { if (batchInsert(new ArrayList<>(set))) {
return true; return true;
} }
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment