| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.dto.AccountTransferDto; |
| | | import com.ruoyi.account.pojo.Account; |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | import com.ruoyi.account.service.AccountIncomeService; |
| | |
| | | |
| | | |
| | | /** |
| | | * 新增 |
| | | * 新增流水(自动补全收支方向) |
| | | * @param account |
| | | * @return |
| | | */ |
| | | @PostMapping() |
| | | @ApiOperation("新增") |
| | | @PostMapping("/add") |
| | | @ApiOperation("新增流水") |
| | | public AjaxResult add(@RequestBody Account account) { |
| | | return AjaxResult.success(accountService.save(account)); |
| | | return AjaxResult.success(accountService.saveFlow(account)); |
| | | } |
| | | |
| | | /** |
| | | * 转账(生成成对流水) |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | @PostMapping("/transfer") |
| | | @ApiOperation("转账") |
| | | public AjaxResult transfer(@RequestBody AccountTransferDto dto) { |
| | | return AjaxResult.success(accountService.transfer(dto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | } |
| | | //删除检验单 |
| | | if (accountService.listByIds(ids).stream().anyMatch(item -> "2".equals(item.getFlowType()))) { |
| | | return AjaxResult.error("转账成对流水不可单独删除"); |
| | | } |
| | | // 删除普通资金流水;转账流水必须保持成对完整 |
| | | return AjaxResult.success(accountService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | |
| | | @PutMapping() |
| | | @ApiOperation("修改") |
| | | public AjaxResult update(@RequestBody Account account) { |
| | | return AjaxResult.success(accountService.updateById(account)); |
| | | return AjaxResult.success(accountService.updateFlow(account)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiOperation("分页查询") |
| | | public AjaxResult accountListPage(Page page) { |
| | | return AjaxResult.success(accountService.page(page)); |
| | | public AjaxResult accountListPage(Page page,Account account) { |
| | | return AjaxResult.success(accountService.accountListPage(page,account)); |
| | | } |
| | | |
| | | |