feat: 账单导入、统计维度扩展与收支记录增强
- 账单导入:新增支付宝账单解析/导入接口,按 external_no 去重;前端拖拽上传 + 预览确认弹窗 - 分类可选:category_id 允许为空,支持「未分类」筛选,新增按类型一键批量设置分类 - 备注隐藏:新增 remark_hidden 与切换接口,列表默认显示 ****** 并可单格查看/取消隐藏,导出同步隐藏 - 统计扩展:新增 /statistics/summary、/statistics/group,支持日/周/月/季/年/支付方式/分类/类型维度与时间范围过滤 - 收支记录:金额区间过滤、金额/交易时间列排序、分页快速跳转、本页收支结余汇总、交易时间列前置并合并创建时间提示 - 用户偏好:统计面板与列表的筛选条件持久化到 localStorage,进入自动还原 - 其他:新增默认分类种子脚本(含美容美发)、commons-csv 依赖、上传大小限制 10MB、Vite 监听 0.0.0.0
This commit is contained in:
@@ -3,6 +3,7 @@ package com.example.finance.controller;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.example.finance.common.PageResult;
|
||||
import com.example.finance.common.Result;
|
||||
import com.example.finance.dto.BatchCategoryRequest;
|
||||
import com.example.finance.dto.TransactionQuery;
|
||||
import com.example.finance.dto.TransactionRequest;
|
||||
import com.example.finance.service.TransactionService;
|
||||
@@ -130,6 +131,40 @@ public class TransactionController {
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换交易记录的备注隐藏标记
|
||||
*
|
||||
* @param request HTTP请求,从中获取用户ID
|
||||
* @param id 交易记录ID
|
||||
* @param body 请求体,包含 remarkHidden 字段
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/{id}/remark-hidden")
|
||||
@Operation(summary = "切换备注隐藏标记", description = "切换交易记录的备注是否隐藏(用于表格中单元格按钮)")
|
||||
public Result<Void> toggleRemarkHidden(HttpServletRequest request,
|
||||
@Parameter(description = "交易记录ID") @PathVariable Long id,
|
||||
@RequestBody Map<String, Boolean> body) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
Boolean remarkHidden = body != null ? body.get("remarkHidden") : null;
|
||||
transactionService.toggleRemarkHidden(userId, id, remarkHidden);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置交易记录的分类
|
||||
*
|
||||
* @param request HTTP请求,从中获取用户ID
|
||||
* @param body 批量设置请求参数
|
||||
* @return 实际更新的记录数
|
||||
*/
|
||||
@PutMapping("/batch-category")
|
||||
@Operation(summary = "批量设置分类", description = "将当前表格展示的多条交易记录按类型一键归入所选分类")
|
||||
public Result<Integer> batchUpdateCategory(HttpServletRequest request,
|
||||
@RequestBody @Valid BatchCategoryRequest body) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
return Result.success(transactionService.batchUpdateCategory(userId, body));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出交易记录为 Excel 文件
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user