From c7cf4606c748e3ef2a4df1811b60e0ef000ff9e8 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期五, 24 四月 2026 13:43:45 +0800
Subject: [PATCH] fix: 库存导入导出缺失厚度
---
src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java | 88 +++++++++----------------------------------
1 files changed, 19 insertions(+), 69 deletions(-)
diff --git a/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java b/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
index f09323d..1e94a30 100644
--- a/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
+++ b/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
@@ -4,15 +4,13 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.mapper.AccountExpenseMapper;
import com.ruoyi.account.mapper.AccountIncomeMapper;
import com.ruoyi.account.pojo.AccountExpense;
-import com.ruoyi.home.mapper.HomeMapper;
-import com.ruoyi.account.mapper.AccountExpenseMapper;
import com.ruoyi.approve.mapper.ApproveProcessMapper;
import com.ruoyi.approve.pojo.ApproveProcess;
import com.ruoyi.basic.mapper.CustomerMapper;
import com.ruoyi.basic.mapper.ProductMapper;
-import com.ruoyi.basic.mapper.ProductModelMapper;
import com.ruoyi.basic.mapper.SupplierManageMapper;
import com.ruoyi.basic.pojo.Customer;
import com.ruoyi.basic.pojo.Product;
@@ -27,19 +25,11 @@
import com.ruoyi.dto.MapDto;
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.home.dto.*;
+import com.ruoyi.home.mapper.HomeMapper;
import com.ruoyi.home.service.HomeService;
-import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper;
-import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage;
-import com.ruoyi.procurementrecord.utils.StockUtils;
import com.ruoyi.production.dto.ProductOrderDto;
import com.ruoyi.production.dto.ProductWorkOrderDto;
-import com.ruoyi.production.mapper.ProductOrderMapper;
-import com.ruoyi.production.mapper.ProductProcessMapper;
-import com.ruoyi.production.mapper.ProductWorkOrderMapper;
-import com.ruoyi.production.mapper.ProductionProductInputMapper;
-import com.ruoyi.production.mapper.ProductionProductOutputMapper;
-import com.ruoyi.production.mapper.SalesLedgerProductionAccountingMapper;
-import com.ruoyi.production.pojo.ProductProcess;
+import com.ruoyi.production.mapper.*;
import com.ruoyi.production.pojo.ProductWorkOrder;
import com.ruoyi.project.system.domain.SysDept;
import com.ruoyi.project.system.mapper.SysDeptMapper;
@@ -145,7 +135,7 @@
@Autowired
private ProductProcessMapper productProcessMapper;
-
+
@Autowired
private AccountExpenseMapper accountExpenseMapper;
@@ -185,28 +175,31 @@
LambdaQueryWrapper<PurchaseLedger> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.ge(PurchaseLedger::getEntryDate, currentMonth.atDay(1).atStartOfDay()) // 澶т簬绛変簬鏈湀绗竴澶�
.lt(PurchaseLedger::getEntryDate, currentMonth.plusMonths(1).atDay(1).atStartOfDay()); // 灏忎簬涓嬫湀绗竴澶�
- // 鎵ц鏌ヨ骞惰绠楁�诲拰
+
List<PurchaseLedger> purchaseLedgers = purchaseLedgerMapper.selectList(queryWrapper);
if (!CollectionUtils.isEmpty(purchaseLedgers)) {
- LambdaQueryWrapper<SalesLedgerProduct> salesLedgerProductMapperLambdaQueryWrapperCopy = new LambdaQueryWrapper<SalesLedgerProduct>();
- salesLedgerProductMapperLambdaQueryWrapperCopy.eq(SalesLedgerProduct::getType, 2)
+ LambdaQueryWrapper<SalesLedgerProduct> salesLedgerProductMapperLambdaQueryWrapperCopy = new LambdaQueryWrapper<>();
+ salesLedgerProductMapperLambdaQueryWrapperCopy.eq(SalesLedgerProduct::getType, 2) // 閲囪喘绫诲瀷
.in(SalesLedgerProduct::getSalesLedgerId,
purchaseLedgers.stream().map(PurchaseLedger::getId).collect(Collectors.toList()));
+
List<SalesLedgerProduct> salesLedgerProductsCopy = salesLedgerProductMapper
.selectList(salesLedgerProductMapperLambdaQueryWrapperCopy);
- // 鍚堣鍚堝悓閲戦
+
+ // 鍚堣鍚堝悓鎬婚噾棰�
BigDecimal receiveAmount = purchaseLedgers.stream()
.map(PurchaseLedger::getContractAmount)
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
- // 鏈紑绁ㄩ噾棰�
+
+ // 寰呬粯娆炬�婚噾棰�
BigDecimal unReceiptPaymentAmount = salesLedgerProductsCopy.stream()
- .map(SalesLedgerProduct::getNoInvoiceAmount)
+ .map(SalesLedgerProduct::getPendingTicketsTotal)
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
+
homeBusinessDto.setMonthPurchaseMoney(receiveAmount.setScale(2, RoundingMode.HALF_UP).toString());
- homeBusinessDto
- .setMonthPurchaseHaveMoney(unReceiptPaymentAmount.setScale(2, RoundingMode.HALF_UP).toString());
+ homeBusinessDto.setMonthPurchaseHaveMoney(unReceiptPaymentAmount.setScale(2, RoundingMode.HALF_UP).toString());
}
// 缁熻搴撳瓨
BigDecimal stockQuantityTotal = stockInventoryMapper.selectTotal();
@@ -673,64 +666,21 @@
@Override
public HomeSummaryDto summaryStatistics() {
HomeSummaryDto dto = new HomeSummaryDto();
- LocalDate now = LocalDate.now();
- YearMonth currentMonth = YearMonth.from(now);
- YearMonth prevMonth = currentMonth.minusMonths(1);
-
- LocalDateTime currentMonthEnd = currentMonth.atEndOfMonth().atTime(23, 59, 59);
- LocalDateTime prevMonthEnd = prevMonth.atEndOfMonth().atTime(23, 59, 59);
-
// 鎬诲伐浣滀汉鍛�
- Long currentStaff = countStaff(currentMonthEnd);
- Long prevStaff = countStaff(prevMonthEnd);
+ Long currentStaff = 0L;
dto.setTotalStaff(currentStaff);
- dto.setStaffGrowthRate(calculateMoM(currentStaff, prevStaff));
// 鎬诲鎴锋暟
- Long currentCustomers = countCustomers(currentMonthEnd);
- Long prevCustomers = countCustomers(prevMonthEnd);
+ Long currentCustomers = customerMapper.selectCount(null);
dto.setTotalCustomer(currentCustomers);
- dto.setCustomerGrowthRate(calculateMoM(currentCustomers, prevCustomers));
// 鎬讳緵搴斿晢鏁�
- Long currentSuppliers = countSuppliers(currentMonthEnd);
- Long prevSuppliers = countSuppliers(prevMonthEnd);
+ Long currentSuppliers = supplierManageMapper.selectCount(null);
dto.setTotalSupplier(currentSuppliers);
- dto.setSupplierGrowthRate(calculateMoM(currentSuppliers, prevSuppliers));
return dto;
}
- private Long countStaff(LocalDateTime dateTime) {
- Long staffCountItem = staffOnJobMapper.selectCount(new LambdaQueryWrapper<StaffOnJob>()
- .isNotNull(StaffOnJob::getStaffState)
- .eq(StaffOnJob::getStaffState, 1)
- .le(StaffOnJob::getCreateTime, dateTime));
- return staffCountItem;
- }
-
- private Long countCustomers(LocalDateTime dateTime) {
- return customerMapper.selectCount(new LambdaQueryWrapper<Customer>()
- .le(Customer::getMaintenanceTime, dateTime.toLocalDate()));
- }
-
- private Long countSuppliers(LocalDateTime dateTime) {
- return supplierManageMapper.selectCount(new LambdaQueryWrapper<SupplierManage>()
- .le(SupplierManage::getCreateTime, dateTime));
- }
-
- private String calculateMoM(Number current, Number prev) {
- BigDecimal curVal = new BigDecimal(current.toString());
- BigDecimal prevVal = new BigDecimal(prev.toString());
- if (prevVal.compareTo(BigDecimal.ZERO) == 0) {
- return curVal.compareTo(BigDecimal.ZERO) > 0 ? "100.00" : "0.00";
- }
- return curVal.subtract(prevVal)
- .divide(prevVal, 4, RoundingMode.HALF_UP)
- .multiply(new BigDecimal("100"))
- .setScale(2, RoundingMode.HALF_UP)
- .toString();
- }
@Override
public List<SupplierPurchaseRankingDto> supplierPurchaseRanking(Integer type) {
@@ -2413,7 +2363,7 @@
.collect(Collectors.groupingBy(QualityInspect::getCheckResult));
List<QualityInspect> qualityInspects = groupedByCheckResult.get("涓嶅悎鏍�");
if (ObjectUtils.isNull(qualityInspects) || qualityInspects.size() == 0) {
- return null;
+ return dto;
}
// 4. 澶勭悊鍥捐〃椤� (Item)
List<QualityStatisticsItem> itemList = new ArrayList<>();
--
Gitblit v1.9.3