Browse Source

feature(增加应用权限变更通知):

huangzqa 4 years ago
parent
commit
c5fd6fc6bd

+ 9 - 1
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v1/controller/AuthServiceController.java

@@ -81,15 +81,23 @@ public class AuthServiceController {
 
         DecodedJWT decode = JWT.decode(userToken);
         String idcard = decode.getClaim("idcard").asString();
+        int iat = decode.getClaim("iat").asInt();
+        int exp = decode.getClaim("exp").asInt();
 
-        log.info("UserToken:{} , idcard:{}", userToken, idcard);
+        int expAt = exp - iat;
+
+        log.info("UserToken:{} , idcard:{}, expAt:{}", userToken, idcard, expAt);
 
         UserInfo userInfo = userFacade.detailBySfzh(idcard);
         if (userInfo == null) {
             return ApiResult.setFailMessage("用户不存在");
         }
+
+        staffAssignAuthInfoFacade.cacheUserToken(idcard, userToken, expAt);
+
         String userId = userInfo.getId();
         List<AppDataSensitiveLevelDTO> appList = staffAssignAuthInfoFacade.getAppLitByUserId(userId);
+
         List<AppAuthRespVO> respVOList = appList.stream().map(AppAuthRespVO::parseDto)
                 .collect(Collectors.toList());
         return ApiResult.setSuccessResult(respVOList);