更改MQ配置
This commit is contained in:
@@ -4,6 +4,7 @@ import org.springframework.format.annotation.DateTimeFormat;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lyf
|
* @author lyf
|
||||||
@@ -47,11 +48,11 @@ public class HomeVO {
|
|||||||
/**
|
/**
|
||||||
* 店铺标签
|
* 店铺标签
|
||||||
*/
|
*/
|
||||||
private String shopTag;
|
private List<String> shopTag;
|
||||||
/**
|
/**
|
||||||
* 商品标签
|
* 商品标签
|
||||||
*/
|
*/
|
||||||
private String proTag;
|
private List<String> proTag;
|
||||||
/**
|
/**
|
||||||
* 距离
|
* 距离
|
||||||
*/
|
*/
|
||||||
@@ -88,19 +89,19 @@ public class HomeVO {
|
|||||||
this.distances = distances;
|
this.distances = distances;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getShopTag() {
|
public List<String> getShopTag() {
|
||||||
return shopTag;
|
return shopTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setShopTag(String shopTag) {
|
public void setShopTag(List<String> shopTag) {
|
||||||
this.shopTag = shopTag;
|
this.shopTag = shopTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProTag() {
|
public List<String> getProTag() {
|
||||||
return proTag;
|
return proTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProTag(String proTag) {
|
public void setProTag(List<String> proTag) {
|
||||||
this.proTag = proTag;
|
this.proTag = proTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import java.util.*;
|
|||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@RabbitListener(queues = {RabbitConstants.CART_QUEUE_PUT})
|
//@RabbitListener(queues = {RabbitConstants.CART_QUEUE_PUT})
|
||||||
@Service
|
@Service
|
||||||
public class CartConsumer {
|
public class CartConsumer {
|
||||||
|
|
||||||
@@ -39,6 +39,7 @@ public class CartConsumer {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CartService cartService;
|
private CartService cartService;
|
||||||
@RabbitHandler
|
@RabbitHandler
|
||||||
|
@RabbitListener(queues = {"${queue}"})
|
||||||
public void listener(String message) {
|
public void listener(String message) {
|
||||||
try {
|
try {
|
||||||
JSONObject jsonObject = JSON.parseObject(message);
|
JSONObject jsonObject = JSON.parseObject(message);
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ public class RabbitConfig {
|
|||||||
|
|
||||||
@Value("${spring.rabbitmq.password}")
|
@Value("${spring.rabbitmq.password}")
|
||||||
private String password;
|
private String password;
|
||||||
|
@Value("${prod}")
|
||||||
|
private String prod;
|
||||||
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@@ -49,17 +50,17 @@ public class RabbitConfig {
|
|||||||
}
|
}
|
||||||
@Bean
|
@Bean
|
||||||
public DirectExchange defaultExchange_Register() {
|
public DirectExchange defaultExchange_Register() {
|
||||||
return new DirectExchange(RabbitConstants.CART_PUT);
|
return new DirectExchange(RabbitConstants.CART_PUT+prod);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Queue queuePut_Register() {
|
public Queue queuePut_Register() {
|
||||||
return new Queue(RabbitConstants.CART_QUEUE_PUT, true); //队列持久
|
return new Queue(RabbitConstants.CART_QUEUE_PUT+prod, true); //队列持久
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Binding bindingPut_Register() {
|
public Binding bindingPut_Register() {
|
||||||
return BindingBuilder.bind(queuePut_Register()).to(defaultExchange_Register()).with(RabbitConstants.CART_ROUTINGKEY_PUT);
|
return BindingBuilder.bind(queuePut_Register()).to(defaultExchange_Register()).with(RabbitConstants.CART_ROUTINGKEY_PUT+prod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|
||||||
@@ -17,6 +18,8 @@ public class RabbitProducer implements RabbitTemplate.ConfirmCallback {
|
|||||||
|
|
||||||
private RabbitTemplate rabbitTemplate;
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
@Value("${prod}")
|
||||||
|
private String prod;
|
||||||
@Autowired
|
@Autowired
|
||||||
public RabbitProducer(RabbitTemplate rabbitTemplate) {
|
public RabbitProducer(RabbitTemplate rabbitTemplate) {
|
||||||
this.rabbitTemplate = rabbitTemplate;
|
this.rabbitTemplate = rabbitTemplate;
|
||||||
@@ -25,7 +28,7 @@ public class RabbitProducer implements RabbitTemplate.ConfirmCallback {
|
|||||||
|
|
||||||
public void putCart(String content) {
|
public void putCart(String content) {
|
||||||
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
|
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
|
||||||
rabbitTemplate.convertAndSend(RabbitConstants.CART_PUT, RabbitConstants.CART_ROUTINGKEY_PUT, content, correlationId);
|
rabbitTemplate.convertAndSend(RabbitConstants.CART_PUT+prod, RabbitConstants.CART_ROUTINGKEY_PUT+prod, content, correlationId);
|
||||||
}
|
}
|
||||||
public void putOrderCollect(String content) {
|
public void putOrderCollect(String content) {
|
||||||
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
|
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import javax.annotation.Resource;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
@@ -78,8 +79,12 @@ public class HomePageService {
|
|||||||
if (o.getShopId().equals(tbShopInfo.getId().toString())) {
|
if (o.getShopId().equals(tbShopInfo.getId().toString())) {
|
||||||
homeVO.setShopName(tbShopInfo.getShopName());
|
homeVO.setShopName(tbShopInfo.getShopName());
|
||||||
homeVO.setImage(tbShopInfo.getLogo());
|
homeVO.setImage(tbShopInfo.getLogo());
|
||||||
TbPlatformDict tbPlatformDict = platformDictMapper.queryById(Integer.valueOf(tbShopInfo.getTag()));
|
if (tbShopInfo.getTag() == null){
|
||||||
homeVO.setShopTag(tbPlatformDict == null?"":tbPlatformDict.getName());
|
homeVO.setShopTag(new ArrayList<>());
|
||||||
|
}else {
|
||||||
|
TbPlatformDict tbPlatformDict = platformDictMapper.queryById(Integer.valueOf(tbShopInfo.getTag()));
|
||||||
|
homeVO.setShopTag(tbPlatformDict == null ? new ArrayList<>() : Collections.singletonList(tbPlatformDict.getName()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (TbProduct tbProduct : product.get()) {
|
for (TbProduct tbProduct : product.get()) {
|
||||||
@@ -101,7 +106,7 @@ public class HomePageService {
|
|||||||
}
|
}
|
||||||
for (TagProductVO tagProductVO :dictPro.get()) {
|
for (TagProductVO tagProductVO :dictPro.get()) {
|
||||||
if (o.getRelationIds().equals(tagProductVO.getProductId().toString())){
|
if (o.getRelationIds().equals(tagProductVO.getProductId().toString())){
|
||||||
homeVO.setProTag(tagProductVO.getTags());
|
homeVO.setProTag(Collections.singletonList(tagProductVO.getTags()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
homeVO.setEndTime(DateUtils.getTodayEndTimeAsString());
|
homeVO.setEndTime(DateUtils.getTodayEndTimeAsString());
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ spring:
|
|||||||
# redis数据库索引(默认为0),我们使用索引为3的数据库,避免和其他数据库冲突
|
# redis数据库索引(默认为0),我们使用索引为3的数据库,避免和其他数据库冲突
|
||||||
database: 5
|
database: 5
|
||||||
# redis服务器地址(默认为localhost)
|
# redis服务器地址(默认为localhost)
|
||||||
host: 101.37.12.135
|
# host: 101.37.12.135
|
||||||
|
host: 127.0.0.1
|
||||||
# redis端口(默认为6379)
|
# redis端口(默认为6379)
|
||||||
port: 6379
|
port: 6379
|
||||||
# redis访问密码(默认为空)
|
# redis访问密码(默认为空)
|
||||||
@@ -54,6 +55,7 @@ ysk:
|
|||||||
callBackurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBack
|
callBackurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBack
|
||||||
callBackIn: https://p40312246f.goho.co/cashierService/notify/memberInCallBack
|
callBackIn: https://p40312246f.goho.co/cashierService/notify/memberInCallBack
|
||||||
default: 18710449883
|
default: 18710449883
|
||||||
|
prod: prod1
|
||||||
|
queue: cart_queue_putprod1
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ ysk:
|
|||||||
callBackurl: https://cashier.sxczgkj.cn/cashierService/notify/notifyCallBack
|
callBackurl: https://cashier.sxczgkj.cn/cashierService/notify/notifyCallBack
|
||||||
callBackIn: https://cashier.sxczgkj.cn/cashierService/notify/memberInCallBack
|
callBackIn: https://cashier.sxczgkj.cn/cashierService/notify/memberInCallBack
|
||||||
default: 19191703856
|
default: 19191703856
|
||||||
|
prod: prod1
|
||||||
|
queue: cart_queue_put1prod1
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
server:
|
server:
|
||||||
port: 9888
|
port: 9889
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://rm-bp1b572nblln4jho2.mysql.rds.aliyuncs.com/fycashier?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false
|
url: jdbc:mysql://rm-bp1b572nblln4jho2.mysql.rds.aliyuncs.com/fycashier?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false
|
||||||
@@ -56,6 +56,7 @@ ysk:
|
|||||||
callBackurl: https://cashier.sxczgkj.cn/cashierService/notify/notifyCallBack
|
callBackurl: https://cashier.sxczgkj.cn/cashierService/notify/notifyCallBack
|
||||||
callBackIn: https://cashier.sxczgkj.cn/cashierService/notify/memberInCallBack
|
callBackIn: https://cashier.sxczgkj.cn/cashierService/notify/memberInCallBack
|
||||||
default: 19191703856
|
default: 19191703856
|
||||||
|
prod: prod2
|
||||||
|
queue: cart_queue_put1prod2
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user