From 3d0c7bd3222693ededcfa8e3fe3ef4042e3f33f5 Mon Sep 17 00:00:00 2001 From: shiyang Date: Mon, 6 Sep 2021 18:21:36 +0800 Subject: [PATCH] update --- .../java/com/lyms/platform/operate/web/Test.java | 99 +++++++++++++++++----- 1 file changed, 76 insertions(+), 23 deletions(-) diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java index 4b154c4..5370868 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java @@ -1,23 +1,76 @@ -package com.lyms.platform.operate.web; - -import com.alibaba.fastjson.JSON; -import com.lyms.platform.common.enums.BabySourceEnums; -import com.lyms.platform.common.enums.QhdBabyPsychologyEnums; - -/** - * Created by Administrator on 2016/8/22 0022. - */ -public class Test { - - final static long TIME = 1000 * 90; - - public static void main(String[] args) throws Exception { - - } - - - - -} - - +//package com.lyms.platform.operate.web; +// +//import org.apache.http.HttpEntity; +//import org.apache.http.client.ClientProtocolException; +//import org.apache.http.client.config.RequestConfig; +//import org.apache.http.client.methods.CloseableHttpResponse; +//import org.apache.http.client.methods.HttpPost; +//import org.apache.http.entity.ContentType; +//import org.apache.http.entity.mime.MultipartEntityBuilder; +//import org.apache.http.entity.mime.content.FileBody; +//import org.apache.http.entity.mime.content.StringBody; +//import org.apache.http.impl.client.CloseableHttpClient; +//import org.apache.http.impl.client.HttpClients; +//import org.apache.http.util.EntityUtils; +// +//import java.io.File; +//import java.io.IOException; +// +///** +// * Created by Administrator on 2016/8/22 0022. +// */ +//public class Test { +// +// final static long TIME = 1000 * 90; +// +// public static void main(String[] args) throws Exception { +// +// File dir = new File("F:\\aa"); +// File[] files = dir.listFiles(); +// for (File file : files) +// { +// upload("https://cert-qhd-api.healthbaby.com.cn:18020/cp/common/importSignature", file, file.getName()); +// Thread.sleep(TIME); +// } +// } +// +// +// public static void upload(String url,File file,String filename) { +// CloseableHttpClient httpclient = HttpClients.createDefault(); +// try { +// HttpPost httppost = new HttpPost(url); +// RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(2000000).setSocketTimeout(2000000).build(); +// httppost.setConfig(requestConfig); +// FileBody bin = new FileBody(file); +// StringBody comment = new StringBody(filename, ContentType.TEXT_PLAIN); +// HttpEntity reqEntity = MultipartEntityBuilder.create().addPart("file", bin).addPart("filename", comment).build(); +// httppost.setEntity(reqEntity); +// httppost.setHeader("Authorization","18674e5b23b200f86a6210ea2f1006a8"); +// CloseableHttpResponse response = httpclient.execute(httppost); +// try { +// System.out.println(response.getStatusLine()); +// HttpEntity resEntity = response.getEntity(); +// if (resEntity != null) { +// String responseEntityStr = EntityUtils.toString(response.getEntity()); +// System.out.println(file.getName()+"===="+responseEntityStr); +// } +// EntityUtils.consume(resEntity); +// } finally { +// response.close(); +// } +// } catch (ClientProtocolException e) { +// e.printStackTrace(); +// } catch (IOException e) { +// e.printStackTrace(); +// } finally { +// try { +// httpclient.close(); +// } catch (IOException e) { +// e.printStackTrace(); +// } +// } +// } +// +//} +// +// \ No newline at end of file -- 1.8.3.1