my-csc-config-file.git 5 lat temu
rodzic
commit
977b7ef8d5

+ 6 - 19
src/main/java/com/unissoft/controller/UserController.java

@@ -3,6 +3,7 @@ package com.unissoft.controller;
3 3
 import com.alibaba.fastjson.JSON;
4 4
 import com.alibaba.fastjson.JSONObject;
5 5
 import com.unissoft.model.SysUser;
6
+import com.unissoft.model.SysUserPO;
6 7
 import org.springframework.beans.factory.annotation.Autowired;
7 8
 import org.springframework.security.core.Authentication;
8 9
 import org.springframework.security.core.context.SecurityContext;
@@ -63,31 +64,17 @@ public class UserController {
63 64
      * @param token
64 65
      * @return
65 66
      */
66
-    @GetMapping("/decodeToken")
67
-    public ResultView decodeToken(@RequestParam String token) throws UnsupportedEncodingException {
68
-
69
-//        Claims claims = Jwts.parser().setSigningKey("jwt_wsm".getBytes("UTF-8"))
70
-//                .parseClaimsJws(token).getBody();
71
-//        System.err.println(claims);
72
-//
73
-//        Object createTime = claims.get("createTime");
74
-//        System.err.println("创建时间:" + createTime);
75
-//
76
-//        Date expiration = claims.getExpiration();
77
-//        System.err.println("过期时间:" + expiration);
78
-//
79
-//        String author = (String) claims.get("author");
80
-//        System.err.println("作者:" + author);
67
+    @GetMapping("/getCurrUserInfo")
68
+    public SysUserPO getCurrUserInfo(@RequestParam String token) throws UnsupportedEncodingException {
81 69
 
82 70
         Jwt decode = JwtHelper.decode(token);
83 71
 
84
-
85 72
         String claims = decode.getClaims();
86 73
         JSONObject jsonObject = JSON.parseObject(claims);
87 74
         Map<String, String> jsonMap = JSONObject.toJavaObject(jsonObject, Map.class);
88 75
         JSONObject user = JSON.parseObject(jsonMap.get("user_name"));
89
-        SysUser SysUser = JSONObject.toJavaObject(user, SysUser.class);
90
-        System.out.println(SysUser);
91
-        return ResultView.success(decode);
76
+        SysUserPO sysUserPO = JSONObject.toJavaObject(user, SysUserPO.class);
77
+
78
+        return sysUserPO;
92 79
     }
93 80
 }

+ 9 - 9
src/main/resources/bootstrap.yml

@@ -1,16 +1,16 @@
1 1
 #端口号
2 2
 server:
3 3
   port: 9602
4
-
4
+ 
5 5
 eureka:
6 6
   instance:
7
-    hostname: 172.16.0.46 #地址
7
+    hostname: 172.16.0.2 #地址
8 8
     prefer-ip-address: true
9 9
   client:
10 10
     service-url:
11 11
       # 向注册中心注册服务
12
-      defaultZone: http://172.16.0.46:9600/eureka
13
-
12
+      defaultZone: http://172.16.0.2:9600/eureka
13
+ 
14 14
 #spring:
15 15
 #  application:
16 16
 #    name: csc-szls-oauth #服务名
@@ -21,7 +21,7 @@ eureka:
21 21
 #        service-id: CSC-SZLS-CONFIG  # 注册中心的服务名
22 22
 #      profile: dev  # 指定配置文件的环境
23 23
 #      label: master
24
-
24
+ 
25 25
 spring:
26 26
   application:
27 27
     name: csc-szls-oauth #服务名
@@ -30,7 +30,7 @@ spring:
30 30
     username: root
31 31
     password: 123456
32 32
     url: jdbc:mysql://172.16.0.46:3306/csc-szls?characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
33
-
33
+ 
34 34
 redis:
35 35
   database: 0 #Redis数据库索引(默认为0)
36 36
   timeout: 5000ms # 连接超时时间(毫秒)
@@ -43,12 +43,12 @@ redis:
43 43
       max-wait: -1ms  # 连接池最大阻塞等待时间(使用负值表示没有限制)
44 44
       max-idle: 8  # 连接池中的最大空闲连接
45 45
       min-idle: 0  # 连接池中的最小空闲连接
46
-
46
+ 
47 47
 mybatis:
48 48
   mapper-locations: classpath:/mapper/*Mapper.xml
49
-
49
+ 
50 50
 my-config:
51 51
   clientId: client_oauth
52 52
 logging:
53 53
   level:
54
-    com.unissoft.mapper: DEBUG #包路径为mapper文件包路径
54
+    com.unissoft.mapper: DEBUG #包路径为mapper文件包路径