| | |
| | | |
| | | @Bean |
| | | public Binding orderReturnMoneyBind() { |
| | | return BindingBuilder.bind(agentReturnMoneyQueue()).to(agentReturnMoneyExchange()).with(RabbitQueueEnum.ORDER_RETURN_MONEY.getRoute()); |
| | | return BindingBuilder.bind(orderReturnMoneyQueue()).to(orderReturnMoneyExchange()).with(RabbitQueueEnum.ORDER_RETURN_MONEY.getRoute()); |
| | | } |
| | | |
| | | } |
| | |
| | | continue; |
| | | } |
| | | |
| | | if (direct.compareTo(BigDecimal.ONE) < 1) { |
| | | break; |
| | | } |
| | | |
| | | int reduce = walletService.reduce(direct, parentMember.getId(), "score"); |
| | | if (reduce == 2) { |
| | | continue; |
| | | } |
| | | |
| | | walletService.add(direct, parentMember.getId(), "commission"); |
| | | |
| | | moneyFlowService.addMoneyFlow(parentMember.getId(), direct, MoneyFlowTypeEnum.RECOMMEND_BONUS.getValue(), orderInfo.getOrderNo(), FlowTypeEnum.COMMISSION.getValue()); |
| | | moneyFlowService.addMoneyFlow(parentMember.getId(), direct.negate(), MoneyFlowTypeEnum.RECOMMEND_BONUS.getValue(), orderInfo.getOrderNo(), FlowTypeEnum.SCORE.getValue()); |
| | | |
| | | if (direct.compareTo(BigDecimal.ONE) < 1) { |
| | | break; |
| | | } |
| | | direct = direct.divide(indrectDicProp, 2, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | if (dynamicProfit.compareTo(BigDecimal.ZERO) < 1) { |
| | | continue; |
| | | } |
| | | |
| | | int reduce = walletService.reduce(dynamicProfit, member.getId(), "score"); |
| | | if (reduce == 2) { |
| | | continue; |
| | |
| | | @RabbitListener(queues = QueueConstants.ORDER_RETURN_MONEY) |
| | | public void orderReturnMoney(String orderId) { |
| | | log.info("收到订单返利消息:{}", orderId); |
| | | |
| | | try { |
| | | memberProfitService.dynamicProfit(Long.parseLong(orderId)); |
| | | } catch (Exception e) { |
| | | log.error("订单返利异常:{}", e); |
| | | log.error("订单返利异常:", e); |
| | | } |
| | | } |
| | | } |
| | |
| | | import cc.mrbird.febs.mall.service.IAgentService; |
| | | import cc.mrbird.febs.mall.vo.ApiMallActWinDetailsVo; |
| | | import cc.mrbird.febs.mall.vo.ApiMallAwardDetailsVo; |
| | | import cc.mrbird.febs.rabbit.consumer.AgentConsumer; |
| | | import cc.mrbird.febs.rabbit.producter.AgentProducer; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private AgentConsumer agentConsumer; |
| | | |
| | | @Test |
| | | public void orderReturnTest() { |
| | | agentProducer.sendOrderReturn(1L); |
| | | agentConsumer.orderReturnMoney("1"); |
| | | } |
| | | } |