| | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | // 收集所有设施ID |
| | | List<Integer> facilityIds = records.stream() |
| | | .map(SafeFacilityInspection::getFacilityId) |
| | | .filter(id -> id != null) |
| | | .filter(Objects::nonNull) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | |
| | | // 收集所有巡检人ID |
| | | List<Long> inspectorIds = records.stream() |
| | | .map(SafeFacilityInspection::getInspectorId) |
| | | .filter(id -> id != null) |
| | | .filter(Objects::nonNull) |
| | | .map(Integer::longValue) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | |
| | | Map<Integer, SafeFacilityLedger> facilityMap = Map.of(); |
| | | if (!facilityIds.isEmpty()) { |
| | | facilityMap = safeFacilityLedgerService.listByIds(facilityIds).stream() |
| | | .collect(Collectors.toMap(SafeFacilityLedger::getId, f -> f, (v1, v2) -> v1)); |
| | | .collect(Collectors.toMap(SafeFacilityLedger::getId, f -> f, (v1, _) -> v1)); |
| | | } |
| | | |
| | | // 批量查询巡检人信息 |
| | |
| | | if (!inspectorIds.isEmpty()) { |
| | | List<SysUser> users = sysUserMapper.selectUserByIds(inspectorIds); |
| | | userMap = users.stream() |
| | | .collect(Collectors.toMap(SysUser::getUserId, SysUser::getNickName, (v1, v2) -> v1)); |
| | | .collect(Collectors.toMap(SysUser::getUserId, SysUser::getNickName, (v1, _) -> v1)); |
| | | } |
| | | |
| | | // 填充字段 |