|
|
@ -100,8 +100,10 @@ public class IssueProjectTagDictRedis { |
|
|
|
throw new RenException("customerId can not be null when obtain govern tags."); |
|
|
|
} |
|
|
|
|
|
|
|
//查询客户的“其他"分类的Id
|
|
|
|
IssueProjectCategoryDictEntity otherCategory = categoryDictDao.selectSingleByCustomerIdAndCategoryNameAndCategoryType(customerId, ModuleConstants.CATEGORY_NAME_OTHERS, null); |
|
|
|
//是否传入的类别Id中只包含"其他"分类,因为自定义分类和默认分类排序规则不一样
|
|
|
|
//判断入参是否是只有一个分类Id并且是"其他"的Id
|
|
|
|
boolean ifOtherOnly = null == otherCategory ? false : (!CollectionUtils.isEmpty(category) && category.size() == NumConstant.ONE && category.contains(otherCategory.getId()) ? true : false); |
|
|
|
|
|
|
|
Map<String,List<IssueCategoryTagResultDTO>> result = new HashMap<>(); |
|
|
@ -349,13 +351,22 @@ public class IssueProjectTagDictRedis { |
|
|
|
//result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME,CollectionUtils.isEmpty(db) ? null : db.stream().filter(o -> !StringUtils.equals(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,o.getCategoryId())).map(entity -> {
|
|
|
|
// IssueCategoryTagResultDTO tag = ConvertUtils.sourceToTarget(entity,IssueCategoryTagResultDTO.class);
|
|
|
|
// tag.setName(entity.getTagName()); return tag;}).collect(Collectors.toList()));
|
|
|
|
result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME,poolDao.selectDefault(customerId,ifOtherOnly ? null : category)); |
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(preResult) && !CollectionUtils.isEmpty(preResult.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME))) { |
|
|
|
result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME, preResult.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME)); |
|
|
|
} else { |
|
|
|
result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME, poolDao.selectDefault(customerId, ifOtherOnly ? null : category)); |
|
|
|
} |
|
|
|
|
|
|
|
//自定义标签:按照热度排序 sorted(Comparator.comparing(IssueProjectTagDictEntity :: getIssueUseCount).reversed())
|
|
|
|
result.put(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,CollectionUtils.isEmpty(db) ? null : db.stream().filter(o -> StringUtils.equals(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,o.getCategoryId())).sorted(Comparator.comparing(IssueProjectTagDictEntity :: getIssueUseCount).reversed()).map(entity -> { |
|
|
|
IssueCategoryTagResultDTO tag = ConvertUtils.sourceToTarget(entity,IssueCategoryTagResultDTO.class); |
|
|
|
tag.setName(entity.getTagName());return tag;}).collect(Collectors.toList())); |
|
|
|
if (!CollectionUtils.isEmpty(preResult) && !CollectionUtils.isEmpty(preResult.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME))) { |
|
|
|
result.put(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME, preResult.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME)); |
|
|
|
} else { |
|
|
|
result.put(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME, CollectionUtils.isEmpty(db) ? null : db.stream().filter(o -> StringUtils.equals(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME, o.getCategoryId())).sorted(Comparator.comparing(IssueProjectTagDictEntity::getIssueUseCount).reversed()).map(entity -> { |
|
|
|
IssueCategoryTagResultDTO tag = ConvertUtils.sourceToTarget(entity, IssueCategoryTagResultDTO.class); |
|
|
|
tag.setName(entity.getTagName()); |
|
|
|
return tag; |
|
|
|
}).collect(Collectors.toList())); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|