|
|
@ -27,7 +27,6 @@ import com.epmet.dto.result.IssueCategoryTagResultDTO; |
|
|
|
import com.epmet.entity.IssueProjectCategoryDictEntity; |
|
|
|
import com.epmet.entity.IssueProjectTagDictEntity; |
|
|
|
import com.epmet.utils.ModuleConstants; |
|
|
|
import com.fasterxml.jackson.databind.Module; |
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
@ -107,14 +106,14 @@ public class IssueProjectTagDictRedis { |
|
|
|
|
|
|
|
|
|
|
|
//如果keys集合为空,说明缓存中没有当前客户的标签排行信息,直接进行补偿
|
|
|
|
Set<ZSetOperations.TypedTuple<Object>> customizedTuples = redisUtils.zReverseRangeWithScores(GovIssueRedisKeys.getGovernmentTagKey(customerId, null), NumConstant.ZERO_L, (long) (NumConstant.ONE_NEG)); |
|
|
|
Set<ZSetOperations.TypedTuple<Object>> customizedTuples = redisUtils.zReverseRangeWithScores(GovIssueRedisKeys.getGovernmentTagKey(customerId, ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME), NumConstant.ZERO_L, (long) (NumConstant.ONE_NEG)); |
|
|
|
if(!CollectionUtils.isEmpty(customizedTuples)){ |
|
|
|
Map<Double, List<IssueCategoryTagResultDTO>> customizedHeatMap = new HashMap<>(); |
|
|
|
customizedTuples.forEach(tuple -> { |
|
|
|
List<IssueCategoryTagResultDTO> queue = customizedHeatMap.get(tuple.getValue()); |
|
|
|
List<IssueCategoryTagResultDTO> queue = customizedHeatMap.get(tuple.getScore()); |
|
|
|
if((CollectionUtils.isEmpty(queue))) queue = new LinkedList<>(); |
|
|
|
queue.add(parseObject(tuple.getValue(), IssueCategoryTagResultDTO.class)); |
|
|
|
customizedHeatMap.put((Double) tuple.getValue(),queue); |
|
|
|
customizedHeatMap.put(tuple.getScore(),queue); |
|
|
|
}); |
|
|
|
List<IssueCategoryTagResultDTO> customizedResult = new LinkedList<>(); |
|
|
|
customizedHeatMap.keySet().stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList()).forEach(count -> { |
|
|
@ -123,7 +122,10 @@ public class IssueProjectTagDictRedis { |
|
|
|
result.put(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,customizedResult); |
|
|
|
} |
|
|
|
|
|
|
|
if(!CollectionUtils.isEmpty(result)) |
|
|
|
//默认、自定义标签,只要有一个是空就触发补偿
|
|
|
|
//不信任缓存数据
|
|
|
|
if(!CollectionUtils.isEmpty(result) && !CollectionUtils.isEmpty(result.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME)) |
|
|
|
&& !CollectionUtils.isEmpty(result.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME))) |
|
|
|
return result; |
|
|
|
|
|
|
|
|
|
|
@ -285,7 +287,7 @@ public class IssueProjectTagDictRedis { |
|
|
|
fulfilled.forEach((redisKey, map) -> { |
|
|
|
map.forEach((score,list) -> { |
|
|
|
list.forEach(factor -> { |
|
|
|
connection.zSetCommands().zAdd(redisTemplate.getValueSerializer().serialize(redisKey), |
|
|
|
connection.zSetCommands().zAdd(redisTemplate.getKeySerializer().serialize(redisKey), |
|
|
|
score.doubleValue(), |
|
|
|
redisTemplate.getValueSerializer().serialize(factor)); |
|
|
|
}); |
|
|
|