|
@@ -1,10 +1,13 @@
|
|
package cn.com.qmth.examcloud.exchange.inner.api.client;
|
|
package cn.com.qmth.examcloud.exchange.inner.api.client;
|
|
|
|
|
|
|
|
+import java.io.File;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
+import org.apache.commons.fileupload.disk.DiskFileItem;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.web.client.RestTemplate;
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
|
|
|
|
|
import com.google.common.collect.Maps;
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
|
@@ -50,7 +53,11 @@ public class UpyunCloudServiceClient extends ExchangeCloudClientSupport
|
|
params.put("siteId", req.getSiteId());
|
|
params.put("siteId", req.getSiteId());
|
|
params.put("rootOrgId", String.valueOf(req.getRootOrgId()));
|
|
params.put("rootOrgId", String.valueOf(req.getRootOrgId()));
|
|
params.put("userId", String.valueOf(req.getUserId()));
|
|
params.put("userId", String.valueOf(req.getUserId()));
|
|
- return postForm("upyun/putFile", params, req.getFile(), PutFileResp.class);
|
|
|
|
|
|
+
|
|
|
|
+ CommonsMultipartFile file = req.getFile();
|
|
|
|
+ DiskFileItem item = (DiskFileItem) file.getFileItem();
|
|
|
|
+ File storeLocation = item.getStoreLocation();
|
|
|
|
+ return postForm("upyun/putFile", params, storeLocation, PutFileResp.class);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|