增加订单过期耗材消息发送
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
package cn.ysk.cashier.config;
|
||||
|
||||
import cn.ysk.cashier.cons.rabbit.RabbitConstants;
|
||||
import cn.ysk.cashier.service.order.TbOrderInfoService;
|
||||
import cn.ysk.cashier.service.shop.TbShopInfoService;
|
||||
import cn.ysk.cashier.system.service.UserService;
|
||||
import cn.ysk.cashier.utils.CacheKey;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -18,6 +21,7 @@ import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.UUID;
|
||||
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@@ -35,6 +39,12 @@ public class RedisKeyExpirationListener implements MessageListener {
|
||||
@Autowired
|
||||
private TbOrderInfoService tbOrderInfoService;
|
||||
|
||||
private final RabbitTemplate rabbitTemplate;
|
||||
|
||||
public RedisKeyExpirationListener(RabbitTemplate rabbitTemplate) {
|
||||
this.rabbitTemplate = rabbitTemplate;
|
||||
}
|
||||
|
||||
//redis key失效监听
|
||||
@Bean
|
||||
public RedisMessageListenerContainer redisMessageListenerContainer(RedisConnectionFactory connectionFactory) {
|
||||
@@ -55,10 +65,11 @@ public class RedisKeyExpirationListener implements MessageListener {
|
||||
log.info("商户到期 账户名为:{}",account);
|
||||
shopInfoService.update(account);
|
||||
userServiceu.upEnableByusername(account);
|
||||
|
||||
}else if(expiredKey.startsWith(CacheKey.ORDER_EXPIRED)){
|
||||
log.info("监听到订单过期,{}",expiredKey);
|
||||
String orderId = expiredKey.substring(CacheKey.ORDER_EXPIRED.length());
|
||||
tbOrderInfoService.expired(orderId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user