From 0da945da9f19f45d849fe8b14dc06bb59c5e4283 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期五, 22 五月 2026 14:36:24 +0800
Subject: [PATCH] feat(purchase): 完善采购报表及增值税比对功能
---
src/main/java/com/ruoyi/account/service/impl/AccountingServiceImpl.java | 66 ++++++++++++++++++++++-----------
1 files changed, 44 insertions(+), 22 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 7df89e6..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,14 +3,20 @@
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.mapper.BorrowInfoMapper;
-import com.ruoyi.account.pojo.BorrowInfo;
+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.R;
+import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.procurementrecord.mapper.CustomStorageMapper;
import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper;
import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper;
@@ -35,15 +41,18 @@
@Service
@Slf4j
@RequiredArgsConstructor
-public class AccountingServiceImpl {
+public class AccountingServiceImpl implements AccountingService {
private final DeviceLedgerMapper deviceLedgerMapper;
- private final BorrowInfoMapper borrowInfoMapper;
private final CustomStorageMapper customStorageMapper;
private final ProcurementRecordMapper procurementRecordMapper;
private final ProcurementRecordOutMapper procurementRecordOutMapper;
+ private final AccountSalesCollectionMapper accountSalesCollectionMapper;
+ private final AccountPurchasePaymentMapper accountPurchasePaymentMapper;
- public R<?> total(Integer year) {
+
+ @Override
+ public AjaxResult total(Integer year) {
Map<String,Object> map = new HashMap<>();
map.put("deprAmount",0); // 鎶樻棫閲戦
map.put("deviceTotal",0); // 璁惧鎬绘暟
@@ -75,17 +84,8 @@
map.put("netValue",reduce.subtract(total));
}
// 璐熷��
- LambdaQueryWrapper<BorrowInfo> borrowInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
- borrowInfoLambdaQueryWrapper.like(BorrowInfo::getCreateTime,year)
- .eq(BorrowInfo::getStatus,1);
- List<BorrowInfo> borrowInfos = borrowInfoMapper.selectList(borrowInfoLambdaQueryWrapper);
- if(CollectionUtils.isNotEmpty(borrowInfos)){
- BigDecimal reduce = borrowInfos.stream()
- .map(BorrowInfo::getBorrowAmount)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
- map.put("debt",reduce);
- }
+ map.put("debt",BigDecimal.ZERO);
+
// 搴撳瓨璧勪骇
LambdaQueryWrapper<ProcurementRecordStorage> procurementRecordStorageLambdaQueryWrapper = new LambdaQueryWrapper<>();
procurementRecordStorageLambdaQueryWrapper.like(ProcurementRecordStorage::getCreateTime,year);
@@ -150,7 +150,7 @@
});
}
map.put("inventoryValue",procurementRecordTotal.add(customStorageTotal));
- return R.ok(map);
+ return AjaxResult.success( map);
}
/**
@@ -245,7 +245,8 @@
return totalDepreciation.setScale(2, BigDecimal.ROUND_HALF_UP);
}
- public R<?> deviceTypeDistribution(Integer year) {
+ @Override
+ public AjaxResult deviceTypeDistribution(Integer year) {
// 2. 缁勮杩斿洖VO
DeviceTypeDistributionVO vo = new DeviceTypeDistributionVO();
List<DeviceTypeDetail> details = deviceLedgerMapper.getDeviceTypeDistributionByYear( year);
@@ -265,10 +266,11 @@
.collect(Collectors.toList()));
vo.setTotalCount(vo.getCategories().size());
}
- return R.ok(vo);
+ return AjaxResult.success(vo);
}
- public R<?> calculateDepreciation(Page page, Integer year) {
+ @Override
+ public AjaxResult calculateDepreciation(Page page, Integer year) {
LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>();
deviceLedgerLambdaQueryWrapper.like(DeviceLedger::getCreateTime,year)
.eq(DeviceLedger::getIsDepr,1);
@@ -277,6 +279,26 @@
record.setDeprAmount(calculatePreciseDepreciation(record));
record.setNetValue(record.getTaxIncludingPriceTotal().subtract(record.getDeprAmount()));
}
- return R.ok(deviceLedgerIPage);
+ 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