| | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.xzx.gc.common.constant.CommonEnum; |
| | | import com.xzx.gc.common.constant.Constants; |
| | | import com.xzx.gc.entity.*; |
| | | import com.xzx.gc.order.mapper.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | } |
| | | |
| | | Integer count = userHeadDetailsMapper.selectDetailsCount(userId); |
| | | // UserInfo userInfo = userMapper.selectByPrimaryKey(userId); |
| | | UserInfo userInfo = userMapper.selectByPrimaryKey(userId); |
| | | AccountInfo accountInfo = accountMapper.selectAccountInfoByUserId(userHeadRelate.getHeadUserId()); |
| | | |
| | | if (AccountInfo.IS_PROHIBIT_Y.equals(accountInfo.getIsProhibit())) { |
| | |
| | | // 根据订单总积分, 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(50), 2, BigDecimal.ROUND_DOWN); |
| | | BigDecimal totalCoin = totalScore.divide(new BigDecimal(Constants.PRICE_SCORE_EXCHANGE), 2, BigDecimal.ROUND_DOWN); |
| | | |
| | | BigDecimal returnCoin = totalCoin.multiply(coinRatio).setScale(2, BigDecimal.ROUND_DOWN); |
| | | totalReturnCoin = totalReturnCoin.add(returnCoin); |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (totalReturnCoin.intValue() == 0 && totalReturnScore.intValue() == 0) { |
| | | return; |
| | | } |
| | | |
| | | UserHeadDetails userHeadDetails = new UserHeadDetails(); |
| | |
| | | sysMessage.setUserId(userHeadRelate.getHeadUserId()); |
| | | sysMessage.setMessageType("4"); |
| | | sysMessage.setMessageSubTypeName("返利消息"); |
| | | sysMessage.setMessage("收到用户:" + accountInfo.getAccountName().replaceAll("(\\w{3})\\w*(\\w{4})", "$1****$2") + "的订单返利, 积分:" + totalReturnScore +", 环保币:" + totalReturnCoin); |
| | | sysMessage.setMessage("收到用户:" + userInfo.getMobilePhone().replaceAll("(\\w{3})\\w*(\\w{4})", "$1****$2") + "的订单返利, 积分:" + totalReturnScore +", 环保币:" + totalReturnCoin); |
| | | sysMessage.setFlag("2"); |
| | | sysMessageMapper.insert(sysMessage); |
| | | } |