mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-09-03 19:16:21 +00:00
ref 支付宝支付替换为原生SDK方式, 调整一些数据库字段必填和长度属性
This commit is contained in:
@@ -24,7 +24,7 @@ public class AllocationParam extends PaymentCommonParam {
|
||||
@NotBlank(message = "商户分账单号不可为空")
|
||||
@Size(max = 100, message = "商户分账单号不可超过100位")
|
||||
@Schema(description = "商户分账单号")
|
||||
private String bizAllocationNo;
|
||||
private String bizAllocNo;
|
||||
|
||||
/** 支付订单号 */
|
||||
@Size(max = 32, message = "支付订单号不可超过32位")
|
||||
|
@@ -4,10 +4,13 @@ import cn.bootx.platform.common.core.util.LocalDateTimeUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 支付工具类
|
||||
@@ -51,7 +54,7 @@ public class PayUtil {
|
||||
* @param amount 元的金额
|
||||
* @return 分的金额
|
||||
*/
|
||||
public static int convertCentAmount(BigDecimal amount) {
|
||||
public int convertCentAmount(BigDecimal amount) {
|
||||
return amount.multiply(HUNDRED).setScale(0, RoundingMode.HALF_UP).intValue();
|
||||
}
|
||||
|
||||
@@ -61,7 +64,27 @@ public class PayUtil {
|
||||
* @param amount 元的金额
|
||||
* @return 元的金额 两位小数
|
||||
*/
|
||||
public static BigDecimal conversionAmount(int amount) {
|
||||
public BigDecimal conversionAmount(int amount) {
|
||||
return BigDecimal.valueOf(amount).divide(HUNDRED,2, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取请求参数
|
||||
*/
|
||||
public Map<String, String> toMap(HttpServletRequest request) {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
Map<String, String[]> requestParams = request.getParameterMap();
|
||||
|
||||
for (String name : requestParams.keySet()) {
|
||||
String[] values = requestParams.get(name);
|
||||
String valueStr = "";
|
||||
|
||||
for (int i = 0; i < values.length; ++i) {
|
||||
valueStr = i == values.length - 1 ? valueStr + values[i] : valueStr + values[i] + ",";
|
||||
}
|
||||
|
||||
params.put(name, valueStr);
|
||||
}
|
||||
return params;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user