|
@@ -19,6 +19,7 @@ import jcifs.smb.NtlmPasswordAuthentication;
|
|
|
import jcifs.smb.SmbFile;
|
|
|
import jcifs.smb.SmbFileInputStream;
|
|
|
import okhttp3.FormBody;
|
|
|
+import okhttp3.MediaType;
|
|
|
import okhttp3.OkHttpClient;
|
|
|
import okhttp3.Request;
|
|
|
import okhttp3.RequestBody;
|
|
@@ -31,6 +32,7 @@ public class DataService {
|
|
|
private static String SAVE_REPORT_URL = "https://risserver3.pacsonline.cn/butt/saveReport";
|
|
|
|
|
|
private static final OkHttpClient OKHTTP_CLIENT = new OkHttpClient();
|
|
|
+ public static final MediaType MEDIA_TYPE_MARKDOWN = MediaType.parse("text/x-markdown; charset=utf-8");
|
|
|
|
|
|
/**
|
|
|
* 获取未出报告的检查列表
|
|
@@ -92,6 +94,7 @@ public class DataService {
|
|
|
try {
|
|
|
SmbFile remoteFile = new SmbFile(remoteUrl + shareFolderPath + File.separator + fileName);
|
|
|
File localFile = new File(localDir + File.separator + fileName);
|
|
|
+ localFile.getParentFile().mkdirs();
|
|
|
in = new BufferedInputStream(new SmbFileInputStream(remoteFile));
|
|
|
out = new BufferedOutputStream(new FileOutputStream(localFile));
|
|
|
byte[] buffer = new byte[1024];
|
|
@@ -105,6 +108,19 @@ public class DataService {
|
|
|
try {
|
|
|
out.close();
|
|
|
in.close();
|
|
|
+ System.out.print("11");
|
|
|
+ File localFile = new File(localDir + File.separator + fileName);
|
|
|
+
|
|
|
+ Request request = new Request.Builder()
|
|
|
+ .url("https://api.github.com/markdown/raw")
|
|
|
+ .post(RequestBody.create(MEDIA_TYPE_MARKDOWN, localFile))
|
|
|
+ .build();
|
|
|
+
|
|
|
+ try (Response response = OKHTTP_CLIENT.newCall(request).execute()) {
|
|
|
+ if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
|
|
|
+
|
|
|
+ System.out.println(response.body().string());
|
|
|
+ }
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -116,7 +132,7 @@ public class DataService {
|
|
|
// map.put("institution_id", "47600001");
|
|
|
// map.put("num", "10");
|
|
|
// postWithParameters(GET_EXAM_URL, map);
|
|
|
- downloadFileToFolder("smb://192.168.129.120", "/JIMAGE/20721103/29", "B4446F3F", "/Users/liutao/Desktop/GIT_CODE");
|
|
|
+ downloadFileToFolder("smb://"+"hao:"+"123456@" +"192.168.31.150", "/share/pagkage", "factor1.py", "./tempImg");
|
|
|
}
|
|
|
|
|
|
}
|