最新代码

This commit is contained in:
admin
2024-05-06 10:20:46 +08:00
parent a0cd0312a5
commit 2919029b81
126 changed files with 5276 additions and 1137 deletions

View File

@@ -0,0 +1,36 @@
package com.starry.admin.utils;
import com.starry.admin.common.exception.CustomException;
/**
* 金额辅助类
*/
public class MoneyUtils {
/**
* 校验金钱值是否正常
*
* @param money 金钱值
*/
public static void verificationTypeIsNormal(String money) {
if (money == null || money.isEmpty()) {
throw new CustomException("金额类型异常");
}
float item;
try {
item = Float.parseFloat(money);
} catch (Exception e) {
throw new CustomException("金额类型异常");
}
if (item < 0f) {
throw new CustomException("金额不能小于0");
}
if (item > Integer.MAX_VALUE) {
throw new CustomException("金额超出计算范围");
}
}
}