Commit 5cbf24ceeedeec589f76860a57a4761016e7c945
1 parent
04eef27c
Exists in
master
.
Showing
3 changed files
with
23 additions
and
2 deletions
Show diff stats
build.gradle
src/main/java/com/taover/util/UtilExcel.java
... | ... | @@ -299,6 +299,8 @@ public class UtilExcel { |
299 | 299 | }else if(cell.getCellType() == HSSFCell.CELL_TYPE_FORMULA){ |
300 | 300 | dataRow.add(""+cell.getCellFormula()); |
301 | 301 | //dataRow.add(cell.getNumericCellValue()); |
302 | + }else if(cell.getCellType() == HSSFCell.CELL_TYPE_ERROR){ | |
303 | + dataRow.add(""+cell.getErrorCellValue()); | |
302 | 304 | }else{ |
303 | 305 | dataRow.add(cell.getStringCellValue()); |
304 | 306 | } | ... | ... |
src/main/java/com/taover/util/UtilHttpByOkHttp.java
... | ... | @@ -95,7 +95,7 @@ public class UtilHttpByOkHttp { |
95 | 95 | return getHttpClient(url).newCall(request).execute().body().bytes(); |
96 | 96 | } |
97 | 97 | |
98 | - private static OkHttpClient getHttpClient(String url){ | |
98 | + public static OkHttpClient getHttpClient(String url){ | |
99 | 99 | if(url.trim().toLowerCase().startsWith("https")){ |
100 | 100 | return buildOkHttpClientForHttps(); |
101 | 101 | }else{ |
... | ... | @@ -103,6 +103,25 @@ public class UtilHttpByOkHttp { |
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | + /** | |
107 | + * 并发请求复用连接池,避免内存溢出 | |
108 | + * @param okHttpClient | |
109 | + * @param url | |
110 | + * @param headers | |
111 | + * @param jsonStr | |
112 | + * @return | |
113 | + * @throws Exception | |
114 | + */ | |
115 | + public static String sendPostJson(OkHttpClient okHttpClient,String url, final Map<String, String> headers, String jsonStr) throws Exception{ | |
116 | + //请求体 | |
117 | + RequestBody requestBody = getReqeustBodyJson(jsonStr); | |
118 | + | |
119 | + //http头信息拼装 | |
120 | + Request request = getRequestBuilder(url, headers).post(requestBody).build(); | |
121 | + | |
122 | + return okHttpClient.newCall(request).execute().body().string(); | |
123 | + } | |
124 | + | |
106 | 125 | private static RequestBody getReqeustBody(Map<String, Object> params){ |
107 | 126 | //表单信息拼装 |
108 | 127 | FormBody.Builder builder = new FormBody.Builder(Charset.forName("UTF-8")); | ... | ... |