|
|
@@ -6,6 +6,7 @@ import com.uas.dfs.domain.MetaData;
|
|
|
import com.uas.dfs.service.FileClient;
|
|
|
import com.uas.platform.b2c.common.base.constant.FileClientConstant;
|
|
|
import com.uas.platform.b2c.core.config.SysConf;
|
|
|
+import org.apache.log4j.Logger;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.core.io.ByteArrayResource;
|
|
|
import org.springframework.http.*;
|
|
|
@@ -26,6 +27,8 @@ public class FileClientImpl implements FileClient {
|
|
|
|
|
|
private final SysConf sysConf;
|
|
|
|
|
|
+ private final Logger logger = Logger.getLogger(getClass());
|
|
|
+
|
|
|
@Autowired
|
|
|
public FileClientImpl(RestTemplate restTemplate, SysConf sysConf) {
|
|
|
this.restTemplate = restTemplate;
|
|
|
@@ -58,7 +61,18 @@ public class FileClientImpl implements FileClient {
|
|
|
form.add("file", arrayResource);
|
|
|
|
|
|
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<MultiValueMap<String, Object>>(form, headers);
|
|
|
- ResponseEntity<JSONObject> responseEntity = restTemplate.postForEntity(sysConf.getUploadFileUrl() + FileClientConstant.FILE_UPLOAD, requestEntity, JSONObject.class);
|
|
|
+ ResponseEntity<JSONObject> responseEntity = null;
|
|
|
+ try {
|
|
|
+ logger.info("------------------");
|
|
|
+ logger.info(sysConf.getUploadFileUrl() + FileClientConstant.FILE_UPLOAD);
|
|
|
+ responseEntity = restTemplate.postForEntity(sysConf.getUploadFileUrl() + FileClientConstant.FILE_UPLOAD, requestEntity, JSONObject.class);
|
|
|
+ logger.info(responseEntity);
|
|
|
+ logger.info(responseEntity.getBody());
|
|
|
+ logger.info(responseEntity.getBody().getString("patch"));
|
|
|
+ logger.info("------------------");
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
return responseEntity.getBody().getString("path");
|
|
|
}
|
|
|
|