升级工具依赖;去掉一些极少用的依赖,按需加入;
This commit is contained in:
@@ -53,12 +53,12 @@
|
|||||||
<version>${commons-text.version}</version>
|
<version>${commons-text.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Apache Tools Ant Tar Zip -->
|
<!-- Apache Zip Tools
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.ant</groupId>
|
<groupId>org.apache.ant</groupId>
|
||||||
<artifactId>ant</artifactId>
|
<artifactId>ant</artifactId>
|
||||||
<version>${ant.version}</version>
|
<version>${ant.version}</version>
|
||||||
</dependency>
|
</dependency> -->
|
||||||
|
|
||||||
<!-- Java serialization -->
|
<!-- Java serialization -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -88,12 +88,12 @@
|
|||||||
<version>${fastjson.version}</version>
|
<version>${fastjson.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Java xml -->
|
<!-- Java xml
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.dom4j</groupId>
|
<groupId>org.dom4j</groupId>
|
||||||
<artifactId>dom4j</artifactId>
|
<artifactId>dom4j</artifactId>
|
||||||
<version>${dom4j.version}</version>
|
<version>${dom4j.version}</version>
|
||||||
</dependency>
|
</dependency> -->
|
||||||
|
|
||||||
<!-- jdk11 JAXB module
|
<!-- jdk11 JAXB module
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -123,12 +123,12 @@
|
|||||||
<artifactId>httpclient</artifactId>
|
<artifactId>httpclient</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Jsoup HTTP -->
|
<!-- Jsoup HTTP
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jsoup</groupId>
|
<groupId>org.jsoup</groupId>
|
||||||
<artifactId>jsoup</artifactId>
|
<artifactId>jsoup</artifactId>
|
||||||
<version>${jsoup.version}</version>
|
<version>${jsoup.version}</version>
|
||||||
</dependency>
|
</dependency> -->
|
||||||
|
|
||||||
<!-- Email -->
|
<!-- Email -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -136,11 +136,11 @@
|
|||||||
<artifactId>commons-email</artifactId>
|
<artifactId>commons-email</artifactId>
|
||||||
<version>${commons-email.version}</version>
|
<version>${commons-email.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<!-- <dependency>
|
||||||
<groupId>javax.activation</groupId>
|
<groupId>javax.activation</groupId>
|
||||||
<artifactId>activation</artifactId>
|
<artifactId>activation</artifactId>
|
||||||
<version>${activation.version}</version>
|
<version>${activation.version}</version>
|
||||||
</dependency>
|
</dependency> -->
|
||||||
|
|
||||||
<!-- User Agent -->
|
<!-- User Agent -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -210,7 +210,7 @@
|
|||||||
<version>${zxing.version}</version>
|
<version>${zxing.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- POI Office Tools -->
|
<!-- Office Tools -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi</artifactId>
|
<artifactId>poi</artifactId>
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ import java.io.OutputStream;
|
|||||||
import java.io.RandomAccessFile;
|
import java.io.RandomAccessFile;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipFile;
|
||||||
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
import javax.activation.MimetypesFileTypeMap;
|
import javax.activation.MimetypesFileTypeMap;
|
||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
@@ -21,9 +24,6 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
|
|
||||||
import org.apache.commons.io.Charsets;
|
import org.apache.commons.io.Charsets;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.tools.zip.ZipEntry;
|
|
||||||
import org.apache.tools.zip.ZipFile;
|
|
||||||
import org.apache.tools.zip.ZipOutputStream;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
@@ -462,14 +462,18 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
// zipFiles("target\\classes", "*", "target\\classes.zip");
|
||||||
|
// unZipFiles("target\\classes.zip", "target\\classes2");
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 压缩文件或目录
|
* 压缩文件或目录
|
||||||
* @param srcDirName 压缩的根目录
|
* @param srcDirName 压缩的根目录
|
||||||
* @param fileName 根目录下的待压缩的文件名或文件夹名,其中*或""表示跟目录下的全部文件
|
* @param fileName 根目录下的待压缩的文件名或文件夹名,其中*或""表示跟目录下的全部文件
|
||||||
* @param descFileName 目标zip文件
|
* @param descFileName 目标zip文件
|
||||||
*/
|
*/
|
||||||
public static void zipFiles(String srcDirName, String fileName,
|
public static void zipFiles(String srcDirName, String fileName, String descFileName) {
|
||||||
String descFileName) {
|
|
||||||
// 判断目录是否存在
|
// 判断目录是否存在
|
||||||
if (srcDirName == null) {
|
if (srcDirName == null) {
|
||||||
logger.debug("文件压缩失败,目录 " + srcDirName + " 不存在!");
|
logger.debug("文件压缩失败,目录 " + srcDirName + " 不存在!");
|
||||||
@@ -483,8 +487,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
|||||||
String dirPath = fileDir.getAbsolutePath();
|
String dirPath = fileDir.getAbsolutePath();
|
||||||
File descFile = new File(descFileName);
|
File descFile = new File(descFileName);
|
||||||
try {
|
try {
|
||||||
ZipOutputStream zouts = new ZipOutputStream(new FileOutputStream(
|
ZipOutputStream zouts = new ZipOutputStream(new FileOutputStream(descFile));
|
||||||
descFile));
|
|
||||||
if ("*".equals(fileName) || "".equals(fileName)) {
|
if ("*".equals(fileName) || "".equals(fileName)) {
|
||||||
FileUtils.zipDirectoryToZipFile(dirPath, fileDir, zouts);
|
FileUtils.zipDirectoryToZipFile(dirPath, fileDir, zouts);
|
||||||
} else {
|
} else {
|
||||||
@@ -492,8 +495,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
|||||||
if (file.isFile()) {
|
if (file.isFile()) {
|
||||||
FileUtils.zipFilesToZipFile(dirPath, file, zouts);
|
FileUtils.zipFilesToZipFile(dirPath, file, zouts);
|
||||||
} else {
|
} else {
|
||||||
FileUtils
|
FileUtils.zipDirectoryToZipFile(dirPath, file, zouts);
|
||||||
.zipDirectoryToZipFile(dirPath, file, zouts);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
zouts.close();
|
zouts.close();
|
||||||
@@ -525,7 +527,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
|||||||
int readByte = 0;
|
int readByte = 0;
|
||||||
// 获取ZIP文件里所有的entry
|
// 获取ZIP文件里所有的entry
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
Enumeration enums = zipFile.getEntries();
|
Enumeration enums = zipFile.entries();
|
||||||
// 遍历所有entry
|
// 遍历所有entry
|
||||||
while (enums.hasMoreElements()) {
|
while (enums.hasMoreElements()) {
|
||||||
entry = (ZipEntry) enums.nextElement();
|
entry = (ZipEntry) enums.nextElement();
|
||||||
@@ -585,12 +587,10 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
|||||||
for (int i = 0; i < files.length; i++) {
|
for (int i = 0; i < files.length; i++) {
|
||||||
if (files[i].isFile()) {
|
if (files[i].isFile()) {
|
||||||
// 如果是文件,则调用文件压缩方法
|
// 如果是文件,则调用文件压缩方法
|
||||||
FileUtils
|
FileUtils.zipFilesToZipFile(dirPath, files[i], zouts);
|
||||||
.zipFilesToZipFile(dirPath, files[i], zouts);
|
|
||||||
} else {
|
} else {
|
||||||
// 如果是目录,则递归调用
|
// 如果是目录,则递归调用
|
||||||
FileUtils.zipDirectoryToZipFile(dirPath, files[i],
|
FileUtils.zipDirectoryToZipFile(dirPath, files[i], zouts);
|
||||||
zouts);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -646,7 +646,6 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
|||||||
filePath += "/";
|
filePath += "/";
|
||||||
}
|
}
|
||||||
int index = filePath.indexOf(dirPaths);
|
int index = filePath.indexOf(dirPaths);
|
||||||
|
|
||||||
return filePath.substring(index + dirPaths.length());
|
return filePath.substring(index + dirPaths.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,21 +4,9 @@
|
|||||||
package com.jeesite.common.mapper;
|
package com.jeesite.common.mapper;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.dom4j.Attribute;
|
|
||||||
import org.dom4j.Document;
|
|
||||||
import org.dom4j.DocumentException;
|
|
||||||
import org.dom4j.DocumentHelper;
|
|
||||||
import org.dom4j.Element;
|
|
||||||
import org.dom4j.Namespace;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||||
@@ -124,167 +112,167 @@ public class XmlMapper extends com.fasterxml.jackson.dataformat.xml.XmlMapper{
|
|||||||
return (T) XmlMapper.getInstance().fromXmlString(jsonString, clazz);
|
return (T) XmlMapper.getInstance().fromXmlString(jsonString, clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* xml转map 不带属性
|
// * xml转map 不带属性
|
||||||
* @param xmlStr
|
// * @param xmlStr
|
||||||
* @param needRootKey 是否需要在返回的map里加根节点键
|
// * @param needRootKey 是否需要在返回的map里加根节点键
|
||||||
* @throws DocumentException
|
// * @throws DocumentException
|
||||||
*/
|
// */
|
||||||
@SuppressWarnings("unchecked")
|
// @SuppressWarnings("unchecked")
|
||||||
public static Map<String, Object> xmlToMap(String xmlStr, boolean needRootKey) {
|
// public static Map<String, Object> xmlToMap(String xmlStr, boolean needRootKey) {
|
||||||
try {
|
// try {
|
||||||
Document doc = DocumentHelper.parseText(xmlStr);
|
// Document doc = DocumentHelper.parseText(xmlStr);
|
||||||
Element root = doc.getRootElement();
|
// Element root = doc.getRootElement();
|
||||||
Map<String, Object> map = (Map<String, Object>) xmlToMap(root);
|
// Map<String, Object> map = (Map<String, Object>) xmlToMap(root);
|
||||||
if (root.elements().size() == 0 && root.attributes().size() == 0) {
|
// if (root.elements().size() == 0 && root.attributes().size() == 0) {
|
||||||
return map;
|
// return map;
|
||||||
}
|
// }
|
||||||
if (needRootKey) {
|
// if (needRootKey) {
|
||||||
//在返回的map里加根节点键(如果需要)
|
// //在返回的map里加根节点键(如果需要)
|
||||||
Map<String, Object> rootMap = new HashMap<String, Object>();
|
// Map<String, Object> rootMap = new HashMap<String, Object>();
|
||||||
rootMap.put(root.getName(), map);
|
// rootMap.put(root.getName(), map);
|
||||||
return rootMap;
|
// return rootMap;
|
||||||
}
|
// }
|
||||||
return map;
|
// return map;
|
||||||
} catch (DocumentException e) {
|
// } catch (DocumentException e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* xml转map 带属性
|
// * xml转map 带属性
|
||||||
* @param xmlStr
|
// * @param xmlStr
|
||||||
* @param needRootKey 是否需要在返回的map里加根节点键
|
// * @param needRootKey 是否需要在返回的map里加根节点键
|
||||||
* @return
|
// * @return
|
||||||
* @throws DocumentException
|
// * @throws DocumentException
|
||||||
*/
|
// */
|
||||||
@SuppressWarnings("unchecked")
|
// @SuppressWarnings("unchecked")
|
||||||
public static Map<String, Object> xmlToMapWithAttr(String xmlStr, boolean needRootKey) {
|
// public static Map<String, Object> xmlToMapWithAttr(String xmlStr, boolean needRootKey) {
|
||||||
try {
|
// try {
|
||||||
Document doc = DocumentHelper.parseText(xmlStr);
|
// Document doc = DocumentHelper.parseText(xmlStr);
|
||||||
Element root = doc.getRootElement();
|
// Element root = doc.getRootElement();
|
||||||
Map<String, Object> map = (Map<String, Object>) xmlToMapWithAttr(root);
|
// Map<String, Object> map = (Map<String, Object>) xmlToMapWithAttr(root);
|
||||||
if (root.elements().size() == 0 && root.attributes().size() == 0) {
|
// if (root.elements().size() == 0 && root.attributes().size() == 0) {
|
||||||
return map; //根节点只有一个文本内容
|
// return map; //根节点只有一个文本内容
|
||||||
}
|
// }
|
||||||
if (needRootKey) {
|
// if (needRootKey) {
|
||||||
//在返回的map里加根节点键(如果需要)
|
// //在返回的map里加根节点键(如果需要)
|
||||||
Map<String, Object> rootMap = new HashMap<String, Object>();
|
// Map<String, Object> rootMap = new HashMap<String, Object>();
|
||||||
rootMap.put(root.getName(), map);
|
// rootMap.put(root.getName(), map);
|
||||||
return rootMap;
|
// return rootMap;
|
||||||
}
|
// }
|
||||||
return map;
|
// return map;
|
||||||
} catch (DocumentException e) {
|
// } catch (DocumentException e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* xml转map 不带属性
|
// * xml转map 不带属性
|
||||||
* @param element
|
// * @param element
|
||||||
* @return
|
// * @return
|
||||||
*/
|
// */
|
||||||
private static Object xmlToMap(Element element) {
|
// private static Object xmlToMap(Element element) {
|
||||||
// System.out.println(element.getName());
|
// // System.out.println(element.getName());
|
||||||
Map<String, Object> map = new LinkedHashMap<String, Object>();
|
// Map<String, Object> map = new LinkedHashMap<String, Object>();
|
||||||
List<Element> elements = element.elements();
|
// List<Element> elements = element.elements();
|
||||||
if (elements.size() == 0) {
|
// if (elements.size() == 0) {
|
||||||
map.put(element.getName(), element.getText());
|
// map.put(element.getName(), element.getText());
|
||||||
if (!element.isRootElement()) {
|
// if (!element.isRootElement()) {
|
||||||
return element.getText();
|
// return element.getText();
|
||||||
}
|
// }
|
||||||
} else if (elements.size() == 1) {
|
// } else if (elements.size() == 1) {
|
||||||
map.put(elements.get(0).getName(), xmlToMap(elements.get(0)));
|
// map.put(elements.get(0).getName(), xmlToMap(elements.get(0)));
|
||||||
} else if (elements.size() > 1) {
|
// } else if (elements.size() > 1) {
|
||||||
// 多个子节点的话就得考虑list的情况了,比如多个子节点有节点名称相同的
|
// // 多个子节点的话就得考虑list的情况了,比如多个子节点有节点名称相同的
|
||||||
// 构造一个map用来去重
|
// // 构造一个map用来去重
|
||||||
Map<String, Element> tempMap = new LinkedHashMap<String, Element>();
|
// Map<String, Element> tempMap = new LinkedHashMap<String, Element>();
|
||||||
for (Element ele : elements) {
|
// for (Element ele : elements) {
|
||||||
tempMap.put(ele.getName(), ele);
|
// tempMap.put(ele.getName(), ele);
|
||||||
}
|
// }
|
||||||
Set<String> keySet = tempMap.keySet();
|
// Set<String> keySet = tempMap.keySet();
|
||||||
for (String string : keySet) {
|
// for (String string : keySet) {
|
||||||
Namespace namespace = tempMap.get(string).getNamespace();
|
// Namespace namespace = tempMap.get(string).getNamespace();
|
||||||
List<Element> elements2 = element.elements(new org.dom4j.QName(string, namespace));
|
// List<Element> elements2 = element.elements(new org.dom4j.QName(string, namespace));
|
||||||
// 如果同名的数目大于1则表示要构建list
|
// // 如果同名的数目大于1则表示要构建list
|
||||||
if (elements2.size() > 1) {
|
// if (elements2.size() > 1) {
|
||||||
List<Object> list = new ArrayList<Object>();
|
// List<Object> list = new ArrayList<Object>();
|
||||||
for (Element ele : elements2) {
|
// for (Element ele : elements2) {
|
||||||
list.add(xmlToMap(ele));
|
// list.add(xmlToMap(ele));
|
||||||
}
|
// }
|
||||||
map.put(string, list);
|
// map.put(string, list);
|
||||||
} else {
|
// } else {
|
||||||
// 同名的数量不大于1则直接递归去
|
// // 同名的数量不大于1则直接递归去
|
||||||
map.put(string, xmlToMap(elements2.get(0)));
|
// map.put(string, xmlToMap(elements2.get(0)));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return map;
|
// return map;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* xml转map 带属性
|
// * xml转map 带属性
|
||||||
* @param element
|
// * @param element
|
||||||
* @return
|
// * @return
|
||||||
*/
|
// */
|
||||||
private static Object xmlToMapWithAttr(Element element) {
|
// private static Object xmlToMapWithAttr(Element element) {
|
||||||
// System.out.println(element.getName());
|
// // System.out.println(element.getName());
|
||||||
Map<String, Object> map = new LinkedHashMap<String, Object>();
|
// Map<String, Object> map = new LinkedHashMap<String, Object>();
|
||||||
List<Element> elements = element.elements();
|
// List<Element> elements = element.elements();
|
||||||
|
//
|
||||||
List<Attribute> listAttr = element.attributes(); // 当前节点的所有属性的list
|
// List<Attribute> listAttr = element.attributes(); // 当前节点的所有属性的list
|
||||||
boolean hasAttributes = false;
|
// boolean hasAttributes = false;
|
||||||
for (Attribute attr : listAttr) {
|
// for (Attribute attr : listAttr) {
|
||||||
hasAttributes = true;
|
// hasAttributes = true;
|
||||||
map.put("@" + attr.getName(), attr.getValue());
|
// map.put("@" + attr.getName(), attr.getValue());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (elements.size() == 0) {
|
// if (elements.size() == 0) {
|
||||||
// map.put(element.getName(), element.getText());
|
// // map.put(element.getName(), element.getText());
|
||||||
if (hasAttributes) {
|
// if (hasAttributes) {
|
||||||
map.put("#text", element.getText());
|
// map.put("#text", element.getText());
|
||||||
} else {
|
// } else {
|
||||||
map.put(element.getName(), element.getText());
|
// map.put(element.getName(), element.getText());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (!element.isRootElement()) {
|
// if (!element.isRootElement()) {
|
||||||
// return element.getText();
|
// // return element.getText();
|
||||||
if (!hasAttributes) {
|
// if (!hasAttributes) {
|
||||||
return element.getText();
|
// return element.getText();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} else if (elements.size() == 1) {
|
// } else if (elements.size() == 1) {
|
||||||
map.put(elements.get(0).getName(), xmlToMapWithAttr(elements.get(0)));
|
// map.put(elements.get(0).getName(), xmlToMapWithAttr(elements.get(0)));
|
||||||
} else if (elements.size() > 1) {
|
// } else if (elements.size() > 1) {
|
||||||
// 多个子节点的话就得考虑list的情况了,比如多个子节点有节点名称相同的
|
// // 多个子节点的话就得考虑list的情况了,比如多个子节点有节点名称相同的
|
||||||
// 构造一个map用来去重
|
// // 构造一个map用来去重
|
||||||
Map<String, Element> tempMap = new LinkedHashMap<String, Element>();
|
// Map<String, Element> tempMap = new LinkedHashMap<String, Element>();
|
||||||
for (Element ele : elements) {
|
// for (Element ele : elements) {
|
||||||
tempMap.put(ele.getName(), ele);
|
// tempMap.put(ele.getName(), ele);
|
||||||
}
|
// }
|
||||||
Set<String> keySet = tempMap.keySet();
|
// Set<String> keySet = tempMap.keySet();
|
||||||
for (String string : keySet) {
|
// for (String string : keySet) {
|
||||||
Namespace namespace = tempMap.get(string).getNamespace();
|
// Namespace namespace = tempMap.get(string).getNamespace();
|
||||||
List<Element> elements2 = element.elements(new org.dom4j.QName(string, namespace));
|
// List<Element> elements2 = element.elements(new org.dom4j.QName(string, namespace));
|
||||||
// 如果同名的数目大于1则表示要构建list
|
// // 如果同名的数目大于1则表示要构建list
|
||||||
if (elements2.size() > 1) {
|
// if (elements2.size() > 1) {
|
||||||
List<Object> list = new ArrayList<Object>();
|
// List<Object> list = new ArrayList<Object>();
|
||||||
for (Element ele : elements2) {
|
// for (Element ele : elements2) {
|
||||||
list.add(xmlToMapWithAttr(ele));
|
// list.add(xmlToMapWithAttr(ele));
|
||||||
}
|
// }
|
||||||
map.put(string, list);
|
// map.put(string, list);
|
||||||
} else {
|
// } else {
|
||||||
// 同名的数量不大于1则直接递归去
|
// // 同名的数量不大于1则直接递归去
|
||||||
map.put(string, xmlToMapWithAttr(elements2.get(0)));
|
// map.put(string, xmlToMapWithAttr(elements2.get(0)));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return map;
|
// return map;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// public static void main(String[] args) throws Exception {
|
// public static void main(String[] args) throws Exception {
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -77,4 +77,9 @@ public class EmailUtils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
// EmailUtils.send("jeesite_demo@163.com", "jeesitedemo1234", "smtp.163.com",
|
||||||
|
// "false", "465", "jeesite_demo@163.com", "测试邮件", "测试<b>邮件</b>的内容");
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -296,7 +296,8 @@ public class ReflectUtils {
|
|||||||
* 改变private/protected的方法为public,尽量不调用实际改动的语句,避免JDK的SecurityManager抱怨。
|
* 改变private/protected的方法为public,尽量不调用实际改动的语句,避免JDK的SecurityManager抱怨。
|
||||||
*/
|
*/
|
||||||
public static void makeAccessible(Method method) {
|
public static void makeAccessible(Method method) {
|
||||||
if ((!Modifier.isPublic(method.getModifiers()) || !Modifier.isPublic(method.getDeclaringClass().getModifiers()))
|
if ((!Modifier.isPublic(method.getModifiers())
|
||||||
|
|| !Modifier.isPublic(method.getDeclaringClass().getModifiers()))
|
||||||
&& !method.isAccessible()) {
|
&& !method.isAccessible()) {
|
||||||
method.setAccessible(true);
|
method.setAccessible(true);
|
||||||
}
|
}
|
||||||
@@ -306,8 +307,9 @@ public class ReflectUtils {
|
|||||||
* 改变private/protected的成员变量为public,尽量不调用实际改动的语句,避免JDK的SecurityManager抱怨。
|
* 改变private/protected的成员变量为public,尽量不调用实际改动的语句,避免JDK的SecurityManager抱怨。
|
||||||
*/
|
*/
|
||||||
public static void makeAccessible(Field field) {
|
public static void makeAccessible(Field field) {
|
||||||
if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers()) || Modifier
|
if ((!Modifier.isPublic(field.getModifiers())
|
||||||
.isFinal(field.getModifiers())) && !field.isAccessible()) {
|
|| !Modifier.isPublic(field.getDeclaringClass().getModifiers())
|
||||||
|
|| Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) {
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -333,16 +335,12 @@ public class ReflectUtils {
|
|||||||
* @return the index generic declaration, or Object.class if cannot be determined
|
* @return the index generic declaration, or Object.class if cannot be determined
|
||||||
*/
|
*/
|
||||||
public static Class getClassGenricType(final Class clazz, final int index) {
|
public static Class getClassGenricType(final Class clazz, final int index) {
|
||||||
|
|
||||||
Type genType = clazz.getGenericSuperclass();
|
Type genType = clazz.getGenericSuperclass();
|
||||||
|
|
||||||
if (!(genType instanceof ParameterizedType)) {
|
if (!(genType instanceof ParameterizedType)) {
|
||||||
logger.debug(clazz.getSimpleName() + "'s superclass not ParameterizedType");
|
logger.debug(clazz.getSimpleName() + "'s superclass not ParameterizedType");
|
||||||
return Object.class;
|
return Object.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
|
Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
|
||||||
|
|
||||||
if (index >= params.length || index < 0) {
|
if (index >= params.length || index < 0) {
|
||||||
logger.debug("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: "
|
logger.debug("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: "
|
||||||
+ params.length);
|
+ params.length);
|
||||||
@@ -352,7 +350,6 @@ public class ReflectUtils {
|
|||||||
logger.debug(clazz.getSimpleName() + " not set the actual class on superclass generic parameter");
|
logger.debug(clazz.getSimpleName() + " not set the actual class on superclass generic parameter");
|
||||||
return Object.class;
|
return Object.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (Class) params[index];
|
return (Class) params[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,22 +21,22 @@
|
|||||||
<properties>
|
<properties>
|
||||||
|
|
||||||
<!-- common version setting -->
|
<!-- common version setting -->
|
||||||
<commons-io.version>2.6</commons-io.version>
|
<commons-io.version>2.7</commons-io.version>
|
||||||
<commons-fileupload.version>1.4</commons-fileupload.version>
|
<commons-fileupload.version>1.4</commons-fileupload.version>
|
||||||
<commons-beanutils.version>1.9.4</commons-beanutils.version>
|
<commons-beanutils.version>1.9.4</commons-beanutils.version>
|
||||||
<commons-text.version>1.8</commons-text.version>
|
<commons-text.version>1.9</commons-text.version>
|
||||||
<ant.version>1.10.7</ant.version>
|
<!-- <ant.version>1.10.7</ant.version> -->
|
||||||
<fst.version>2.57</fst.version>
|
<fst.version>2.57</fst.version>
|
||||||
<fastjson.version>1.2.70</fastjson.version>
|
<fastjson.version>1.2.73</fastjson.version>
|
||||||
<jackson.version>2.11.0</jackson.version>
|
<jackson.version>2.11.2</jackson.version>
|
||||||
<dom4j.version>2.1.1</dom4j.version>
|
<!-- <dom4j.version>2.1.1</dom4j.version> -->
|
||||||
<jsoup.version>1.12.2</jsoup.version>
|
<!-- <jsoup.version>1.12.2</jsoup.version> -->
|
||||||
<commons-email.version>1.5</commons-email.version>
|
<commons-email.version>1.5</commons-email.version>
|
||||||
<activation.version>1.1.1</activation.version>
|
<activation.version>1.1.1</activation.version>
|
||||||
<UserAgentUtils.version>1.21</UserAgentUtils.version>
|
<UserAgentUtils.version>1.21</UserAgentUtils.version>
|
||||||
<!-- <metadata-extractor.version>2.11.0</metadata-extractor.version> -->
|
<!-- <metadata-extractor.version>2.11.0</metadata-extractor.version> -->
|
||||||
<thumbnailator.version>0.4.11</thumbnailator.version>
|
<thumbnailator.version>0.4.12</thumbnailator.version>
|
||||||
<twelvemonkeys.version>3.5</twelvemonkeys.version>
|
<twelvemonkeys.version>3.6</twelvemonkeys.version>
|
||||||
<blade-patchca.version>1.1.2</blade-patchca.version>
|
<blade-patchca.version>1.1.2</blade-patchca.version>
|
||||||
<jmimemagic.version>0.1.5</jmimemagic.version>
|
<jmimemagic.version>0.1.5</jmimemagic.version>
|
||||||
<zxing.version>3.4.0</zxing.version>
|
<zxing.version>3.4.0</zxing.version>
|
||||||
@@ -47,8 +47,8 @@
|
|||||||
<!-- framework version setting -->
|
<!-- framework version setting -->
|
||||||
<mybatis.version>3.5.5</mybatis.version>
|
<mybatis.version>3.5.5</mybatis.version>
|
||||||
<mybatis-spring.version>2.0.5</mybatis-spring.version>
|
<mybatis-spring.version>2.0.5</mybatis-spring.version>
|
||||||
<jsqlparser.version>3.1</jsqlparser.version>
|
<jsqlparser.version>3.2</jsqlparser.version>
|
||||||
<druid.version>1.1.22</druid.version>
|
<druid.version>1.1.23</druid.version>
|
||||||
<shiro.version>1.6.0</shiro.version>
|
<shiro.version>1.6.0</shiro.version>
|
||||||
<j2cache.version>2.8.0-release</j2cache.version>
|
<j2cache.version>2.8.0-release</j2cache.version>
|
||||||
<beetl.version>3.1-SNAPSHOT</beetl.version>
|
<beetl.version>3.1-SNAPSHOT</beetl.version>
|
||||||
|
|||||||
@@ -47,14 +47,14 @@
|
|||||||
<version>${project.parent.version}</version>
|
<version>${project.parent.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 文件管理与共享
|
<!-- 文件管理共享(个人版)
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.jeesite</groupId>
|
<groupId>com.jeesite</groupId>
|
||||||
<artifactId>jeesite-module-filemanager</artifactId>
|
<artifactId>jeesite-module-filemanager</artifactId>
|
||||||
<version>${project.parent.version}</version>
|
<version>${project.parent.version}</version>
|
||||||
</dependency> -->
|
</dependency> -->
|
||||||
|
|
||||||
<!-- 文件在线预览
|
<!-- 文件在线预览(个人版)
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.jeesite</groupId>
|
<groupId>com.jeesite</groupId>
|
||||||
<artifactId>jeesite-module-filepreview</artifactId>
|
<artifactId>jeesite-module-filepreview</artifactId>
|
||||||
|
|||||||
Reference in New Issue
Block a user