空数组容错
This commit is contained in:
parent
a838e16c09
commit
36442eccea
@ -254,21 +254,25 @@ public class EbikeRegionServiceImpl extends ServiceImpl<EbikeRegionMapper, Ebike
|
||||
}
|
||||
|
||||
private List<RspBikeInfo> getRspBikeInfos(List<RedisPoint> points) {
|
||||
List<String> sns = points.stream().map(RedisPoint::getMember).toList();
|
||||
JsonResult<List<RspBikeInfo>> bike = maintenanceFeignClient.getBikeByEcuSn(new ReqEcuSnDto(sns));
|
||||
if (bike.getCode() != Code.SUCCESS) {
|
||||
throw new RuntimeException("获取车辆信息失败");
|
||||
}
|
||||
List<RspBikeInfo> bikeInfos = bike.getData();
|
||||
for (RspBikeInfo rspBikeInfo : bikeInfos) {
|
||||
points.forEach(redisPoint -> {
|
||||
if (redisPoint.getMember().equals(rspBikeInfo.getEcuSn())) {
|
||||
rspBikeInfo.setLongitude(redisPoint.getPoint().getX());
|
||||
rspBikeInfo.setLatitude(redisPoint.getPoint().getY());
|
||||
}
|
||||
});
|
||||
}
|
||||
return bikeInfos;
|
||||
if (points != null && !points.isEmpty()) {
|
||||
List<String> sns = points.stream().map(RedisPoint::getMember).toList();
|
||||
JsonResult<List<RspBikeInfo>> bike = maintenanceFeignClient.getBikeByEcuSn(new ReqEcuSnDto(sns));
|
||||
if (bike.getCode() != Code.SUCCESS) {
|
||||
throw new RuntimeException("获取车辆信息失败");
|
||||
}
|
||||
List<RspBikeInfo> bikeInfos = bike.getData();
|
||||
for (RspBikeInfo rspBikeInfo : bikeInfos) {
|
||||
points.forEach(redisPoint -> {
|
||||
if (redisPoint.getMember().equals(rspBikeInfo.getEcuSn())) {
|
||||
rspBikeInfo.setLongitude(redisPoint.getPoint().getX());
|
||||
rspBikeInfo.setLatitude(redisPoint.getPoint().getY());
|
||||
}
|
||||
});
|
||||
}
|
||||
return bikeInfos;
|
||||
}else {
|
||||
return List.of();
|
||||
}
|
||||
}
|
||||
|
||||
private void saveRegion(List<ReqEbikePointDto> points, EbikeRegion region, Integer type) {
|
||||
|
||||
@ -7,7 +7,6 @@ import com.cdzy.user.service.RolesService;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user