Commit 04eef27c964e1c416bfd8b20d59c3273b719be66
Exists in
master
1.fix conflict
Showing
4 changed files
with
69 additions
and
1 deletions
Show diff stats
build.gradle
| @@ -54,7 +54,7 @@ uploadArchives { | @@ -54,7 +54,7 @@ uploadArchives { | ||
| 54 | authentication(userName: NEXUS_USERNAME, password: NEXUS_PASSWORD) | 54 | authentication(userName: NEXUS_USERNAME, password: NEXUS_PASSWORD) |
| 55 | } | 55 | } |
| 56 | pom.project { | 56 | pom.project { |
| 57 | - version '1.1.5' | 57 | + version '1.1.10' |
| 58 | artifactId ARTIFACT_Id | 58 | artifactId ARTIFACT_Id |
| 59 | groupId GROUP_ID | 59 | groupId GROUP_ID |
| 60 | packaging TYPE | 60 | packaging TYPE |
src/main/java/com/taover/util/UtilExcel.java
| @@ -15,6 +15,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook; | @@ -15,6 +15,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook; | ||
| 15 | import org.apache.poi.hssf.util.HSSFColor; | 15 | import org.apache.poi.hssf.util.HSSFColor; |
| 16 | import org.apache.poi.ss.usermodel.Cell; | 16 | import org.apache.poi.ss.usermodel.Cell; |
| 17 | import org.apache.poi.ss.usermodel.CellStyle; | 17 | import org.apache.poi.ss.usermodel.CellStyle; |
| 18 | +import org.apache.poi.ss.usermodel.CellType; | ||
| 18 | import org.apache.poi.ss.usermodel.Row; | 19 | import org.apache.poi.ss.usermodel.Row; |
| 19 | import org.apache.poi.ss.usermodel.Sheet; | 20 | import org.apache.poi.ss.usermodel.Sheet; |
| 20 | import org.apache.poi.ss.usermodel.Workbook; | 21 | import org.apache.poi.ss.usermodel.Workbook; |
| @@ -295,6 +296,9 @@ public class UtilExcel { | @@ -295,6 +296,9 @@ public class UtilExcel { | ||
| 295 | dataRow.add(df.format(cell.getNumericCellValue())); | 296 | dataRow.add(df.format(cell.getNumericCellValue())); |
| 296 | }else if(cell.getCellType() == HSSFCell.CELL_TYPE_BOOLEAN){ | 297 | }else if(cell.getCellType() == HSSFCell.CELL_TYPE_BOOLEAN){ |
| 297 | dataRow.add(Boolean.valueOf(cell.getBooleanCellValue())); | 298 | dataRow.add(Boolean.valueOf(cell.getBooleanCellValue())); |
| 299 | + }else if(cell.getCellType() == HSSFCell.CELL_TYPE_FORMULA){ | ||
| 300 | + dataRow.add(""+cell.getCellFormula()); | ||
| 301 | + //dataRow.add(cell.getNumericCellValue()); | ||
| 298 | }else{ | 302 | }else{ |
| 299 | dataRow.add(cell.getStringCellValue()); | 303 | dataRow.add(cell.getStringCellValue()); |
| 300 | } | 304 | } |
src/main/java/com/taover/util/UtilHttpByOkHttp.java
| 1 | package com.taover.util; | 1 | package com.taover.util; |
| 2 | 2 | ||
| 3 | +import java.io.File; | ||
| 4 | +import java.io.IOException; | ||
| 3 | import java.io.UnsupportedEncodingException; | 5 | import java.io.UnsupportedEncodingException; |
| 4 | import java.net.URLEncoder; | 6 | import java.net.URLEncoder; |
| 5 | import java.nio.charset.Charset; | 7 | import java.nio.charset.Charset; |
| @@ -18,10 +20,14 @@ import javax.net.ssl.TrustManager; | @@ -18,10 +20,14 @@ import javax.net.ssl.TrustManager; | ||
| 18 | import javax.net.ssl.X509TrustManager; | 20 | import javax.net.ssl.X509TrustManager; |
| 19 | 21 | ||
| 20 | import okhttp3.FormBody; | 22 | import okhttp3.FormBody; |
| 23 | +import okhttp3.Headers; | ||
| 21 | import okhttp3.MediaType; | 24 | import okhttp3.MediaType; |
| 25 | +import okhttp3.MultipartBody; | ||
| 22 | import okhttp3.OkHttpClient; | 26 | import okhttp3.OkHttpClient; |
| 23 | import okhttp3.Request; | 27 | import okhttp3.Request; |
| 24 | import okhttp3.RequestBody; | 28 | import okhttp3.RequestBody; |
| 29 | +import okhttp3.Response; | ||
| 30 | +import okhttp3.ResponseBody; | ||
| 25 | 31 | ||
| 26 | public class UtilHttpByOkHttp { | 32 | public class UtilHttpByOkHttp { |
| 27 | public static final String METHOD_GET = "GET"; | 33 | public static final String METHOD_GET = "GET"; |
| @@ -146,6 +152,62 @@ public class UtilHttpByOkHttp { | @@ -146,6 +152,62 @@ public class UtilHttpByOkHttp { | ||
| 146 | return builder.build(); | 152 | return builder.build(); |
| 147 | } | 153 | } |
| 148 | 154 | ||
| 155 | + | ||
| 156 | + /** | ||
| 157 | + * | ||
| 158 | + * @param url 请求地址 | ||
| 159 | + * @param filePath 文件路径 | ||
| 160 | + * @param fileName 文件名 | ||
| 161 | + * @param fileKey 表单上传文件对应的key值 | ||
| 162 | + * @param header 请求头 | ||
| 163 | + * @return 只发post请求 | ||
| 164 | + * @throws Exception | ||
| 165 | + */ | ||
| 166 | + public static ResponseBody sendPostFile(String url, String filePath, String fileName,String fileKey,Map<String, String> header) throws Exception { | ||
| 167 | + OkHttpClient client = new OkHttpClient(); | ||
| 168 | + RequestBody requestBody = new MultipartBody.Builder() | ||
| 169 | + .setType(MultipartBody.FORM) | ||
| 170 | + .addFormDataPart(fileKey, fileName, | ||
| 171 | + RequestBody.create(MediaType.parse("multipart/form-data"), new File(filePath))) | ||
| 172 | + .build(); | ||
| 173 | + | ||
| 174 | + Request request = new Request.Builder() | ||
| 175 | + .headers(Headers.of(header)) | ||
| 176 | + .url(url) | ||
| 177 | + .post(requestBody) | ||
| 178 | + .build(); | ||
| 179 | + | ||
| 180 | + Response response = client.newCall(request).execute(); | ||
| 181 | + if (!response.isSuccessful()){ | ||
| 182 | + throw new IOException("Unexpected code " + response); | ||
| 183 | + } | ||
| 184 | + return response.body(); | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + | ||
| 188 | + | ||
| 189 | + public static ResponseBody sendPostFile(String url, File file,String fileKey,Map<String, String> header) throws Exception { | ||
| 190 | + OkHttpClient client = new OkHttpClient(); | ||
| 191 | + RequestBody requestBody = new MultipartBody.Builder() | ||
| 192 | + .setType(MultipartBody.FORM) | ||
| 193 | + .addFormDataPart(fileKey, file.getName(), | ||
| 194 | + RequestBody.create(MediaType.parse("multipart/form-data"), file)) | ||
| 195 | + .build(); | ||
| 196 | + | ||
| 197 | + Request request = new Request.Builder() | ||
| 198 | + .headers(Headers.of(header)) | ||
| 199 | + .url(url) | ||
| 200 | + .post(requestBody) | ||
| 201 | + .build(); | ||
| 202 | + | ||
| 203 | + Response response = client.newCall(request).execute(); | ||
| 204 | + if (!response.isSuccessful()){ | ||
| 205 | + throw new IOException("Unexpected code " + response); | ||
| 206 | + } | ||
| 207 | + return response.body(); | ||
| 208 | + } | ||
| 209 | + | ||
| 210 | + | ||
| 149 | static TrustManager[] trustAllCerts = new TrustManager[]{ | 211 | static TrustManager[] trustAllCerts = new TrustManager[]{ |
| 150 | new X509TrustManager() { | 212 | new X509TrustManager() { |
| 151 | public java.security.cert.X509Certificate[] getAcceptedIssuers() { | 213 | public java.security.cert.X509Certificate[] getAcceptedIssuers() { |
src/main/java/com/taover/util/UtilPinyin.java
| @@ -5,6 +5,8 @@ import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; | @@ -5,6 +5,8 @@ import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; | ||
| 5 | import net.sourceforge.pinyin4j.format.HanyuPinyinToneType; | 5 | import net.sourceforge.pinyin4j.format.HanyuPinyinToneType; |
| 6 | import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; | 6 | import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; |
| 7 | 7 | ||
| 8 | + | ||
| 9 | + | ||
| 8 | public class UtilPinyin { | 10 | public class UtilPinyin { |
| 9 | /** | 11 | /** |
| 10 | * 对单个字进行转换 | 12 | * 对单个字进行转换 |