use of com.tony.billing.response.budget.BudgetDetailResponse in project BillingDubbo by TonyJiangWJ.
the class BudgetController method getBudgetInfo.
@RequestMapping("/budget/get")
public BaseResponse getBudgetInfo(@ModelAttribute("request") @Validated BudgetDetailRequest request) {
Budget budget = budgetService.getById(request.getId());
if (budget != null) {
BudgetDetailResponse response = ResponseUtil.success(new BudgetDetailResponse());
BudgetDTO budgetDTO = new BudgetDTO();
budgetDTO.setId(budget.getId());
budgetDTO.setYearMonth(YearMonth.of(Integer.parseInt(budget.getBelongYear()), budget.getBelongMonth()).format(DateTimeFormatter.ofPattern("yyyy-MM")));
budgetDTO.setBudgetName(budget.getBudgetName());
budgetDTO.setBudgetMoney(MoneyUtil.fen2Yuan(budget.getBudgetMoney()));
budgetDTO.setVersion(budget.getVersion());
budgetDTO.setTagInfos(budgetService.getTagInfosByBudgetId(budget.getId(), request.getUserId()));
response.setBudgetInfo(budgetDTO);
return response;
}
return ResponseUtil.dataNotExisting();
}
Aggregations