Skip to content

Commit

Permalink
增加api功能
Browse files Browse the repository at this point in the history
  • Loading branch information
ghdefe committed Aug 26, 2020
1 parent b2d8c27 commit 2bb16e6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
17 changes: 10 additions & 7 deletions src/main/java/com/chunmiao/jsontotxt/JsonToTxtApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ public static void main(String[] args) throws IOException {
Iterator<String> stringIterator = node.fieldNames();
while (stringIterator.hasNext()) {
JsonNode tags = node.findValue((api = stringIterator.next())); //api
String name = tags.findValue("tags").get(0).asText(); //名称
Iterator<String> methods = tags.fieldNames();
while (methods.hasNext()) {
String method = methods.next(); //方法
Root root = new Root(name, method, api); //当前查询到的一个接口数据
Iterator<String> methodsname = tags.fieldNames();
while (methodsname.hasNext()) {
String method = methodsname.next(); //方法
JsonNode methods = tags.findValue(method);
String name = methods.findValue("tags").get(0).asText();
String description = methods.findValue("description").asText();

Root root = new Root(name, method, api,description); //当前查询到的一个接口数据
//放到hashmap里管理
if (hm.containsKey(root.getName())) {
List<Root> roots = hm.get(root.getName());
Expand Down Expand Up @@ -67,7 +70,7 @@ public static void main(String[] args) throws IOException {
}
Root next = iterator1.next();
bufferedWriter.write(next.getMethod() + "," +
next.getApi());
next.getApi() + "," + next.getDescription());
bufferedWriter.newLine();
}

Expand All @@ -85,7 +88,7 @@ public static void main(String[] args) throws IOException {
// + api);
// bufferedWriter.newLine();
// bufferedWriter.close();
Runtime.getRuntime().exec("cmd /c start F:/Project/json-to-txt/result.csv");
Runtime.getRuntime().exec("cmd /c start F:/Project/JsonSoup/result.csv");
System.out.println("done");


Expand Down
5 changes: 4 additions & 1 deletion src/main/java/com/chunmiao/jsontotxt/entity/Root.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@

@Data
public class Root {
public Root(String name, String method, String api) {
public Root(String name, String method, String api,String description) {
this.name = name;
this.method = method;
this.api = api;
this.description = description;
}

private String description;

private String name;

private String method;
Expand Down

0 comments on commit 2bb16e6

Please sign in to comment.