## Opt - 订单完成后推送MQ
This commit is contained in:
parent
30572dc242
commit
10c98b6d99
|
@ -51,6 +51,7 @@ import com.hzs.system.config.IAwardsServiceApi;
|
|||
import com.hzs.system.config.IGradeServiceApi;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -91,6 +92,8 @@ public class RetailOrderServiceImpl implements IRetailOrderService {
|
|||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@DubboReference
|
||||
IGradeServiceApi iGradeServiceApi;
|
||||
|
@ -577,16 +580,16 @@ public class RetailOrderServiceImpl implements IRetailOrderService {
|
|||
this.allProductSync(saOrderExt);
|
||||
|
||||
if (EOrderType.RETAIL_REGISTER.getValue() == saOrderExt.getOrderType()
|
||||
|| EOrderType.RETAIL_UPGRADE.getValue() == saOrderExt.getOrderType()
|
||||
|| EOrderType.RETAIL_REPURCHASE.getValue() == saOrderExt.getOrderType()
|
||||
|| EOrderType.RETAIL_CONSUME.getValue() == saOrderExt.getOrderType()
|
||||
) {
|
||||
// 计算奖金,通过mq分发消息,异步处理
|
||||
saOrderExt.setCancelBool(Boolean.FALSE);
|
||||
// log.info("新零售秒结消息,order.second.exchange:{}", saOrderExt.getOrderCode());
|
||||
// rabbitTemplate.convertAndSend(RabbitMqConstants.ORDER_SECOND_EXCHANGE, RabbitMqConstants.ORDER_SECOND_KEY, saOrderExt);
|
||||
log.info("{} 秒结消息,order.second.exchange:{}", SysConstants.RETAIL_PREFIX, saOrderExt.getOrderCode());
|
||||
rabbitTemplate.convertAndSend(RabbitMqConstants.ORDER_SECOND_EXCHANGE, RabbitMqConstants.ORDER_SECOND_KEY, saOrderExt);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("新零售 pushOrderMq 推送MQ失败. order: {}", saOrderExt, e);
|
||||
log.error("{} pushOrderMq 推送MQ失败. order: {}", SysConstants.RETAIL_PREFIX, saOrderExt, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1402,11 +1402,11 @@ public class SaOrderServiceImpl extends ServiceImpl<SaOrderMapper, SaOrder> impl
|
|||
// 撤单标记为 true
|
||||
saOrderExt.setCancelBool(Boolean.TRUE);
|
||||
// 计算奖金,通过mq分发消息,异步处理
|
||||
// log.info("新零售秒结消息,order.second.exchange:{}", saOrderExt.getOrderCode());
|
||||
// rabbitTemplate.convertAndSend(RabbitMqConstants.ORDER_SECOND_EXCHANGE, RabbitMqConstants.ORDER_SECOND_KEY, saOrderExt);
|
||||
log.info("{} 秒结消息,order.second.exchange:{}", SysConstants.RETAIL_PREFIX, saOrderExt.getOrderCode());
|
||||
rabbitTemplate.convertAndSend(RabbitMqConstants.ORDER_SECOND_EXCHANGE, RabbitMqConstants.ORDER_SECOND_KEY, saOrderExt);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("新零售 pushOrderMq 推送MQ失败. order: {}", saOrderExt, e);
|
||||
log.error("{} pushOrderMq 推送MQ失败. order: {}", SysConstants.RETAIL_PREFIX, saOrderExt, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue