Title: uploadFile
+ *Description:
+ * @param fileName 文件全路径 + * @param extName 文件扩展名,不包含(.) + * @param metas 文件扩展信息 + * @return + * @throws Exception + */ + public String uploadFile(String fileName, String extName, NameValuePair[] metas) throws Exception { + String result = storageClient.upload_file1(fileName, extName, metas); + return result; + } + + public String uploadFile(String fileName) throws Exception { + return uploadFile(fileName, null, null); + } + + public String uploadFile(String fileName, String extName) throws Exception { + return uploadFile(fileName, extName, null); + } + + /** + * 上传文件方法 + *Title: uploadFile
+ *Description:
+ * @param fileContent 文件的内容,字节数组 + * @param extName 文件扩展名 + * @param metas 文件扩展信息 + * @return + * @throws Exception + */ + public String uploadFile(byte[] fileContent, String extName, NameValuePair[] metas) throws Exception { + + String result = storageClient.upload_file1(fileContent, extName, metas); + return result; + } + + public String uploadFile(byte[] fileContent) throws Exception { + return uploadFile(fileContent, null, null); + } + + public String uploadFile(byte[] fileContent, String extName) throws Exception { + return uploadFile(fileContent, extName, null); + } +} diff --git a/src/demo/manager/src/main/java/com/dream/common/JsonUtils.java b/src/demo/manager/src/main/java/com/dream/common/JsonUtils.java new file mode 100644 index 00000000..0338383e --- /dev/null +++ b/src/demo/manager/src/main/java/com/dream/common/JsonUtils.java @@ -0,0 +1,69 @@ +package com.dream.common; + +import java.util.List; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class JsonUtils { + + // 定义jackson对象 + private static final ObjectMapper MAPPER = new ObjectMapper(); + + /** + * 将对象转换成json字符串。 + *Title: pojoToJson
+ *Description:
+ * @param data + * @return + */ + public static String objectToJson(Object data) { + try { + String string = MAPPER.writeValueAsString(data); + return string; + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + return null; + } + + /** + * 将json结果集转化为对象 + * + * @param jsonData json数据 + * @param clazz 对象中的object类型 + * @return + */ + public staticTitle: jsonToList
+ *Description:
+ * @param jsonData + * @param beanType + * @return + */ + public static