feat: 可视化大屏展示

This commit is contained in:
2025-12-30 17:14:17 +08:00
parent 02f9b46b22
commit fb40fce9cd
15 changed files with 2195 additions and 44 deletions
@@ -192,4 +192,20 @@ public class TourismController {
}
}
@Operation(summary = "获取景区以及设备信息")
@GetMapping("/{tourismId}/device-sn")
public Result<Map<String,Object>> getTourismAndDeviceSn(@PathVariable("tourismId") Long tourismId) {
try {
if(tourismId==null || tourismId ==0L){
return Result.failed("tourismId不能为空或者不能为0");
}
return tourismService.getTourismInfo(tourismId);
} catch (Exception e) {
log.error("获取景区设备列表失败", e);
return Result.failed("获取景区设备列表失败:" + e.getMessage());
}
}
}
@@ -95,5 +95,8 @@ public interface ITourismService extends ISuperService<Tourism> {
* @return 去重后的设备SN列表
*/
List<String> getDeviceSnsByTourismId(Long tourismId);
Result<Map<String, Object>> getTourismInfo(Long tourismId);
}
@@ -23,10 +23,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -265,4 +262,41 @@ public class TourismServiceImpl extends SuperServiceImpl<TourismMapper, Tourism>
return deviceSns;
}
@Override
public Result<Map<String, Object>> getTourismInfo(Long tourismId) {
Tourism tourism = baseMapper.getTourismById(tourismId);
if(Objects.isNull(tourism)){
return Result.failed("获取景区失败");
}
if(tourism.getStatus()==0){
return Result.failed("景区被禁用");
}
Map<String,Object> map =new HashMap<>();
map.put("tourismDec",tourism.getTourismDesc());
LambdaQueryWrapper<TourismFile> wrapper =new LambdaQueryWrapper<>() ;
wrapper.eq(TourismFile::getTourismId,tourismId)
.eq(TourismFile::getType,6);
List<TourismFile> tourismFiles = tourismFileService.list(wrapper);
if(tourismFiles!=null && tourismFiles.size()>0){
List<String> list = new ArrayList<>();
for(TourismFile tourismFile:tourismFiles){
if (tourismFile != null && tourismFile.getImageUrl() != null) {
// 获取图片的完整URL
String imageUrl = fileCenterService.getViewUrlByPath(tourismFile.getImageUrl());
list.add(imageUrl);
}
}
map.put("images",list);
}
LambdaQueryWrapper<QrCode> wrapperQrcod =new LambdaQueryWrapper<>() ;
wrapperQrcod.eq(QrCode::getTourismId,tourismId);
wrapperQrcod.eq(QrCode::getIsTest,0);
wrapperQrcod.orderByDesc(QrCode::getId);
List<QrCode> qrCodes= qrCodeMapper.selectList(wrapperQrcod);
if(qrCodes!=null && qrCodes.size()>0){
map.put("deviceSn",qrCodes.get(0).getDeviceSn());
}
return Result.succeed(map,"获取成功");
}
}