Browse Source

提现账户还原提现中的金额到余额

wangwl 2 days ago
parent
commit
536751c362

+ 7 - 0
leromro-core/src/main/java/com/leromro/core/service/impl/VolunteerPaymentRecordsServiceImpl.java

@@ -254,6 +254,13 @@ public class VolunteerPaymentRecordsServiceImpl extends ServiceImpl<VolunteerPay
                 SendSmsUtil.send(user.getPhonenumber(), json.toString(), ConstantsConfig.SMS_TEMPLATE_TYPE_VOLUNTEER_WITGDRAW.getValue());
 
             } else {
+                //修改账户提现中的金额,把当前申请单金额加到账户余额中,把提现申请单金额从账户提现中的金额中减去
+                VolunteerAccount driverAccount = volunteerAccountService.getById(takeAmountRecord.getVolunteerAccountId());
+                BigDecimal subtract = driverAccount.getBeBalance().subtract(takeAmountRecord.getTakeAmount());
+                driverAccount.setBeBalance(subtract.compareTo(BigDecimal.ZERO) < 0 ? new BigDecimal(BigInteger.ZERO) : subtract);
+                driverAccount.setBalance(driverAccount.getBalance().add(takeAmountRecord.getTakeAmount()));
+                volunteerAccountService.updateById(driverAccount);
+
                 takeAmountRecord.setIsPay("2");
                 takeAmountRecord.setUpdateTime(new Date());
                 takeAmountRecord.setPayNote(response.getSubMsg());