diff --git a/zlt-business/order-center/src/main/java/com/central/order/service/impl/TourismServiceImpl.java b/zlt-business/order-center/src/main/java/com/central/order/service/impl/TourismServiceImpl.java index e64cb20d..32647c25 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/service/impl/TourismServiceImpl.java +++ b/zlt-business/order-center/src/main/java/com/central/order/service/impl/TourismServiceImpl.java @@ -345,7 +345,6 @@ public class TourismServiceImpl extends SuperServiceImpl if (qrCodes == null || qrCodes.isEmpty()) { continue; } - String imageUrl=null; for (QrCode qrCode : qrCodes) { if (qrCode == null || qrCode.getCodeId() == null || qrCode.getCodeId().trim().isEmpty()) { continue; @@ -359,11 +358,8 @@ public class TourismServiceImpl extends SuperServiceImpl vo.setQrCodeName(qrName); vo.setQrCode(qrCode.getCodeId()); vo.setPrice(qrCode.getPrice()); - if(imageUrl==null){ - imageUrl = resolveQrCodeImageUrl(qrCode.getCodeId()); - vo.setQrCodeImage(imageUrl); - } - + String imageUrls = resolveQrCodeImageUrl(qrCode.getCodeId()); + vo.setQrCodeImage(imageUrls); BigDecimal[] lngLat = resolveDeviceLngLat(qrCode.getDeviceSn(), deviceSnToLngLat); if (lngLat != null && lngLat.length == 2) { vo.setDistance(GeoDistanceUtils.distanceKm(longitude, latitude, lngLat[0], lngLat[1])); @@ -400,8 +396,9 @@ public class TourismServiceImpl extends SuperServiceImpl List files = tourismFileService.findByIds(fileIds); if (files != null) { TourismFile file = files.get(0); - if(file != null && file.getImageUrl() != null && !file.getImageUrl().trim().isEmpty()){ - imageUrl = fileCenterService.getViewUrlByPath(file.getImageUrl()); + if (file != null && file.getImageUrl() != null && !file.getImageUrl().trim().isEmpty()) { + // findByIds 已将图片路径转换为可访问 URL,避免重复转换 + imageUrl = file.getImageUrl(); } } }