datacenter 全球眼

This commit is contained in:
punchhhh 2025-01-12 11:00:19 +08:00
parent 4a0f6af423
commit be97de9e40
9 changed files with 820 additions and 0 deletions

View File

@ -0,0 +1,53 @@
package cn.iocoder.yudao.module.datacenter.controller;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraDO;
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraDTO;
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraPageReqVO;
import cn.iocoder.yudao.module.datacenter.service.camera.CameraService;
import com.baomidou.dynamic.datasource.annotation.DS;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.*;
@Tag(name = "大屏服务 - 监控点")
@RestController
@RequestMapping("/camera")
@Validated
public class CameraApi {
@Resource
private CameraService cameraService;
@GetMapping("/selectCameraByPageAndCondition")
@Operation(summary = "分页条件查询监控点信息")
@DS("slave")
public Map<String, Object> selectCameraByPageAndCondition(@Valid CameraPageReqVO pageReqVO) {
// System.out.println(name);
// CameraPageReqVO cameraPageReqVO = new CameraPageReqVO();
// cameraPageReqVO.setName(name);
PageResult<CameraDO> cameraPage = cameraService.getCameraPage(pageReqVO);
List<CameraDTO> cameraDTOList = new ArrayList<>();
cameraPage.getList().forEach(cameraDO -> {
CameraDTO cameraDTO = new CameraDTO();
cameraDTO.setCamera_type(cameraDO.getCameraType());
cameraDTO.setName(cameraDO.getName());
cameraDTO.setId(cameraDO.getId());
cameraDTOList.add(cameraDTO);
});
Map<String, Object> result = new HashMap<>();
result.put("cameraDTOList", cameraDTOList);
result.put("total", cameraPage.getTotal());
return result;
}
}

View File

@ -0,0 +1,234 @@
package cn.iocoder.yudao.module.datacenter.controller.app.camera.vo;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.math.BigDecimal;
/**
* 资源 DO
*
* @author 管理员
*/
@TableName("hiking_camera")
@KeySequence("hiking_camera_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CameraDO extends BaseDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 监控点唯一标识
*/
private String cameraIndexCode;
/**
* 海拔
*/
private String altitude;
/**
* 监控点类型
*
* 枚举 {@link TODO camera_type 对应的类}
*/
private Integer cameraType;
/**
* 监控点类型说明
*/
private String cameraTypeName;
/**
* 资源类型
*/
private String resourceType;
/**
* 设备能力集
*/
private String capabilitySet;
/**
* 能力集说明
*/
private String capabilitySetName;
/**
* 智能分析能力集
*/
private String intelligentSet;
/**
* 智能分析能力集说明
*/
private String intelligentSetName;
/**
* 通道编号
*/
private String channelNo;
/**
* 通道类型说明
*/
private String channelTypeName;
/**
* 所属编码设备唯一标识
*/
private String encodeDevIndexCode;
/**
* 所属设备类型
*/
private String encodeDevResourceType;
/**
* 所属设备类型说明
*/
private String encodeDevResourceTypeName;
/**
* 监控点国标编号
*/
private String gbIndexCode;
/**
* 键盘控制码
*/
private String keyBoardCode;
/**
* 摄像机像素
*/
private String pixel;
/**
* 云镜类型
*/
private String ptz;
/**
* 云镜类型说明
*/
private String ptzName;
/**
* 云台控制
*/
private String ptzController;
/**
* 云台控制说明
*/
private String ptzControllerName;
/**
* 录像存储位置说明
*/
private String recordLocationName;
/**
* 在线状态
*/
private String status;
/**
* 在线状态说明
*/
private String statusName;
/**
* 传输协议
*/
private Integer transType;
/**
* 传输协议说明
*/
private String transTypeName;
/**
* 接入协议
*/
private String treatyType;
/**
* 接入协议说明
*/
private String treatyTypeName;
/**
* 可视域相关
*/
private String viewshed;
/**
* 唯一编码
*/
private String indexCode;
/**
* 监控点国标编号
*/
private String externalIndexCode;
/**
* 资源名称
*/
private String name;
/**
* 通道号
*/
private Integer chanNum;
/**
* 级联编号
*/
private String cascadeCode;
/**
* 父级资源编号
*/
private String parentIndexCode;
/**
* 经度
*/
private BigDecimal longitude;
/**
* 纬度
*/
private BigDecimal latitude;
/**
* 海拔高度
*/
private String elevation;
/**
* 能力集
*/
private String capability;
/**
* 录像存储位置
*/
private String recordLocation;
/**
* 通道子类型
*/
private String channelType;
/**
* 所属区域
*/
private String regionIndexCode;
/**
* 所属区域路径
*/
private String regionPath;
/**
* 安装位置
*/
private String installLocation;
/**
* 数据在界面上的显示顺序
*/
private Integer disOrder;
/**
* 资源唯一编码
*/
private String resourceIndexCode;
/**
* 解码模式
*/
private String decodeTag;
/**
* 监控点关联对讲唯一标志
*/
private String cameraRelateTalk;
/**
* 所属区域路径
*/
private String regionName;
/**
* 区域路径名称
*/
private String regionPathName;
}

