update huifu

This commit is contained in:
2023-05-16 16:24:26 +08:00
parent 87666032b2
commit eef6af1c6c
6 changed files with 150 additions and 35 deletions

View File

@@ -94,6 +94,10 @@ public enum ReturnCodeEnum {
CODE_STATION_IS_NOT_OPEN("00100045", "该站点暂未营业"),
CODE_MEMBER_RECHARGE_BALANCE_ERROR("00100046", "会员充值余额失败"),
/* 个人桩 start */
CODE_PILE_HAS_BEEN_BINDING_ERROR("00400001", "此桩已被绑定,请联系管理员!"),
CODE_AUTHENTICATION_ERROR("00400002", "您的身份信息验证有误,请重试!"),
@@ -114,6 +118,8 @@ public enum ReturnCodeEnum {
CODE_GET_PERSONAL_PILE_CONNECTOR_INFO_ERROR("00400010", "获取个人桩枪口实时数据异常"),
/* 个人桩 end */
CODE_THIS_CARNO_HAS_BEEN_BINDING("00500001", "当前车牌号已经绑定,请检查!"),
CODE_USER_BINDING_CARNO_ERROR("00500002", "用户绑定车牌号异常"),

View File

@@ -0,0 +1,29 @@
package com.jsowell.common.util;
import java.math.BigDecimal;
import java.text.DecimalFormat;
public class AdapayUtil {
public static void main(String[] args) {
String amount = "1110.5309";
String s = formatAmount(amount);
System.out.println(s);
BigDecimal bigDecimal = new BigDecimal(amount);
String s2 = formatAmount(bigDecimal);
System.out.println(s2);
}
// 格式化数字 保留两位小数不足补0
public static String formatAmount(String amount) {
//保留2位小数
double score = new BigDecimal(amount).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
//不足两位则补0
DecimalFormat decimalFormat = new DecimalFormat("0.00#");
return decimalFormat.format(score);
}
public static String formatAmount(BigDecimal amount) {
return formatAmount(amount.toString());
}
}