余额相关改动
This commit is contained in:
@@ -15,6 +15,7 @@ import cn.pluss.platform.vo.UserMakerQuotaVO;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -64,22 +65,24 @@ public class UserMakerQuotaServiceImpl extends ServiceImpl<UserMakerQuotaMapper,
|
||||
//商户码转userId
|
||||
if (consumeFee.compareTo(new BigDecimal("0.01"))>0) {
|
||||
MerchantBaseInfo merchantBaseInfoByMerchantCode = merchantBaseInfoService.getMerchantBaseInfoByMerchantCode(order.getMerchantCode());
|
||||
if(merchantBaseInfoByMerchantCode == null)
|
||||
return;
|
||||
//找到上级增加额度
|
||||
UserPromotion userInfo = userPromotionMapper.selectByPrimaryKey(Long.valueOf(merchantBaseInfoByMerchantCode.getUserId()));
|
||||
if (userInfo != null) {
|
||||
UserPromotion userParent = userPromotionMapper.selectByUserIdMC(Long.valueOf(userInfo.getParentUserId()));
|
||||
if (userParent != null && "1".equals(userParent.getIsExtend())){
|
||||
BigDecimal profit = consumeFee.multiply(new BigDecimal("0.0038")).setScale(2,BigDecimal.ROUND_DOWN);
|
||||
BigDecimal profit = consumeFee.multiply(new BigDecimal("0.5")).setScale(2,BigDecimal.ROUND_DOWN);
|
||||
String s = String.valueOf(userParent.getUserId());
|
||||
Integer integer = Integer.valueOf(s);
|
||||
this.modMakerFunds(integer,"SD","免费额度",profit,"");
|
||||
//给自己计算
|
||||
if ("1".equals(userInfo.getIsExtend())){
|
||||
profit(userInfo,consumeFee);
|
||||
}
|
||||
}
|
||||
}
|
||||
//自己如果是创客的话
|
||||
assert userInfo != null;
|
||||
if ("1".equals(userInfo.getIsExtend())){
|
||||
profit(userInfo,consumeFee);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +130,8 @@ public class UserMakerQuotaServiceImpl extends ServiceImpl<UserMakerQuotaMapper,
|
||||
}
|
||||
}
|
||||
//增加提现金额
|
||||
private void profit(UserPromotion userInfo,BigDecimal consumeFee){
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void profit(UserPromotion userInfo,BigDecimal consumeFee){
|
||||
UserMakerQuota userMakerQuota = userMakerQuotaMapper.selectByUserId(userInfo.getUserId());
|
||||
if (userMakerQuota != null) {
|
||||
BigDecimal sumbigDecimal = userMakerQuota.getAmount();
|
||||
@@ -139,7 +143,7 @@ public class UserMakerQuotaServiceImpl extends ServiceImpl<UserMakerQuotaMapper,
|
||||
//提现金额
|
||||
userAccountService.modFunds(integer, "LD", "免提现额度", profit, "");
|
||||
//额度改变
|
||||
this.modMakerFunds(integer, "LD", "收款消耗", sumbigDecimal, "");
|
||||
modMakerFunds(integer, "LD", "收款消耗", sumbigDecimal, "");
|
||||
} else {
|
||||
BigDecimal profit = sumbigDecimal.multiply(new BigDecimal("0.0038")).setScale(2, BigDecimal.ROUND_DOWN);
|
||||
String s = String.valueOf(userInfo.getUserId());
|
||||
@@ -147,7 +151,7 @@ public class UserMakerQuotaServiceImpl extends ServiceImpl<UserMakerQuotaMapper,
|
||||
//提现金额
|
||||
userAccountService.modFunds(integer, "LD", "收款消耗", profit, "");
|
||||
//额度改变
|
||||
this.modMakerFunds(integer, "LD", "收款消耗", BigDecimal.ZERO, "");
|
||||
modMakerFunds(integer, "LD", "收款消耗", BigDecimal.ZERO, "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,6 +165,7 @@ public class UserMakerQuotaServiceImpl extends ServiceImpl<UserMakerQuotaMapper,
|
||||
* @param difference
|
||||
* @param remark
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class, propagation = Propagation.MANDATORY)
|
||||
public void modMakerFunds(Integer userId, String bizCode, String bizName, BigDecimal difference, String remark) {
|
||||
Assert.notNull(userId, "NOt Null");
|
||||
Assert.notNull(bizCode, "Not Null");
|
||||
@@ -189,7 +194,7 @@ public class UserMakerQuotaServiceImpl extends ServiceImpl<UserMakerQuotaMapper,
|
||||
private UserMakerQuota initUserMaker(Integer userId){
|
||||
Assert.notNull(userId, "NOt Null");
|
||||
synchronized (this){
|
||||
UserMakerQuota userMakerQuota = getUserAccountByUserId(userId);
|
||||
UserMakerQuota userMakerQuota = userMakerQuotaMapper.selectByUserId(userId);
|
||||
if(ObjectUtil.isEmpty(userMakerQuota)){
|
||||
userMakerQuota=new UserMakerQuota();
|
||||
userMakerQuota.setUserId(Long.valueOf(userId));
|
||||
|
||||
@@ -284,8 +284,8 @@ public class CashServiceImpl extends ServiceImpl<CashMapper, Cash> implements Ca
|
||||
cash.setMerchantName(tokenUa.getMerchantName());
|
||||
cash.setMerchantCode(tokenUa.getMerchantCode());
|
||||
cash.setRate(8);
|
||||
cash.setBaseServiceCharge(BigDecimal.valueOf(3));
|
||||
cash.setRatioCharge(cash.getCashAmt().multiply(BigDecimal.valueOf(0.08)));
|
||||
cash.setBaseServiceCharge(BigDecimal.ZERO);
|
||||
cash.setRatioCharge(cash.getCashAmt().multiply(new BigDecimal("0.01")).setScale(2,BigDecimal.ROUND_DOWN));
|
||||
|
||||
LambdaQueryWrapper<CashAccount> qWrapper2 = Wrappers.lambdaQuery();
|
||||
qWrapper2.eq(CashAccount::getUserId, cash.getUserId())
|
||||
|
||||
Reference in New Issue
Block a user