| | |
| | | import com.ruoyi.business.service.InputInventoryRecordService; |
| | | import com.ruoyi.business.service.InventorySummaryService; |
| | | import com.ruoyi.business.service.PendingInventoryService; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.system.mapper.SysUserMapper; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private final CoalFieldMapper coalFieldMapper; |
| | | |
| | | private final CoalInfoMapper coalInfoMapper; |
| | | |
| | | private final SysUserMapper sysUserMapper; |
| | | |
| | | private final InputInventoryRecordService inputInventoryRecordService; |
| | | |
| | |
| | | coalInfoMap = new HashMap<>(); |
| | | } |
| | | |
| | | // 5. 批量查询登记人id |
| | | List<Long> registrantIds = pendingInventoryPage.getRecords().stream() |
| | | .map(PendingInventory::getRegistrantId) |
| | | .distinct() |
| | | .toList(); |
| | | // 批量查询登记人 |
| | | Map<Long, SysUser> sysUserMap; |
| | | if (!registrantIds.isEmpty()) { |
| | | List<SysUser> sysUsers = sysUserMapper.selectList(registrantIds); |
| | | sysUserMap = sysUsers.stream().collect(Collectors.toMap(SysUser::getUserId, Function.identity())); |
| | | } else { |
| | | sysUserMap = new HashMap<>(); |
| | | } |
| | | |
| | | // 批量查询正式库存信息 |
| | | Map<Long, Long> pendingToOfficialMap = getOfficialInventoryMap(pendingIds); |
| | | |
| | |
| | | dto.setCoal(coalInfo.getCoal()); |
| | | } |
| | | |
| | | // 设置登记人 |
| | | SysUser sysUser = sysUserMap.get(record.getRegistrantId()); |
| | | if (sysUser != null) { |
| | | dto.setRegistrant(sysUser.getNickName()); |
| | | } |
| | | |
| | | // 从预加载的Map中获取officialId |
| | | dto.setOfficialId(pendingToOfficialMap.getOrDefault(record.getId(), null)); |
| | | |