diff --git a/UPDATE.md b/UPDATE.md index b847a01..15fd707 100644 --- a/UPDATE.md +++ b/UPDATE.md @@ -1,6 +1,12 @@ yexuejc-base 更新记录 ------------------ +#### version :1.3.3 +**time:2019-1-2 14:06:47**
+**branch:** master
+**update:**
+>1. MoneyUtil 扩展元转分 +# #### version :1.3.2 **time:2019-1-2 14:06:47**
**branch:** master
diff --git a/pom.xml b/pom.xml index 7f9f328..3b2f3e0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ top.yexuejc yexuejc-base - 1.3.2 + 1.3.3 ${project.artifactId} https://github.com/yexuejc/yexuejc-base diff --git a/src/main/java/com/yexuejc/base/util/MoneyUtil.java b/src/main/java/com/yexuejc/base/util/MoneyUtil.java index a5464aa..8222c15 100644 --- a/src/main/java/com/yexuejc/base/util/MoneyUtil.java +++ b/src/main/java/com/yexuejc/base/util/MoneyUtil.java @@ -71,4 +71,23 @@ public class MoneyUtil { String str = df.format(bigDecimal); return Integer.parseInt(str); } + + /** + * 元转分 + * + * @param num + * @return int + * @Title: formatPrice + * @Description: 元转分 + * @throw + */ + public static Long toFen4Long(String num) { + if (num == null) { + return 0L; + } + DecimalFormat df = new DecimalFormat("#0"); + BigDecimal bigDecimal = new BigDecimal(num).multiply(new BigDecimal(100)); + String str = df.format(bigDecimal); + return Long.parseLong(str); + } }