|
@@ -537,7 +537,7 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
if ("深圳".equals(type)){
|
|
|
//将downloadurl下载到本地
|
|
|
try {
|
|
|
- downloadFile(ydDownloadUrl, filePathSz + fileName);
|
|
|
+ downloadFile(ydDownloadUrl, filePathSz,fileName);
|
|
|
System.out.println("文件下载成功!");
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
@@ -551,7 +551,7 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
}else {
|
|
|
//将downloadurl下载到本地
|
|
|
try {
|
|
|
- downloadFile(ydDownloadUrl, filePathXg + fileName);
|
|
|
+ downloadFile(ydDownloadUrl, filePathXg,fileName);
|
|
|
System.out.println("文件下载成功!");
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
@@ -607,21 +607,23 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
return McR.success();
|
|
|
}
|
|
|
|
|
|
- public void downloadFile(String fileURL, String savePath) throws IOException {
|
|
|
+ public void downloadFile(String fileURL, String savePath , String fileName) throws IOException {
|
|
|
//若是宜搭附件url 则需获得附件临时免登地址
|
|
|
Map<String,Object> param = new HashMap<>();
|
|
|
param.put("systemToken",ydConf.getSystemToken());
|
|
|
param.put("userId","344749020127590108");//wzy
|
|
|
param.put("fileUrl",fileURL);
|
|
|
|
|
|
-// Map mcBody = new HashMap();
|
|
|
-// mcBody.put("params",param);
|
|
|
-// mcBody.put("headers",ddClient.initTokenHeader());
|
|
|
-// mcBody.put("url","https://api.dingtalk.com/v1.0/yida/apps/temporaryUrls/" + ydConf.getAppType());
|
|
|
-//
|
|
|
-// UtilHttp.doPost("http://127.0.0.1/mc/api/request/downloadFile",null,null,mcBody);
|
|
|
+ Map mcBody = new HashMap();
|
|
|
+ mcBody.put("params",param);
|
|
|
+ mcBody.put("headers",ddClient.initTokenHeader());
|
|
|
+ mcBody.put("url","https://api.dingtalk.com/v1.0/yida/apps/temporaryUrls/" + ydConf.getAppType());
|
|
|
+ mcBody.put("fileName",fileName);
|
|
|
+ mcBody.put("downloadPath","/home/mc/mjs/lingmingguangzi/");
|
|
|
+
|
|
|
+ fileURL = UtilHttp.doPost("https://mc.cloudpure.cn/mc/api/request/downloadFile",null,null,mcBody);
|
|
|
|
|
|
- fileURL = ((DDR_New) UtilHttp.doGet("https://api.dingtalk.com/v1.0/yida/apps/temporaryUrls/" + ydConf.getAppType(), ddClient.initTokenHeader(), param, DDR_New.class)).getResult().toString();
|
|
|
+// fileURL = ((DDR_New) UtilHttp.doGet("https://api.dingtalk.com/v1.0/yida/apps/temporaryUrls/" + ydConf.getAppType(), ddClient.initTokenHeader(), param, DDR_New.class)).getResult().toString();
|
|
|
|
|
|
URL url = new URL(fileURL);
|
|
|
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
|