1、视频监控配置信息完善;
2、摄像机实体完善;
3、工程模块-视频站管理功能实现;
4、远程模块--视频监控查询;
7个文件已修改
11个文件已添加
875 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/webUtil/QueryResultVo.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoVi/ViCameraMapper.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoVi/ViCamera.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/CameraTypeEnum.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voVi/VoCamera.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/ViCameraMapper.xml 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/PipIrrProjectApplication.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraCtrl.java 241 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraDto.java 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraQo.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraSv.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/TypesVo.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/CameraQo.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VideoCtrl.java 118 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VideoSv.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VoVideo.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/ys/YsAppClient.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/webUtil/QueryResultVo.java
@@ -53,6 +53,16 @@
    @JSONField(serialize = false)
    public Integer queryCount ;
    public void copyTo(QueryResultVo to){
        to.pageSize = this.pageSize ;
        to.itemTotal = this.itemTotal  ;
        to.pageCurr = this.pageCurr  ;
        to.pageTotal = this.pageTotal  ;
        to.obj = this.obj ;
        to.queryStart = this.queryStart  ;
        to.queryCount = this.queryCount  ;
    }
    public void calculateAndSet(Long itemTotal, Map<String, Object> params) {
        this.itemTotal = itemTotal ;
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoVi/ViCameraMapper.java
@@ -2,23 +2,49 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoVi.ViCamera;
import com.dy.pipIrrGlobal.voVi.VoCamera;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
 * @Author: liurunyu
 * @Date: 2025/6/9 8:49
 * @Date: 2025/6/9 9:15
 * @Description
 */
@Mapper
public interface ViCameraMapper extends BaseMapper<ViCamera> {
    int deleteByPrimaryKey(Long id);
    /**
     * 逻辑删除
     * @param id primaryKey
     * @return update count
     */
    int deleteLogicById(Long id);
    int insert(ViCamera record);
    int insertSelective(ViCamera record);
    ViCamera selectByPrimaryKey(Long id);
    /**
     * 查询总数
     * @param params 查询条件
     * @return 总数
     */
    Long selectTotal(Map<?, ?> params) ;
    /**
     * 分页查询一些
     * @param params 查询条件
     * @return 实体集合
     */
    List<VoCamera> selectSome(Map<?, ?> params) ;
// Update the record in the ViCamera table based on the primary key, but only update the fields that are not null
    int updateByPrimaryKeySelective(ViCamera record);
    int updateByPrimaryKey(ViCamera record);
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoVi/ViCamera.java
@@ -11,9 +11,10 @@
/**
 * @Author: liurunyu
 * @Date: 2025/6/9 8:49
 * @Date: 2025/6/9 9:15
 * @Description
 */
/**
 * 萤石摄像机(视频站)
 */
@@ -83,4 +84,11 @@
     */
    @Schema(description = "备注信息", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    public String remark;
    /**
     * 是否删除(1是,0否)
     */
    @Schema(description = "是否删除", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    public Byte deleted;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/CameraTypeEnum.java
New file
@@ -0,0 +1,24 @@
package com.dy.pipIrrGlobal.util;
/**
 * @Author: liurunyu
 * @Date: 2025/6/9 11:31
 * @Description
 */
public enum CameraTypeEnum {
    YINGSHI((byte)1, "萤石");
    private Byte type ; //1萤石 2海康
    private String name ;//萤石 海康
    CameraTypeEnum(Byte type, String name){
        this.type = type ;
        this.name = name ;
    }
    public Byte getType() {
        return this.type ;
    }
    public String getName() {
        return this.name ;
    }
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voVi/VoCamera.java
New file
@@ -0,0 +1,59 @@
package com.dy.pipIrrGlobal.voVi;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
 * @Author: liurunyu
 * @Date: 2025/6/9 9:12
 * @Description
 */
@Data
public class VoCamera {
    private static final long serialVersionUID = 202506090918001L;
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    public Long id;
    /**
     * 类型(1萤石)
     */
    public Byte type;
    /**
     * 摄像机序列号
     */
    public String devNo;
    /**
     * 视频站名称
     */
    public String name;
    /**
     * 经度
     */
    public Double lng;
    /**
     * 纬度
     */
    public Double lat;
    /**
     * 是否大屏展示(1是,0或null否)
     */
    public Byte onScreen;
    /**
     * 大屏展示排序(大于等于1,数字越小排序越前)
     */
    public Integer onSort;
    /**
     * 备注
     */
    public String remark;
}
pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml
@@ -472,16 +472,24 @@
        at-all: true
        mobile: 18602657034
#萤石云开放平台
ys:
    accessTokenExpireDay: 7 #AccessToken过期时间,单位天
    appKey: 93987fd687444c23b427181a108f5253
    secret: d73a08e4fb3c3d9d0b696630eea8bd4e
    requestAccessTokenUrl: https://open.ys7.com/api/lapp/token/get
    requestVideoCommonUrl: https://open.ys7.com/console/jssdk/pc.html
    requestVideoCameraPreUrl: ezopen://open.ys7.com/
    requestVideoCameraTailUrl: /1.live&themeId=
#视频监控相关
video:
    #萤石云开放平台
    ys:
        accessTokenExpireDay: 7 #AccessToken过期时间,单位天
        appKey: 93987fd687444c23b427181a108f5253
        secret: d73a08e4fb3c3d9d0b696630eea8bd4e
        requestAccessTokenUrl: https://open.ys7.com/api/lapp/token/get
        requestVideoCommonUrl: https://open.ys7.com/console/jssdk/pc.html
        requestVideoCameraPreUrl: ezopen://open.ys7.com/
        requestVideoCameraTailUrl: /1.live&themeId=
    types:
        - 1,萤石 #1:萤石
        #- 2,海康 #2:海康
        #- 3,大华 #3:大华
        #- 4,天地伟业 #4:天地伟业
    screen:
        count: 4 #默认显示4个视频
#阀控器参数
rtu:
    signalIntensity:
pipIrr-platform/pipIrr-global/src/main/resources/mapper/ViCameraMapper.xml
@@ -13,8 +13,13 @@
    <result column="on_screen" jdbcType="TINYINT" property="onScreen" />
    <result column="on_sort" jdbcType="INTEGER" property="onSort" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="deleted" jdbcType="TINYINT" property="deleted" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, `type`, dev_no, `name`, lng, lat, on_screen, on_sort, remark, deleted
  </sql>
  <sql id="part_Column_List">
    <!--@mbg.generated-->
    id, `type`, dev_no, `name`, lng, lat, on_screen, on_sort, remark
  </sql>
@@ -25,19 +30,59 @@
    from vi_camera
    where id = #{id,jdbcType=BIGINT}
  </select>
  <select id="selectTotal" parameterType="java.util.Map" resultType="java.lang.Long">
    select
    count(*)
    from vi_camera tb
    where tb.deleted != 1
    <trim prefix="and" suffixOverrides="and">
      <if test="name != null and name != ''">
        tb.`name` like concat('%', #{name}, '%') and
      </if>
    </trim>
  </select>
  <select id="selectSome" parameterType="java.util.Map" resultType="com.dy.pipIrrGlobal.voVi.VoCamera">
    <!--@mbg.generated-->
    select
    <include refid="part_Column_List" >
      <property name="alias" value="tb"/>
    </include>
    from vi_camera tb
    where tb.deleted != 1
    <trim prefix="and" suffixOverrides="and">
      <if test="name != null">
        tb.`name` like concat('%', #{name}, '%') and
      </if>
    </trim>
    order by tb.on_sort ASC, tb.id DESC
    <trim prefix="limit " >
      <if test="start != null and count != null">
        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
      </if>
    </trim>
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from vi_camera
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteLogicById" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    update vi_camera set deleted = 1
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoVi.ViCamera">
    <!--@mbg.generated-->
    insert into vi_camera (id, `type`, dev_no, 
      `name`, lng, lat, on_screen, 
      on_sort, remark)
      on_sort, remark, deleted
      )
    values (#{id,jdbcType=BIGINT}, #{type,jdbcType=TINYINT}, #{devNo,jdbcType=VARCHAR}, 
      #{name,jdbcType=VARCHAR}, #{lng,jdbcType=DOUBLE}, #{lat,jdbcType=DOUBLE}, #{onScreen,jdbcType=TINYINT}, 
      #{onSort,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR})
      #{onSort,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, #{deleted,jdbcType=TINYINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoVi.ViCamera">
    <!--@mbg.generated-->
@@ -70,6 +115,9 @@
      <if test="remark != null">
        remark,
      </if>
      <if test="deleted != null">
        deleted,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
@@ -98,6 +146,9 @@
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="deleted != null">
        #{deleted,jdbcType=TINYINT},
      </if>
    </trim>
  </insert>
@@ -129,6 +180,9 @@
      <if test="remark != null">
        remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="deleted != null">
        deleted = #{deleted,jdbcType=TINYINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
@@ -142,7 +196,8 @@
      lat = #{lat,jdbcType=DOUBLE},
      on_screen = #{onScreen,jdbcType=TINYINT},
      on_sort = #{onSort,jdbcType=INTEGER},
      remark = #{remark,jdbcType=VARCHAR}
      remark = #{remark,jdbcType=VARCHAR},
      deleted = #{deleted,jdbcType=TINYINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/PipIrrProjectApplication.java
@@ -25,7 +25,7 @@
                })
        }
)
@MapperScan({"com.dy.pipIrrGlobal.daoPr", "com.dy.pipIrrGlobal.daoBa","com.dy.pipIrrGlobal.daoFi"})
@MapperScan({"com.dy.pipIrrGlobal.daoPr", "com.dy.pipIrrGlobal.daoBa","com.dy.pipIrrGlobal.daoFi","com.dy.pipIrrGlobal.daoVi"})
public class PipIrrProjectApplication {
    public static void main(String[] args) {
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraCtrl.java
New file
@@ -0,0 +1,241 @@
package com.dy.pipIrrProject.video;
import com.dy.common.aop.SsoAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.common.webUtil.ResultCodeMsg;
import com.dy.pipIrrGlobal.pojoVi.ViCamera;
import com.dy.pipIrrGlobal.voVi.VoCamera;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Value;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
 * @Author: liurunyu
 * @Date: 2025/6/9 9:01
 * @Description
 */
@Slf4j
@Tag(name = "视频站管理", description = "视频站管理")
@RestController
@RequestMapping(path = "camera")
@RequiredArgsConstructor
public class CameraCtrl {
    private CameraSv sv;
    @Autowired
    private void setSv(CameraSv sv){
        this.sv = sv ;
    }
    @Value("${video.types}")
    private String[] types;
    /**
     * 客户端请求得到所有摄像机类型
     * @return 所有摄像机类型
     */
    @Operation(summary = "获得全部摄像机类型", description = "返回全部摄像机类型")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "返回全部摄像机类型数据(BaseResponse.content:TypesVo[{}])",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = TypesVo.class))}
            )
    })
    @GetMapping(path = "types")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<TypesVo>>> types() {
        try {
            List<TypesVo> list = new ArrayList<>() ;
            if(types != null && types.length > 0){
                for (String type : types) {
                    String[] typeGrp = type.split(",");
                    if(typeGrp.length == 2){
                        TypesVo vo = new TypesVo() ;
                        vo.type = Integer.parseInt(typeGrp[0].trim()) ;
                        vo.name = typeGrp[1].trim() ;
                        list.add(vo) ;
                    }
                }
            }
            QueryResultVo<List<TypesVo>> res = new QueryResultVo() ;
            res.obj = list ;
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("查询取水口异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
    /**
     * 客户端请求得到一些摄像机数据
     * @return 所有摄像机数据
     */
    @Operation(summary = "获得一页摄像机数据", description = "返回一页摄像机数据数据")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "返回一页摄像机数据(BaseResponse.content:QueryResultVo[{}])",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = VoCamera.class))}
            )
    })
    @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE)
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoCamera>>> some(@RequestBody CameraQo vo){
        try {
            QueryResultVo<List<VoCamera>> res = this.sv.some(vo) ;
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("查询摄像机异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
    /**
     * 得到一个摄像机数据
     * @return 一个摄像机数据
     */
    @Operation(summary = "一个摄像机", description = "得到一个摄像机数据")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "返回一个摄像机数据(BaseResponse.content:{})",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = ViCamera.class))}
            )
    })
    @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE)
    @SsoAop()
    public BaseResponse<ViCamera> one(Long id){
        return BaseResponseUtils.buildSuccess(this.sv.selectById(id));
    }
    /**
     * 保存摄像机
     * @param dto 保存摄像机form表单对象
     * @return 是否成功
     */
    @Operation(summary = "保存摄像机", description = "提交摄像机数据(form表单),进行保存")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE)
    @SsoAop()
    public BaseResponse<Boolean> save(@RequestBody @Valid CameraDto dto, BindingResult bindingResult){
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        ViCamera po = dto.toNewPo() ;
        int count;
        try {
            count = this.sv.save(po);
        } catch (Exception e) {
            log.error("保存摄像机异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
        if(count <= 0){
            return BaseResponseUtils.buildFail("数据库存储失败") ;
        }else{
            return BaseResponseUtils.buildSuccess(true) ;
        }
    }
    /**
     * 编辑修改摄像机
     * @param dto 保存摄像机form表单对象
     * @return 是否成功
     */
    @Operation(summary = "编辑修改摄像机", description = "提交摄像机数据(form表单),进行修改")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE)
    @SsoAop()
    public BaseResponse<Boolean> update(@RequestBody @Valid CameraDto dto, BindingResult bindingResult){
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        ViCamera po = dto.toPo() ;
        if(po.id == null){
            return BaseResponseUtils.buildFail("无数据实体ID") ;
        }
        int count;
        try {
            count = this.sv.update(po);
        } catch (Exception e) {
            log.error("保存摄像机异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
        if(count <= 0){
            return BaseResponseUtils.buildFail("数据库存储失败") ;
        }else{
            return BaseResponseUtils.buildSuccess(true) ;
        }
    }
    /**
     * 删除摄像机
     * @param id 摄像机ID
     * @return 是否成功
     */
    @Operation(summary = "删除摄像机", description = "提交摄像机ID,进行逻辑删除")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE)
    @SsoAop()
    public BaseResponse<Boolean> delete(Long id){
        if(id == null){
            return BaseResponseUtils.buildFail("id不能为空") ;
        }
        int count;
        try {
            count = this.sv.delete(id);
        } catch (Exception e) {
            log.error("保存摄像机异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
        if(count <= 0){
            return BaseResponseUtils.buildFail("数据库存储失败") ;
        }else{
            return BaseResponseUtils.buildSuccess(true) ;
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraDto.java
New file
@@ -0,0 +1,82 @@
package com.dy.pipIrrProject.video;
import com.dy.pipIrrGlobal.pojoVi.ViCamera;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
/**
 * @Author: liurunyu
 * @Date: 2025/6/9 10:18
 * @Description
 */
@Data
@Schema(name = "摄像机(视频站)")
public class CameraDto {
    public static final long serialVersionUID = 202506091020001L;
    /**
     * 主键
     */
    public String id;
    /**
     * 类型(1萤石)
     */
    @NotEmpty(message = "摄像机类型不能为空") //不能为空也不能为null
    public Byte type;
    /**
     * 摄像机序列号
     */
    @NotEmpty(message = "摄像机类型不能为空") //不能为空也不能为null
    public String devNo;
    /**
     * 视频站名称
     */
    @NotEmpty(message = "视频站名称不能为空") //不能为空也不能为null
    public String name;
    /**
     * 经度
     */
    public Double lng;
    /**
     * 纬度
     */
    public Double lat;
    /**
     * 是否大屏展示(1是,0或null否)
     */
    public Byte onScreen;
    /**
     * 大屏展示排序(大于等于1,数字越小排序越前)
     */
    public Integer onSort;
    /**
     * 备注
     */
    public String remark;
    public ViCamera toNewPo(){
        ViCamera po = new ViCamera();
        po.type = this.type;
        po.devNo = this.devNo;
        po.name = this.name;
        po.lng = this.lng;
        po.lat = this.lat;
        po.onScreen = this.onScreen;
        po.onSort = this.onSort;
        po.remark = this.remark;
        return po;
    }
    public ViCamera toPo(){
        ViCamera po = this.toNewPo();
        po.id = Long.parseLong(this.id) ;
        return po;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraQo.java
New file
@@ -0,0 +1,22 @@
package com.dy.pipIrrProject.video;
import com.dy.common.webUtil.QueryConditionVo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
/**
 * @Author: liurunyu
 * @Date: 2025/6/9 9:03
 * @Description
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ToString(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Schema(name = "视频监控查询条件")
public class CameraQo extends QueryConditionVo {
    @Schema(description = "名称(地址)")
    public String name;
}
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraSv.java
New file
@@ -0,0 +1,84 @@
package com.dy.pipIrrProject.video;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoVi.ViCameraMapper;
import com.dy.pipIrrGlobal.pojoVi.ViCamera;
import com.dy.pipIrrGlobal.voVi.VoCamera;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
 * @Author: liurunyu
 * @Date: 2025/6/9 9:01
 * @Description
 */
@Slf4j
@Service
public class CameraSv {
    @Autowired
    private ViCameraMapper dao;
    /**
     * 根据指定条件获取实体记录
     * @param queryQo 查询条件值对象
     * @return 实体记录列表
     */
    public QueryResultVo<List<VoCamera>> some(CameraQo queryQo) {
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryQo);
        Long itemTotal = dao.selectTotal(params);
        QueryResultVo<List<VoCamera>> rsVo = new QueryResultVo<>();
        rsVo.pageSize = queryQo.pageSize;
        rsVo.pageCurr = queryQo.pageCurr;
        rsVo.calculateAndSet(itemTotal, params);
        rsVo.obj = dao.selectSome(params);
        return rsVo;
    }
    /**
     * 得到一个实体
     * @param id 实体ID
     * @return 实体
     */
    public ViCamera selectById(Long id){
        return this.dao.selectById(id) ;
    }
    /**
     * 保存(添加)视频监控点
     * @param po
     * @return
     */
    @Transactional
    Integer save(ViCamera po) {
        return dao.insert(po);
    }
    /**
     * 修改实体
     * @param po 实体
     * @return 数量
     */
    @Transactional
    public int update(ViCamera po) {
        return this.dao.updateByPrimaryKeySelective(po);
    }
    /**
     * 保存修改实体
     * @param id 实体ID
     * @return 影响记录数量
     */
    @Transactional
    public int delete(Long id){
        return this.dao.deleteLogicById(id) ;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/TypesVo.java
New file
@@ -0,0 +1,14 @@
package com.dy.pipIrrProject.video;
import lombok.Data;
/**
 * @Author: liurunyu
 * @Date: 2025/6/9 9:37
 * @Description
 */
@Data
public class TypesVo {
    public Integer type ;
    public String name ;
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/CameraQo.java
New file
@@ -0,0 +1,20 @@
package com.dy.pipIrrRemote.video;
import com.dy.common.webUtil.QueryConditionVo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
/**
 * @Author: liurunyu
 * @Date: 2025/6/9 9:03
 * @Description
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ToString(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Schema(name = "视频监控查询条件")
public class CameraQo extends QueryConditionVo {
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VideoCtrl.java
New file
@@ -0,0 +1,118 @@
package com.dy.pipIrrRemote.video;
import com.dy.common.aop.SsoAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.common.webUtil.ResultCodeMsg;
import com.dy.pipIrrGlobal.pojoVi.ViYsApp;
import com.dy.pipIrrGlobal.util.CameraTypeEnum;
import com.dy.pipIrrGlobal.voVi.VoCamera;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
 * @Author: liurunyu
 * @Date: 2025/6/9 10:34
 * @Description
 */
@Slf4j
@Tag(name = "视频监控", description = "视频监控")
@RestController
@RequestMapping(path = "video")
@RequiredArgsConstructor
public class VideoCtrl {
    private VideoSv sv;
    private YsAppSv ysSv;
    @Value("${video.screen.count: 4}")
    private Integer pageSize;//每页显示条数
    @Value("${video.ys.requestVideoCommonUrl: https://open.ys7.com/console/jssdk/pc.html}")
    private String requestVideoCommonUrl;//
    @Value("${video.ys.requestVideoCameraPreUrl: ezopen://open.ys7.com/}")
    private String requestVideoCameraPreUrl;//
    @Value("${video.ys.requestVideoCameraTailUrl: /1.live&themeId=}")
    private String requestVideoCameraTailUrl;//
    @Autowired
    private void setSv(VideoSv sv, YsAppSv ysSv){
        this.sv = sv ;
        this.ysSv = ysSv ;
    }
    /**
     * 客户端请求得到一些摄像机数据
     * @return 所有摄像机数据
     */
    @Operation(summary = "获得一页摄像机数据", description = "返回一页摄像机数据数据")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "返回一页摄像机数据(BaseResponse.content:QueryResultVo[{}])",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = VoCamera.class))}
            )
    })
    @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE)
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoVideo>>> some(CameraQo queryQo){
        try {
            ViYsApp ysApp = this.ysSv.selectSingleton() ;
            if(ysApp == null){
                //remote模块的自动任务可能清空了,所以再查询一次
                ysApp = this.ysSv.selectSingleton() ;
            }
            List<VoVideo> list = new ArrayList<>() ;
            QueryResultVo<List<VoCamera>> resTmp = this.sv.some(queryQo, pageSize) ;
            if(resTmp != null && resTmp.obj != null){
                for(VoCamera vo : resTmp.obj){
                    VoVideo vvo = new VoVideo() ;
                    vvo.id = vo.id ;
                    vvo.name = vo.name ;
                    if(ysApp != null && vo.type != null && vo.type.byteValue() == CameraTypeEnum.YINGSHI.getType().byteValue()){
                        //萤石
                        StringBuilder sb = new StringBuilder();
                        sb.append(requestVideoCommonUrl);
                        sb.append("?accessToken=");
                        sb.append(ysApp.accessToken);
                        sb.append("&url=");
                        sb.append(requestVideoCameraPreUrl);
                        sb.append(vo.devNo);
                        sb.append(requestVideoCameraTailUrl);
                        vvo.videoUrl4Simple = sb.toString() + "simple";
                        vvo.videoUrl4Standard = sb.toString() + "standard" ;
                        vvo.videoUrl4Security = sb.toString() + "security" ;
                    }else{
                        vvo.videoUrl4Simple = "" ;
                        vvo.videoUrl4Standard = "" ;
                        vvo.videoUrl4Security = "" ;
                    }
                }
            }
            QueryResultVo<List<VoVideo>> res = new QueryResultVo<>() ;
            resTmp.copyTo(res);
            res.obj = list ;
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("查询摄像机异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VideoSv.java
New file
@@ -0,0 +1,44 @@
package com.dy.pipIrrRemote.video;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoVi.ViCameraMapper;
import com.dy.pipIrrGlobal.voVi.VoCamera;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
 * @Author: liurunyu
 * @Date: 2025/6/9 10:42
 * @Description
 */
@Slf4j
@Service
public class VideoSv {
    @Autowired
    private ViCameraMapper dao;
    /**
     * 根据指定条件获取实体记录
     * @param queryQo 查询条件值对象
     * @return 实体记录列表
     */
    public QueryResultVo<List<VoCamera>> some(CameraQo queryQo, int pageSize) {
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryQo);
        Long itemTotal = dao.selectTotal(params);
        QueryResultVo<List<VoCamera>> rsVo = new QueryResultVo<>();
        rsVo.pageSize = pageSize;
        rsVo.pageCurr = queryQo.pageCurr;
        rsVo.calculateAndSet(itemTotal, params);
        rsVo.obj = dao.selectSome(params);
        return rsVo;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VoVideo.java
New file
@@ -0,0 +1,20 @@
package com.dy.pipIrrRemote.video;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import lombok.Data;
/**
 * @Author: liurunyu
 * @Date: 2025/6/9 10:57
 * @Description
 */
@Data
public class VoVideo {
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    public Long id ;
    public String name ;
    public String videoUrl4Simple ;
    public String videoUrl4Standard ;
    public String videoUrl4Security ;
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/ys/YsAppClient.java
@@ -27,16 +27,16 @@
    private static final Integer ThreadPoolPriority = 5 ;//线程优先级
    private static final boolean quartzJobRunOneTimes = true ;//定时任务只执行一次
    @Value("${ys.accessTokenExpireDay: 7}")
    @Value("${video.ys.accessTokenExpireDay: 7}")
    protected Integer accessTokenExpireDay;//AccessToken过期时间,单位天
    @Value("${ys.appKey}")
    @Value("${video.ys.appKey}")
    protected String appKey;
    @Value("${ys.secret}")
    @Value("${video.ys.secret}")
    protected String secret;
    @Value("${ys.requestAccessTokenUrl}")
    @Value("${video.ys.requestAccessTokenUrl}")
    protected String requestAccessTokenUrl;
    @Autowired