Browse Source

commit doudian

zxy 2 years ago
parent
commit
50e2b166b7

+ 7 - 0
pom.xml

@@ -158,6 +158,13 @@
158
             <artifactId>springfox-swagger-ui</artifactId>
158
             <artifactId>springfox-swagger-ui</artifactId>
159
             <version>${swagger.version}</version>
159
             <version>${swagger.version}</version>
160
         </dependency>
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
     </dependencies>
168
     </dependencies>
162
 
169
 
163
     <!-- 阿里云maven仓库 -->
170
     <!-- 阿里云maven仓库 -->

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

@@ -8,7 +8,7 @@
8
 
8
 
9
 package com.api.config;
9
 package com.api.config;
10
 
10
 
11
-import com.api.interceptor.AuthorizationInterceptor;
11
+import com.common.interceptor.AuthorizationInterceptor;
12
 import com.api.resolver.LoginUserHandlerMethodArgumentResolver;
12
 import com.api.resolver.LoginUserHandlerMethodArgumentResolver;
13
 import org.springframework.beans.factory.annotation.Autowired;
13
 import org.springframework.beans.factory.annotation.Autowired;
14
 import org.springframework.context.annotation.Configuration;
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
 import com.api.entity.UserEntity;
15
 import com.api.entity.UserEntity;
16
 import io.swagger.annotations.Api;
16
 import io.swagger.annotations.Api;
17
 import io.swagger.annotations.ApiOperation;
17
 import io.swagger.annotations.ApiOperation;
18
+import org.springframework.beans.factory.BeanFactory;
18
 import org.springframework.beans.factory.annotation.Autowired;
19
 import org.springframework.beans.factory.annotation.Autowired;
19
 import org.springframework.context.ApplicationContext;
20
 import org.springframework.context.ApplicationContext;
20
 import org.springframework.web.bind.annotation.GetMapping;
21
 import org.springframework.web.bind.annotation.GetMapping;
@@ -23,6 +24,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
23
 import org.springframework.web.bind.annotation.RestController;
24
 import org.springframework.web.bind.annotation.RestController;
24
 import springfox.documentation.annotations.ApiIgnore;
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
 public class ApiTestController extends AbsctactController {
38
 public class ApiTestController extends AbsctactController {
35
     @Autowired
39
     @Autowired
36
     ApplicationContext applicationContext;
40
     ApplicationContext applicationContext;
37
-
41
+    @Autowired
42
+    BeanFactory beanFactory;
43
+    @Autowired
44
+    TokenDao tokenDao;
38
     @Login
45
     @Login
39
     @GetMapping("userInfo")
46
     @GetMapping("userInfo")
40
     @ApiOperation(value="获取用户信息", response=UserEntity.class)
47
     @ApiOperation(value="获取用户信息", response=UserEntity.class)
@@ -51,10 +58,12 @@ public class ApiTestController extends AbsctactController {
51
 
58
 
52
     @GetMapping("notToken")
59
     @GetMapping("notToken")
53
     @ApiOperation("忽略Token验证测试")
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
         TokenDao tokenDao = (TokenDao) beanNamesForType;
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
 package com.api.resolver;
9
 package com.api.resolver;
10
 
10
 
11
 import com.api.annotation.LoginUser;
11
 import com.api.annotation.LoginUser;
12
-import com.api.interceptor.AuthorizationInterceptor;
12
+import com.common.interceptor.AuthorizationInterceptor;
13
 import com.api.entity.UserEntity;
13
 import com.api.entity.UserEntity;
14
 import com.api.service.UserService;
14
 import com.api.service.UserService;
15
 import org.springframework.beans.factory.annotation.Autowired;
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
 import com.common.exception.RRException;
12
 import com.common.exception.RRException;

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

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

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

@@ -1,6 +1,6 @@
1
 <?xml version="1.0" encoding="UTF-8"?>
1
 <?xml version="1.0" encoding="UTF-8"?>
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
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
 </mapper>
6
 </mapper>

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

@@ -1,7 +1,7 @@
1
 <?xml version="1.0" encoding="UTF-8"?>
1
 <?xml version="1.0" encoding="UTF-8"?>
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
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
 </mapper>
7
 </mapper>