diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java index 23a9307b17..f4013ebd58 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java @@ -1029,10 +1029,10 @@ public class ArticleServiceImpl extends BaseServiceImpl tagsList = Arrays.asList(tags.split("\\|")); List tagsInfo = new ArrayList<>(); //政府端的 标签使用次数 DB - for (String tag : tagsList) { + tagsList.forEach(tag -> { UpdateTagUseCountsResultDTO updateTagUseCount = tagCustomerService.checkTagInfo(tag, customerId, userId); tagsInfo.add(updateTagUseCount); - } + }); UpdateCustomerTagCacheDTO result = new UpdateCustomerTagCacheDTO(); result.setCustomerId(customerId); result.setTagsInfo(tagsInfo); @@ -1048,11 +1048,10 @@ public class ArticleServiceImpl extends BaseServiceImpl tagsInfo = formDto.getTagsInfo(); String customerId = formDto.getCustomerId(); //更新缓存标签使用数量 - for (UpdateTagUseCountsResultDTO resultDTO : tagsInfo) { + tagsInfo.forEach(resultDTO -> { String customerKey = TagConstant.GOV_TAG_KEY+customerId; tagRedis.updateTagUseCounts(customerKey,resultDTO); - } - + }); //政府端更新redis的级联标签(set) List tagsInfoCopy = new ArrayList<>(); for (int i = 0; i < tagsInfo.size(); i++) { @@ -1084,12 +1083,12 @@ public class ArticleServiceImpl extends BaseServiceImpl gridTags = new ArrayList<>(); List gridTagCache = new ArrayList<>(); - for (String gridId : gridIds) { + gridIds.forEach(gridId -> { UpdateGridTagCacheDTO cache = new UpdateGridTagCacheDTO(); cache.setGridId(gridId); cache.setTagsInfo(tagsInfo); gridTagCache.add(cache); - for (UpdateTagUseCountsResultDTO resultDTO : tagsInfo) { + tagsInfo.forEach(resultDTO -> { UpdateGridTagsFormDTO tag = new UpdateGridTagsFormDTO(); BeanUtils.copyProperties(resultDTO,tag); tag.setCreatedBy(userId); @@ -1097,8 +1096,8 @@ public class ArticleServiceImpl extends BaseServiceImpl gridTagCache){ //更新 网格下 标签使用数量 List gridTagCacheCopy = new ArrayList<>(); - for (UpdateGridTagCacheDTO cacheDTO : gridTagCache) { + gridTagCache.forEach(cacheDTO -> { String gridId = cacheDTO.getGridId(); String key = TagConstant.GRID_TAG_KEY+gridId; List tagsInfo = cacheDTO.getTagsInfo(); - for (UpdateTagUseCountsResultDTO resultDTO : tagsInfo) { + tagsInfo.forEach(resultDTO -> { tagRedis.updateTagUseCounts(key,resultDTO); - } + }); //级联 for (int i = 0; i < tagsInfo.size(); i++) { gridTagCacheCopy.addAll(tagsInfo); @@ -1127,7 +1126,7 @@ public class ArticleServiceImpl extends BaseServiceImpl { AddArticleTagsFormDTO addArticleTag = new AddArticleTagsFormDTO(); addArticleTag.setCreatedBy(userId); addArticleTag.setUpdatedBy(userId); @@ -1151,7 +1150,7 @@ public class ArticleServiceImpl extends BaseServiceImpl