| | |
| | | |
| | | if (StrUtil.isNotBlank(value) && !"0".equals(value)) { |
| | | // 首单完成后,在value单内,返利积分或者环保币 |
| | | if (count - 1 <= Integer.parseInt(value)) { |
| | | if (count - 1 < Integer.parseInt(value)) { |
| | | String scoreStr = getRuleValue(redPaperRule, CommonEnum.返利固定积分.getValue()); |
| | | String coinStr = getRuleValue(redPaperRule, CommonEnum.返利环保币比例.getValue()); |
| | | // 根据积分返利固定积分 |
| | |
| | | // 根据订单总积分, 1:40比例,换算成环保币,返对应百分比 |
| | | if (StrUtil.isNotBlank(coinStr) && !"0".equals(coinStr)) { |
| | | BigDecimal coinRatio = new BigDecimal(coinStr).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_DOWN); |
| | | BigDecimal totalCoin = totalScore.divide(new BigDecimal(40), 2, BigDecimal.ROUND_DOWN); |
| | | BigDecimal totalCoin = totalScore.divide(new BigDecimal(50), 2, BigDecimal.ROUND_DOWN); |
| | | |
| | | BigDecimal returnCoin = totalCoin.multiply(coinRatio).setScale(2, BigDecimal.ROUND_DOWN); |
| | | totalReturnCoin = totalReturnCoin.add(returnCoin); |
| | |
| | | userHeadRelate.setScore(userHeadRelate.getScore().add(totalReturnScore)); |
| | | userHeadRelateMapper.updateByPrimaryKey(userHeadRelate); |
| | | |
| | | accountInfo.setAccountId(accountInfo.getAccountId()); |
| | | accountInfo.setMoney(new BigDecimal(accountInfo.getMoney()).add(totalReturnCoin).setScale(2, BigDecimal.ROUND_DOWN).toString()); |
| | | BigDecimal collectScore = StrUtil.isNotBlank(accountInfo.getCollectScore()) ? new BigDecimal(accountInfo.getCollectScore()) : BigDecimal.ZERO; |
| | | accountInfo.setCollectScore(collectScore.add(totalReturnScore).setScale(0, BigDecimal.ROUND_DOWN).toString()); |