View File

@ -0,0 +1,24 @@
package cn.iocoder.yudao.module.datacenter.controller.app.camera.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "监控点 Response DTO")
@Data
public class CameraDTO {
@Schema(description = "监控点ID")
private Long id;
@Schema(description = "监控点名称")
private String name;
@Schema(description = "监控点类型")
private Integer camera_type;
@Schema(description = "预览URL")
private String previewUrl;
@Schema(description = "回放URL")
private String playBackUrl;
}

View File

@ -0,0 +1,47 @@
package cn.iocoder.yudao.module.datacenter.controller.app.camera.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 资源分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CameraPageReqVO extends PageParam {
@Schema(description = "监控点类型说明")
private String cameraTypeName;
@Schema(description = "资源类型")
private String resourceType;
@Schema(description = "通道类型说明")
private String channelTypeName;
@Schema(description = "传输协议说明")
private String transTypeName;
@Schema(description = "接入协议说明")
private String treatyTypeName;
@Schema(description = "资源名称")
private String name;
@Schema(description = "安装位置")
private String installLocation;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String[] createTime;
@Schema(description = "更新时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String[] updateTime;
}

View File

@ -0,0 +1,174 @@
package cn.iocoder.yudao.module.datacenter.controller.app.camera.vo;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 资源 Response VO")
@Data
@ExcelIgnoreUnannotated
public class CameraRespVO {
@Schema(description = "监控点唯一标识")
@ExcelProperty("监控点唯一标识")
private String cameraIndexCode;
@Schema(description = "海拔")
@ExcelProperty("海拔")
private String altitude;
@Schema(description = "监控点类型")
@ExcelProperty(value = "监控点类型", converter = DictConvert.class)
@DictFormat("camera_type") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer cameraType;
@Schema(description = "监控点类型说明")
@ExcelProperty("监控点类型说明")
private String cameraTypeName;
@Schema(description = "资源类型")
@ExcelProperty("资源类型")
private String resourceType;
@Schema(description = "设备能力集")
@ExcelProperty("设备能力集")
private String capabilitySet;
@Schema(description = "能力集说明")
@ExcelProperty("能力集说明")
private String capabilitySetName;
@Schema(description = "通道编号")
@ExcelProperty("通道编号")
private String channelNo;
@Schema(description = "通道类型说明")
@ExcelProperty("通道类型说明")
private String channelTypeName;
@Schema(description = "所属编码设备唯一标识")
@ExcelProperty("所属编码设备唯一标识")
private String encodeDevIndexCode;
@Schema(description = "监控点国标编号")
@ExcelProperty("监控点国标编号")
private String gbIndexCode;
@Schema(description = "键盘控制码")
@ExcelProperty("键盘控制码")
private String keyBoardCode;
@Schema(description = "录像存储位置说明")
@ExcelProperty("录像存储位置说明")
private String recordLocationName;
@Schema(description = "传输协议")
@ExcelProperty("传输协议")
private Integer transType;
@Schema(description = "传输协议说明")
@ExcelProperty("传输协议说明")
private String transTypeName;
@Schema(description = "接入协议")
@ExcelProperty("接入协议")
private String treatyType;
@Schema(description = "接入协议说明")
@ExcelProperty("接入协议说明")
private String treatyTypeName;
@Schema(description = "唯一编码")
@ExcelProperty("唯一编码")
private String indexCode;
@Schema(description = "监控点国标编号")
@ExcelProperty("监控点国标编号")
private String externalIndexCode;
@Schema(description = "资源名称")
@ExcelProperty("资源名称")
private String name;
@Schema(description = "通道号")
@ExcelProperty("通道号")
private Integer chanNum;
@Schema(description = "级联编号")
@ExcelProperty("级联编号")
private String cascadeCode;
@Schema(description = "父级资源编号")
@ExcelProperty("父级资源编号")
private String parentIndexCode;
@Schema(description = "经度")
@ExcelProperty("经度")
private BigDecimal longitude;
@Schema(description = "纬度")
@ExcelProperty("纬度")
private BigDecimal latitude;
@Schema(description = "海拔高度")
@ExcelProperty("海拔高度")
private String elevation;
@Schema(description = "能力集")
@ExcelProperty("能力集")
private String capability;
@Schema(description = "录像存储位置")
@ExcelProperty("录像存储位置")
private String recordLocation;
@Schema(description = "通道子类型")
@ExcelProperty("通道子类型")
private String channelType;
@Schema(description = "所属区域")
@ExcelProperty("所属区域")
private String regionIndexCode;
@Schema(description = "所属区域路径")
@ExcelProperty("所属区域路径")
private String regionPath;
@Schema(description = "安装位置")
@ExcelProperty("安装位置")
private String installLocation;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private String createTime;
@Schema(description = "更新时间")
@ExcelProperty("更新时间")
private String updateTime;
@Schema(description = "资源唯一编码")
@ExcelProperty("资源唯一编码")
private String resourceIndexCode;
@Schema(description = "解码模式")
@ExcelProperty("解码模式")
private String decodeTag;
@Schema(description = "监控点关联对讲唯一标志")
@ExcelProperty("监控点关联对讲唯一标志")
private String cameraRelateTalk;
@Schema(description = "所属区域路径")
@ExcelProperty("所属区域路径")
private String regionName;
@Schema(description = "区域路径名称")
@ExcelProperty("区域路径名称")
private String regionPathName;
}

View File

@ -0,0 +1,129 @@
package cn.iocoder.yudao.module.datacenter.controller.app.camera.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 资源新增/修改 Request VO")
@Data
public class CameraSaveReqVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED)
private Long id;
@Schema(description = "监控点唯一标识")
private String cameraIndexCode;
@Schema(description = "海拔")
private String altitude;
@Schema(description = "监控点类型")
private Integer cameraType;
@Schema(description = "监控点类型说明")
private String cameraTypeName;
@Schema(description = "资源类型")
private String resourceType;
@Schema(description = "设备能力集")
private String capabilitySet;
@Schema(description = "能力集说明")
private String capabilitySetName;
@Schema(description = "通道编号")
private String channelNo;
@Schema(description = "通道类型说明")
private String channelTypeName;
@Schema(description = "所属编码设备唯一标识")
private String encodeDevIndexCode;
@Schema(description = "监控点国标编号")
private String gbIndexCode;
@Schema(description = "键盘控制码")
private String keyBoardCode;
@Schema(description = "录像存储位置说明")
private String recordLocationName;
@Schema(description = "传输协议")
private Integer transType;
@Schema(description = "传输协议说明")
private String transTypeName;
@Schema(description = "接入协议")
private String treatyType;
@Schema(description = "接入协议说明")
private String treatyTypeName;
@Schema(description = "唯一编码")
private String indexCode;
@Schema(description = "监控点国标编号")
private String externalIndexCode;
@Schema(description = "资源名称")
private String name;
@Schema(description = "通道号")
private Integer chanNum;
@Schema(description = "级联编号")
private String cascadeCode;
@Schema(description = "父级资源编号")
private String parentIndexCode;
@Schema(description = "经度")
private BigDecimal longitude;
@Schema(description = "纬度")
private BigDecimal latitude;
@Schema(description = "海拔高度")
private String elevation;
@Schema(description = "能力集")
private String capability;
@Schema(description = "录像存储位置")
private String recordLocation;
@Schema(description = "通道子类型")
private String channelType;
@Schema(description = "所属区域")
private String regionIndexCode;
@Schema(description = "所属区域路径")
private String regionPath;
@Schema(description = "安装位置")
private String installLocation;
@Schema(description = "数据在界面上的显示顺序")
private Integer disOrder;
@Schema(description = "资源唯一编码")
private String resourceIndexCode;
@Schema(description = "解码模式")
private String decodeTag;
@Schema(description = "监控点关联对讲唯一标志")
private String cameraRelateTalk;
@Schema(description = "所属区域路径")
private String regionName;
@Schema(description = "区域路径名称")
private String regionPathName;
}

