From dd69bfc1fb8e5e28dde754fab7f23bfb1a18faa5 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期五, 05 六月 2026 16:58:07 +0800
Subject: [PATCH] config(dev): 更新开发环境配置和文件上传功能 - 调整文件上传路径配置 - 修复OA环境文件链接前缀配置 - 在审批实例服务中添加报销相关数据删除逻辑 - 实现申请人姓名自动填充功能 - 添加文件下载预览路由的正则表达式支持 - 为企业新闻VO添加附件列表兼容别名 - 完善员工入职服务的异常处理 - 新增账户附件管理控制器 - 实现文件上传接口并返回完整文件信息

---
 src/main/java/com/ruoyi/account/service/impl/financial/FinLedgerServiceImpl.java |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/ruoyi/account/service/impl/financial/FinLedgerServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/financial/FinLedgerServiceImpl.java
index a489c67..a36b241 100644
--- a/src/main/java/com/ruoyi/account/service/impl/financial/FinLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/account/service/impl/financial/FinLedgerServiceImpl.java
@@ -41,7 +41,7 @@
         if (startMonth.isAfter(endMonth)) {
             throw new ServiceException("寮�濮嬫湀浠戒笉鑳藉ぇ浜庣粨鏉熸湀浠�");
         }
-        return buildLedgerRows(queryDto.getSubjectCode(), startMonth, endMonth, null, null);
+        return Collections.singletonList(buildGeneralLedgerTotalRow(queryDto.getSubjectCode(), startMonth, endMonth));
     }
 
     @Override
@@ -117,6 +117,37 @@
         return rows;
     }
 
+    private FinLedgerRowVo buildGeneralLedgerTotalRow(String subjectCode, YearMonth startMonth, YearMonth endMonth) {
+        LocalDate startDate = startMonth.atDay(1);
+        LocalDate endDate = endMonth.atEndOfMonth();
+
+        List<FinLedgerEntryRecordVo> openingEntries = finVoucherEntryMapper.listPostedEntriesBefore(
+                subjectCode, startDate, null, null
+        );
+        BigDecimal openingBalance = calculateBalance(openingEntries);
+
+        List<FinLedgerEntryRecordVo> currentPeriodEntries = finVoucherEntryMapper.listPostedEntries(
+                subjectCode, startDate, endDate, null, null
+        );
+
+        BigDecimal totalDebit = ZERO;
+        BigDecimal totalCredit = ZERO;
+        for (FinLedgerEntryRecordVo entry : currentPeriodEntries) {
+            totalDebit = totalDebit.add(money(entry.getDebit()));
+            totalCredit = totalCredit.add(money(entry.getCredit()));
+        }
+
+        BigDecimal endingBalance = openingBalance.add(totalDebit).subtract(totalCredit);
+        FinLedgerRowVo totalRow = new FinLedgerRowVo();
+        totalRow.setRowType("yearly_total");
+        totalRow.setDate(endDate);
+        totalRow.setDebit(money(totalDebit));
+        totalRow.setCredit(money(totalCredit));
+        totalRow.setBalance(money(endingBalance));
+        totalRow.setDirection(resolveDirection(endingBalance));
+        return totalRow;
+    }
+
     private Map<YearMonth, List<FinLedgerEntryRecordVo>> groupEntriesByMonth(List<FinLedgerEntryRecordVo> entries) {
         Map<YearMonth, List<FinLedgerEntryRecordVo>> map = new LinkedHashMap<>();
         for (FinLedgerEntryRecordVo entry : entries) {

--
Gitblit v1.9.3