Răsfoiți Sursa

Merge branch 'huangzqa-new-version-20210404' into 'develop'

Huangzqa new version 20210404

See merge request dcuc-tjdsj/auth-back!4
黄资权 4 ani în urmă
părinte
comite
5b2c5a79df

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

@@ -80,16 +80,24 @@ public class AuthServiceController {
         }
 
         DecodedJWT decode = JWT.decode(userToken);
-        String idcard = decode.getClaim("idcard").asString();
+        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);