更改分润通知小数点位数
This commit is contained in:
@@ -56,7 +56,7 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
|
|||||||
private UserAssessService userAssessService;
|
private UserAssessService userAssessService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = RuntimeException.class,propagation = Propagation.NESTED)
|
@Transactional(rollbackFor = RuntimeException.class, propagation = Propagation.NESTED)
|
||||||
public void batchInsert(Vector<MerchantProfit> profitList) {
|
public void batchInsert(Vector<MerchantProfit> profitList) {
|
||||||
saveBatch(profitList);
|
saveBatch(profitList);
|
||||||
}
|
}
|
||||||
@@ -73,10 +73,13 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
|
|||||||
//解决通知分润带有科学计数法
|
//解决通知分润带有科学计数法
|
||||||
amt = profitMoney.stripTrailingZeros().toPlainString();
|
amt = profitMoney.stripTrailingZeros().toPlainString();
|
||||||
Notice notice = new Notice(0, 6, userApp);
|
Notice notice = new Notice(0, 6, userApp);
|
||||||
|
|
||||||
|
amt = String.format("%.2f", amt);
|
||||||
|
|
||||||
notice.setConrtent("您有一笔" + amt + "元的推广分润");
|
notice.setConrtent("您有一笔" + amt + "元的推广分润");
|
||||||
notice.setUniqueKey(userApp.getUserId() + orderNumber + "profit");
|
notice.setUniqueKey(userApp.getUserId() + orderNumber + "profit");
|
||||||
noticeService.saveNotice(notice);
|
noticeService.saveNotice(notice);
|
||||||
}catch (RuntimeException e){
|
} catch (RuntimeException e) {
|
||||||
flag = false;
|
flag = false;
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -84,148 +87,155 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
|
|||||||
log.info("=========推送人userId======" + userApp.getUserId() + "=========金额=======" + profitMoney);
|
log.info("=========推送人userId======" + userApp.getUserId() + "=========金额=======" + profitMoney);
|
||||||
alias.add(userApp.getUserId() + "");
|
alias.add(userApp.getUserId() + "");
|
||||||
try {
|
try {
|
||||||
if(flag){
|
if (flag) {
|
||||||
String content = "本次分润金额:" + amt + "元";
|
String content = "本次分润金额:" + amt + "元";
|
||||||
generalPushUtil.sendAllPlatByAlias(alias, "推广分润通知", content, "0");
|
generalPushUtil.sendAllPlatByAlias(alias, "推广分润通知", content, "0");
|
||||||
log.debug("========================================分润人USERID:{}分润金额:{}推送成功",userApp.getUserId(),amt);
|
log.debug("========================================分润人USERID:{}分润金额:{}推送成功", userApp.getUserId(), amt);
|
||||||
}else{
|
} else {
|
||||||
log.debug("========================================分润人USERID:{}分润金额:{}重复推送",userApp.getUserId(),amt);
|
log.debug("========================================分润人USERID:{}分润金额:{}重复推送", userApp.getUserId(), amt);
|
||||||
}
|
}
|
||||||
} catch (MsgException e) {
|
} catch (MsgException e) {
|
||||||
log.debug(e.getMessage());
|
log.debug(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分润创建2.0模式
|
* 分润创建2.0模式
|
||||||
* @date: 2022/1/21 15:16
|
*
|
||||||
* @param order:
|
* @param order:
|
||||||
* @param type:
|
* @param type:
|
||||||
|
* @date: 2022/1/21 15:16
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void createOrderProfitV2(MerchantOrder order,String type) {
|
public void createOrderProfitV2(MerchantOrder order, String type) {
|
||||||
log.info("【分润V2.0】分润计算开始====================>");
|
log.info("【分润V2.0】分润计算开始====================>");
|
||||||
UserApp userApp = userAppMapper.selectByMerchantCode(order.getMerchantCode());
|
UserApp userApp = userAppMapper.selectByMerchantCode(order.getMerchantCode());
|
||||||
if(userApp == null){
|
if (userApp == null) {
|
||||||
userApp = userAppMapper.selectByUserId(order.getUserId());
|
userApp = userAppMapper.selectByUserId(order.getUserId());
|
||||||
}
|
}
|
||||||
MsgException.checkNull(userApp,"用户信息为空,分润创建失败");
|
MsgException.checkNull(userApp, "用户信息为空,分润创建失败");
|
||||||
log.info("【分润V2.0】当前交易用户ID:{},交易单号:{},交易用户角色:{},用户等级:{}",userApp.getUserId(),order.getOrderNumber(),userApp.getRoleCode(),userApp.getLevelCode());
|
log.info("【分润V2.0】当前交易用户ID:{},交易单号:{},交易用户角色:{},用户等级:{}", userApp.getUserId(), order.getOrderNumber(), userApp.getRoleCode(), userApp.getLevelCode());
|
||||||
if(StringUtil.isEmpty(userApp.getRoleCode()) || StringUtil.isEmpty(userApp.getLevelCode())){
|
if (StringUtil.isEmpty(userApp.getRoleCode()) || StringUtil.isEmpty(userApp.getLevelCode())) {
|
||||||
log.info("【分润V2.0】订单号为:{}当前交易角色为空 创建分润结束",order.getOrderNumber());
|
log.info("【分润V2.0】订单号为:{}当前交易角色为空 创建分润结束", order.getOrderNumber());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
calcUserProfitV2(userApp,order,type);
|
calcUserProfitV2(userApp, order, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算分润开始
|
* 计算分润开始
|
||||||
* @date: 2022/1/21 15:29
|
|
||||||
*
|
*
|
||||||
* @param userApp:
|
* @param userApp:
|
||||||
* @param orderType:
|
* @param orderType:
|
||||||
|
* @date: 2022/1/21 15:29
|
||||||
*/
|
*/
|
||||||
private void calcUserProfitV2(UserApp userApp,MerchantOrder order,String orderType) {
|
private void calcUserProfitV2(UserApp userApp, MerchantOrder order, String orderType) {
|
||||||
//2.0
|
//2.0
|
||||||
Vector<MerchantProfit> profitList = new Vector<MerchantProfit>();
|
Vector<MerchantProfit> profitList = new Vector<MerchantProfit>();
|
||||||
if(UserRoleEnum.SV2.getCode().equals(userApp.getRoleCode())){
|
if (UserRoleEnum.SV2.getCode().equals(userApp.getRoleCode())) {
|
||||||
createUserSV2Profit(userApp,order,null,userApp,profitList,1,orderType);
|
createUserSV2Profit(userApp, order, null, userApp, profitList, 1, orderType);
|
||||||
}else if(UserRoleEnum.ZY_BST.getCode().equals(userApp.getRoleCode())){
|
} else if (UserRoleEnum.ZY_BST.getCode().equals(userApp.getRoleCode())) {
|
||||||
createUserBstProfit(userApp,userApp,order,profitList,1,BigDecimal.ZERO,orderType);
|
createUserBstProfit(userApp, userApp, order, profitList, 1, BigDecimal.ZERO, orderType);
|
||||||
}else {
|
} else {
|
||||||
log.info("【分润V2.0】交易用户类型位置 创建分润结束",order.getOrderNumber());
|
log.info("【分润V2.0】交易用户类型位置 创建分润结束", order.getOrderNumber());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!profitList.isEmpty()){
|
if (!profitList.isEmpty()) {
|
||||||
log.info("【分润计算完成】开始批量插入分润数据,生成分润的订单编号:{},分润条数:{}",order.getOrderNumber(),profitList.size());
|
log.info("【分润计算完成】开始批量插入分润数据,生成分润的订单编号:{},分润条数:{}", order.getOrderNumber(), profitList.size());
|
||||||
try {
|
try {
|
||||||
batchInsert(profitList);
|
batchInsert(profitList);
|
||||||
log.info("【分润插入】插入分润成功!");
|
log.info("【分润插入】插入分润成功!");
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.info("【分润插入】插入分润异常,异常信息:{}",e.getMessage());
|
log.info("【分润插入】插入分润异常,异常信息:{}", e.getMessage());
|
||||||
}
|
}
|
||||||
//累计生成分润的总额
|
//累计生成分润的总额
|
||||||
BigDecimal sumProfitMoney = BigDecimal.ZERO;
|
BigDecimal sumProfitMoney = BigDecimal.ZERO;
|
||||||
for (MerchantProfit p:profitList) {
|
for (MerchantProfit p : profitList) {
|
||||||
sumProfitMoney = sumProfitMoney.add(new BigDecimal(String.valueOf(p.getPrice())));
|
sumProfitMoney = sumProfitMoney.add(new BigDecimal(String.valueOf(p.getPrice())));
|
||||||
}
|
}
|
||||||
order.setProfitShareMoney(sumProfitMoney.setScale(4,BigDecimal.ROUND_DOWN).doubleValue());
|
order.setProfitShareMoney(sumProfitMoney.setScale(4, BigDecimal.ROUND_DOWN).doubleValue());
|
||||||
log.info("【分润结算结束】订单号:{}产生的分润总额:{}",order.getOrderNumber(),sumProfitMoney);
|
log.info("【分润结算结束】订单号:{}产生的分润总额:{}", order.getOrderNumber(), sumProfitMoney);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建2.0分润
|
* 创建2.0分润
|
||||||
* @date: 2022/1/21 15:48
|
*
|
||||||
* @param nowUserApp:
|
* @param nowUserApp:
|
||||||
* @param order:
|
* @param order:
|
||||||
|
* @date: 2022/1/21 15:48
|
||||||
*/
|
*/
|
||||||
private void createUserSV2Profit(UserApp userApp, MerchantOrder order,BigDecimal nowRate,
|
private void createUserSV2Profit(UserApp userApp, MerchantOrder order, BigDecimal nowRate,
|
||||||
UserApp nowUserApp,Vector<MerchantProfit> profitList,Integer type,String orderType) {
|
UserApp nowUserApp, Vector<MerchantProfit> profitList, Integer type, String orderType) {
|
||||||
Long parentId = userApp.getParentId();
|
Long parentId = userApp.getParentId();
|
||||||
if(parentId == null){
|
if (parentId == null) {
|
||||||
log.info("【分润V2.0】订单号:{},分润计算结束,获取分润的条数为:{}",order.getOrderNumber(),profitList.size());
|
log.info("【分润V2.0】订单号:{},分润计算结束,获取分润的条数为:{}", order.getOrderNumber(), profitList.size());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(nowRate == null){
|
if (nowRate == null) {
|
||||||
nowRate = order.getRate();
|
nowRate = order.getRate();
|
||||||
}
|
}
|
||||||
UserApp pUserApp = userAppMapper.selectByUserId(parentId);
|
UserApp pUserApp = userAppMapper.selectByUserId(parentId);
|
||||||
if(pUserApp == null){
|
if (pUserApp == null) {
|
||||||
log.info("【分润V2.0】上级用户Id为空,分润创建结束");
|
log.info("【分润V2.0】上级用户Id为空,分润创建结束");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UserLevel userLevel = userLevelService.getLevelInfoByRoleLevel(pUserApp.getRoleCode(), pUserApp.getLevelCode());
|
UserLevel userLevel = userLevelService.getLevelInfoByRoleLevel(pUserApp.getRoleCode(), pUserApp.getLevelCode());
|
||||||
if(userLevel == null){
|
if (userLevel == null) {
|
||||||
log.info("【分润V2.0】用户角色配置异常,分润创建结束");
|
log.info("【分润V2.0】用户角色配置异常,分润创建结束");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BigDecimal profitRate = BigDecimal.ZERO;
|
BigDecimal profitRate = BigDecimal.ZERO;
|
||||||
//缴费通
|
//缴费通
|
||||||
if("2".equals(orderType)){
|
if ("2".equals(orderType)) {
|
||||||
if(nowRate.compareTo(userLevel.getJftRate()) >= 0){
|
if (nowRate.compareTo(userLevel.getJftRate()) >= 0) {
|
||||||
profitRate = nowRate.subtract(userLevel.getJftRate());
|
profitRate = nowRate.subtract(userLevel.getJftRate());
|
||||||
nowRate = userLevel.getJftRate();
|
nowRate = userLevel.getJftRate();
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
if(nowRate.compareTo(userLevel.getRate()) >= 0){
|
if (nowRate.compareTo(userLevel.getRate()) >= 0) {
|
||||||
profitRate = nowRate.subtract(userLevel.getRate());
|
profitRate = nowRate.subtract(userLevel.getRate());
|
||||||
nowRate = userLevel.getRate();
|
nowRate = userLevel.getRate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BigDecimal profitAmt = profitRate.divide(BigDecimal.valueOf(10000)).multiply(BigDecimal.valueOf(order.getConsumeFee())).setScale(4,BigDecimal.ROUND_DOWN);
|
BigDecimal profitAmt = profitRate.divide(BigDecimal.valueOf(10000)).multiply(BigDecimal.valueOf(order.getConsumeFee())).setScale(4, BigDecimal.ROUND_DOWN);
|
||||||
MerchantProfit profit = new MerchantProfit(nowUserApp,pUserApp,order,profitAmt,profitRate,type.toString(),orderType);
|
MerchantProfit profit = new MerchantProfit(nowUserApp, pUserApp, order, profitAmt, profitRate, type.toString(), orderType);
|
||||||
profitList.add(profit);
|
profitList.add(profit);
|
||||||
sendProfitMessage(pUserApp,profitAmt,order.getOrderNumber());
|
sendProfitMessage(pUserApp, profitAmt, order.getOrderNumber());
|
||||||
if(type < 2){
|
if (type < 2) {
|
||||||
type = type + 1;
|
type = type + 1;
|
||||||
}else{
|
} else {
|
||||||
type = 6;
|
type = 6;
|
||||||
}
|
}
|
||||||
createUserSV2Profit(pUserApp,order,nowRate,nowUserApp,profitList,type,orderType);
|
createUserSV2Profit(pUserApp, order, nowRate, nowUserApp, profitList, type, orderType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建直营倍斯特分润
|
* 创建直营倍斯特分润
|
||||||
* @date: 2022/1/21 15:48
|
*
|
||||||
* @param userApp:
|
* @param userApp:
|
||||||
* @param order:
|
* @param order:
|
||||||
|
* @date: 2022/1/21 15:48
|
||||||
*/
|
*/
|
||||||
private void createUserBstProfit(UserApp userApp,UserApp nowUserApp, MerchantOrder order,Vector<MerchantProfit> profitList,
|
private void createUserBstProfit(UserApp userApp, UserApp nowUserApp, MerchantOrder order, Vector<MerchantProfit> profitList,
|
||||||
Integer type,BigDecimal useRate,String orderType) {
|
Integer type, BigDecimal useRate, String orderType) {
|
||||||
Long parentId = userApp.getParentId();
|
Long parentId = userApp.getParentId();
|
||||||
if(type >= 3){
|
if (type >= 3) {
|
||||||
if(parentId != null){
|
if (parentId != null) {
|
||||||
UserApp pUser = userAppMapper.selectByUserId(parentId);
|
UserApp pUser = userAppMapper.selectByUserId(parentId);
|
||||||
if(pUser != null){
|
if (pUser != null) {
|
||||||
if(UserRoleEnum.ZY_BST.getCode().equals(pUser.getRoleCode())){
|
if (UserRoleEnum.ZY_BST.getCode().equals(pUser.getRoleCode())) {
|
||||||
if(BstLevelCode.T2.getCode().equals(pUser.getLevelCode()) || BstLevelCode.T3.getCode().equals(pUser.getLevelCode())){
|
if (BstLevelCode.T2.getCode().equals(pUser.getLevelCode()) || BstLevelCode.T3.getCode().equals(pUser.getLevelCode())) {
|
||||||
UserRewardFlow rewardFlow = new UserRewardFlow(pUser,order,UserRewardFlow.TYPE_DIRE);
|
UserRewardFlow rewardFlow = new UserRewardFlow(pUser, order, UserRewardFlow.TYPE_DIRE);
|
||||||
userRewardFlowService.save(rewardFlow);
|
userRewardFlowService.save(rewardFlow);
|
||||||
}
|
}
|
||||||
Long p2Parent = pUser.getParentId();
|
Long p2Parent = pUser.getParentId();
|
||||||
if(p2Parent != null){
|
if (p2Parent != null) {
|
||||||
UserApp p2User = userAppMapper.selectByUserId(p2Parent);
|
UserApp p2User = userAppMapper.selectByUserId(p2Parent);
|
||||||
if(p2User != null && BstLevelCode.T3.getCode().equals(p2User.getLevelCode())){
|
if (p2User != null && BstLevelCode.T3.getCode().equals(p2User.getLevelCode())) {
|
||||||
UserRewardFlow rewardFlow = new UserRewardFlow(p2User,order,UserRewardFlow.TYPE_INRE);
|
UserRewardFlow rewardFlow = new UserRewardFlow(p2User, order, UserRewardFlow.TYPE_INRE);
|
||||||
userRewardFlowService.save(rewardFlow);
|
userRewardFlowService.save(rewardFlow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -234,59 +244,59 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
|
|||||||
}
|
}
|
||||||
//获取倍斯特顶级分润
|
//获取倍斯特顶级分润
|
||||||
String roleCode = userApp.getRoleCode() == null ? UserRoleEnum.ZY_BST.getCode() : userApp.getRoleCode();
|
String roleCode = userApp.getRoleCode() == null ? UserRoleEnum.ZY_BST.getCode() : userApp.getRoleCode();
|
||||||
UserApp boosApp = userAppMapper.getRoleCodeAndLevelCode(roleCode,BstLevelCode.T4.getCode());
|
UserApp boosApp = userAppMapper.getRoleCodeAndLevelCode(roleCode, BstLevelCode.T4.getCode());
|
||||||
if(userApp == null){
|
if (userApp == null) {
|
||||||
log.info("【倍斯特分润计算】订单号:{},分润计算结束,未配置boss账号无法获取顶级分润:{}",order.getOrderNumber(),profitList.size());
|
log.info("【倍斯特分润计算】订单号:{},分润计算结束,未配置boss账号无法获取顶级分润:{}", order.getOrderNumber(), profitList.size());
|
||||||
}
|
}
|
||||||
BigDecimal pRate = boosApp.getRate() == null ? Constant.MIX_SETTLE_RATE : boosApp.getRate();
|
BigDecimal pRate = boosApp.getRate() == null ? Constant.MIX_SETTLE_RATE : boosApp.getRate();
|
||||||
if("2".equals(orderType)){
|
if ("2".equals(orderType)) {
|
||||||
pRate = Constant.JFT_MIX_SETTLE_RATE;
|
pRate = Constant.JFT_MIX_SETTLE_RATE;
|
||||||
}
|
}
|
||||||
BigDecimal profitRate = order.getRate().subtract(pRate).subtract(useRate);
|
BigDecimal profitRate = order.getRate().subtract(pRate).subtract(useRate);
|
||||||
BigDecimal profitAmt = profitRate.divide(BigDecimal.valueOf(10000)).multiply(BigDecimal.valueOf(order.getConsumeFee())).setScale(4,BigDecimal.ROUND_DOWN);
|
BigDecimal profitAmt = profitRate.divide(BigDecimal.valueOf(10000)).multiply(BigDecimal.valueOf(order.getConsumeFee())).setScale(4, BigDecimal.ROUND_DOWN);
|
||||||
MerchantProfit profit = new MerchantProfit(nowUserApp,boosApp,order,profitAmt,profitRate,type+"",orderType);
|
MerchantProfit profit = new MerchantProfit(nowUserApp, boosApp, order, profitAmt, profitRate, type + "", orderType);
|
||||||
sendProfitMessage(boosApp,profitAmt,order.getOrderNumber());
|
sendProfitMessage(boosApp, profitAmt, order.getOrderNumber());
|
||||||
profitList.add(profit);
|
profitList.add(profit);
|
||||||
log.info("【倍斯特分润计算】订单号:{},分润计算结束,获取分润的条数为:{}",order.getOrderNumber(),profitList.size());
|
log.info("【倍斯特分润计算】订单号:{},分润计算结束,获取分润的条数为:{}", order.getOrderNumber(), profitList.size());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UserApp pUserApp = userAppMapper.selectByUserId(parentId);
|
UserApp pUserApp = userAppMapper.selectByUserId(parentId);
|
||||||
if(pUserApp == null || !UserRoleEnum.ZY_BST.getCode().equals(pUserApp.getRoleCode())){
|
if (pUserApp == null || !UserRoleEnum.ZY_BST.getCode().equals(pUserApp.getRoleCode())) {
|
||||||
log.info("【倍斯特分润计算】上级用户Id为空或者当前用户上级角色异常,分润创建结束");
|
log.info("【倍斯特分润计算】上级用户Id为空或者当前用户上级角色异常,分润创建结束");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UserLevel userLevel = userLevelService.getLevelInfoByRoleLevel(pUserApp.getRoleCode(), pUserApp.getLevelCode());
|
UserLevel userLevel = userLevelService.getLevelInfoByRoleLevel(pUserApp.getRoleCode(), pUserApp.getLevelCode());
|
||||||
if(userLevel == null){
|
if (userLevel == null) {
|
||||||
log.info("【倍斯特分润计算】用户角色配置异常,分润创建结束");
|
log.info("【倍斯特分润计算】用户角色配置异常,分润创建结束");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//判断用户是否在考核期间之内
|
//判断用户是否在考核期间之内
|
||||||
// boolean flag = userAssessService.getUserValid(parentId,pUserApp);
|
// boolean flag = userAssessService.getUserValid(parentId,pUserApp);
|
||||||
// if(flag){
|
// if(flag){
|
||||||
if(BstLevelCode.T4.getCode().equals(userLevel.getLevelCode())){
|
if (BstLevelCode.T4.getCode().equals(userLevel.getLevelCode())) {
|
||||||
BigDecimal t4Rate = userLevel.getRate() == null ? Constant.MIX_SETTLE_RATE : userLevel.getRate();
|
BigDecimal t4Rate = userLevel.getRate() == null ? Constant.MIX_SETTLE_RATE : userLevel.getRate();
|
||||||
if("2".equals(orderType)){
|
if ("2".equals(orderType)) {
|
||||||
t4Rate = userLevel.getJftRate() == null ? Constant.JFT_MIX_SETTLE_RATE : userLevel.getJftRate();
|
t4Rate = userLevel.getJftRate() == null ? Constant.JFT_MIX_SETTLE_RATE : userLevel.getJftRate();
|
||||||
}
|
|
||||||
BigDecimal profitRate = order.getRate().subtract(t4Rate).subtract(useRate);
|
|
||||||
if(profitRate.compareTo(BigDecimal.ZERO) <= 0){
|
|
||||||
profitRate = BigDecimal.ZERO;
|
|
||||||
}
|
|
||||||
BigDecimal profitAmt = profitRate.divide(BigDecimal.valueOf(10000)).multiply(BigDecimal.valueOf(order.getConsumeFee())).setScale(4,BigDecimal.ROUND_DOWN);
|
|
||||||
MerchantProfit profit = new MerchantProfit(nowUserApp,pUserApp,order,profitAmt,profitRate,type.toString(),orderType);
|
|
||||||
profitList.add(profit);
|
|
||||||
sendProfitMessage(pUserApp,profitAmt,order.getOrderNumber());
|
|
||||||
return;
|
|
||||||
}else{
|
|
||||||
BigDecimal profitRate = type == 1 ? userLevel.getDirectRate() : userLevel.getIndirectRate() ;
|
|
||||||
BigDecimal profitAmt = profitRate.divide(BigDecimal.valueOf(10000)).multiply(BigDecimal.valueOf(order.getConsumeFee())).setScale(4,BigDecimal.ROUND_DOWN);
|
|
||||||
MerchantProfit profit = new MerchantProfit(nowUserApp,pUserApp,order,profitAmt,profitRate,type.toString(),orderType);
|
|
||||||
profitList.add(profit);
|
|
||||||
type = type + 1;
|
|
||||||
useRate = useRate.add(profitRate);
|
|
||||||
sendProfitMessage(pUserApp,profitAmt,order.getOrderNumber());
|
|
||||||
createUserBstProfit(pUserApp,nowUserApp,order,profitList,type,useRate,orderType);
|
|
||||||
}
|
}
|
||||||
|
BigDecimal profitRate = order.getRate().subtract(t4Rate).subtract(useRate);
|
||||||
|
if (profitRate.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
profitRate = BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
BigDecimal profitAmt = profitRate.divide(BigDecimal.valueOf(10000)).multiply(BigDecimal.valueOf(order.getConsumeFee())).setScale(4, BigDecimal.ROUND_DOWN);
|
||||||
|
MerchantProfit profit = new MerchantProfit(nowUserApp, pUserApp, order, profitAmt, profitRate, type.toString(), orderType);
|
||||||
|
profitList.add(profit);
|
||||||
|
sendProfitMessage(pUserApp, profitAmt, order.getOrderNumber());
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
BigDecimal profitRate = type == 1 ? userLevel.getDirectRate() : userLevel.getIndirectRate();
|
||||||
|
BigDecimal profitAmt = profitRate.divide(BigDecimal.valueOf(10000)).multiply(BigDecimal.valueOf(order.getConsumeFee())).setScale(4, BigDecimal.ROUND_DOWN);
|
||||||
|
MerchantProfit profit = new MerchantProfit(nowUserApp, pUserApp, order, profitAmt, profitRate, type.toString(), orderType);
|
||||||
|
profitList.add(profit);
|
||||||
|
type = type + 1;
|
||||||
|
useRate = useRate.add(profitRate);
|
||||||
|
sendProfitMessage(pUserApp, profitAmt, order.getOrderNumber());
|
||||||
|
createUserBstProfit(pUserApp, nowUserApp, order, profitList, type, useRate, orderType);
|
||||||
|
}
|
||||||
// }else{
|
// }else{
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
|||||||
Reference in New Issue
Block a user