diff --git a/gather-app/src/main/java/com/ruoyi/common/utils/V4CodeUtils.java b/gather-app/src/main/java/com/ruoyi/business/controller/utils/V4CodeUtils.java similarity index 98% rename from gather-app/src/main/java/com/ruoyi/common/utils/V4CodeUtils.java rename to gather-app/src/main/java/com/ruoyi/business/controller/utils/V4CodeUtils.java index d53a000..cad9bfd 100644 --- a/gather-app/src/main/java/com/ruoyi/common/utils/V4CodeUtils.java +++ b/gather-app/src/main/java/com/ruoyi/business/controller/utils/V4CodeUtils.java @@ -1,4 +1,4 @@ -package com.ruoyi.common.utils; +package com.ruoyi.business.controller.utils; import java.util.concurrent.atomic.AtomicInteger; diff --git a/gather-app/src/main/java/com/ruoyi/database/controller/DevopsDeviceInfoController.java b/gather-app/src/main/java/com/ruoyi/database/controller/DevopsDeviceInfoController.java index 6962638..2929a68 100644 --- a/gather-app/src/main/java/com/ruoyi/database/controller/DevopsDeviceInfoController.java +++ b/gather-app/src/main/java/com/ruoyi/database/controller/DevopsDeviceInfoController.java @@ -151,7 +151,7 @@ public class DevopsDeviceInfoController extends BaseController { } @DeleteMapping - @ApiOperation("删除智能设备信息表") + @ApiOperation("删除智能设备信息表") @Log(title = "智能设备信息表", businessType = BusinessType.DELETE) public AjaxResult delete(@RequestParam("idList") List idList) { return toAjax(devopsDeviceInfoService.removeByIds(idList)); diff --git a/gather-app/src/main/java/com/ruoyi/database/controller/DevopsVideoInfoController.java b/gather-app/src/main/java/com/ruoyi/database/controller/DevopsVideoInfoController.java index 63af842..c282165 100644 --- a/gather-app/src/main/java/com/ruoyi/database/controller/DevopsVideoInfoController.java +++ b/gather-app/src/main/java/com/ruoyi/database/controller/DevopsVideoInfoController.java @@ -1,35 +1,33 @@ package com.ruoyi.database.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ruoyi.business.domain.dto.DevopsVideoInfoDto; -import com.ruoyi.common.utils.StringKit; -import com.ruoyi.common.utils.bean.BeanUtils; -import com.ruoyi.database.domain.DevopsVideoInfo; -import com.ruoyi.database.domain.DevopsVideoStatus; -import com.ruoyi.database.domain.MetaActualUnitInfo; -import com.ruoyi.database.domain.dto.VideoDTO; -import com.ruoyi.database.domain.vo.MetaActualUnitInfoVO; -import com.ruoyi.database.service.DevopsVideoInfoService; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.StringKit; import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.database.domain.DevopsVideoInfo; +import com.ruoyi.database.domain.DevopsVideoStatus; +import com.ruoyi.database.service.DevopsVideoInfoService; import com.ruoyi.database.service.DevopsVideoStatusService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; -import org.apache.commons.lang3.StringUtils; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; -import java.util.List; +import java.util.*; import java.util.stream.Collectors; + /** * 视频监控设备表(DevopsVideoInfo)Controller * @@ -90,6 +88,63 @@ public class DevopsVideoInfoController extends BaseController { return getDataTable(list); } + @GetMapping("/name") + @ApiOperation("按名称查询设备经纬度") + public TableDataInfo getNameWhereList(@RequestParam String name){ + startPage(); + // 使用LambdaQueryWrapper构建查询条件 + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(); + queryWrapper.like(DevopsVideoInfo::getDeviceName, name); + // 执行查询 + List list = devopsVideoInfoService.list(queryWrapper); + return getDataTable(list); + } + @GetMapping("/Noname") + @ApiOperation("按名称查询设备channelNo") + public ResponseEntity> getChannalNoList(@RequestParam String name){ + startPage(); + // 使用LambdaQueryWrapper构建查询条件 + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(); + queryWrapper.like(DevopsVideoInfo::getDeviceName, name); + // 执行查询 + List list = devopsVideoInfoService.list(queryWrapper); + + // 提取channelNo字段的值并转换为String后放入列表中 + List channelNos = list.stream() + .map(devopsVideoInfo -> String.valueOf(devopsVideoInfo.getChannelNo())) + .collect(Collectors.toList()); + // 返回channelNo列表 + return ResponseEntity.ok(channelNos); + } + @GetMapping("/device/coordinates") + @ApiOperation("根据设备ID查询设备经纬度") + public ResponseEntity> getDeviceCoordinates(@RequestParam String ChannelNo) { + // 根据设备ID查询设备信息 + DevopsVideoInfo device = devopsVideoInfoService.getById(ChannelNo); + + // 检查设备是否存在 + if (device == null) { + return ResponseEntity.notFound().build(); + } + // 获取设备的经纬度 + double longitude = device.getLongitude(); + double latitude = device.getLatitude(); + + // 检查经纬度是否都为0 + if (longitude == 0 && latitude == 0) { + // 如果经纬度都为0,返回200状态码和一个空的响应体 + return ResponseEntity.ok(Collections.emptyMap()); + } + + // 准备返回的经纬度信息 + Map result = new HashMap<>(); + result.put("longitude", device.getLongitude()); + result.put("latitude", device.getLatitude()); + + // 返回经纬度信息 + return ResponseEntity.ok(result); + } + @GetMapping("/type") @ApiOperation("查询视频设备沿海与海堤线") public TableDataInfo levelList(DevopsVideoInfo devopsVideoInfo) { diff --git a/gather-app/src/main/java/com/ruoyi/database/controller/TransitUserRecordController.java b/gather-app/src/main/java/com/ruoyi/database/controller/TransitUserRecordController.java index 5574950..16aeb93 100644 --- a/gather-app/src/main/java/com/ruoyi/database/controller/TransitUserRecordController.java +++ b/gather-app/src/main/java/com/ruoyi/database/controller/TransitUserRecordController.java @@ -1,7 +1,6 @@ package com.ruoyi.database.controller; -import cn.hutool.core.date.DateTime; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; @@ -11,26 +10,20 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.database.domain.DevopsDeviceInfo; -import com.ruoyi.database.domain.TransitImpUserRecord; import com.ruoyi.database.domain.TransitUserRecord; -import com.ruoyi.database.domain.vo.TransitUserRecordVO; import com.ruoyi.database.service.DevopsDeviceInfoService; import com.ruoyi.database.service.TransitImpUserRecordService; import com.ruoyi.database.service.TransitUserRecordService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import lombok.Data; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; -import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.LocalDateTime; -import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; -import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -47,7 +40,7 @@ import java.util.stream.Collectors; public class TransitUserRecordController extends BaseController { private final TransitUserRecordService transitUserRecordService; - private final TransitImpUserRecordService transitImpUserRecordService; + private final DevopsDeviceInfoService devopsDeviceInfoService; @GetMapping diff --git a/gather-app/src/main/java/com/ruoyi/database/domain/DAO/Coordinate.java b/gather-app/src/main/java/com/ruoyi/database/domain/DAO/Coordinate.java new file mode 100644 index 0000000..e4bb625 --- /dev/null +++ b/gather-app/src/main/java/com/ruoyi/database/domain/DAO/Coordinate.java @@ -0,0 +1,26 @@ +package com.ruoyi.database.domain.DAO; + +public class Coordinate { + private Double longitude; + private Double latitude; + + public Coordinate(Double longitude, Double latitude) { + this.longitude = longitude; + this.latitude = latitude; + } + + public Double getLongitude() { + return longitude; + } + + public Double getLatitude() { + return latitude; + } + + // 可以重写toString方法,以便更好地格式化输出 + @Override + public String toString() { + return "(" + longitude + ", " + latitude + ")"; + } +} +