|
|
@@ -220,10 +220,20 @@ public class ParkingWalletFeeService {
|
|
|
|
|
|
KwtParkingWalletFee walletFee = parkingWalletFeeRepository.getById(param.getId());
|
|
|
if (walletFee == null) {
|
|
|
- throw new BusinessPlatfromException(ErrorCodeEnum.DRIVER_NOT_FOUND, "服务费信息不存在");
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.PARAM_ERROR, "服务费信息不存在");
|
|
|
}
|
|
|
+
|
|
|
+ // 预付
|
|
|
+ if (Objects.equals(param.getPaymentType(), 1)) {
|
|
|
+ walletFee.setServiceFeeBalance(walletFee.getServiceFeeBalance().add(param.getServiceFee()));
|
|
|
+ }else {
|
|
|
+ if (walletFee.getServiceFeeBalance().compareTo(param.getServiceFee()) < 0) {
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.PARAM_ERROR, "扣款金额不能大于服务余额");
|
|
|
+ }
|
|
|
+ walletFee.setServiceFeeBalance(walletFee.getServiceFeeBalance().subtract(param.getServiceFee()));
|
|
|
+ }
|
|
|
+
|
|
|
// 1. 先修改服务余额
|
|
|
- walletFee.setServiceFeeBalance(walletFee.getServiceFeeBalance().add(param.getServiceFee()));
|
|
|
parkingWalletFeeRepository.updateById(walletFee);
|
|
|
|
|
|
// 2.新增明细
|
|
|
@@ -231,6 +241,7 @@ public class ParkingWalletFeeService {
|
|
|
feeBalance.setSupEntId(param.getSupEntId());
|
|
|
feeBalance.setProEntId(param.getProEntId());
|
|
|
feeBalance.setTradeType(9);
|
|
|
+ feeBalance.setPaymentType(param.getPaymentType());
|
|
|
feeBalance.setTradeAmount(param.getServiceFee());
|
|
|
feeBalance.setServiceFeeBalance(walletFee.getServiceFeeBalance());
|
|
|
feeBalance.setTradingAmount(walletFee.getTradingAmount());
|
|
|
@@ -298,7 +309,8 @@ public class ParkingWalletFeeService {
|
|
|
resp.setSupEntName(getEntName(feeBalance.getSupEntId()));
|
|
|
resp.setTradeType(feeBalance.getTradeType());
|
|
|
resp.setTradeTypeDesc(WalletTypEnum.getDescByCode(feeBalance.getTradeType()));
|
|
|
- resp.setTradeAmount(feeBalance.getTradeAmount());
|
|
|
+ resp.setPaymentType(feeBalance.getPaymentType());
|
|
|
+ resp.setTradeAmount(Objects.equals(feeBalance.getPaymentType(), 1) ? feeBalance.getTradeAmount() : feeBalance.getTradeAmount().negate());
|
|
|
resp.setServiceFeeBalance(feeBalance.getServiceFeeBalance());
|
|
|
resp.setTradingAmount(feeBalance.getTradingAmount());
|
|
|
resp.setVoucherUrl(feeBalance.getVoucherUrl());
|