添加耗材

This commit is contained in:
韩鹏辉
2024-06-28 10:27:34 +08:00
parent 05c88e00d3
commit 0b4c658f7c
4 changed files with 42 additions and 1 deletions

View File

@@ -114,4 +114,22 @@ public class RabbitConfig {
public Binding bindingcons_Register() {
return BindingBuilder.bind(queuePrint_Register()).to(printExchange_Register()).with(RabbitConstants.CONS_COLLECT_ROUTINGKEY_PUT);
}
@Bean
public DirectExchange cons_msg_Exchange_Register() {
return new DirectExchange(RabbitConstants.CONS_MSG_COLLECT_PUT);
}
@Bean
public Queue queuecons_msg_Register() {
return new Queue(RabbitConstants.CONS_MSG_COLLECT_QUEUE_PUT, true); //队列持久
}
@Bean
public Binding bindingcons_msg_Register() {
return BindingBuilder.bind(queuePrint_Register()).to(printExchange_Register()).with(RabbitConstants.CONS_MSG_COLLECT_ROUTINGKEY_PUT);
}
}

View File

@@ -49,4 +49,14 @@ public interface RabbitConstants {
public static final String CONS_COLLECT_ROUTINGKEY_PUT = "cons_collect_routingkey_put";
public static final String CONS_MSG_COLLECT_PUT="cons_msg_collect_put";
public static final String CONS_MSG_COLLECT_QUEUE_PUT = "cons_msg_collect_queue_put";
public static final String CONS_MSG_COLLECT_ROUTINGKEY_PUT = "cons_msg_collect_routingkey_put";
}

View File

@@ -51,7 +51,10 @@ public class RabbitProducer implements RabbitTemplate.ConfirmCallback {
rabbitTemplate.convertAndSend(RabbitConstants.CONS_COLLECT_PUT, RabbitConstants.CONS_COLLECT_ROUTINGKEY_PUT, content, correlationId);
}
public void con_msg(String content){
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
rabbitTemplate.convertAndSend(RabbitConstants.CONS_MSG_COLLECT_PUT, RabbitConstants.CONS_MSG_COLLECT_ROUTINGKEY_PUT, content, correlationId);
}
@Override
public void confirm(CorrelationData correlationData, boolean ack, String cause) {

View File

@@ -117,6 +117,16 @@ public class CartService {
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = productSkuMapper.selectByPrimaryKey(Integer.valueOf(skuId));
JSONObject objectMsg=new JSONObject();
objectMsg.put("skuId",tbProductSkuWithBLOBs.getId());
objectMsg.put("shopId",Integer.valueOf(shopId));
producer.con_msg(objectMsg.toString());
if (Integer.valueOf(tbProduct.getIsPauseSale()).equals(1)) {
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("status", "fail");