use of com.tony.billing.response.taginfo.TagInfoListResponse in project BillingDubbo by TonyJiangWJ.
the class TagInfoController method listTag.
/**
* 列出所有标签
*
* @param request
* @return
*/
@RequestMapping(value = "/tag/list")
public TagInfoListResponse listTag(@ModelAttribute("request") BaseRequest request) {
TagInfoListResponse response = new TagInfoListResponse();
TagInfo tagInfo = new TagInfo();
tagInfo.setUserId(request.getUserId());
List<TagInfo> tagInfos = tagInfoService.listTagInfo(tagInfo);
if (!CollectionUtils.isEmpty(tagInfos)) {
response.setTagInfoList(tagInfos.parallelStream().map(tag -> {
TagInfoDTO model = new TagInfoDTO();
model.setTagName(tag.getTagName());
model.setTagId(tag.getId());
model.setUsageCount(tagInfoService.countTagUsage(tag.getId(), request.getUserId()));
return model;
}).sorted(Comparator.comparing(TagInfoDTO::getUsageCount).reversed()).collect(Collectors.toList()));
}
ResponseUtil.success(response);
return response;
}
use of com.tony.billing.response.taginfo.TagInfoListResponse in project BillingDubbo by TonyJiangWJ.
the class TagInfoController method listBudgetAssignableTags.
@RequestMapping("/budget/tag/assignable/list")
public TagInfoListResponse listBudgetAssignableTags(@Validated @ModelAttribute("request") BudgetTagAssignableListRequest request) {
List<TagInfo> tagInfos = tagInfoService.listAssignableTagsByBudgetId(request.getBudgetId());
TagInfoListResponse response = new TagInfoListResponse();
response.setTagInfoList(new TagInfoToDtoListSupplier(tagInfos).get());
if (CollectionUtils.isEmpty(tagInfos)) {
return ResponseUtil.dataNotExisting(response);
}
return ResponseUtil.success(response);
}
Aggregations