|
|
@@ -2187,7 +2187,7 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
|
|
|
|
|
|
@Override
|
|
|
public QwUser getQwUserByRedisForId(String qwUserId) {
|
|
|
- if(StringUtils.isEmpty(qwUserId)){
|
|
|
+ if(StringUtils.isEmpty(qwUserId) || "null".equals(qwUserId)){
|
|
|
return null;
|
|
|
}
|
|
|
String redisKey = "qwUserRdById:" + qwUserId;
|
|
|
@@ -2203,14 +2203,19 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- QwUser qwUser = qwUserMapper.selectQwUserById(Long.valueOf(qwUserId));
|
|
|
- if (qwUser == null) {
|
|
|
+ try {
|
|
|
+ QwUser qwUser = qwUserMapper.selectQwUserById(Long.valueOf(qwUserId));
|
|
|
+ if (qwUser == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 存储时确保是JSON字符串
|
|
|
+ redisCache.setCacheObject(redisKey, JSON.toJSONString(qwUser), 1, TimeUnit.HOURS);
|
|
|
+ return qwUser;
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ logger.error("企微用户ID格式错误: {}", qwUserId);
|
|
|
return null;
|
|
|
}
|
|
|
-
|
|
|
- // 存储时确保是JSON字符串
|
|
|
- redisCache.setCacheObject(redisKey, JSON.toJSONString(qwUser), 1, TimeUnit.HOURS);
|
|
|
- return qwUser;
|
|
|
}
|
|
|
;
|
|
|
|