From e4f9df46dc6671ae68b3888e3573cea5c43c0eda Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期五, 22 五月 2026 13:29:44 +0800
Subject: [PATCH] refactor(account): 重构财务报表相关代码,完善财务报表功能
---
src/main/java/com/ruoyi/account/service/impl/AccountingServiceImpl.java | 36 +++++++++++++++++++++++++++++++++++-
1 files changed, 35 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/ruoyi/account/service/impl/AccountingServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/AccountingServiceImpl.java
index 01f5687..911c808 100644
--- a/src/main/java/com/ruoyi/account/service/impl/AccountingServiceImpl.java
+++ b/src/main/java/com/ruoyi/account/service/impl/AccountingServiceImpl.java
@@ -3,9 +3,17 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.AccountReportDto;
import com.ruoyi.account.bean.dto.DeviceTypeDetail;
import com.ruoyi.account.bean.dto.DeviceTypeDistributionVO;
+import com.ruoyi.account.bean.vo.AccountReportVo;
+import com.ruoyi.account.mapper.purchase.AccountPurchasePaymentMapper;
+import com.ruoyi.account.mapper.sales.AccountSalesCollectionMapper;
+import com.ruoyi.account.pojo.purchase.AccountPurchasePayment;
+import com.ruoyi.account.pojo.sales.AccountSalesCollection;
+import com.ruoyi.account.service.AccountingService;
import com.ruoyi.device.mapper.DeviceLedgerMapper;
import com.ruoyi.device.pojo.DeviceLedger;
import com.ruoyi.framework.web.domain.AjaxResult;
@@ -33,13 +41,17 @@
@Service
@Slf4j
@RequiredArgsConstructor
-public class AccountingServiceImpl {
+public class AccountingServiceImpl implements AccountingService {
private final DeviceLedgerMapper deviceLedgerMapper;
private final CustomStorageMapper customStorageMapper;
private final ProcurementRecordMapper procurementRecordMapper;
private final ProcurementRecordOutMapper procurementRecordOutMapper;
+ private final AccountSalesCollectionMapper accountSalesCollectionMapper;
+ private final AccountPurchasePaymentMapper accountPurchasePaymentMapper;
+
+ @Override
public AjaxResult total(Integer year) {
Map<String,Object> map = new HashMap<>();
map.put("deprAmount",0); // 鎶樻棫閲戦
@@ -233,6 +245,7 @@
return totalDepreciation.setScale(2, BigDecimal.ROUND_HALF_UP);
}
+ @Override
public AjaxResult deviceTypeDistribution(Integer year) {
// 2. 缁勮杩斿洖VO
DeviceTypeDistributionVO vo = new DeviceTypeDistributionVO();
@@ -256,6 +269,7 @@
return AjaxResult.success(vo);
}
+ @Override
public AjaxResult calculateDepreciation(Page page, Integer year) {
LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>();
deviceLedgerLambdaQueryWrapper.like(DeviceLedger::getCreateTime,year)
@@ -267,4 +281,24 @@
}
return AjaxResult.success(deviceLedgerIPage);
}
+
+ @Override
+ public AccountReportVo getAccountStatementDetailsByMonth(AccountReportDto accountReportDto) {
+ AccountReportVo accountReportVo = new AccountReportVo();
+ //鎬昏惀鏀�=鏀舵鍗曟�婚噾棰�
+ //鎬绘敹鍏ョ瑪鏁�=鏀舵鍗曟�荤瑪鏁�
+ List<AccountSalesCollection> accountSalesCollections = accountSalesCollectionMapper.selectList(Wrappers.<AccountSalesCollection>lambdaQuery()
+ .between(AccountSalesCollection::getCollectionDate, accountReportDto.getEntryDateStart(), accountReportDto.getEntryDateEnd()));
+ accountReportVo.setTotalIncome(accountSalesCollections.stream().map(AccountSalesCollection::getCollectionAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
+ accountReportVo.setIncomeNumber(accountSalesCollections.size());
+ //鎬绘敮鍑�=浠樻鍗曟�婚噾棰�
+ //鎬绘敮鍑虹瑪鏁�=浠樻鍗曟�荤瑪鏁�
+ List<AccountPurchasePayment> accountPurchasePayments = accountPurchasePaymentMapper.selectList(Wrappers.<AccountPurchasePayment>lambdaQuery()
+ .between(AccountPurchasePayment::getPaymentDate, accountReportDto.getEntryDateStart(), accountReportDto.getEntryDateEnd()));
+ accountReportVo.setTotalExpense(accountPurchasePayments.stream().map(AccountPurchasePayment::getPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
+ accountReportVo.setExpenseNumber(accountPurchasePayments.size());
+ //鍑�鍒╂鼎=鎬昏惀鏀�-鎬绘敮鍑�
+ accountReportVo.setNetRevenue(accountReportVo.getTotalIncome().subtract(accountReportVo.getTotalExpense()));
+ return accountReportVo;
+ }
}
--
Gitblit v1.9.3