提交 f32318ad authored 作者: 胡宁宁's avatar 胡宁宁

如果运费为负,那么保证金冻结为0元

上级 d1507afc
......@@ -20,6 +20,10 @@ public class PayPlatformFeeParam {
@ApiModelProperty(value = "金额", example = "2356", dataType = "int")
Integer figure;
@ApiModelProperty(value = "最新冻结金额金额", example = "2356", dataType = "int")
Integer figureNew;
@NotBlank(message = "交易单号不能为空")
@ApiModelProperty(value = "交易单号", example = "2356", dataType = "String")
String tradeNo;
......
......@@ -156,7 +156,7 @@ public class OrderChildPoundAuditServiceImpl implements OrderChildPoundAuditSer
//判断是否平衡冻结金额
if(Objects.nonNull(paymentDTO.getChangeDeposit()) &&
paymentDTO.getChangeDeposit().compareTo(BigDecimal.ZERO) !=0){
paymentChangePlatformFee(orderChild.getChildNo(),paymentDTO.getChangeDeposit());
paymentChangePlatformFee(orderChild.getChildNo(),paymentDTO.getChangeDeposit(),paymentDTO.getPlatformServiceFeeNew());
}
//保存运单日志数据
orderChildLogService.saveOrderChildLog(param.getChildNo(),type,OrderChildLogEnum.Type.getByCode(type).isPresent() ? OrderChildLogEnum.Type.getByCode(type).get().getMsg() :"",
......@@ -167,11 +167,12 @@ public class OrderChildPoundAuditServiceImpl implements OrderChildPoundAuditSer
/***
* 平衡司机冻结保证金
*/
public void paymentChangePlatformFee(String childNo,BigDecimal changeDeposite){
public void paymentChangePlatformFee(String childNo,BigDecimal changeDeposite,BigDecimal figureNew){
if(changeDeposite.compareTo(BigDecimal.ZERO) !=0){
PayPlatformFeeParam payPlatformFeeParam = new PayPlatformFeeParam();
payPlatformFeeParam.setTradeNo(childNo);
payPlatformFeeParam.setFigure(changeDeposite.intValue());
payPlatformFeeParam.setFigureNew(figureNew.intValue());
//冻结司机押金
paymentService.paymentChangePlatformFee(payPlatformFeeParam);
}
......@@ -226,6 +227,9 @@ public class OrderChildPoundAuditServiceImpl implements OrderChildPoundAuditSer
//本次调整金额
BigDecimal platformServiceFeeNew = BigDecimal.ZERO;
log.info("运单号 {} ,原始冻结金额 {} ",orderChild.getChildNo(),platformServiceFee);
if(freight.compareTo(BigDecimal.ZERO)<=0){
return PaymentDTO.builder().changeDeposit(platformServiceFee.multiply(new BigDecimal("-1"))).platformServiceFeeNew(platformServiceFeeNew).build();
}
/**
* 如果之前未冻结保证金,本次不调整
* 如果 平台服务费率 为0 本次不处理
......
......@@ -819,7 +819,7 @@ public class OrderChildServiceImpl implements OrderChildService {
//判断是否平衡冻结金额
if(Objects.nonNull(paymentDTO.getChangeDeposit()) &&
paymentDTO.getChangeDeposit().compareTo(BigDecimal.ZERO) !=0){
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit());
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit(),paymentDTO.getPlatformServiceFeeNew());
}
} else {
//计算司机保证金
......@@ -837,7 +837,7 @@ public class OrderChildServiceImpl implements OrderChildService {
//判断是否平衡冻结金额
if(Objects.nonNull(paymentDTO.getChangeDeposit()) &&
paymentDTO.getChangeDeposit().compareTo(BigDecimal.ZERO) !=0){
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit());
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit(),paymentDTO.getPlatformServiceFeeNew());
}
}
}
......@@ -1018,7 +1018,7 @@ public class OrderChildServiceImpl implements OrderChildService {
//判断是否平衡冻结金额
if(Objects.nonNull(paymentDTO.getChangeDeposit()) &&
paymentDTO.getChangeDeposit().compareTo(BigDecimal.ZERO) !=0){
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit());
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit(),paymentDTO.getPlatformServiceFeeNew());
}
} else {
//计算司机保证金
......@@ -1039,7 +1039,7 @@ public class OrderChildServiceImpl implements OrderChildService {
//判断是否平衡冻结金额
if(Objects.nonNull(paymentDTO.getChangeDeposit()) &&
paymentDTO.getChangeDeposit().compareTo(BigDecimal.ZERO) !=0){
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit());
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit(),paymentDTO.getPlatformServiceFeeNew());
}
}
}
......@@ -1047,11 +1047,12 @@ public class OrderChildServiceImpl implements OrderChildService {
/***
* 平衡司机冻结保证金
*/
public void paymentChangePlatformFee(String childNo,BigDecimal changeDeposite){
public void paymentChangePlatformFee(String childNo,BigDecimal changeDeposite,BigDecimal deposite){
if(changeDeposite.compareTo(BigDecimal.ZERO) !=0){
PayPlatformFeeParam payPlatformFeeParam = new PayPlatformFeeParam();
payPlatformFeeParam.setTradeNo(childNo);
payPlatformFeeParam.setFigure(changeDeposite.intValue());
payPlatformFeeParam.setFigureNew(deposite.intValue());
//冻结司机押金
paymentService.paymentChangePlatformFee(payPlatformFeeParam);
}
......@@ -1299,7 +1300,7 @@ public class OrderChildServiceImpl implements OrderChildService {
//判断是否平衡冻结金额
if(Objects.nonNull(paymentDTO.getChangeDeposit()) &&
paymentDTO.getChangeDeposit().compareTo(BigDecimal.ZERO) !=0){
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit());
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit(),paymentDTO.getPlatformServiceFeeNew());
}
}
......
......@@ -43,6 +43,7 @@ import java.security.GeneralSecurityException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.stream.Collectors;
......@@ -253,8 +254,13 @@ public class PaymentServiceImpl implements PaymentService {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR);
}
if (notify.getCode() != 0) {
if(Objects.equals(notify.getCode(),"")){
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR,
"预估接单保证金"+new BigDecimal(param.getFigureNew()).movePointLeft(2)+"元,车主钱包余额不足,请先充值");
}else{
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, notify.getMsg());
}
}
return notify;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论