From 2c19f00b211b7ffb1a265d67991d92f2b194b1f5 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 08 六月 2026 11:33:47 +0800
Subject: [PATCH] feat(financial): 新增凭证分录科目明细字段
---
src/main/java/com/ruoyi/account/service/impl/financial/FinLedgerServiceImpl.java | 36 ++++++++++++++++++++++++++++++++++--
1 files changed, 34 insertions(+), 2 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 35360e3..aaf0aa8 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
@@ -101,6 +101,7 @@
row.setDate(entry.getVoucherDate());
row.setVoucherNo(entry.getVoucherNo());
row.setSummary(StringUtils.isNotEmpty(entry.getSummary()) ? entry.getSummary() : "");
+ row.setSubjectDetail(entry.getSubjectDetail());
row.setDebit(debit);
row.setCredit(credit);
row.setBalance(money(runningBalance));
@@ -115,6 +116,37 @@
rows.add(buildYearlyTotalRow(endMonth.atEndOfMonth(), yearDebit, yearCredit, runningBalance));
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) {
@@ -166,7 +198,7 @@
row.setRowType("yearly_total");
row.setDate(date);
row.setVoucherNo("-");
- row.setSummary("鏈勾绱");
+ row.setSummary("鍚堣");
row.setDebit(money(yearDebit));
row.setCredit(money(yearCredit));
row.setBalance(money(yearBalance));
--
Gitblit v1.9.3