|
|
@ -122,7 +122,9 @@ public class IssueProjectTagDictRedis { |
|
|
|
Map<Double, List<IssueCategoryTagResultDTO>> customizedHeatMap = new HashMap<>(); |
|
|
|
customizedTuples.forEach(tuple -> { |
|
|
|
List<IssueCategoryTagResultDTO> queue = customizedHeatMap.get(tuple.getScore()); |
|
|
|
if((CollectionUtils.isEmpty(queue))) queue = new LinkedList<>(); |
|
|
|
if((CollectionUtils.isEmpty(queue))) { |
|
|
|
queue = new LinkedList<>(); |
|
|
|
} |
|
|
|
queue.add(parseObject(tuple.getValue(), IssueCategoryTagResultDTO.class)); |
|
|
|
customizedHeatMap.put(tuple.getScore(),queue); |
|
|
|
}); |
|
|
@ -137,8 +139,9 @@ public class IssueProjectTagDictRedis { |
|
|
|
//默认、自定义标签,只要有一个是空就触发补偿
|
|
|
|
//不信任缓存数据
|
|
|
|
if(!CollectionUtils.isEmpty(result) && !CollectionUtils.isEmpty(result.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME)) |
|
|
|
&& !CollectionUtils.isEmpty(result.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME))) |
|
|
|
&& !CollectionUtils.isEmpty(result.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME))) { |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -183,11 +186,13 @@ public class IssueProjectTagDictRedis { |
|
|
|
IssueProjectCategoryDictEntity otherCategory = categoryDictDao.selectSingleByCustomerIdAndCategoryNameAndCategoryType(customerId, ModuleConstants.CATEGORY_NAME_OTHERS, null); |
|
|
|
boolean ifOtherOnly = null != otherCategory && (!CollectionUtils.isEmpty(category) && category.size() == NumConstant.ONE && category.contains(otherCategory.getId())); |
|
|
|
Set<String> keys; |
|
|
|
if (CollectionUtils.isEmpty(category) || ifOtherOnly) |
|
|
|
if (CollectionUtils.isEmpty(category) || ifOtherOnly) { |
|
|
|
keys = redisUtils.keys(GovIssueRedisKeys.getGovernmentTagKey(customerId, null)); |
|
|
|
else keys = category.stream().map(key -> { |
|
|
|
return GovIssueRedisKeys.getGovernmentTagKey(customerId, key); |
|
|
|
}).collect(Collectors.toSet()); |
|
|
|
} else { |
|
|
|
keys = category.stream().map(key -> { |
|
|
|
return GovIssueRedisKeys.getGovernmentTagKey(customerId, key); |
|
|
|
}).collect(Collectors.toSet()); |
|
|
|
} |
|
|
|
//如果keys集合为空,说明缓存中没有当前客户的标签排行信息,直接进行补偿
|
|
|
|
if (!CollectionUtils.isEmpty(keys)){ |
|
|
|
keys.remove(GovIssueRedisKeys.getGovernmentTagKey(customerId,ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME)); |
|
|
@ -211,7 +216,9 @@ public class IssueProjectTagDictRedis { |
|
|
|
tupleSet.forEach(tuple -> { |
|
|
|
Double heatScore = tuple.getScore(); |
|
|
|
List<IssueCategoryTagResultDTO> queue = heatMap.get(heatScore); |
|
|
|
if (CollectionUtils.isEmpty(queue)) queue = new LinkedList<>(); |
|
|
|
if (CollectionUtils.isEmpty(queue)) { |
|
|
|
queue = new LinkedList<>(); |
|
|
|
} |
|
|
|
queue.add(parseObject(tuple.getValue(), IssueCategoryTagResultDTO.class)); |
|
|
|
heatMap.put(heatScore, queue); |
|
|
|
}); |
|
|
@ -228,7 +235,9 @@ public class IssueProjectTagDictRedis { |
|
|
|
Map<Double, List<IssueCategoryTagResultDTO>> customizedHeatMap = new HashMap<>(); |
|
|
|
customizedTuples.forEach(tuple -> { |
|
|
|
List<IssueCategoryTagResultDTO> queue = customizedHeatMap.get(tuple.getValue()); |
|
|
|
if((CollectionUtils.isEmpty(queue))) queue = new LinkedList<>(); |
|
|
|
if((CollectionUtils.isEmpty(queue))) { |
|
|
|
queue = new LinkedList<>(); |
|
|
|
} |
|
|
|
queue.add(parseObject(tuple.getValue(), IssueCategoryTagResultDTO.class)); |
|
|
|
customizedHeatMap.put((Double) tuple.getValue(),queue); |
|
|
|
}); |
|
|
@ -323,7 +332,9 @@ public class IssueProjectTagDictRedis { |
|
|
|
String redisKey = GovIssueRedisKeys.getGovernmentTagKey(customerId, k); |
|
|
|
v.forEach(tag -> { |
|
|
|
List<IssueCategoryTagResultDTO> unit = scoreMap.get(tag.getIssueUseCount()); |
|
|
|
if (CollectionUtils.isEmpty(unit)) unit = new LinkedList<>(); |
|
|
|
if (CollectionUtils.isEmpty(unit)) { |
|
|
|
unit = new LinkedList<>(); |
|
|
|
} |
|
|
|
IssueCategoryTagResultDTO object = ConvertUtils.sourceToTarget(tag, IssueCategoryTagResultDTO.class); |
|
|
|
object.setName(tag.getTagName()); |
|
|
|
unit.add(object); |
|
|
@ -423,7 +434,9 @@ public class IssueProjectTagDictRedis { |
|
|
|
* @date 2021.03.20 01:04 |
|
|
|
*/ |
|
|
|
public void batchIncrScore(Map<String,Map<String,List<IssueCategoryTagResultDTO>>> param){ |
|
|
|
if(CollectionUtils.isEmpty(param)) return; |
|
|
|
if(CollectionUtils.isEmpty(param)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
redisTemplate.executePipelined((RedisCallback) connection -> { |
|
|
|
param.forEach((operation,map) -> { |
|
|
|
if(!CollectionUtils.isEmpty(map)){ |
|
|
@ -452,7 +465,9 @@ public class IssueProjectTagDictRedis { |
|
|
|
* @date 2021.03.22 16:20 |
|
|
|
*/ |
|
|
|
public void updateTagAvailabilityBySecondCategoryIds(String customerId,List<String>secondCategoryIds,String availableFlag){ |
|
|
|
if(CollectionUtils.isEmpty(secondCategoryIds)) return; |
|
|
|
if(CollectionUtils.isEmpty(secondCategoryIds)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
secondCategoryIds.forEach(cid -> { |
|
|
|
String key = GovIssueRedisKeys.getGovernmentTagKey(customerId, cid); |
|
|
|
|
|
|
@ -463,7 +478,9 @@ public class IssueProjectTagDictRedis { |
|
|
|
Map<Double, Set<IssueCategoryTagResultDTO>> heatMap = new HashMap<>(); |
|
|
|
tagTuples.forEach(tuple -> { |
|
|
|
Set<IssueCategoryTagResultDTO> queue = heatMap.get(tuple.getValue()); |
|
|
|
if((CollectionUtils.isEmpty(queue))) queue = new HashSet<>(); |
|
|
|
if((CollectionUtils.isEmpty(queue))) { |
|
|
|
queue = new HashSet<>(); |
|
|
|
} |
|
|
|
IssueCategoryTagResultDTO ele = parseObject(tuple.getValue(), IssueCategoryTagResultDTO.class); |
|
|
|
ele.setIsDisable(availableFlag); |
|
|
|
queue.add(ele); |
|
|
|