|
@ -141,12 +141,16 @@ public class TagServiceImpl implements TagService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Map<String, Set<ZSetOperations.TypedTuple<UpdateTagUseCountsResultDTO>>> customerTag = new HashMap<>(); |
|
|
Map<String, Set<ZSetOperations.TypedTuple<UpdateTagUseCountsResultDTO>>> customerTag = new HashMap<>(); |
|
|
customerTagList.stream().forEach(tag -> { |
|
|
customerTagList.forEach(tag -> { |
|
|
buildZset(customerTag, tag.getCustomerId(), tag.getId(), tag.getTagName(), tag.getUseCount()); |
|
|
buildZset(customerTag, tag.getCustomerId(), tag.getId(), tag.getTagName(),tag.getTagColor(), tag.getUseCount()); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
if (customerTag.size() > 0) { |
|
|
if (customerTag.size() > 0) { |
|
|
customerTag.forEach((customerId, tagSet) -> tagRedis.zAddCustomerTag(customerId, tagSet)); |
|
|
customerTag.forEach((customerId, tagSet) -> { |
|
|
|
|
|
//先删除(排行及关联标签) 再添加
|
|
|
|
|
|
tagRedis.clearCustomerTag(customerId); |
|
|
|
|
|
tagRedis.zAddCustomerTag(customerId, tagSet); |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
//key customerId:tagId
|
|
|
//key customerId:tagId
|
|
|
Map<String, Set<UpdateTagUseCountsResultDTO>> reCustomerTagMap = new HashMap<>(); |
|
|
Map<String, Set<UpdateTagUseCountsResultDTO>> reCustomerTagMap = new HashMap<>(); |
|
@ -172,9 +176,13 @@ public class TagServiceImpl implements TagService { |
|
|
throw new RenException("网格标签数为空"); |
|
|
throw new RenException("网格标签数为空"); |
|
|
} |
|
|
} |
|
|
customerTag.clear(); |
|
|
customerTag.clear(); |
|
|
gridTagList.stream().forEach(tag -> buildZset(customerTag, tag.getGridId(), tag.getTagId(), tag.getTagName(), tag.getUseCount())); |
|
|
gridTagList.forEach(tag -> buildZset(customerTag, tag.getGridId(), tag.getTagId(), tag.getTagName(), null, tag.getUseCount())); |
|
|
if (customerTag.size() > 0) { |
|
|
if (customerTag.size() > 0) { |
|
|
customerTag.forEach((gridId, tagSet) -> tagRedis.zAddGridTag(gridId, tagSet)); |
|
|
customerTag.forEach((gridId, tagSet) -> { |
|
|
|
|
|
//先删除(排行及关联标签) 再添加
|
|
|
|
|
|
tagRedis.clearGridTag(gridId); |
|
|
|
|
|
tagRedis.zAddGridTag(gridId, tagSet); |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//获取网格发布的文章 按网格排序
|
|
|
//获取网格发布的文章 按网格排序
|
|
@ -236,7 +244,7 @@ public class TagServiceImpl implements TagService { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void buildZset(Map<String, Set<ZSetOperations.TypedTuple<UpdateTagUseCountsResultDTO>>> customerTag, String customerId, String id, String tagName, Integer useCount) { |
|
|
private void buildZset(Map<String, Set<ZSetOperations.TypedTuple<UpdateTagUseCountsResultDTO>>> customerTag, String customerId, String id, String tagName, String tagColor, Integer useCount) { |
|
|
Set<ZSetOperations.TypedTuple<UpdateTagUseCountsResultDTO>> typedTupleSet = customerTag.get(customerId); |
|
|
Set<ZSetOperations.TypedTuple<UpdateTagUseCountsResultDTO>> typedTupleSet = customerTag.get(customerId); |
|
|
if (typedTupleSet == null) { |
|
|
if (typedTupleSet == null) { |
|
|
typedTupleSet = new HashSet<>(); |
|
|
typedTupleSet = new HashSet<>(); |
|
@ -245,7 +253,8 @@ public class TagServiceImpl implements TagService { |
|
|
UpdateTagUseCountsResultDTO initTag = new UpdateTagUseCountsResultDTO(); |
|
|
UpdateTagUseCountsResultDTO initTag = new UpdateTagUseCountsResultDTO(); |
|
|
initTag.setTagId(id); |
|
|
initTag.setTagId(id); |
|
|
initTag.setTagName(tagName); |
|
|
initTag.setTagName(tagName); |
|
|
|
|
|
initTag.setTagColor(tagColor); |
|
|
ZSetOperations.TypedTuple<UpdateTagUseCountsResultDTO> typedTuple1 = new DefaultTypedTuple<>(initTag, Double.valueOf(useCount)); |
|
|
ZSetOperations.TypedTuple<UpdateTagUseCountsResultDTO> typedTuple1 = new DefaultTypedTuple<>(initTag, Double.valueOf(useCount)); |
|
|
typedTupleSet.add(typedTuple1); |
|
|
typedTupleSet.add(typedTuple1); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|