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

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

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