|
@ -1,9 +1,12 @@ |
|
|
package com.example.demo.controller; |
|
|
package com.example.demo.controller; |
|
|
import com.example.demo.Util.JWTUtil; |
|
|
import com.example.demo.Util.JWTUtil; |
|
|
|
|
|
import com.example.demo.Util.TokenPayload; |
|
|
import com.example.demo.domain.entity.Admin; |
|
|
import com.example.demo.domain.entity.Admin; |
|
|
import com.example.demo.domain.vo.Page; |
|
|
import com.example.demo.domain.vo.Page; |
|
|
import com.example.demo.domain.vo.Result; |
|
|
import com.example.demo.domain.vo.Result; |
|
|
import com.example.demo.sevice.AdminService; |
|
|
import com.example.demo.sevice.AdminService; |
|
|
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException; |
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
@ -53,11 +56,20 @@ public class AdminController { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
@PostMapping("/userinfo") |
|
|
@PostMapping("/userinfo") |
|
|
public UserDetails getUserInfo(@RequestBody String token) { |
|
|
|
|
|
System.out.println("*-*-*-*-*-*-"+token); |
|
|
|
|
|
|
|
|
public UserDetails getUserInfo(@RequestBody String requestBody) { |
|
|
|
|
|
ObjectMapper objectMapper = new ObjectMapper(); |
|
|
|
|
|
TokenPayload token1; |
|
|
try { |
|
|
try { |
|
|
System.out.println(JWTUtil.getUserDetailsList(token,Admin.class)); |
|
|
|
|
|
return JWTUtil.getUserDetailsList(token,Admin.class); |
|
|
|
|
|
|
|
|
token1 = objectMapper.readValue(requestBody, TokenPayload.class); |
|
|
|
|
|
} catch (JsonProcessingException e) { |
|
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
|
} |
|
|
|
|
|
String token = token1.getToken(); |
|
|
|
|
|
|
|
|
|
|
|
System.out.println("1/*/*/*/*//*-*-*-*-*-*-1" +token); |
|
|
|
|
|
try { |
|
|
|
|
|
System.out.println("/+/+/+/+/+/+/+//" + JWTUtil.getUserDetailsList(String.valueOf(token), Admin.class)); |
|
|
|
|
|
return JWTUtil.getUserDetailsList(String.valueOf(token), Admin.class); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
throw new RuntimeException(e); |
|
|
throw new RuntimeException(e); |
|
|
} |
|
|
} |
|
|