|
|
@@ -299,27 +299,39 @@ public class TransferFuncServiceImpl implements TransferFuncService {
|
|
|
distributeMoneyApply = userDistributeMapper.selectRelationBusiness(userId);
|
|
|
isTakeAll = true;
|
|
|
}
|
|
|
- BigDecimal userPoints = user.getPoints();
|
|
|
- DistributePointsExchangeMoney distributePointsExchangeMoney = distributePointsExchangeMoneyMapper.selectOne(Wrappers.lambdaQuery(DistributePointsExchangeMoney.class).orderByDesc(DistributePointsExchangeMoney::getPoints).last("limit 1"));
|
|
|
- BigDecimal minPoints = BigDecimal.valueOf(distributePointsExchangeMoney.getMinPoints());
|
|
|
- BigDecimal ratePoints = BigDecimal.valueOf(distributePointsExchangeMoney.getPoints());
|
|
|
- BigDecimal minMoney = distributePointsExchangeMoney.getMoney();
|
|
|
- if (userPoints.compareTo(minPoints) < 0) {
|
|
|
- throw BusinessRuntimeException.getInstance("您当前积分未达到积分门槛,无法提现");
|
|
|
- }
|
|
|
// //今日是否已提现
|
|
|
// DistributeMoneyApply apply = distributeMoneyApplyMapper.selectOne(Wrappers.lambdaQuery(DistributeMoneyApply.class).eq(DistributeMoneyApply::getUserId, userId).between(DistributeMoneyApply::getCreatedTime, DateUtil.beginOfDay(DateTime.now()), DateUtil.endOfDay(DateTime.now())).last("limit 1"));
|
|
|
// if (apply != null) {
|
|
|
// throw BusinessRuntimeException.getInstance("今日已提现,请明日再进行操作");
|
|
|
// }
|
|
|
- BigDecimal num = userPoints.divide(ratePoints, 0, RoundingMode.DOWN);
|
|
|
- BigDecimal needApplyMoney = num.multiply(minMoney);
|
|
|
- BigDecimal needSubPoints = num.multiply(ratePoints);
|
|
|
- BigDecimal fourHundred = BigDecimal.valueOf(4 * 100 * 100);
|
|
|
- if (isTakeAll == null || !isTakeAll) {
|
|
|
- if (needApplyMoney.compareTo(fourHundred) > 0) {
|
|
|
- needApplyMoney = fourHundred;
|
|
|
- needSubPoints = fourHundred.divide(minMoney).multiply(ratePoints);
|
|
|
+ BigDecimal userPoints = null;
|
|
|
+ BigDecimal needSubPoints = null;
|
|
|
+ BigDecimal needApplyMoney = null;
|
|
|
+ BigDecimal fourHundred = null;
|
|
|
+ if (mType == DistributeMoneyApply.MType.ds) {
|
|
|
+ userPoints = user.getPoints();
|
|
|
+ DistributePointsExchangeMoney distributePointsExchangeMoney = distributePointsExchangeMoneyMapper.selectOne(Wrappers.lambdaQuery(DistributePointsExchangeMoney.class).orderByDesc(DistributePointsExchangeMoney::getPoints).last("limit 1"));
|
|
|
+ BigDecimal minPoints = BigDecimal.valueOf(distributePointsExchangeMoney.getMinPoints());
|
|
|
+ BigDecimal ratePoints = BigDecimal.valueOf(distributePointsExchangeMoney.getPoints());
|
|
|
+ BigDecimal minMoney = distributePointsExchangeMoney.getMoney();
|
|
|
+ if (userPoints.compareTo(minPoints) < 0) {
|
|
|
+ throw BusinessRuntimeException.getInstance("您当前积分未达到积分门槛,无法提现");
|
|
|
+ }
|
|
|
+ BigDecimal num = userPoints.divide(ratePoints, 0, RoundingMode.DOWN);
|
|
|
+ needApplyMoney = num.multiply(minMoney);
|
|
|
+ needSubPoints = num.multiply(ratePoints);
|
|
|
+ fourHundred = BigDecimal.valueOf(4 * 100 * 100);
|
|
|
+ if (isTakeAll == null || !isTakeAll) {
|
|
|
+ if (needApplyMoney.compareTo(fourHundred) > 0) {
|
|
|
+ needApplyMoney = fourHundred;
|
|
|
+ needSubPoints = fourHundred.divide(minMoney).multiply(ratePoints);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (mType == DistributeMoneyApply.MType.sub) {
|
|
|
+ needApplyMoney = user.getSubApplyMoney();
|
|
|
+ if (needApplyMoney.compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
+ throw BusinessRuntimeException.getInstance("您暂无可提现金额..");
|
|
|
}
|
|
|
}
|
|
|
Integer update = 0;
|