| | |
| | | order.setOutTradeNo(notifyResult.getOutTradeNo()); |
| | | order.setTransactionId(notifyResult.getTransactionId()); |
| | | TbCompany company = companyService.getById(order.getCompanyId()); |
| | | // 生成记录 看是否分佣 金额 发布人 |
| | | TbUser user = userService.getById(company.getUserId()); |
| | | // 购买人 生成记录 看是否分佣 金额 发布人 如A用户售卖100元公司 C用户购买这个公司 B是C的上级 抽10% 平台抽成20% 那么A应得80 B得2 平台得18 |
| | | TbUser user = userService.getById(order.getUserId()); |
| | | TbSystemConfig config = configService.getOne(new LambdaQueryWrapper<TbSystemConfig>().eq(TbSystemConfig::getType, 3)); |
| | | if(config!=null){ |
| | | JSONObject jsonObject = JSONObject.parseObject(config.getContent()); |
| | |
| | | BigDecimal userCommission = new BigDecimal(jsonObject.get("user").toString()); |
| | | BigDecimal price = order.getPrice(); |
| | | BigDecimal divide = platformCommission.divide(new BigDecimal("100")); |
| | | // 平台抽佣 |
| | | BigDecimal platformCommissionMoney = divide.multiply(price).setScale(2, RoundingMode.HALF_UP); |
| | | |
| | | // 购买人是否绑定了用户 且次数足够 |
| | | if(StringUtils.isNotEmpty(user.getInviteId()) && user.getInviteNum()>0){ |
| | | BigDecimal divide1 = userCommission.divide(new BigDecimal("100")); |
| | | BigDecimal userCommissionMoney = divide1.multiply(price).setScale(2, RoundingMode.HALF_UP); |
| | | BigDecimal userCommissionMoney = divide1.multiply(platformCommissionMoney).setScale(2, RoundingMode.HALF_UP); |
| | | order.setCommissionPrice(userCommissionMoney); |
| | | |
| | | platformCommissionMoney = platformCommissionMoney.subtract(userCommissionMoney); |
| | | |
| | | if(userCommissionMoney.doubleValue()>0){ |
| | | TbUser shareUser = userService.getById(user.getInviteId()); |
| | | if(shareUser!=null){ |