mirror of https://gitee.com/stylefeng/roses
【8.3.3】【sys】【cache】更新职位缓存的删除
parent
2a6c414bdd
commit
17fd7544b5
|
@ -14,6 +14,7 @@ import cn.stylefeng.roses.kernel.rule.enums.StatusEnum;
|
||||||
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
|
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
|
||||||
import cn.stylefeng.roses.kernel.rule.pojo.dict.SimpleDict;
|
import cn.stylefeng.roses.kernel.rule.pojo.dict.SimpleDict;
|
||||||
import cn.stylefeng.roses.kernel.sys.api.callback.RemovePositionCallbackApi;
|
import cn.stylefeng.roses.kernel.sys.api.callback.RemovePositionCallbackApi;
|
||||||
|
import cn.stylefeng.roses.kernel.sys.api.constants.SysConstants;
|
||||||
import cn.stylefeng.roses.kernel.sys.modular.position.entity.HrPosition;
|
import cn.stylefeng.roses.kernel.sys.modular.position.entity.HrPosition;
|
||||||
import cn.stylefeng.roses.kernel.sys.modular.position.enums.HrPositionExceptionEnum;
|
import cn.stylefeng.roses.kernel.sys.modular.position.enums.HrPositionExceptionEnum;
|
||||||
import cn.stylefeng.roses.kernel.sys.modular.position.mapper.HrPositionMapper;
|
import cn.stylefeng.roses.kernel.sys.modular.position.mapper.HrPositionMapper;
|
||||||
|
@ -30,6 +31,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 职位信息业务实现层
|
* 职位信息业务实现层
|
||||||
|
@ -67,6 +69,9 @@ public class HrPositionServiceImpl extends ServiceImpl<HrPositionMapper, HrPosit
|
||||||
HrPosition hrPosition = this.queryHrPosition(hrPositionRequest);
|
HrPosition hrPosition = this.queryHrPosition(hrPositionRequest);
|
||||||
this.removeById(hrPosition.getPositionId());
|
this.removeById(hrPosition.getPositionId());
|
||||||
|
|
||||||
|
// 删除缓存
|
||||||
|
positionNameCache.remove(hrPosition.getPositionId().toString());
|
||||||
|
|
||||||
// 记录日志
|
// 记录日志
|
||||||
BusinessLogUtil.setLogTitle("删除职务,职务名称:" + hrPosition.getPositionName());
|
BusinessLogUtil.setLogTitle("删除职务,职务名称:" + hrPosition.getPositionName());
|
||||||
BusinessLogUtil.addContent("职务详细信息如下:\n", hrPosition);
|
BusinessLogUtil.addContent("职务详细信息如下:\n", hrPosition);
|
||||||
|
@ -85,6 +90,10 @@ public class HrPositionServiceImpl extends ServiceImpl<HrPositionMapper, HrPosit
|
||||||
// 批量删除职位
|
// 批量删除职位
|
||||||
this.removeBatchByIds(positionIdList);
|
this.removeBatchByIds(positionIdList);
|
||||||
|
|
||||||
|
// 删除缓存
|
||||||
|
Set<String> positionIdString = positionIdList.stream().map(String::valueOf).collect(Collectors.toSet());
|
||||||
|
positionNameCache.remove(positionIdString);
|
||||||
|
|
||||||
// 记录日志
|
// 记录日志
|
||||||
BusinessLogUtil.setLogTitle("批量删除职务");
|
BusinessLogUtil.setLogTitle("批量删除职务");
|
||||||
BusinessLogUtil.addContent("被删除职务信息列表:\n", positionIdList);
|
BusinessLogUtil.addContent("被删除职务信息列表:\n", positionIdList);
|
||||||
|
@ -167,7 +176,7 @@ public class HrPositionServiceImpl extends ServiceImpl<HrPositionMapper, HrPosit
|
||||||
if (hrPosition == null) {
|
if (hrPosition == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
positionNameCache.put(positionId.toString(), hrPosition.getPositionName());
|
positionNameCache.put(positionId.toString(), hrPosition.getPositionName(), SysConstants.DEFAULT_SYS_CACHE_TIMEOUT_SECONDS);
|
||||||
return hrPosition.getPositionName();
|
return hrPosition.getPositionName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue