Browse Source

。。。

WANG 6 years ago
parent
commit
cbaba2b997

+ 5 - 0
examcloud-exchange-inner-api-client/src/main/java/cn/com/qmth/examcloud/exchange/inner/api/client/AbstractCloudClientSupport.java

@@ -1,6 +1,7 @@
 package cn.com.qmth.examcloud.exchange.inner.api.client;
 
 import cn.com.qmth.examcloud.api.commons.exchange.BaseRequest;
+import cn.com.qmth.examcloud.api.commons.exchange.FormRequest;
 import cn.com.qmth.examcloud.web.cloud.CloudClientSupport;
 
 /**
@@ -29,4 +30,8 @@ public abstract class AbstractCloudClientSupport extends CloudClientSupport {
 		return super.post(APP_NAME, requestMappingSuffix, body, responseType);
 	}
 
+	protected <T> T postForm(String requestMappingSuffix, FormRequest req, Class<T> responseType) {
+		return super.postForm(APP_NAME, requestMappingSuffix, req, responseType);
+	}
+
 }

+ 1 - 18
examcloud-exchange-inner-api-client/src/main/java/cn/com/qmth/examcloud/exchange/inner/api/client/UpyunCloudServiceClient.java

@@ -1,18 +1,10 @@
 package cn.com.qmth.examcloud.exchange.inner.api.client;
 
-import java.io.File;
-import java.util.Map;
-
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.web.client.RestTemplate;
-
-import com.google.common.collect.Maps;
 
 import cn.com.qmth.examcloud.exchange.inner.api.UpyunCloudService;
 import cn.com.qmth.examcloud.exchange.inner.api.request.PutFileReq;
 import cn.com.qmth.examcloud.exchange.inner.api.response.PutFileResp;
-import cn.com.qmth.examcloud.web.redis.RedisClient;
 
 /**
  * 类注释
@@ -30,16 +22,7 @@ public class UpyunCloudServiceClient extends AbstractCloudClientSupport
 
 	@Override
 	public PutFileResp putFile(PutFileReq req) {
-		Map<String, String> params = Maps.newHashMap();
-		params.put("siteId", req.getSiteId());
-		params.put("fileSuffix", req.getFileSuffix());
-		params.put("rootOrgId", String.valueOf(req.getRootOrgId()));
-		params.put("userId", String.valueOf(req.getUserId()));
-		params.put("filePath", req.getFilePath());
-
-		// return postForm("upyun/putFile", params, new File(req.getFilePath()),
-		// PutFileResp.class);
-		return null;
+		return postForm("upyun/putFile", req, PutFileResp.class);
 	}
 
 }

+ 2 - 24
examcloud-exchange-inner-api/src/main/java/cn/com/qmth/examcloud/exchange/inner/api/request/PutFileReq.java

@@ -1,8 +1,6 @@
 package cn.com.qmth.examcloud.exchange.inner.api.request;
 
-import org.springframework.web.multipart.commons.CommonsMultipartFile;
-
-import cn.com.qmth.examcloud.api.commons.exchange.BaseRequest;
+import cn.com.qmth.examcloud.api.commons.exchange.FormRequest;
 
 /**
  * 类注释
@@ -11,7 +9,7 @@ import cn.com.qmth.examcloud.api.commons.exchange.BaseRequest;
  * @date 2018年11月27日
  * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
  */
-public class PutFileReq extends BaseRequest {
+public class PutFileReq extends FormRequest {
 
 	private static final long serialVersionUID = 6724768358354616915L;
 
@@ -23,10 +21,6 @@ public class PutFileReq extends BaseRequest {
 
 	private String fileSuffix;
 
-	private String filePath;
-
-	private CommonsMultipartFile file;
-
 	public String getSiteId() {
 		return siteId;
 	}
@@ -59,20 +53,4 @@ public class PutFileReq extends BaseRequest {
 		this.fileSuffix = fileSuffix;
 	}
 
-	public String getFilePath() {
-		return filePath;
-	}
-
-	public void setFilePath(String filePath) {
-		this.filePath = filePath;
-	}
-
-	public CommonsMultipartFile getFile() {
-		return file;
-	}
-
-	public void setFile(CommonsMultipartFile file) {
-		this.file = file;
-	}
-
 }