mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 05:42:06 +08:00
1、产品管理、定价规则接口完善;2、支付测试;
This commit is contained in:
+13
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -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;
|
||||
}
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import org.springframework.context.annotation.Bean;
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@EnableConfigurationProperties({ChenfengAlipayConfig.class, ChenfengWechatPayConfig.class})
|
||||
@EnableConfigurationProperties({ChenfengAlipayConfig.class, ChenfengWechatPayConfig.class, ChenfengPayConfig.class})
|
||||
public class ChenfengPayAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.cf.imes.framework.pay.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2025/8/12 15:55
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "chenfeng.pay")
|
||||
@Data
|
||||
public class ChenfengPayConfig {
|
||||
/**
|
||||
* 支付超时时间
|
||||
*/
|
||||
private Duration payExpireTime = Duration.ofMinutes(5);
|
||||
}
|
||||
Reference in New Issue
Block a user