use of com.tony.billing.functions.TagInfoToDtoListSupplier in project BillingDubbo by TonyJiangWJ.
the class BudgetServiceImpl method queryBudgetsByCondition.
@Override
public List<BudgetDTO> queryBudgetsByCondition(Budget condition) {
Preconditions.checkNotNull(condition.getUserId(), "userId must not be null");
Preconditions.checkNotNull(condition.getBelongMonth(), "month must not be null");
Preconditions.checkNotNull(condition.getBelongYear(), "year must not be null");
List<Budget> budgets = mapper.findByYearMonth(condition);
return budgets.stream().map((budget) -> {
BudgetDTO dto = new BudgetDTO();
dto.setId(budget.getId());
dto.setBudgetName(budget.getBudgetName());
dto.setBudgetMoney(MoneyUtil.fen2Yuan(budget.getBudgetMoney()));
dto.setYearMonth(YearMonth.of(Integer.parseInt(budget.getBelongYear()), budget.getBelongMonth()).format(DateTimeFormatter.ofPattern("yyyy-MM")));
List<TagInfo> tagInfos = tagInfoMapper.listTagInfoByBudgetId(budget.getId(), budget.getUserId());
dto.setTagInfos(new TagInfoToDtoListSupplier(tagInfos).get());
return dto;
}).collect(Collectors.toList());
}
use of com.tony.billing.functions.TagInfoToDtoListSupplier in project BillingDubbo by TonyJiangWJ.
the class TagInfoServiceImpl method listCommonTagInfos.
@Override
public List<TagInfoDTO> listCommonTagInfos(List<Long> recordIds) {
Preconditions.checkState(CollectionUtils.isNotEmpty(recordIds));
List<TagInfo> commonTags = mapper.listCommonTagInfos(recordIds, recordIds.size());
return new TagInfoToDtoListSupplier(commonTags).get();
}
use of com.tony.billing.functions.TagInfoToDtoListSupplier 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