feat: 根据租户获取景区二维码内容

This commit is contained in:
2026-01-15 15:34:44 +08:00
parent 90dd340bad
commit 7f9e4e8034
11 changed files with 2169 additions and 481 deletions
@@ -27,6 +27,10 @@ public class TourismQrCodeDistanceVO {
@Schema(description = "距离描述(如:120m、1.2km)")
private String distanceDesc;
@Schema(description = "价格")
private String price;
public String getDistanceDesc() {
if (distance == null) {
return "未知距离";
@@ -337,7 +337,6 @@ public class TourismServiceImpl extends SuperServiceImpl<TourismMapper, Tourism>
return Result.succeed(List.of(), "暂无数据");
}
Map<String, String> codeIdToImageUrl = new HashMap<>();
Map<String, BigDecimal[]> deviceSnToLngLat = new HashMap<>();
List<TourismQrCodeDistanceVO> resultList = new ArrayList<>();
@@ -359,8 +358,9 @@ public class TourismServiceImpl extends SuperServiceImpl<TourismMapper, Tourism>
}
vo.setQrCodeName(qrName);
vo.setQrCode(qrCode.getCodeId());
vo.setPrice(qrCode.getPrice());
String imageUrl = resolveQrCodeImageUrl(qrCode.getCodeId(), codeIdToImageUrl);
String imageUrl = resolveQrCodeImageUrl(qrCode.getCodeId());
vo.setQrCodeImage(imageUrl);
BigDecimal[] lngLat = resolveDeviceLngLat(qrCode.getDeviceSn(), deviceSnToLngLat);
@@ -384,13 +384,10 @@ public class TourismServiceImpl extends SuperServiceImpl<TourismMapper, Tourism>
return Result.succeed(resultList, "获取成功");
}
private String resolveQrCodeImageUrl(String codeId, Map<String, String> cache) {
private String resolveQrCodeImageUrl(String codeId) {
if (codeId == null || codeId.trim().isEmpty()) {
return null;
}
if (cache.containsKey(codeId)) {
return cache.get(codeId);
}
String imageUrl = null;
try {
@@ -413,8 +410,6 @@ public class TourismServiceImpl extends SuperServiceImpl<TourismMapper, Tourism>
} catch (Exception e) {
log.warn("解析二维码图片失败: codeId={}, error={}", codeId, e.getMessage());
}
cache.put(codeId, imageUrl);
return imageUrl;
}