Commit 0f0d6ff2 authored by yanzg's avatar yanzg

Excel导出功能

parent d491b855
...@@ -14,6 +14,7 @@ import java.util.UUID; ...@@ -14,6 +14,7 @@ import java.util.UUID;
/** /**
* 字符串帮主类 * 字符串帮主类
*
* @author 颜佐光 * @author 颜佐光
*/ */
public class StringHelper { public class StringHelper {
...@@ -748,15 +749,8 @@ public class StringHelper { ...@@ -748,15 +749,8 @@ public class StringHelper {
* @return 加密后的字符串 * @return 加密后的字符串
*/ */
public static String md5(String string) { public static String md5(String string) {
byte[] hash = null;
try { try {
hash = MessageDigest.getInstance("MD5").digest(string.getBytes("UTF-8")); byte[] hash = MessageDigest.getInstance("MD5").digest(string.getBytes("UTF-8"));
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
StringBuilder hex = new StringBuilder(hash.length * 2); StringBuilder hex = new StringBuilder(hash.length * 2);
for (byte b : hash) { for (byte b : hash) {
if ((b & 0xFF) < 0x10) { if ((b & 0xFF) < 0x10) {
...@@ -765,6 +759,12 @@ public class StringHelper { ...@@ -765,6 +759,12 @@ public class StringHelper {
hex.append(Integer.toHexString(b & 0xFF)); hex.append(Integer.toHexString(b & 0xFF));
} }
return hex.toString(); return hex.toString();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return StringHelper.EMPTY;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment