南昌市物联网技防平台-后台
tangzy
2021-03-25 1fab629a800e70f80f22c645d3ef15d1de735330
1.录制视频
6 files modified
9 files added
499 ■■■■■ changed files
blade-ops/blade-resource/src/main/resources/application.yml 2 ●●● patch | view | raw | blame | history
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/entity/Alarm.java 1 ●●●● patch | view | raw | blame | history
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/mapper/AlarmMapper.java 1 ●●●● patch | view | raw | blame | history
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/mapper/AlarmMapper.xml 5 ●●●●● patch | view | raw | blame | history
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/service/IAlarmService.java 2 ●●● patch | view | raw | blame | history
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/service/impl/AlarmServiceImpl.java 5 ●●●●● patch | view | raw | blame | history
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/rvideo/controller/RvideoController.java 200 ●●●●● patch | view | raw | blame | history
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/rvideo/dto/RvideoDTO.java 34 ●●●●● patch | view | raw | blame | history
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/rvideo/entity/Rvideo.java 61 ●●●●● patch | view | raw | blame | history
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/rvideo/mapper/RvideoMapper.java 42 ●●●●● patch | view | raw | blame | history
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/rvideo/mapper/RvideoMapper.xml 18 ●●●●● patch | view | raw | blame | history
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/rvideo/service/IRvideoService.java 41 ●●●●● patch | view | raw | blame | history
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/rvideo/service/impl/RvideoServiceImpl.java 41 ●●●●● patch | view | raw | blame | history
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/rvideo/vo/RvideoVO.java 36 ●●●●● patch | view | raw | blame | history
blade-service/blade-jfpts/src/main/java/sql/rvideo.menu.mysql 10 ●●●●● patch | view | raw | blame | history
blade-ops/blade-resource/src/main/resources/application.yml
@@ -5,7 +5,7 @@
    enabled: true
    name: minio
    tenant-mode: true
    endpoint: https://web.byisf.com:9001
    endpoint: http://web.byisf.com:9000
    access-key: adminminio
    secret-key: adminminio
    bucket-name: jfpt
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/entity/Alarm.java
@@ -158,6 +158,7 @@
    private String czTime;
    private String bz;
    private String cid;
    private String vaddress;
//    @TableLogic
//    private Integer isDeleted;
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/mapper/AlarmMapper.java
@@ -54,6 +54,7 @@
    void updateJtype(String id, String jtype, String bz);
    void updatePoliceStatus(String id, String status);
    void updateOne(Alarm alarm);
    void updateVaddress(String vaddress ,String jid);
    List<Map<String, Object>> selectScount(String time);
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/mapper/AlarmMapper.xml
@@ -31,6 +31,7 @@
        <result column="bz" property="bz"/>
        <result column="name" property="name"/>
        <result column="cid" property="cid"/>
        <result column="vaddress" property="vaddress"/>
    </resultMap>
@@ -421,4 +422,8 @@
        is_deleted != '1'
        AND role_id = "1370562810882502657"
    </select>
    <update id="updateVaddress">
        update sys_alarm SET vaddress=#{vaddress} where id=#{jid}
    </update>
</mapper>
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/service/IAlarmService.java
@@ -52,7 +52,7 @@
    List<Map<String, Object>> selectScount(String time);
    List<AlarmVO> selectListSe(String beginTime, String endTime);
    void updateJtype(String id, String jtype, String bz);
    void updateVaddress(String vaddress ,String jid);
    void updatePoliceStatus(String id, String status);
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/service/impl/AlarmServiceImpl.java
@@ -103,6 +103,11 @@
    }
    @Override
    public void updateVaddress(String vaddress, String jid) {
        baseMapper.updateVaddress(vaddress, jid);
    }
    @Override
    public void updatePoliceStatus(String id,String status) {
        baseMapper.updatePoliceStatus(id,status);
    }
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/rvideo/controller/RvideoController.java
New file
@@ -0,0 +1,200 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.jfpt.rvideo.controller;
import io.minio.MinioClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import jodd.util.StringPool;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import net.logstash.logback.encoder.org.apache.commons.lang3.StringEscapeUtils;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.jfpt.alarm.service.IAlarmService;
import org.springblade.jfpt.xlfeedback.service.IXlfeedbackService;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.jfpt.rvideo.entity.Rvideo;
import org.springblade.jfpt.rvideo.vo.RvideoVO;
import org.springblade.jfpt.rvideo.service.IRvideoService;
import org.springblade.core.boot.ctrl.BladeController;
import java.io.File;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;
/**
 * 控制器
 *
 * @author BladeX
 * @since 2021-03-24
 */
