能力统计详情 资源名称模糊查询与缓存

This commit is contained in:
wangliwen 2022-11-03 09:41:47 +08:00
parent 66acc1a318
commit 82a0b3537b
3 changed files with 35 additions and 7 deletions

View File

@ -19,6 +19,8 @@ import java.util.Map;
*/
@Mapper
public interface ResourceDao extends BaseDao<ResourceEntity> {
static final String selectCensusResourceTableKey = "selectCensusResourceTable";
static final String selectCensusApplyTableKey = "selectCensusApplyTable";
Integer deleteByIds(@Param("ids") List<Long> idList);
@ -193,8 +195,10 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
List<Map<String, Object>> selectDeptDetailTypeCountList(Map params);
@Cacheable(value = selectCensusResourceTableKey, key = "#p0")
List<Map> selectCensusResourceTable(Map params);
@Cacheable(value = selectCensusApplyTableKey, key = "#p0")
List<Map> selectCensusApplyTable(Map params);
List<Map> selectCollectList(@Param("resourceType") String resourceType, @Param("attrType") String attrType);

View File

@ -106,6 +106,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
private static final String SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY = "selectDTOPageSpecilTotal";
private static final String SELECTWITHATTRS_KEY = "selectWithAttrs";
private static final String SELECTCENSUSRESOURCETABLEKEY = "selectCensusResourceTable";
private static final String selectCensusApplyTableKey = "selectCensusApplyTable";
@Value("${system.startDay}")
private String systemDay;
@ -236,13 +240,13 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
}
@Override
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true)
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, SELECTCENSUSRESOURCETABLEKEY, selectCensusApplyTableKey}, allEntries = true)
public void save(ResourceDTO dto) {
super.save(dto);
}
@Override
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true)
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, SELECTCENSUSRESOURCETABLEKEY, selectCensusApplyTableKey}, allEntries = true)
public void update(ResourceDTO dto) {
super.update(dto);
}
@ -250,7 +254,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
@Transactional
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true)
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, SELECTCENSUSRESOURCETABLEKEY, selectCensusApplyTableKey}, allEntries = true)
public void insertWithAttrs(ResourceDTO dto) {
ResourceEntity resourceEntity = new ResourceEntity();
BeanUtils.copyProperties(dto, resourceEntity);
@ -314,7 +318,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
@Transactional
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true)
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, selectCensusApplyTableKey, SELECTCENSUSRESOURCETABLEKEY}, allEntries = true)
public void createMixAbility(ResourceDTO dto) {
ResourceEntity resourceEntity = new ResourceEntity();
BeanUtils.copyProperties(dto, resourceEntity);
@ -357,7 +361,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
@Transactional
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true)
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, SELECTCENSUSRESOURCETABLEKEY, selectCensusApplyTableKey}, allEntries = true)
public void deleteWithAttrs(JSONObject jsonObject) {
JSONArray jsonArray = jsonObject.getJSONArray("ids");
List<Long> idList = jsonArray.toJavaList(Long.class);
@ -371,7 +375,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
@Transactional
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true)
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, SELECTCENSUSRESOURCETABLEKEY, selectCensusApplyTableKey}, allEntries = true)
public void updateWithAttrs(ResourceDTO dto) {
ResourceEntity resourceEntity = new ResourceEntity();
BeanUtils.copyProperties(dto, resourceEntity);
@ -1185,7 +1189,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
* 同步知识库
*/
@Override
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true)
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, SELECTCENSUSRESOURCETABLEKEY, selectCensusApplyTableKey}, allEntries = true)
public void KnowledgeBase() {
final List<String> knowledgeUUID = jdbcTemplate.queryForList("SELECT note1 FROM tb_data_resource WHERE type ='知识库' AND note1 IS NOT NULL FOR UPDATE;", String.class).stream().distinct().collect(Collectors.toList());
final int pageSize = CPU_NUM * 10;

View File

@ -80,4 +80,24 @@
diskPersistent="true"
memoryStoreEvictionPolicy="LRU"/>
<!-- selectCensusResourceTable缓存 -->
<cache name="selectCensusResourceTable"
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="60"
timeToLiveSeconds="120"
overflowToDisk="true"
diskPersistent="true"
memoryStoreEvictionPolicy="LRU"/>
<!-- selectCensusResourceTable缓存 -->
<cache name="selectCensusApplyTable"
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="60"
timeToLiveSeconds="120"
overflowToDisk="true"
diskPersistent="true"
memoryStoreEvictionPolicy="LRU"/>
</ehcache>