解决手续费计算规则

This commit is contained in:
kuang.yife 2022-11-23 14:16:45 +08:00
parent 4882e59be9
commit b11b8b9c2b
2 changed files with 3 additions and 2 deletions

View File

@ -50,7 +50,7 @@ public class AdapayUtils {
* @return 保留两位小数的String * @return 保留两位小数的String
*/ */
public static String bigDecimalToString(BigDecimal b) { public static String bigDecimalToString(BigDecimal b) {
return b.setScale(2, RoundingMode.HALF_UP).toString(); return b.setScale(2, RoundingMode.CEILING).toString();
} }
public synchronized static String createOrderNo(AdapayOrderType type) { public synchronized static String createOrderNo(AdapayOrderType type) {

View File

@ -38,6 +38,7 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder; import java.time.format.DateTimeFormatterBuilder;
@ -350,7 +351,7 @@ public class OrderDetailServiceImpl implements OrderDetailService {
DivMember feeDivMember = new DivMember("0", AdapayUtils.bigDecimalToString(fee), true); DivMember feeDivMember = new DivMember("0", AdapayUtils.bigDecimalToString(fee), true);
divMembers.add(feeDivMember); divMembers.add(feeDivMember);
BigDecimal totalMoney = feeAmount.add(fee); BigDecimal totalMoney = feeAmount.add(fee.setScale(2, RoundingMode.CEILING));
// 扣除交易费用 // 扣除交易费用
String sureMoney = AdapayUtils.bigDecimalToString(totalMoney); String sureMoney = AdapayUtils.bigDecimalToString(totalMoney);