Skip to content

Commit 8cc976e

Browse files
authored
Merge pull request 2227324689#162 from 2227324689/stu_dev_0809
Stu dev 0809
2 parents 5d7ca45 + 237019d commit 8cc976e

11 files changed

Lines changed: 477 additions & 445 deletions

File tree

db_scrpit/gpmall.sql

Lines changed: 451 additions & 429 deletions
Large diffs are not rendered by default.

docker-compose.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,18 @@ services:
5353
image: wurstmeister/zookeeper
5454
ports:
5555
- "2181:2181"
56+
rabbitmq:
57+
image: rabbitmq:management
58+
ports:
59+
- "4369:4369"
60+
- "5671:5671"
61+
- "25672:25672"
62+
- "5672:5672"
63+
- "15672:15672"
64+
container_name: rabbitmq
65+
hostname: rabbitmq
66+
environment:
67+
RABBITMQ_DEFAULT_USER: rabbitmq
68+
RABBITMQ_DEFAULT_PASS: 123456
69+
RABBITMQ_NODENAME: rabbitmq
70+
RABBITMQ_ERLANG_COOKIE: CURIOAPPLICATION

gpmall-commons/commons-mq/src/main/java/com/gpmall/commons/config/RabbitMqConfig.java renamed to gpmall-commons/commons-mq/src/main/java/com/gpmall/commons/mq/config/RabbitMqConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.gpmall.commons.config;
1+
package com.gpmall.commons.mq.config;
22

33

44
import org.springframework.amqp.core.Binding;

gpmall-commons/commons-mq/src/main/java/com/gpmall/commons/producer/RabbitMessageProducer.java renamed to gpmall-commons/commons-mq/src/main/java/com/gpmall/commons/mq/producer/RabbitMessageProducer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package com.gpmall.commons.producer;
1+
package com.gpmall.commons.mq.producer;
22

3-
import com.gpmall.commons.config.RabbitMqConfig;
3+
import com.gpmall.commons.mq.config.RabbitMqConfig;
44
import org.springframework.amqp.core.MessageDeliveryMode;
55
import org.springframework.amqp.rabbit.core.RabbitTemplate;
66
import org.springframework.beans.factory.annotation.Autowired;
@@ -20,7 +20,7 @@ public void send(String context) {
2020
//将订单发送到rabbitmq
2121
rabbitTemplate.convertAndSend(RabbitMqConfig.DELAY_EXCHANGE, context, message -> {
2222
message.getMessageProperties().setDeliveryMode(MessageDeliveryMode.PERSISTENT);
23-
message.getMessageProperties().setDelay(15 * 60 * 1000);//毫秒为单位
23+
message.getMessageProperties().setDelay(10 * 60 * 1000);//毫秒为单位
2424
return message;
2525
});
2626
}

gpmall-parent/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
<maven.compiler.source>1.8</maven.compiler.source>
1717
<maven.compiler.target>1.8</maven.compiler.target>
1818
<spring-boot.version>2.1.6.RELEASE</spring-boot.version>
19-
<dubbo.version>2.7.2</dubbo.version>
20-
<dubbo-spring-boot.version>2.7.1</dubbo-spring-boot.version>
19+
<dubbo.version>2.7.3</dubbo.version>
20+
<dubbo-spring-boot.version>2.7.3</dubbo-spring-boot.version>
2121
<curator.famework.version>4.2.0</curator.famework.version>
2222
<mybatis.version>2.1.0</mybatis.version>
2323
<tkmybatis.version>3.4.2</tkmybatis.version>

order-services/order-provider/src/main/java/com/gpmall/order/biz/handler/InitOrderHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public boolean handle(TransHandlerContext context) {
8282
createOrderContext.getCartProductDtoList().parallelStream().forEach(cartProductDto -> {
8383
OrderItem orderItem = new OrderItem();
8484
orderItem.setId(globalIdGeneratorUtil.getNextSeq(ORDER_ITEM_GLOBAL_ID_CACHE_KEY, 1));
85-
orderItem.setItemId(String.valueOf(cartProductDto.getProductId()));
85+
orderItem.setItemId(cartProductDto.getProductId());
8686
orderItem.setOrderId(String.valueOf(orderId));
8787
orderItem.setNum(Math.toIntExact(cartProductDto.getProductNum()));
8888
orderItem.setPrice(NumberUtils.toDouble(cartProductDto.getSalePrice()));

order-services/order-provider/src/main/java/com/gpmall/order/biz/handler/SendMessageHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.gpmall.order.biz.handler;
22

3-
import com.gpmall.commons.producer.RabbitMessageProducer;
3+
import com.gpmall.commons.mq.producer.RabbitMessageProducer;
44
import com.gpmall.order.biz.context.CreateOrderContext;
55
import com.gpmall.order.biz.context.TransHandlerContext;
66
import lombok.extern.slf4j.Slf4j;

order-services/order-provider/src/main/java/com/gpmall/order/bootstrap/OrderProviderApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import org.springframework.context.annotation.ComponentScan;
66
import tk.mybatis.spring.annotation.MapperScan;
77

8-
@ComponentScan(basePackages ={"com.gpmall.order"})
8+
@ComponentScan(basePackages ={"com.gpmall.order","com.gpmall.commons.mq"})
99
@MapperScan(basePackages = "com.gpmall.order.dal")
1010
@SpringBootApplication
1111
public class OrderProviderApplication {

order-services/order-provider/src/main/java/com/gpmall/order/consumer/OrderCancelConsumer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.gpmall.order.consumer;
22

3-
import com.gpmall.commons.config.RabbitMqConfig;
4-
import com.gpmall.order.OrderQueryService;
3+
import com.gpmall.commons.mq.config.RabbitMqConfig;
54
import com.gpmall.order.constants.OrderConstants;
65
import com.gpmall.order.dal.entitys.Order;
76
import com.gpmall.order.dal.entitys.OrderItem;

order-services/order-provider/src/main/resources/application-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ spring:
3131
rabbitmq:
3232
host: 127.0.0.1
3333
port: 5672
34-
username: root
34+
username: rabbitmq
3535
password: 123456
3636
listener:
3737
direct:

0 commit comments

Comments
 (0)