This commit is contained in:
maxf 2019-01-02 15:23:40 +08:00
parent 93488c6fff
commit a639d61624
3 changed files with 26 additions and 1 deletions

View File

@ -1,6 +1,12 @@
yexuejc-base 更新记录
------------------
#### version 1.3.3
**time2019-1-2 14:06:47** <br/>
**branch** master <br/>
**update** <br/>
>1. MoneyUtil 扩展元转分
#
#### version 1.3.2
**time2019-1-2 14:06:47** <br/>
**branch** master <br/>

View File

@ -6,7 +6,7 @@
<groupId>top.yexuejc</groupId>
<artifactId>yexuejc-base</artifactId>
<version>1.3.2</version>
<version>1.3.3</version>
<name>${project.artifactId}</name>
<url>https://github.com/yexuejc/yexuejc-base</url>

View File

@ -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);
}
}