From f29c8786807015d78b9be8a33397f69478d92a76 Mon Sep 17 00:00:00 2001 From: liding <756868258@qq.com> Date: 星期六, 12 七月 2025 16:52:27 +0800 Subject: [PATCH] 1.设备优化 2.配煤计算器 --- main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java | 58 ++++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 36 insertions(+), 22 deletions(-) diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java index d76fcf5..275e084 100644 --- a/main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java +++ b/main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java @@ -6,18 +6,24 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.basic.dto.CoalFieldDto; import com.ruoyi.basic.entity.CoalField; import com.ruoyi.basic.entity.CoalInfo; import com.ruoyi.basic.entity.CoalValue; import com.ruoyi.basic.mapper.CoalFieldMapper; import com.ruoyi.basic.mapper.CoalInfoMapper; +import com.ruoyi.basic.mapper.CoalPlanMapper; import com.ruoyi.basic.mapper.CoalValueMapper; +import com.ruoyi.basic.service.CoalFieldService; +import com.ruoyi.basic.service.CoalPlanService; import com.ruoyi.business.dto.PendingInventoryDto; import com.ruoyi.business.entity.OfficialInventory; import com.ruoyi.business.entity.PendingInventory; import com.ruoyi.business.entity.SalesRecord; +import com.ruoyi.business.mapper.InventorySummaryMapper; import com.ruoyi.business.mapper.OfficialInventoryMapper; import com.ruoyi.business.mapper.PendingInventoryMapper; +import com.ruoyi.business.mapper.SalesRecordMapper; import com.ruoyi.business.service.InputInventoryRecordService; import com.ruoyi.business.service.InventorySummaryService; import com.ruoyi.business.service.PendingInventoryService; @@ -29,6 +35,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.interceptor.TransactionAspectSupport; import java.math.BigDecimal; import java.time.LocalDate; @@ -36,6 +43,7 @@ import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; +import java.util.stream.Stream; /** * <p> @@ -65,32 +73,32 @@ private final InventorySummaryService inventorySummaryService; + private final CoalFieldService coalFieldService; + + private final CoalPlanService coalPlanService; + @Override public IPage<PendingInventoryDto> selectPendingInventoryList(Page page, PendingInventoryDto pendingInventoryDto) { // 1. 鏋勫缓涓绘煡璇� LambdaQueryWrapper<PendingInventory> queryWrapper = new LambdaQueryWrapper<>(); - if (StringUtils.isNotBlank(pendingInventoryDto.getSearchAll())) { - String searchValue = pendingInventoryDto.getSearchAll(); - // 1. 鍏堝皾璇曚綔涓烘棩鏈熸煡璇� - try { - LocalDate RegistrationDate = LocalDate.parse(searchValue); - queryWrapper.eq(PendingInventory::getRegistrationDate, RegistrationDate); - } catch (DateTimeParseException e) { - // 2. 濡傛灉涓嶆槸鏃ユ湡锛屽垯浣滀负鐓ょ鍚嶇О鏌ヨ - LambdaQueryWrapper<CoalInfo> coalQueryWrapper = new LambdaQueryWrapper<>(); - coalQueryWrapper.like(CoalInfo::getCoal, searchValue); - List<CoalInfo> coalInfos = coalInfoMapper.selectList(coalQueryWrapper); - if (!coalInfos.isEmpty()) { - // 鎻愬彇鎵�鏈夊尮閰嶇殑鐓ょID - List<Long> coalIds = coalInfos.stream() - .map(CoalInfo::getId) - .collect(Collectors.toList()); - // 浣跨敤in鏌ヨ鍖归厤浠绘剰涓�涓叅绉岻D - queryWrapper.in(PendingInventory::getCoalId, coalIds); - } else { - // 3. 濡傛灉鎵句笉鍒扮叅绉嶏紝鍙互杩斿洖绌虹粨鏋� - queryWrapper.eq(PendingInventory::getCoalId, "-1"); // 浣跨敤涓嶅彲鑳藉瓨鍦ㄧ殑ID - } + if (pendingInventoryDto.getRegistrationDate() != null) { + queryWrapper.eq(PendingInventory::getRegistrationDate, pendingInventoryDto.getRegistrationDate()); + } + + // 鎸夌叅绉嶅悕绉版煡璇� + if (StringUtils.isNotBlank(pendingInventoryDto.getCoal())) { + LambdaQueryWrapper<CoalInfo> coalQueryWrapper = new LambdaQueryWrapper<>(); + coalQueryWrapper.like(CoalInfo::getCoal, pendingInventoryDto.getCoal()); + List<CoalInfo> coalInfos = coalInfoMapper.selectList(coalQueryWrapper); + + if (!coalInfos.isEmpty()) { + List<Long> coalIds = coalInfos.stream() + .map(CoalInfo::getId) + .collect(Collectors.toList()); + queryWrapper.in(PendingInventory::getCoalId, coalIds); + } else { + // 濡傛灉娌℃湁鍖归厤鐨勭叅绉嶏紝鐩存帴杩斿洖绌虹粨鏋� + queryWrapper.eq(PendingInventory::getCoalId, -1L); // 浣跨敤涓嶅彲鑳藉瓨鍦ㄧ殑ID } } @@ -286,4 +294,10 @@ } return i; } + + @Override + @Transactional + public int addPending(PendingInventoryDto pendingInventoryDto) { + return 1; + } } -- Gitblit v1.9.3