소스 검색

commit doudian

zxy 2 년 전
부모
커밋
50e2b166b7

+ 7 - 0
pom.xml

@@ -158,6 +158,13 @@
158 158
             <artifactId>springfox-swagger-ui</artifactId>
159 159
             <version>${swagger.version}</version>
160 160
         </dependency>
161
+        <dependency>
162
+            <groupId>dou.dou</groupId>
163
+            <artifactId>doudian</artifactId>
164
+            <version>0.1.1</version>
165
+            <scope>system</scope>
166
+            <systemPath>${project.basedir}/src/main/resources/lib/doudian-sdk-java-1.0.0-20220509171318-sources.jar</systemPath>
167
+        </dependency>
161 168
     </dependencies>
162 169
 
163 170
     <!-- 阿里云maven仓库 -->

+ 1 - 1
src/main/java/com/api/config/WebMvcConfig.java

@@ -8,7 +8,7 @@
8 8
 
9 9
 package com.api.config;
10 10
 
11
-import com.api.interceptor.AuthorizationInterceptor;
11
+import com.common.interceptor.AuthorizationInterceptor;
12 12
 import com.api.resolver.LoginUserHandlerMethodArgumentResolver;
13 13
 import org.springframework.beans.factory.annotation.Autowired;
14 14
 import org.springframework.context.annotation.Configuration;

+ 13 - 4
src/main/java/com/api/controller/ApiTestController.java

@@ -15,6 +15,7 @@ import com.api.annotation.LoginUser;
15 15
 import com.api.entity.UserEntity;
16 16
 import io.swagger.annotations.Api;
17 17
 import io.swagger.annotations.ApiOperation;
18
+import org.springframework.beans.factory.BeanFactory;
18 19
 import org.springframework.beans.factory.annotation.Autowired;
19 20
 import org.springframework.context.ApplicationContext;
20 21
 import org.springframework.web.bind.annotation.GetMapping;
@@ -23,6 +24,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
23 24
 import org.springframework.web.bind.annotation.RestController;
24 25
 import springfox.documentation.annotations.ApiIgnore;
25 26
 
27
+import javax.servlet.http.HttpServletRequest;
28
+import javax.servlet.http.HttpSession;
29
+
26 30
 /**
27 31
  * 测试接口
28 32
  *
@@ -34,7 +38,10 @@ import springfox.documentation.annotations.ApiIgnore;
34 38
 public class ApiTestController extends AbsctactController {
35 39
     @Autowired
36 40
     ApplicationContext applicationContext;
37
-
41
+    @Autowired
42
+    BeanFactory beanFactory;
43
+    @Autowired
44
+    TokenDao tokenDao;
38 45
     @Login
39 46
     @GetMapping("userInfo")
40 47
     @ApiOperation(value="获取用户信息", response=UserEntity.class)
@@ -51,10 +58,12 @@ public class ApiTestController extends AbsctactController {
51 58
 
52 59
     @GetMapping("notToken")
53 60
     @ApiOperation("忽略Token验证测试")
54
-    public R notToken(){
55
-        Object beanNamesForType = applicationContext.getBeanProvider(TokenDao.class);
61
+    public R notToken(HttpServletRequest request, HttpSession httpSession){
62
+        Object beanNamesForType = applicationContext.getBean(TokenDao.class);
63
+        TokenDao bean = beanFactory.getBean(TokenDao.class);
56 64
         TokenDao tokenDao = (TokenDao) beanNamesForType;
57
-        return R.ok().put("msg", "无需token也能访问。。。");
65
+//        return R.ok().put("msg", "无需token也能访问。。。");
66
+        return R.ok().put( "无需token也能访问。。。");
58 67
     }
59 68
 
60 69
 }

+ 1 - 1
src/main/java/com/api/resolver/LoginUserHandlerMethodArgumentResolver.java

@@ -9,7 +9,7 @@
9 9
 package com.api.resolver;
10 10
 
11 11
 import com.api.annotation.LoginUser;
12
-import com.api.interceptor.AuthorizationInterceptor;
12
+import com.common.interceptor.AuthorizationInterceptor;
13 13
 import com.api.entity.UserEntity;
14 14
 import com.api.service.UserService;
15 15
 import org.springframework.beans.factory.annotation.Autowired;

+ 1 - 1
src/main/java/com/api/interceptor/AuthorizationInterceptor.java

@@ -6,7 +6,7 @@
6 6
  * 版权所有,侵权必究!
7 7
  */
8 8
 
9
-package com.api.interceptor;
9
+package com.common.interceptor;
10 10
 
11 11
 
12 12
 import com.common.exception.RRException;

+ 1 - 1
src/main/resources/application.yml

@@ -40,7 +40,7 @@ renren:
40 40
 mybatis-plus:
41 41
   mapper-locations: classpath*:/mapper/**/*.xml
42 42
   #实体扫描,多个package用逗号或者分号分隔
43
-  typeAliasesPackage: io.api.entity
43
+  typeAliasesPackage: com.api.*.entity
44 44
   global-config:
45 45
     #数据库相关配置
46 46
     db-config:

+ 1 - 1
src/main/resources/mapper/TokenDao.xml

@@ -1,6 +1,6 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 
4
-<mapper namespace="com.renren.dao.TokenDao">
4
+<mapper namespace="com.api.dao.TokenDao">
5 5
 
6 6
 </mapper>

+ 1 - 1
src/main/resources/mapper/UserDao.xml

@@ -1,7 +1,7 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 
4
-<mapper namespace="com.renren.dao.UserDao">
4
+<mapper namespace="com.api.dao.UserDao">
5 5
 
6 6
 
7 7
 </mapper>