余额相关
This commit is contained in:
@@ -129,24 +129,26 @@ public class UserMakerQuotaServiceImpl extends ServiceImpl<UserMakerQuotaMapper,
|
||||
//增加提现金额
|
||||
private void profit(UserPromotion userInfo,BigDecimal consumeFee){
|
||||
UserMakerQuota userMakerQuota = userMakerQuotaMapper.selectByUserId(userInfo.getUserId());
|
||||
BigDecimal sumbigDecimal = userMakerQuota.getAmount();
|
||||
if (sumbigDecimal !=null && sumbigDecimal.compareTo(consumeFee)>=0){
|
||||
BigDecimal profit = consumeFee.multiply(new BigDecimal("0.0038")).setScale(2,BigDecimal.ROUND_DOWN);
|
||||
sumbigDecimal = sumbigDecimal.subtract(consumeFee);
|
||||
String s = String.valueOf(userInfo.getUserId());
|
||||
Integer integer = Integer.valueOf(s);
|
||||
//提现金额
|
||||
userAccountService.modFunds(integer,"SD","免提现额度",profit,"");
|
||||
//额度改变
|
||||
this.modMakerFunds(integer,"SD","免费额度",sumbigDecimal,"");
|
||||
}else {
|
||||
BigDecimal profit = sumbigDecimal.multiply(new BigDecimal("0.0038")).setScale(2, BigDecimal.ROUND_DOWN);
|
||||
String s = String.valueOf(userInfo.getUserId());
|
||||
Integer integer = Integer.valueOf(s);
|
||||
//提现金额
|
||||
userAccountService.modFunds(integer,"SD","免提现额度",profit,"");
|
||||
//额度改变
|
||||
this.modMakerFunds(integer,"SD","免费额度",BigDecimal.ZERO,"");
|
||||
if (userMakerQuota != null) {
|
||||
BigDecimal sumbigDecimal = userMakerQuota.getAmount();
|
||||
if (sumbigDecimal != null && sumbigDecimal.compareTo(consumeFee) >= 0) {
|
||||
BigDecimal profit = consumeFee.multiply(new BigDecimal("0.0038")).setScale(2, BigDecimal.ROUND_DOWN);
|
||||
sumbigDecimal = sumbigDecimal.subtract(consumeFee);
|
||||
String s = String.valueOf(userInfo.getUserId());
|
||||
Integer integer = Integer.valueOf(s);
|
||||
//提现金额
|
||||
userAccountService.modFunds(integer, "LD", "免提现额度", profit, "");
|
||||
//额度改变
|
||||
this.modMakerFunds(integer, "LD", "收款消耗", sumbigDecimal, "");
|
||||
} else {
|
||||
BigDecimal profit = sumbigDecimal.multiply(new BigDecimal("0.0038")).setScale(2, BigDecimal.ROUND_DOWN);
|
||||
String s = String.valueOf(userInfo.getUserId());
|
||||
Integer integer = Integer.valueOf(s);
|
||||
//提现金额
|
||||
userAccountService.modFunds(integer, "LD", "收款消耗", profit, "");
|
||||
//额度改变
|
||||
this.modMakerFunds(integer, "LD", "收款消耗", BigDecimal.ZERO, "");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,11 +14,9 @@ import cn.pluss.platform.common.RiskBlacklistService;
|
||||
import cn.pluss.platform.entity.*;
|
||||
import cn.pluss.platform.exception.MsgException;
|
||||
import cn.pluss.platform.fans.FansService;
|
||||
import cn.pluss.platform.mapper.CashMapper;
|
||||
import cn.pluss.platform.mapper.FansMapper;
|
||||
import cn.pluss.platform.mapper.MerchantProfitMapper;
|
||||
import cn.pluss.platform.mapper.UserPromotionMapper;
|
||||
import cn.pluss.platform.mapper.*;
|
||||
import cn.pluss.platform.merchantProfit.MerchantProfitService;
|
||||
import cn.pluss.platform.userAccount.UserAccountService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import cn.pluss.platform.userInfo.UserInfoService;
|
||||
import cn.pluss.platform.user.impl.GeneralPushUtil;
|
||||
@@ -94,6 +92,9 @@ public class CashServiceImpl extends ServiceImpl<CashMapper, Cash> implements Ca
|
||||
private MerchantProfitMapper mpMapper;
|
||||
@Resource
|
||||
private CashMapper cashMapper;
|
||||
@Resource
|
||||
private UserAccountService userAccountService;
|
||||
|
||||
|
||||
private void checkStatus(Integer userId) {
|
||||
RiskBlacklist condition = new RiskBlacklist();
|
||||
@@ -261,20 +262,21 @@ public class CashServiceImpl extends ServiceImpl<CashMapper, Cash> implements Ca
|
||||
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);
|
||||
}
|
||||
// Double sum = fansService.queryFansSumShareMoney(map);
|
||||
// if (sum != null) {
|
||||
// BigDecimal fansProfit = BigDecimal.valueOf(sum);
|
||||
// totalProfit = totalProfit.add(fansProfit);
|
||||
// }
|
||||
}
|
||||
|
||||
// 查询商户已提现总数
|
||||
BigDecimal totalCashAmt = getSumValidCashAmtTotal(cash.getUserId() + "");
|
||||
if (totalCashAmt == null) {
|
||||
totalCashAmt = BigDecimal.ZERO;
|
||||
//BigDecimal totalCashAmt = getSumValidCashAmtTotal(cash.getUserId() + "");
|
||||
UserAccount userAccountByUserId = userAccountService.getUserAccountByUserId(cash.getUserId());
|
||||
if (userAccountByUserId == null) {
|
||||
throw new MsgException("可提现金额不足!");
|
||||
}
|
||||
// 校验提现金额是否充足
|
||||
int flag = cash.getCashAmt().compareTo(totalProfit.subtract(totalCashAmt));
|
||||
int flag = cash.getCashAmt().compareTo(totalProfit.subtract(userAccountByUserId.getBalance()));
|
||||
if (flag > 0) {
|
||||
throw new MsgException("可提现金额不足!");
|
||||
}
|
||||
|
||||
@@ -2076,7 +2076,7 @@ public class MerchantOrderServiceImpl extends ServiceImpl<MerchantOrderMapper, M
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getCouponList(String orderNumber) {
|
||||
MerchantOrder merchantOrder = new MerchantOrder().setOrderNumber(orderNumber).setStatus("1");
|
||||
MerchantOrder merchantOrder = new MerchantOrder().setOrderNumber(orderNumber);
|
||||
MerchantOrder one = getOne(new QueryWrapper<>(merchantOrder));
|
||||
if (one == null) {
|
||||
throw new MsgException("订单不存在");
|
||||
|
||||
@@ -15,6 +15,7 @@ import cn.pluss.platform.notice.NoticeService;
|
||||
import cn.pluss.platform.user.UserLevelService;
|
||||
import cn.pluss.platform.user.impl.GeneralPushUtil;
|
||||
import cn.pluss.platform.userAccount.UserAccountService;
|
||||
import cn.pluss.platform.userAccount.impl.UserAccountFlowServiceImpl;
|
||||
import cn.pluss.platform.userAccount.impl.UserAccountServiceImpl;
|
||||
import cn.pluss.platform.userAssess.UserAssessService;
|
||||
import cn.pluss.platform.userRewardFlow.UserRewardFlowService;
|
||||
@@ -61,6 +62,8 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
|
||||
|
||||
@Autowired
|
||||
UserAccountServiceImpl userAccountService;
|
||||
@Resource
|
||||
private UserAccountFlowServiceImpl userAccountFlowService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -301,8 +304,7 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
|
||||
//更新账户余额
|
||||
userAccountService.updateBatchById(userAccounts);
|
||||
//添加账户流水
|
||||
|
||||
|
||||
userAccountFlowService.saveBatch(userAccountFlows);
|
||||
|
||||
log.info("【分润插入】插入分润成功!");
|
||||
} catch (Exception e) {
|
||||
@@ -384,7 +386,7 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
|
||||
MerchantProfit profit = new MerchantProfit(nowUserApp,nowUserApp , order, profitAmt, profitRate, "5", "1");
|
||||
profits.add(profit);
|
||||
|
||||
UserAccount userAccount= userAccountService.getUserAccountByUserId(Integer.valueOf(userId));
|
||||
UserAccount userAccount= userAccountService.initUserAccount(Integer.valueOf(userId));
|
||||
userAccount.setBalance(userAccount.getBalance().add(profitAmt));
|
||||
userAccount.setUpdateTime(new Date());
|
||||
UserAccountFlow flow=new UserAccountFlow();
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package cn.pluss.platform.userAccount;
|
||||
|
||||
public interface UserAccontFlowService {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package cn.pluss.platform.userAccount.impl;
|
||||
|
||||
import cn.pluss.platform.entity.UserAccount;
|
||||
import cn.pluss.platform.entity.UserAccountFlow;
|
||||
import cn.pluss.platform.mapper.UserAccountFlowMapper;
|
||||
import cn.pluss.platform.mapper.UserAccountMapper;
|
||||
import cn.pluss.platform.userAccount.UserAccontFlowService;
|
||||
import cn.pluss.platform.userAccount.UserAccountService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class UserAccountFlowServiceImpl extends ServiceImpl<UserAccountFlowMapper, UserAccountFlow> implements UserAccontFlowService {
|
||||
}
|
||||
@@ -33,12 +33,12 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountMapper, UserA
|
||||
|
||||
@Override
|
||||
public UserAccount getUserAccountByUserId(Integer userId) {
|
||||
return baseMapper.selectById(userId);
|
||||
return userAccountMapper.selectUserByUserId(userId,1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserAccount getUserAccountByUserId(Long userId) {
|
||||
return baseMapper.selectById(userId);
|
||||
return baseMapper.selectUserByUserId(userId.intValue(),1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,7 +48,7 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountMapper, UserA
|
||||
|
||||
|
||||
|
||||
private UserAccount initUserAccount(Integer userId){
|
||||
public UserAccount initUserAccount(Integer userId){
|
||||
Assert.notNull(userId, "NOt Null");
|
||||
synchronized (this){
|
||||
UserAccount userAccount=getUserAccountByUserId(userId);
|
||||
|
||||
Reference in New Issue
Block a user