| | |
| | | package com.matrix.system.shopXcx.mqTask; |
| | | |
| | | |
| | | import com.matrix.system.hive.service.SysVipInfoService; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.system.common.bean.BusParameterSettings; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.hive.bean.SysVipInfo; |
| | | import com.matrix.system.hive.dao.SysVipInfoDao; |
| | | import com.matrix.system.hive.service.SysVipInfoService; |
| | | import com.matrix.system.score.constant.ScoreSettingConstant; |
| | | import com.matrix.system.score.entity.ScoreVipDetail; |
| | | import com.matrix.system.score.service.ScoreVipDetailService; |
| | |
| | | SysVipInfoService sysVipInfoService; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | ScoreVipDetailService scoreVipDetailService; |
| | | |
| | | @Autowired |
| | | BusParameterSettingsDao busParameterSettingsDao; |
| | | |
| | | |
| | | @Autowired |
| | | SysVipInfoDao sysVipInfoDao; |
| | | |
| | | @Override |
| | | public void handle(String consumerTag, Delivery message) throws IOException { |
| | |
| | | Long.parseLong(orderId+""), |
| | | ScoreVipDetail.SCORE_VIP_TYPE_CASH, |
| | | "微商城消费"); |
| | | |
| | | //插入上级积分 |
| | | SysVipInfo vipInfo = sysVipInfoService.findById(order.getUserId()); |
| | | |
| | | |
| | | if (vipInfo.getRecommendId() != null) { |
| | | //推荐注册老带新积分奖励 |
| | | SysVipInfo referrerVip = sysVipInfoDao.selectById(vipInfo.getRecommendId()); |
| | | if (StringUtils.isNotBlank(cashConsumptionShop.getParamValue1())) { |
| | | |
| | | int parentScore = order.getOrderMoney().divide(new BigDecimal(cashConsumptionShop.getParamValue1())).intValue(); |
| | | if (parentScore > 0) { |
| | | scoreVipDetailService.addScore( |
| | | referrerVip.getId(), |
| | | null, |
| | | Long.parseLong(order.getStoreId() + ""), |
| | | parentScore, |
| | | Long.parseLong(order.getId() + ""), |
| | | ScoreVipDetail.SCORE_VIP_TYPE_CASH, |
| | | "推荐消费奖励" |
| | | ); |
| | | } |
| | | } |
| | | |
| | | //推荐注册二级带新积分奖励 |
| | | if (referrerVip.getRecommendId() != null && StringUtils.isNotBlank(cashConsumptionShop.getParamValue2())) { |
| | | SysVipInfo topVipInfo = sysVipInfoDao.selectById(referrerVip.getRecommendId()); |
| | | int topParentScore = order.getOrderMoney().divide(new BigDecimal(cashConsumptionShop.getParamValue2())).intValue(); |
| | | if (topParentScore > 0) { |
| | | scoreVipDetailService.addScore( |
| | | topVipInfo.getId(), |
| | | null, |
| | | Long.parseLong(order.getStoreId() + ""), |
| | | topParentScore, |
| | | Long.parseLong(order.getId() + ""), |
| | | ScoreVipDetail.SCORE_VIP_TYPE_CASH, |
| | | "推荐消费奖励" |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |