diff --git a/changgou_gateway/changgou_gateway_system/pom.xml b/changgou_gateway/changgou_gateway_system/pom.xml
index eb096b6f95ce95623a645a8142567e72f5cfc487..b909cc234f972d6a66da51635755edd2af2e09e3 100644
--- a/changgou_gateway/changgou_gateway_system/pom.xml
+++ b/changgou_gateway/changgou_gateway_system/pom.xml
@@ -11,31 +11,13 @@
changgou_gateway_system
-
+
\ No newline at end of file
diff --git a/changgou_gateway/changgou_gateway_system/src/main/java/com/changgou/system/filter/AuthorizeFilter.java b/changgou_gateway/changgou_gateway_system/src/main/java/com/changgou/system/filter/AuthorizeFilter.java
index b3532f05d2e5eb5c34427780c7914427f237e04c..0de5fa3656ba531d9f021baca7b2831843d6e140 100644
--- a/changgou_gateway/changgou_gateway_system/src/main/java/com/changgou/system/filter/AuthorizeFilter.java
+++ b/changgou_gateway/changgou_gateway_system/src/main/java/com/changgou/system/filter/AuthorizeFilter.java
@@ -23,7 +23,7 @@ public class AuthorizeFilter implements GlobalFilter, Ordered {
ServerHttpResponse response = exchange.getResponse();
//3.判断当前的请求是否为登录请求,如果是,则直接放行
- if (request.getURI().getPath().contains("/admin/login")){
+ if (request.getURI().getPath().contains("/admin/login")) {
//放行
return chain.filter(exchange);
}
@@ -34,7 +34,7 @@ public class AuthorizeFilter implements GlobalFilter, Ordered {
String jwtToken = headers.getFirst("token");
//6.判断当前令牌是否存在,
- if (StringUtils.isEmpty(jwtToken)){
+ if (StringUtils.isEmpty(jwtToken)) {
//如果不存在,则向客户端返回错误提示信息
response.setStatusCode(HttpStatus.UNAUTHORIZED);
return response.setComplete();
@@ -44,7 +44,8 @@ public class AuthorizeFilter implements GlobalFilter, Ordered {
try {
//解析令牌
JwtUtil.parseJWT(jwtToken);
- }catch (Exception e){
+
+ } catch (Exception e) {
e.printStackTrace();
//令牌解析失败
//向客户端返回错误提示信息
diff --git a/changgou_gateway/changgou_gateway_web/src/main/java/com/changgou/web/gateway/filter/UrlFilter.java b/changgou_gateway/changgou_gateway_web/src/main/java/com/changgou/web/gateway/filter/UrlFilter.java
index 741d984e1126eb19aeedb18e462f8e0e0d6e6584..d281ac5cd56c0fb9eaa124e22b993dc0c5736590 100644
--- a/changgou_gateway/changgou_gateway_web/src/main/java/com/changgou/web/gateway/filter/UrlFilter.java
+++ b/changgou_gateway/changgou_gateway_web/src/main/java/com/changgou/web/gateway/filter/UrlFilter.java
@@ -3,7 +3,7 @@ package com.changgou.web.gateway.filter;
public class UrlFilter {
//所有需要传递令牌的地址
- public static String filterPath="/api/worder/**,/api/wseckillorder,/api/seckill,/api/wxpay,/api/wxpay/**,/api/user/**,/api/address/**,/api/wcart/**,/api/cart/**,/api/categoryReport/**,/api/orderConfig/**,/api/order/**,/api/orderItem/**,/api/orderLog/**,/api/preferential/**,/api/returnCause/**,/api/returnOrder/**,/api/returnOrderItem/**";
+ public static String filterPath="/api/worder/**,/api/collect/**,/api/wseckillorder,/api/seckill,/api/wxpay,/api/wxpay/**,/api/user/**,/api/address/**,/api/wcart/**,/api/cart/**,/api/categoryReport/**,/api/orderConfig/**,/api/order/**,/api/orderItem/**,/api/orderLog/**,/api/preferential/**,/api/returnCause/**,/api/returnOrder/**,/api/returnOrderItem/**";
public static boolean hasAuthorize(String url){
diff --git a/changgou_gateway/changgou_gateway_web/src/main/resources/application.yml b/changgou_gateway/changgou_gateway_web/src/main/resources/application.yml
index cfbb961d215daeada9136e8420aa34eed0a045a1..0a246b5c62711950323fca505861732b48045f68 100644
--- a/changgou_gateway/changgou_gateway_web/src/main/resources/application.yml
+++ b/changgou_gateway/changgou_gateway_web/src/main/resources/application.yml
@@ -16,7 +16,7 @@ spring:
- id: changgou_goods_route
uri: lb://goods
predicates:
- - Path=/api/album/**,/api/brand/**,/api/cache/**,/api/categoryBrand/**,/api/category/**,/api/para/**,/api/pref/**,/api/sku/**,/api/spec/**,/api/spu/**,/api/stockBack/**,/api/template/**
+ - Path=/api/album/**,/api/brand/**,/api/cache/**,/api/categoryBrand/**,/api/category/**,/api/para/**,/api/pref/**,/api/sku/**,/api/spec/**,/api/spu/**,/api/stockBack/**,/api/template/**,/api/collect/**
filters:
#- PrefixPath=/brand
- StripPrefix=1
diff --git a/changgou_service/changgou_service_goods/pom.xml b/changgou_service/changgou_service_goods/pom.xml
index 8427bf24deadd54097626b3c348a466636c7ce75..eeced7efd3af6a7c8a0a87dee54a21bf983ad0c9 100644
--- a/changgou_service/changgou_service_goods/pom.xml
+++ b/changgou_service/changgou_service_goods/pom.xml
@@ -32,12 +32,24 @@
changgou_service_order_api
1.0-SNAPSHOT
-
+ org.springframework.cloud
+ spring-cloud-starter-oauth2
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+
+
+ org.springframework.amqp
+ spring-rabbit
+
+
+
diff --git a/changgou_service/changgou_service_goods/src/main/java/com/changgou/GoodsApplication.java b/changgou_service/changgou_service_goods/src/main/java/com/changgou/GoodsApplication.java
index 3be196b2597ac61410cc7e517e22e6ec17ad371c..a78aacff0bebc849b3d3031fcf21cc4e97f656f5 100644
--- a/changgou_service/changgou_service_goods/src/main/java/com/changgou/GoodsApplication.java
+++ b/changgou_service/changgou_service_goods/src/main/java/com/changgou/GoodsApplication.java
@@ -1,5 +1,7 @@
package com.changgou;
+import com.changgou.goods.config.TokenDecode;
+import com.changgou.interceptor.FeignInterceptor;
import com.changgou.util.IdWorker;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
@@ -27,4 +29,15 @@ public class GoodsApplication {
public IdWorker idWorker(){
return new IdWorker(workerId,datacenterId);
}
+
+ @Bean
+ public TokenDecode tokenDecode(){
+ return new TokenDecode();
+ }
+
+
+ @Bean
+ public FeignInterceptor feignInterceptor(){
+ return new FeignInterceptor();
+ }
}
diff --git a/changgou_service/changgou_service_order/pom.xml b/changgou_service/changgou_service_order/pom.xml
index 29468409503a1ac3a082f09240279c2ffea9e31a..e2f3bcc3911c5791dd091899782ff8ef19296bcc 100644
--- a/changgou_service/changgou_service_order/pom.xml
+++ b/changgou_service/changgou_service_order/pom.xml
@@ -41,11 +41,11 @@
spring-cloud-starter-oauth2
-
+
org.springframework.amqp
spring-rabbit
diff --git a/changgou_service/changgou_service_order/src/main/java/com/changgou/order/service/impl/OrderServiceImpl.java b/changgou_service/changgou_service_order/src/main/java/com/changgou/order/service/impl/OrderServiceImpl.java
index d76b11f9e9f51bfdc5b2fbfddcbbfdc49608dec9..60f98e4876c061fb3ad7261303ff5aab87c5240f 100644
--- a/changgou_service/changgou_service_order/src/main/java/com/changgou/order/service/impl/OrderServiceImpl.java
+++ b/changgou_service/changgou_service_order/src/main/java/com/changgou/order/service/impl/OrderServiceImpl.java
@@ -1,7 +1,6 @@
package com.changgou.order.service.impl;
import com.alibaba.fastjson.JSON;
-import com.alibaba.fescar.spring.annotation.GlobalTransactional;
import com.changgou.goods.feign.SkuFeign;
import com.changgou.order.config.RabbitMQConfig;
import com.changgou.order.dao.*;
@@ -76,7 +75,6 @@ public class OrderServiceImpl implements OrderService {
* @param order
*/
@Override
- @GlobalTransactional(name = "order_add")
public String add(Order order){
//1.获取购物车的相关数据(redis)
Map cartMap = cartService.list(order.getUsername());