merge
This commit is contained in:
+6
-14
@@ -43,7 +43,7 @@
|
||||
<dependency> <!-- druid连接池 -->
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>1.1.5</version>
|
||||
<version>${druid-version}</version>
|
||||
</dependency>
|
||||
<dependency> <!-- mysql driver -->
|
||||
<groupId>mysql</groupId>
|
||||
@@ -86,18 +86,18 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>3.14</version>
|
||||
<version>${poi-verison}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>3.14</version>
|
||||
<version>${poi-verison}</version>
|
||||
</dependency>
|
||||
<!-- httpclient -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.1</version>
|
||||
<version>${httpclient-version}</version>
|
||||
</dependency>
|
||||
<!-- servlet 有些类需要HttpServletResponse和HttpServletRequest的支持 -->
|
||||
<dependency>
|
||||
@@ -109,24 +109,16 @@
|
||||
<dependency>
|
||||
<groupId>dom4j</groupId>
|
||||
<artifactId>dom4j</artifactId>
|
||||
<version>1.6.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jdom</groupId>
|
||||
<artifactId>jdom</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<artifactId>jdom2</artifactId>
|
||||
</dependency>
|
||||
<!-- aliPay -->
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<!-- aliPay工具包会用到-->
|
||||
<dependency>
|
||||
<groupId>commons-httpclient</groupId>
|
||||
<artifactId>commons-httpclient</artifactId>
|
||||
<version>3.1</version>
|
||||
<version>${alipay-version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -3,10 +3,10 @@ package com.xwbing.service.other;
|
||||
import com.xwbing.domain.entity.pay.wxpay.*;
|
||||
import com.xwbing.exception.BusinessException;
|
||||
import com.xwbing.exception.PayException;
|
||||
import com.xwbing.util.payWxpay.ClientCustomSSL;
|
||||
import com.xwbing.util.payWxpay.RandomKit;
|
||||
import com.xwbing.util.payWxpay.WxSignKit;
|
||||
import com.xwbing.util.payWxpay.XmlUtil;
|
||||
import com.xwbing.util.wxpay.ClientCustomSSL;
|
||||
import com.xwbing.util.wxpay.RandomKit;
|
||||
import com.xwbing.util.wxpay.WxSignKit;
|
||||
import com.xwbing.util.wxpay.XmlUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpStatus;
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
package com.xwbing.util.payWxpay;
|
||||
package com.xwbing.util.wxpay;
|
||||
|
||||
import com.xwbing.exception.BusinessException;
|
||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.xwbing.util.payWxpay;
|
||||
package com.xwbing.util.wxpay;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.xwbing.util.payWxpay;
|
||||
package com.xwbing.util.wxpay;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.MessageDigest;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.xwbing.util.payWxpay;
|
||||
package com.xwbing.util.wxpay;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.xwbing.util.payWxpay;
|
||||
package com.xwbing.util.wxpay;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.xwbing.util.payWxpay;
|
||||
package com.xwbing.util.wxpay;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.logging.Logger;
|
||||
+16
-14
@@ -1,4 +1,4 @@
|
||||
package com.xwbing.util.payWxpay;
|
||||
package com.xwbing.util.wxpay;
|
||||
|
||||
import org.jdom2.Document;
|
||||
import org.jdom2.Element;
|
||||
@@ -14,23 +14,23 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* jdom2 XmlUtil
|
||||
* jdom2 XmlUtil
|
||||
*/
|
||||
public class XmlUtil {
|
||||
/**
|
||||
* xml解析成map
|
||||
*
|
||||
* @param strxml
|
||||
* @return
|
||||
* @throws JDOMException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static Map<String, String> doXMLParse(String strxml)
|
||||
throws JDOMException, IOException {
|
||||
public static Map<String, String> doXMLParse(String strxml) throws JDOMException, IOException {
|
||||
if (null == strxml || "".equals(strxml)) {
|
||||
return null;
|
||||
}
|
||||
strxml = strxml.replaceFirst("encoding=\".*\"", "encoding=\"UTF-8\"");
|
||||
Map<String, String> m = new HashMap<String, String>();
|
||||
Map<String, String> m = new HashMap<>();
|
||||
InputStream in = new ByteArrayInputStream(strxml.getBytes("UTF-8"));
|
||||
SAXBuilder builder = new SAXBuilder();
|
||||
Document doc = builder.build(in);
|
||||
@@ -38,9 +38,9 @@ public class XmlUtil {
|
||||
List<Element> list = root.getChildren();
|
||||
Iterator<Element> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
Element e = (Element) it.next();
|
||||
Element e = it.next();
|
||||
String k = e.getName();
|
||||
String v = "";
|
||||
String v;
|
||||
List children = e.getChildren();
|
||||
if (children.isEmpty()) {
|
||||
v = e.getTextNormalize();
|
||||
@@ -51,22 +51,24 @@ public class XmlUtil {
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子结点的xml
|
||||
*
|
||||
* @param children
|
||||
* @return String
|
||||
*/
|
||||
public static String getChildrenText(List children) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if(!children.isEmpty()) {
|
||||
if (!children.isEmpty()) {
|
||||
Iterator it = children.iterator();
|
||||
while(it.hasNext()) {
|
||||
while (it.hasNext()) {
|
||||
Element e = (Element) it.next();
|
||||
String name = e.getName();
|
||||
String value = e.getTextNormalize();
|
||||
List list = e.getChildren();
|
||||
sb.append("<" + name + ">");
|
||||
if(!list.isEmpty()) {
|
||||
if (!list.isEmpty()) {
|
||||
sb.append(XmlUtil.getChildrenText(list));
|
||||
}
|
||||
sb.append(value);
|
||||
@@ -83,7 +85,7 @@ public class XmlUtil {
|
||||
* @param return_msg
|
||||
* @return
|
||||
*/
|
||||
public static String setXML(String return_code, String return_msg){
|
||||
public static String setXML(String return_code, String return_msg) {
|
||||
return "<xml><return_code><![CDATA[" + return_code
|
||||
+ "]]></return_code><return_msg><![CDATA[" + return_msg
|
||||
+ "]]></return_msg></xml>";
|
||||
@@ -91,11 +93,11 @@ public class XmlUtil {
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String ff="<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[postæ°æ®ä¸ºç©º]]></return_msg></xml>";
|
||||
String ff = "<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[postæ°æ®ä¸ºç©º]]></return_msg></xml>";
|
||||
try {
|
||||
Map<String, String> sf= XmlUtil.doXMLParse(ff);
|
||||
Map<String, String> sf = XmlUtil.doXMLParse(ff);
|
||||
for (String s : sf.keySet()) {
|
||||
System.out.println(s+",value:"+sf.get(s));
|
||||
System.out.println(s + ",value:" + sf.get(s));
|
||||
}
|
||||
} catch (JDOMException e) {
|
||||
e.printStackTrace();
|
||||
@@ -40,6 +40,10 @@
|
||||
<fastjson.version>1.2.20</fastjson.version>
|
||||
<rsa.version>1.45</rsa.version>
|
||||
<commons-io.version>2.2</commons-io.version>
|
||||
<alipay-version>1.0</alipay-version>
|
||||
<druid-version>1.1.5</druid-version>
|
||||
<poi-verison>3.14</poi-verison>
|
||||
<httpclient-version>4.5.1</httpclient-version>
|
||||
<!-- 打包跳过单元测试 -->
|
||||
<skipTests>true</skipTests>
|
||||
<swagger2.version>2.4.0</swagger2.version>
|
||||
|
||||
Reference in New Issue
Block a user