Browse Source

新增清除用户缓存的接口 epmet/userbaseinfo/clearusercache

master
wangchao 5 years ago
parent
commit
227441b808
  1. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java
  2. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBaseInfoRedis.java
  3. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java
  4. 13
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java

14
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java

@ -176,4 +176,18 @@ public class UserBaseInfoController {
userBaseInfoService.saveUserBaseInfoWhenAuthVolunteer(param);
return new Result();
}
/**
* @Description 清除用户缓存信息
* @param userIds
* @return
* @author wangc
* @date 2020.08.06 14:41
**/
@PostMapping("clearusercache")
public Result clearUserCache(@RequestBody List<String> userIds){
userBaseInfoService.clearUserCache(userIds);
return new Result();
}
}

14
epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBaseInfoRedis.java

@ -255,6 +255,20 @@ public class UserBaseInfoRedis {
}
/**
* @Description 批量清楚用户缓存信息
* @param userIds
* @return
* @author wangc
* @date 2020.08.06 14:34
**/
public void clearUserCache(List<String> userIds){
userIds.forEach(id ->{
if(StringUtils.isNotBlank(id)) {
redisUtils.delete(UserRedisKeys.getResiUserKey(id));
}
});
}
public <T> void mergeObject(T origin, T destination) {
if (origin == null || destination == null)

9
epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java

@ -152,4 +152,13 @@ public interface UserBaseInfoService extends BaseService<UserBaseInfoEntity> {
* @date 2020.07.31 09:38
**/
void saveUserBaseInfoWhenAuthVolunteer(ResiVolunteerAuthenticateFormDTO param);
/**
* @Description 清除用户缓存信息
* @param ids
* @return
* @author wangc
* @date 2020.08.06 14:38
**/
void clearUserCache(List<String> ids);
}

13
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java

@ -283,4 +283,17 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl<UserBaseInfoDao, Us
baseInfo.setHeadImgUrl(param.getAvatarUrl());
insertOrUpdate(baseInfo);
}
/**
* @Description 清除用户缓存信息
* @param ids
* @return
* @author wangc
* @date 2020.08.06 14:38
**/
@Override
public void clearUserCache(List<String> ids) {
if(null == ids || ids.isEmpty()) return;
userBaseInfoRedis.clearUserCache(ids);
}
}

Loading…
Cancel
Save