mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 18:28:43 +08:00 
			
		
		
		
	✨ ERP:基本完成销售入库模块
This commit is contained in:
		| @@ -18,6 +18,11 @@ public class MoneyUtils { | ||||
|      */ | ||||
|     private static final int PRICE_SCALE = 2; | ||||
|  | ||||
|     /** | ||||
|      * 百分比对应的 BigDecimal 对象 | ||||
|      */ | ||||
|     public static final BigDecimal PERCENT_100 = BigDecimal.valueOf(100); | ||||
|  | ||||
|     /** | ||||
|      * 计算百分比金额,四舍五入 | ||||
|      * | ||||
| @@ -107,4 +112,20 @@ public class MoneyUtils { | ||||
|         return price.multiply(count).setScale(PRICE_SCALE, RoundingMode.HALF_UP); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 金额相乘(百分比),默认进行四舍五入 | ||||
|      * | ||||
|      * 位数:{@link #PRICE_SCALE} | ||||
|      * | ||||
|      * @param price  金额 | ||||
|      * @param percent 百分比 | ||||
|      * @return 金额相乘结果 | ||||
|      */ | ||||
|     public static BigDecimal priceMultiplyPercent(BigDecimal price, BigDecimal percent) { | ||||
|         if (price == null || percent == null) { | ||||
|             return null; | ||||
|         } | ||||
|         return price.multiply(percent).divide(PERCENT_100, PRICE_SCALE, RoundingMode.HALF_UP); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV