mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-11 02:40:15 +08:00
update huifu
This commit is contained in:
@@ -296,7 +296,7 @@ public class OrderService {
|
|||||||
createAdaPaymentParam.setApp_id("app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa"); // todo 后面移动到配置文件中
|
createAdaPaymentParam.setApp_id("app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa"); // todo 后面移动到配置文件中
|
||||||
createAdaPaymentParam.setPay_channel("wx_lite"); // todo 如果以后有支付宝等别的渠道,这里需要做修改,判断是什么渠道的请求
|
createAdaPaymentParam.setPay_channel("wx_lite"); // todo 如果以后有支付宝等别的渠道,这里需要做修改,判断是什么渠道的请求
|
||||||
createAdaPaymentParam.setGoods_title("充电费用1");
|
createAdaPaymentParam.setGoods_title("充电费用1");
|
||||||
createAdaPaymentParam.setGoods_desc("充电费用2");
|
createAdaPaymentParam.setGoods_desc("充电费用2"); // 这个字段是微信支付凭证的商品名
|
||||||
createAdaPaymentParam.setDescription("充电费用3");
|
createAdaPaymentParam.setDescription("充电费用3");
|
||||||
createAdaPaymentParam.setExpend(JSONObject.toJSONString( ImmutableMap.of("open_id", openId)));
|
createAdaPaymentParam.setExpend(JSONObject.toJSONString( ImmutableMap.of("open_id", openId)));
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -3,7 +3,11 @@ package com.jsowell.common.util;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 汇付支付的工具类
|
||||||
|
*/
|
||||||
public class AdapayUtil {
|
public class AdapayUtil {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String amount = "1110.5309";
|
String amount = "1110.5309";
|
||||||
String s = formatAmount(amount);
|
String s = formatAmount(amount);
|
||||||
@@ -14,15 +18,24 @@ public class AdapayUtil {
|
|||||||
System.out.println(s2);
|
System.out.println(s2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 格式化数字 保留两位小数,不足补0
|
/**
|
||||||
|
* 格式化数字 保留两位小数,不足补0
|
||||||
|
* @param amount
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public static String formatAmount(String amount) {
|
public static String formatAmount(String amount) {
|
||||||
//保留2位小数
|
//保留2位小数
|
||||||
double score = new BigDecimal(amount).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
double d = new BigDecimal(amount).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||||
//不足两位则补0
|
//不足两位则补0
|
||||||
DecimalFormat decimalFormat = new DecimalFormat("0.00#");
|
DecimalFormat decimalFormat = new DecimalFormat("0.00#");
|
||||||
return decimalFormat.format(score);
|
return decimalFormat.format(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化数字 保留两位小数,不足补0
|
||||||
|
* @param amount
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public static String formatAmount(BigDecimal amount) {
|
public static String formatAmount(BigDecimal amount) {
|
||||||
return formatAmount(amount.toString());
|
return formatAmount(amount.toString());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user