1、产品管理、定价规则接口完善;2、支付测试;

This commit is contained in:
gaoqr
2025-08-12 16:44:07 +08:00
parent 280a3392aa
commit c985272d58
29 changed files with 563 additions and 244 deletions
@@ -1,7 +1,9 @@
package com.cf.imes.framework.common.util.Assert;
import cn.hutool.core.util.ObjectUtil;
import com.cf.imes.framework.common.exception.ErrorCode;
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
import org.springframework.util.ObjectUtils;
import java.util.List;
@@ -38,6 +40,12 @@ public class AssertUtils {
}
}
public static void empty(List<?> array, ErrorCode errorCode, Object... params) {
if (!ObjectUtils.isEmpty(array)) {
throw ServiceExceptionUtil.exception(errorCode, params);
}
}
public static void empty(Object object, ErrorCode errorCode) {
if (object != null) {
throw exception(errorCode);
@@ -64,4 +72,9 @@ public class AssertUtils {
}
}
public static void notEquals(Object obj1, Object obj2, ErrorCode errorCode) {
if (ObjectUtil.notEqual(obj1, obj2)) {
throw exception(errorCode);
}
}
}
@@ -17,7 +17,7 @@ public class NumberValidator implements ConstraintValidator<NumberValid, Number>
private static final String GREATER_THAN_ZERO_NOTIFICATION = "%s必须大于0";
private static final String FLOAT_NUMBER_LENGTH_ERROR_NOTIFICATION = "%s长度不合法,总长度不超过8位,小数点后不超过3";
private static final String FLOAT_NUMBER_LENGTH_ERROR_NOTIFICATION = "%s长度不合法,总长度不超过%d位,小数点后不超过%d";
private String name;
@@ -104,13 +104,13 @@ public class NumberValidator implements ConstraintValidator<NumberValid, Number>
int integerPartLength = split[0].length();
// 获取小数点后的位数
int fractionalPartLength = 0;
if (split.length > 2) {
if (split.length == 2) {
fractionalPartLength = split[1].length();
}
// 总位数不超过 8 位,小数点后位数不超过 3 位
if (integerPartLength > integer || fractionalPartLength > fraction) {
return String.format(FLOAT_NUMBER_LENGTH_ERROR_NOTIFICATION, name);
return String.format(FLOAT_NUMBER_LENGTH_ERROR_NOTIFICATION, name, integer, fraction);
}
return null;
}
@@ -131,13 +131,13 @@ public class NumberValidator implements ConstraintValidator<NumberValid, Number>
int integerPartLength = split[0].length();
// 获取小数点后的位数
int fractionalPartLength = 0;
if (split.length > 2) {
if (split.length == 2) {
fractionalPartLength = split[1].length();
}
// 总位数不超过 8 位,小数点后位数不超过 3 位
if (integerPartLength > integer || fractionalPartLength > fraction) {
return String.format(FLOAT_NUMBER_LENGTH_ERROR_NOTIFICATION, name);
return String.format(FLOAT_NUMBER_LENGTH_ERROR_NOTIFICATION, name, integer, fraction);
}
return null;
}