| | |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | // 批量查询操作人信息 |
| | | Map<Long, String> userNameMap = new HashMap<>(); |
| | | Map<Long, XpOperationsUser> operationUserMap = new HashMap<>(); |
| | | if (!CollectionUtils.isEmpty(allUserIds)) { |
| | | R<List<XpOperationsUser>> userResult = xpOperationUserClient.listByIds(allUserIds); |
| | | List<XpOperationsUser> users = userResult.getData(); |
| | | if (!CollectionUtils.isEmpty(users)) { |
| | | userNameMap = users.stream() |
| | | .collect(Collectors.toMap(XpOperationsUser::getId, XpOperationsUser::getNickName)); |
| | | operationUserMap = users.stream() |
| | | .collect(Collectors.toMap(XpOperationsUser::getId, Function.identity())); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | // 填充操作人姓名 |
| | | if (xpVehicleDetection.getOperationsUserId() != null) { |
| | | String userName = userNameMap.get(xpVehicleDetection.getOperationsUserId()); |
| | | vo.setOperatorStartName(userName); |
| | | XpOperationsUser xpOperationsUser = operationUserMap.get(xpVehicleDetection.getOperationsUserId()); |
| | | if (Objects.nonNull(xpOperationsUser)) { |
| | | vo.setOperatorStartName(xpOperationsUser.getNickName()); |
| | | vo.setPhoneNumber(xpOperationsUser.getPhoneNumber()); |
| | | } |
| | | } |
| | | records.add(vo); |
| | | } |