View File

@ -0,0 +1,32 @@
package cn.iocoder.yudao.module.datacenter.dal.mysql.camera;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraDO;
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraPageReqVO;
import org.apache.ibatis.annotations.Mapper;
/**
* 资源 Mapper
*
* @author 管理员
*/
@Mapper
public interface CameraMapper extends BaseMapperX<CameraDO> {
default PageResult<CameraDO> selectPage(CameraPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<CameraDO>()
.likeIfPresent(CameraDO::getCameraTypeName, reqVO.getCameraTypeName())
.eqIfPresent(CameraDO::getResourceType, reqVO.getResourceType())
.likeIfPresent(CameraDO::getChannelTypeName, reqVO.getChannelTypeName())
.likeIfPresent(CameraDO::getTransTypeName, reqVO.getTransTypeName())
.likeIfPresent(CameraDO::getTreatyTypeName, reqVO.getTreatyTypeName())
.likeIfPresent(CameraDO::getName, reqVO.getName())
.eqIfPresent(CameraDO::getInstallLocation, reqVO.getInstallLocation())
.betweenIfPresent(CameraDO::getCreateTime, reqVO.getCreateTime())
.betweenIfPresent(CameraDO::getUpdateTime, reqVO.getUpdateTime())
.orderByDesc(CameraDO::getId));
}
}

