Search in sources :

Example 1 with BudgetDetailResponse

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();
}
Also used : BudgetDetailResponse(com.tony.billing.response.budget.BudgetDetailResponse) Budget(com.tony.billing.entity.Budget) BudgetDTO(com.tony.billing.dto.BudgetDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

BudgetDTO (com.tony.billing.dto.BudgetDTO)1 Budget (com.tony.billing.entity.Budget)1 BudgetDetailResponse (com.tony.billing.response.budget.BudgetDetailResponse)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1