@RestController
@AllArgsConstructor
@RequestMapping("/rvideo")
@Api(value = "", tags = "接口")
public class RvideoController extends BladeController {
    private final IRvideoService rvideoService;
    private final IAlarmService alarmService;
    private final IXlfeedbackService xlfeedbackService;
    private static String PRE_URL = "D:\\software\\minio\\data\\jfpt\\void\\";
    private static String PRF_MINIO_URL = "minio/jfpt/void/";
    /**
     * 详情
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入rvideo")
    public R<Rvideo> detail(Rvideo rvideo) {
        Rvideo detail = rvideoService.getOne(Condition.getQueryWrapper(rvideo));
        return R.data(detail);
    }
    /**
     * 分页
     */
    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页", notes = "传入rvideo")
    public R<IPage<Rvideo>> list(Rvideo rvideo, Query query) {
        IPage<Rvideo> pages = rvideoService.page(Condition.getPage(query), Condition.getQueryWrapper(rvideo));
        return R.data(pages);
    }
    /**
     * 自定义分页
     */
    @GetMapping("/page")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "分页", notes = "传入rvideo")
    public R<IPage<RvideoVO>> page(RvideoVO rvideo, Query query) {
        IPage<RvideoVO> pages = rvideoService.selectRvideoPage(Condition.getPage(query), rvideo);
        return R.data(pages);
    }
    /**
     * 新增
     */
    @PostMapping("/save")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "新增", notes = "传入rvideo")
    public R save(@Valid @RequestBody Rvideo rvideo) {
        return R.status(rvideoService.save(rvideo));
    }
    /**
     * 修改
     */
    @PostMapping("/update")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "修改", notes = "传入rvideo")
    public R update(@Valid @RequestBody Rvideo rvideo) {
        return R.status(rvideoService.updateById(rvideo));
    }
    /**
     * 新增或修改
     */
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入rvideo")
    public R submit(@Valid @RequestBody Rvideo rvideo) {
        return R.status(rvideoService.saveOrUpdate(rvideo));
    }
    /**
     * 删除
     */
    @PostMapping("/remove")
    @ApiOperationSupport(order = 8)
    @ApiOperation(value = "删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return R.status(rvideoService.removeByIds(Func.toLongList(ids)));
    }
    /**
     * @param sourcePath 源路径
     * @param jid 警情id
     * @throws Exception
     */
    @PostMapping("/rVoid")
    public String rVoid(String sourcePath,String jid) throws Exception {
        String webroot = "D:\\LXVideoServer\\3rd\\ffmpeg\\bin";
        String UUID = DateUtil.time();
        //目标路径
        String targetPath = PRE_URL + UUID + ".mp4";
        //返回前端路径
        String vaddress = null;
        Runtime run = null;
        try {
            run = Runtime.getRuntime();
            long start = System.currentTimeMillis();
            System.out.println(new File(webroot).getAbsolutePath());
            //通过视频url录制30s视频保存,格式为MP4
            String newJson = StringEscapeUtils.unescapeHtml4(sourcePath);
            Process p = run.exec(new File(webroot).getAbsolutePath() + "/ffmpeg -i " +newJson+ " -y -t 00:00:30 -codec copy -f mp4 " + targetPath);
            //释放进程
            p.getOutputStream().close();
            p.getInputStream().close();
            p.getErrorStream().close();
            p.waitFor();
            long end = System.currentTimeMillis();
            System.out.println(sourcePath + " convert success, costs:" + (end - start) + "ms");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            //run调用lame解码器最后释放内存
            run.freeMemory();
            //返回路径
            vaddress = "https://web.byisf.com/" + PRF_MINIO_URL + UUID + ".mp4";
            //把路径通过警情id添加到警情信息
            alarmService.updateVaddress(vaddress,jid);
        }
        return vaddress;
    }
}
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/rvideo/dto/RvideoDTO.java
New file
@@ -0,0 +1,34 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.jfpt.rvideo.dto;
import org.springblade.jfpt.rvideo.entity.Rvideo;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 数据传输对象实体类
 *
 * @author BladeX
 * @since 2021-03-24
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class RvideoDTO extends Rvideo {
    private static final long serialVersionUID = 1L;
}
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/rvideo/entity/Rvideo.java
New file
@@ -0,0 +1,61 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.jfpt.rvideo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * 实体类
 *
 * @author BladeX
 * @since 2021-03-24
 */
