修改可提金额判断
This commit is contained in:
@@ -225,17 +225,6 @@ public class CashServiceImpl extends ServiceImpl<CashMapper, Cash> implements Ca
|
||||
throw new MsgException("提现金额必须大于" + Cash.MINIMUM_CASH + "元");
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<Cash> qWrapper = Wrappers.lambdaQuery();
|
||||
qWrapper.eq(Cash::getUserId, cash.getUserId())
|
||||
.orderByDesc(Cash::getCreateDt)
|
||||
.last("limit 1");
|
||||
Cash existData = getOne(qWrapper);
|
||||
|
||||
//TODO 注释提现限制,后面要取消
|
||||
/* if (existData != null && DateUtil.isSameDay(new Date(), existData.getCreateDt())) {
|
||||
throw new MsgException("一天只能提现一次");
|
||||
}
|
||||
*/
|
||||
LambdaQueryWrapper<CashAccount> qWrapper2 = Wrappers.lambdaQuery();
|
||||
qWrapper2.eq(CashAccount::getUserId, cash.getUserId())
|
||||
.last("limit 1");
|
||||
@@ -251,36 +240,14 @@ public class CashServiceImpl extends ServiceImpl<CashMapper, Cash> implements Ca
|
||||
throw new MsgException("请先补充提现账户信息");
|
||||
}
|
||||
|
||||
// ======查询可提现金额
|
||||
// 查询商户所有分润
|
||||
BigDecimal totalProfit = mpService.getSumValidProfit(cash.getUserId() + "");
|
||||
if (totalProfit == null) {
|
||||
totalProfit = BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(tokenUa.getMerchantCode())) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("lastMerchantCode", tokenUa.getMerchantCode());
|
||||
// 查询可提现粉丝分润
|
||||
// Double sum = fansService.queryFansSumShareMoney(map);
|
||||
// if (sum != null) {
|
||||
// BigDecimal fansProfit = BigDecimal.valueOf(sum);
|
||||
// totalProfit = totalProfit.add(fansProfit);
|
||||
// }
|
||||
}
|
||||
|
||||
// 查询商户已提现总数
|
||||
//BigDecimal totalCashAmt = getSumValidCashAmtTotal(cash.getUserId() + "");
|
||||
UserAccount userAccountByUserId = userAccountService.getUserAccountByUserId(cash.getUserId());
|
||||
if (userAccountByUserId == null) {
|
||||
throw new MsgException("可提现金额不足!");
|
||||
}
|
||||
// 校验提现金额是否充足
|
||||
int flag = cash.getCashAmt().compareTo(totalProfit.subtract(userAccountByUserId.getBalance()));
|
||||
if (flag > 0) {
|
||||
throw new MsgException("可提现金额不足!");
|
||||
}
|
||||
|
||||
UserAccount userAccount = userAccountService.getUserAccountByUserId(cash.getUserId());
|
||||
MsgException.checkNull(userAccount,"可提现金额不足!");
|
||||
cash.setRate(10);
|
||||
cash.setBaseServiceCharge(BigDecimal.ZERO);
|
||||
cash.setRatioCharge(new BigDecimal("0.1"));
|
||||
|
||||
Reference in New Issue
Block a user