diff --git a/src/main/java/com/power/doc/builder/TornaBuilder.java b/src/main/java/com/power/doc/builder/TornaBuilder.java index 463ba163..5d4906b0 100644 --- a/src/main/java/com/power/doc/builder/TornaBuilder.java +++ b/src/main/java/com/power/doc/builder/TornaBuilder.java @@ -23,6 +23,7 @@ package com.power.doc.builder; import com.google.gson.Gson; +import com.power.common.util.CollectionUtil; import com.power.common.util.OkHttp3Util; import com.power.common.util.StringUtil; import com.power.doc.constants.TornaConstants; @@ -108,14 +109,18 @@ public static void buildTorna(List apiDocs, ApiConfig apiConfig, JavaPro //推送字典信息 Map dicMap = new HashMap<>(2); List docDicts = TornaUtil.buildTornaDic(DocUtil.buildDictionary(apiConfig, builder)); - dicMap.put("enums", docDicts); - Map dicRequestJson = TornaConstants.buildParams(ENUM_PUSH, new Gson().toJson(dicMap), apiConfig); + if(CollectionUtil.isNotEmpty(docDicts)) { + dicMap.put("enums", docDicts); + Map dicRequestJson = TornaConstants.buildParams(ENUM_PUSH, new Gson().toJson(dicMap), apiConfig); + String dicResponseMsg = OkHttp3Util.syncPostJson(apiConfig.getOpenUrl(), new Gson().toJson(dicRequestJson)); + TornaUtil.printDebugInfo(apiConfig, dicResponseMsg, dicRequestJson, ENUM_PUSH); + } //获取返回结果 String responseMsg = OkHttp3Util.syncPostJson(apiConfig.getOpenUrl(), new Gson().toJson(requestJson)); - String dicResponseMsg = OkHttp3Util.syncPostJson(apiConfig.getOpenUrl(), new Gson().toJson(dicRequestJson)); + //开启调试时打印请求信息 TornaUtil.printDebugInfo(apiConfig, responseMsg, requestJson, PUSH); - TornaUtil.printDebugInfo(apiConfig, dicResponseMsg, dicRequestJson, ENUM_PUSH); + } } diff --git a/src/main/java/com/power/doc/builder/rpc/RpcTornaBuilder.java b/src/main/java/com/power/doc/builder/rpc/RpcTornaBuilder.java index b9a2f767..6bf0b045 100644 --- a/src/main/java/com/power/doc/builder/rpc/RpcTornaBuilder.java +++ b/src/main/java/com/power/doc/builder/rpc/RpcTornaBuilder.java @@ -23,6 +23,7 @@ package com.power.doc.builder.rpc; import com.google.gson.Gson; +import com.power.common.util.CollectionUtil; import com.power.common.util.OkHttp3Util; import com.power.common.util.StringUtil; import com.power.doc.builder.ProjectDocConfigBuilder; @@ -111,13 +112,17 @@ public static void buildTorna(List apiDocs, ApiConfig apiConfig,JavaP //推送字典信息 Map dicMap = new HashMap<>(2); List docDicts =TornaUtil.buildTornaDic(DocUtil.buildDictionary(apiConfig,builder)); - dicMap.put("enums",docDicts); + + if(CollectionUtil.isNotEmpty(docDicts)) { + dicMap.put("enums", docDicts); + Map dicRequestJson = TornaConstants.buildParams(ENUM_PUSH, new Gson().toJson(dicMap), apiConfig); + String dicResponseMsg = OkHttp3Util.syncPostJson(apiConfig.getOpenUrl(), new Gson().toJson(dicRequestJson)); + TornaUtil.printDebugInfo(apiConfig, dicResponseMsg, dicRequestJson, ENUM_PUSH); + } Map dicRequestJson = TornaConstants.buildParams(ENUM_PUSH, new Gson().toJson(dicMap), apiConfig); //获取返回结果 String responseMsg = OkHttp3Util.syncPostJson(apiConfig.getOpenUrl(), new Gson().toJson(requestJson)); - String dicResponseMsg = OkHttp3Util.syncPostJson(apiConfig.getOpenUrl(), new Gson().toJson(dicRequestJson)); //开启调试时打印请求信息 TornaUtil.printDebugInfo(apiConfig, responseMsg, requestJson,PUSH); - TornaUtil.printDebugInfo(apiConfig, dicResponseMsg, dicRequestJson,ENUM_PUSH); } }