|
|
|
@ -95,29 +95,31 @@ public class WalletAccountQueryServiceImpl implements WalletAccountQueryService |
|
|
|
public BigDecimal countAvailableWithdrawBalance(WalletAccount walletAccount) { |
|
|
|
BigDecimal availableBalance = walletAccount.getAvailableBalance(); |
|
|
|
BigDecimal unavailableWithdrawBalance; |
|
|
|
MatchmakerLevelEnum matchmakerLevel = matchmakerQueryService.queryLevelByUserId(walletAccount.getUserId()); |
|
|
|
if (Objects.isNull(matchmakerLevel) || matchmakerLevel.getLevel() < MatchmakerLevelEnum.MATCHMAKER_PARTNER.getLevel()) { |
|
|
|
//普通提现 月薪 |
|
|
|
LocalDate date = LocalDate.now(); |
|
|
|
int months = 0; |
|
|
|
if (date.getDayOfMonth() < 15) { |
|
|
|
//可结算上一个月 |
|
|
|
months = 1; |
|
|
|
} |
|
|
|
//不可提现的金额 |
|
|
|
unavailableWithdrawBalance = countUnavailableWithdrawBalanceByMonth(walletAccount.getId(), date, months); |
|
|
|
} else { |
|
|
|
// 高级红娘以上 周薪制 |
|
|
|
LocalDate date = LocalDate.now(); |
|
|
|
DayOfWeek dayOfWeek = date.getDayOfWeek(); |
|
|
|
int days = dayOfWeek.getValue() - 1; |
|
|
|
if (dayOfWeek.getValue() < DayOfWeek.WEDNESDAY.getValue()) { |
|
|
|
//可结算上一个周 |
|
|
|
days += DayOfWeek.SUNDAY.getValue(); |
|
|
|
} |
|
|
|
//不可提现的金额 |
|
|
|
unavailableWithdrawBalance = countUnavailableWithdrawBalanceByDays(walletAccount.getId(), date, days); |
|
|
|
} |
|
|
|
// MatchmakerLevelEnum matchmakerLevel = matchmakerQueryService.queryLevelByUserId(walletAccount.getUserId()); |
|
|
|
// if (Objects.isNull(matchmakerLevel) || matchmakerLevel.getLevel() < MatchmakerLevelEnum.MATCHMAKER_PARTNER.getLevel()) { |
|
|
|
// //普通提现 月薪 |
|
|
|
// LocalDate date = LocalDate.now(); |
|
|
|
// int months = 0; |
|
|
|
// if (date.getDayOfMonth() < 15) { |
|
|
|
// //可结算上一个月 |
|
|
|
// months = 1; |
|
|
|
// } |
|
|
|
// //不可提现的金额 |
|
|
|
// unavailableWithdrawBalance = countUnavailableWithdrawBalanceByMonth(walletAccount.getId(), date, months); |
|
|
|
// } else { |
|
|
|
// // 高级红娘以上 周薪制 |
|
|
|
// LocalDate date = LocalDate.now(); |
|
|
|
// DayOfWeek dayOfWeek = date.getDayOfWeek(); |
|
|
|
// int days = dayOfWeek.getValue() - 1; |
|
|
|
// if (dayOfWeek.getValue() < DayOfWeek.WEDNESDAY.getValue()) { |
|
|
|
// //可结算上一个周 |
|
|
|
// days += DayOfWeek.SUNDAY.getValue(); |
|
|
|
// } |
|
|
|
// //不可提现的金额 |
|
|
|
// unavailableWithdrawBalance = countUnavailableWithdrawBalanceByDays(walletAccount.getId(), date, days); |
|
|
|
// } |
|
|
|
LocalDate date = LocalDate.now(); |
|
|
|
unavailableWithdrawBalance = countUnavailableWithdrawBalanceByDays(walletAccount.getId(), date, 2); |
|
|
|
return availableBalance.compareTo(unavailableWithdrawBalance) > 0 ? availableBalance.subtract(unavailableWithdrawBalance) : BigDecimal.ZERO; |
|
|
|
} |
|
|
|
|
|
|
|
|