@Data
@TableName("sys_rvideo")
@ApiModel(value = "Rvideo对象", description = "Rvideo对象")
public class Rvideo implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    /**
    * 警单id
    */
        @ApiModelProperty(value = "警单id")
        private String jid;
    /**
    * 录制发生时间
    */
        @ApiModelProperty(value = "录制发生时间")
        private String rtime;
    /**
     * 录制地址
     */
    @ApiModelProperty(value = "录制地址")
        private String address;
}
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/rvideo/mapper/RvideoMapper.java
New file
@@ -0,0 +1,42 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.jfpt.rvideo.mapper;
import org.springblade.jfpt.rvideo.entity.Rvideo;
import org.springblade.jfpt.rvideo.vo.RvideoVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
 *  Mapper 接口
 *
 * @author BladeX
 * @since 2021-03-24
 */
public interface RvideoMapper extends BaseMapper<Rvideo> {
    /**
     * 自定义分页
     *
     * @param page
     * @param rvideo
     * @return
     */
    List<RvideoVO> selectRvideoPage(IPage page, RvideoVO rvideo);
}
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/rvideo/mapper/RvideoMapper.xml
New file
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.jfpt.rvideo.mapper.RvideoMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="rvideoResultMap" type="org.springblade.jfpt.rvideo.entity.Rvideo">
        <id column="id" property="id"/>
        <result column="jid" property="jid"/>
        <result column="rtime" property="rtime"/>
        <result column="address" property="address"/>
    </resultMap>
    <select id="selectRvideoPage" resultMap="rvideoResultMap">
        select * from sys_rvideo where is_deleted = 0
    </select>
</mapper>
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/rvideo/service/IRvideoService.java
New file
@@ -0,0 +1,41 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.jfpt.rvideo.service;
import org.springblade.jfpt.rvideo.entity.Rvideo;
import org.springblade.jfpt.rvideo.vo.RvideoVO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
 *  服务类
 *
 * @author BladeX
 * @since 2021-03-24
 */
public interface IRvideoService extends IService<Rvideo> {
    /**
     * 自定义分页
     *
     * @param page
     * @param rvideo
     * @return
     */
    IPage<RvideoVO> selectRvideoPage(IPage<RvideoVO> page, RvideoVO rvideo);
}
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/rvideo/service/impl/RvideoServiceImpl.java
New file
@@ -0,0 +1,41 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.jfpt.rvideo.service.impl;
import org.springblade.jfpt.rvideo.entity.Rvideo;
import org.springblade.jfpt.rvideo.vo.RvideoVO;
import org.springblade.jfpt.rvideo.mapper.RvideoMapper;
import org.springblade.jfpt.rvideo.service.IRvideoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
 *  服务实现类
 *
 * @author BladeX
 * @since 2021-03-24
 */
@Service
public class RvideoServiceImpl extends ServiceImpl<RvideoMapper, Rvideo> implements IRvideoService {
    @Override
    public IPage<RvideoVO> selectRvideoPage(IPage<RvideoVO> page, RvideoVO rvideo) {
        return page.setRecords(baseMapper.selectRvideoPage(page, rvideo));
    }
}
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/rvideo/vo/RvideoVO.java
New file
@@ -0,0 +1,36 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.jfpt.rvideo.vo;
import org.springblade.jfpt.rvideo.entity.Rvideo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import io.swagger.annotations.ApiModel;
/**
 * 视图实体类
 *
 * @author BladeX
 * @since 2021-03-24
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "RvideoVO对象", description = "RvideoVO对象")
public class RvideoVO extends Rvideo {
    private static final long serialVersionUID = 1L;
}
blade-service/blade-jfpts/src/main/java/sql/rvideo.menu.mysql
New file
@@ -0,0 +1,10 @@
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1374630731515682822', 1123598815738675201, 'rvideo', '视频录制', 'menu', '/rvideo/rvideo', NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1374630731515682823', '1374630731515682822', 'rvideo_add', '新增', 'add', '/rvideo/rvideo/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1374630731515682824', '1374630731515682822', 'rvideo_edit', '修改', 'edit', '/rvideo/rvideo/edit', 'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1374630731515682825', '1374630731515682822', 'rvideo_delete', '删除', 'delete', '/api/blade-rvideo/rvideo/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1374630731515682826', '1374630731515682822', 'rvideo_view', '查看', 'view', '/rvideo/rvideo/view', 'file-text', 4, 2, 2, 1, NULL, 0);