diff --git a/pig-auth/src/main/java/com/pig4cloud/pig/auth/endpoint/PigTokenEndpoint.java b/pig-auth/src/main/java/com/pig4cloud/pig/auth/endpoint/PigTokenEndpoint.java index a7121f3f..4aec99bd 100644 --- a/pig-auth/src/main/java/com/pig4cloud/pig/auth/endpoint/PigTokenEndpoint.java +++ b/pig-auth/src/main/java/com/pig4cloud/pig/auth/endpoint/PigTokenEndpoint.java @@ -16,6 +16,8 @@ package com.pig4cloud.pig.auth.endpoint; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.TemporalAccessorUtil; import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -213,8 +215,14 @@ public class PigTokenEndpoint { tokenVo.setUsername(authorization.getPrincipalName()); OAuth2Authorization.Token accessToken = authorization.getAccessToken(); tokenVo.setAccessToken(accessToken.getToken().getTokenValue()); - tokenVo.setExpiresAt(accessToken.getToken().getExpiresAt()); - tokenVo.setIssuedAt(accessToken.getToken().getIssuedAt()); + + String expiresAt = TemporalAccessorUtil.format(accessToken.getToken().getExpiresAt(), + DatePattern.NORM_DATETIME_PATTERN); + tokenVo.setExpiresAt(expiresAt); + + String issuedAt = TemporalAccessorUtil.format(accessToken.getToken().getIssuedAt(), + DatePattern.NORM_DATETIME_PATTERN); + tokenVo.setIssuedAt(issuedAt); return tokenVo; }).collect(Collectors.toList()); result.setRecords(tokenVoList); diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/TokenVo.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/TokenVo.java index a24354cf..cf4c1299 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/TokenVo.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/TokenVo.java @@ -2,8 +2,6 @@ package com.pig4cloud.pig.admin.api.vo; import lombok.Data; -import java.time.Instant; - /** * 前端展示令牌管理 * @@ -23,8 +21,8 @@ public class TokenVo { private String accessToken; - private Instant issuedAt; + private String issuedAt; - private Instant expiresAt; + private String expiresAt; }