分账计算代码优化
This commit is contained in:
parent
040c6d3cb1
commit
c5f5978b41
@ -345,7 +345,7 @@ public class LklSeparateWithTotalAmountDTO {
|
|||||||
|
|
||||||
// 2. 校验实际可分账金额不能小于0
|
// 2. 校验实际可分账金额不能小于0
|
||||||
if (actualCanSeparateAmount < 0) {
|
if (actualCanSeparateAmount < 0) {
|
||||||
return Pair.of(false, "实际可分账金额不能为负数");
|
return Pair.of(false, "实际可分账金额不能小于0");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 初始化剩余金额为实际可分账金额
|
// 3. 初始化剩余金额为实际可分账金额
|
||||||
@ -358,7 +358,7 @@ public class LklSeparateWithTotalAmountDTO {
|
|||||||
|
|
||||||
// 校验平台分账金额不能为负数
|
// 校验平台分账金额不能为负数
|
||||||
if (platAmount < 0) {
|
if (platAmount < 0) {
|
||||||
return Pair.of(false, "平台分账金额计算异常");
|
return Pair.of(false, "平台分账金额不能小于0");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保不超过剩余金额
|
// 确保不超过剩余金额
|
||||||
@ -383,7 +383,7 @@ public class LklSeparateWithTotalAmountDTO {
|
|||||||
|
|
||||||
// 校验二级代理商分账金额不能为负数
|
// 校验二级代理商分账金额不能为负数
|
||||||
if (agent2ndAmount < 0) {
|
if (agent2ndAmount < 0) {
|
||||||
return Pair.of(false, "二级代理商分账金额计算异常");
|
return Pair.of(false, "二级代理商分账金额不能小于0");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保不超过剩余金额
|
// 确保不超过剩余金额
|
||||||
@ -401,7 +401,7 @@ public class LklSeparateWithTotalAmountDTO {
|
|||||||
|
|
||||||
// 校验一级代理商分账金额不能为负数
|
// 校验一级代理商分账金额不能为负数
|
||||||
if (agent1stAmount < 0) {
|
if (agent1stAmount < 0) {
|
||||||
return Pair.of(false, "一级代理商分账金额计算异常");
|
return Pair.of(false, "一级代理商分账金额不能小于0");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保不超过剩余金额
|
// 确保不超过剩余金额
|
||||||
@ -416,7 +416,7 @@ public class LklSeparateWithTotalAmountDTO {
|
|||||||
|
|
||||||
// 校验商家分账金额不能为负数
|
// 校验商家分账金额不能为负数
|
||||||
if (mchAmount < 0) {
|
if (mchAmount < 0) {
|
||||||
return Pair.of(false, "商家分账金额计算异常");
|
return Pair.of(false, "商家分账金额不能小于0");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Pair.of(true, "");
|
return Pair.of(true, "");
|
||||||
@ -439,7 +439,7 @@ public class LklSeparateWithTotalAmountDTO {
|
|||||||
String errorMsg = String.format("警告: 商家实际分账比例低于阈值,当前比例: %s,阈值: %s",
|
String errorMsg = String.format("警告: 商家实际分账比例低于阈值,当前比例: %s,阈值: %s",
|
||||||
mchRatio.toPlainString(), MCH_RATIO_THRESHOLD.toPlainString());
|
mchRatio.toPlainString(), MCH_RATIO_THRESHOLD.toPlainString());
|
||||||
log.warn(errorMsg);
|
log.warn(errorMsg);
|
||||||
return Pair.of(false, "商家分账低于阈值");
|
return Pair.of(false, errorMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,7 +461,7 @@ public class LklSeparateWithTotalAmountDTO {
|
|||||||
if (totalAmount > getValueOrZero(totalSeparateAmount)) {
|
if (totalAmount > getValueOrZero(totalSeparateAmount)) {
|
||||||
String errorMsg = String.format("分账金额总和(%d)超过总金额(%d)",
|
String errorMsg = String.format("分账金额总和(%d)超过总金额(%d)",
|
||||||
totalAmount, getValueOrZero(totalSeparateAmount));
|
totalAmount, getValueOrZero(totalSeparateAmount));
|
||||||
return Pair.of(false, "分账金额总和超过总金额: " + errorMsg);
|
return Pair.of(false, errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Pair.of(true, "");
|
return Pair.of(true, "");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user