View File

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.datacenter.service.camera;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraDO;
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraPageReqVO;
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraSaveReqVO;
import javax.validation.Valid;
/**
* 资源 Service 接口
*
* @author 管理员
*/
public interface CameraService {
/**
* 创建资源
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createCamera(@Valid CameraSaveReqVO createReqVO);
/**
* 更新资源
*
* @param updateReqVO 更新信息
*/
void updateCamera(@Valid CameraSaveReqVO updateReqVO);
/**
* 删除资源
*
* @param id 编号
*/
void deleteCamera(Long id);
/**
* 获得资源
*
* @param id 编号
* @return 资源
*/
CameraDO getCamera(Long id);
/**
* 获得资源分页
*
* @param pageReqVO 分页查询
* @return 资源分页
*/
PageResult<CameraDO> getCameraPage(CameraPageReqVO pageReqVO);
}

View File

@ -0,0 +1,72 @@
package cn.iocoder.yudao.module.datacenter.service.camera;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraDO;
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraPageReqVO;
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraSaveReqVO;
import cn.iocoder.yudao.module.datacenter.dal.mysql.camera.CameraMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
/**
* 资源 Service 实现类
*
* @author 管理员
*/
@Service
@Validated
public class CameraServiceImpl implements CameraService {
@Resource
private CameraMapper cameraMapper;
@Override
public Long createCamera(CameraSaveReqVO createReqVO) {
// 插入
CameraDO camera = BeanUtils.toBean(createReqVO, CameraDO.class);
cameraMapper.insert(camera);
// 返回
return camera.getId();
}
@Override
public void updateCamera(CameraSaveReqVO updateReqVO) {
// 校验存在
validateCameraExists(updateReqVO.getId());
// 更新
CameraDO updateObj = BeanUtils.toBean(updateReqVO, CameraDO.class);
cameraMapper.updateById(updateObj);
}
@Override
public void deleteCamera(Long id) {
// 校验存在
validateCameraExists(id);
// 删除
cameraMapper.deleteById(id);
}
private void validateCameraExists(Long id) {
if (cameraMapper.selectById(id) == null) {
throw exception(new ErrorCode(88888, "监控不存在"));
}
}
@Override
public CameraDO getCamera(Long id) {
return cameraMapper.selectById(id);
}
@Override
public PageResult<CameraDO> getCameraPage(CameraPageReqVO pageReqVO) {
return cameraMapper.selectPage(pageReqVO);
}
}