wang-hao-jie
2021-11-25 97b74f99421ae0af00b3dcfa5c875a15ec287e6d
修改
3个文件已修改
5个文件已添加
344 ■■■■■ 已修改文件
xboot-modules/xboot-your/pom.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/FingerprintController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Car.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/HaiKangPost.java 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/vo/FindHistoryGpsRequest.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/vo/PlaybackURLsVo.java 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/vo/PreviewURLsVo.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/vo/TalkURLsVo.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/pom.xml
@@ -11,5 +11,11 @@
    <artifactId>xboot-your</artifactId>
    <dependencies>
        <dependency>
            <groupId>com.hikvision.ga</groupId>
            <artifactId>artemis-http-client</artifactId>
            <version>1.1.2</version>
        </dependency>
    </dependencies>
</project>
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/FingerprintController.java
@@ -135,6 +135,10 @@
            fingerprint.setPassword(user.getDescription());
            fingerprint.setType(user.getType2());
        }
        if(StrUtil.isNotEmpty(fingerprint.getCustomerId())){
            Customer byId = iCustomerService.getById(fingerprint.getCustomerId());
            fingerprint.setAreaId(byId.getAreaId());
        }
        if (iFingerprintService.saveOrUpdate(fingerprint)) {
            return new ResultUtil<Fingerprint>().setData(fingerprint);
        }
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Car.java
@@ -30,6 +30,9 @@
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "车辆编号")
    private String code;
    @ApiModelProperty(value = "品牌")
    private String brand;
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/HaiKangPost.java
New file
@@ -0,0 +1,123 @@
package cn.exrick.xboot.your.util;
import java.util.HashMap;
import java.util.Map;
import cn.exrick.xboot.your.vo.FindHistoryGpsRequest;
import cn.exrick.xboot.your.vo.PlaybackURLsVo;
import cn.exrick.xboot.your.vo.PreviewURLsVo;
import cn.exrick.xboot.your.vo.TalkURLsVo;
import cn.hutool.json.JSONUtil;
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
/**
 * 海康车机接口
 */
public class HaiKangPost {
    /**
     * STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数.
     */
    static {
        ArtemisConfig.host = "111.63.178.115:1443";// 平台门户/nginx的IP和端口(必须使用https协议,https端口默认为443)
        ArtemisConfig.appKey = "28156526"; // 秘钥appkey
        ArtemisConfig.appSecret = "MNkyjHuids4XxFONSOaL";// 秘钥appSecret
    }
    /**
     * STEP2:设置OpenAPI接口的上下文
     */
    private static final String ARTEMIS_PATH = "/artemis";
    //根据车辆编号及时段获取历史定位信息
    public static String findHistoryGps(FindHistoryGpsRequest findHistoryGpsRequest){
        String findHistoryGpsDataApi = ARTEMIS_PATH +"/api/rtsm/v1/gps/findHistoryGps";
        Map<String,String> path = new HashMap<String,String>(2){
            {
                put("https://",findHistoryGpsDataApi);
            }
        };
        String body= JSONUtil.toJsonStr(findHistoryGpsRequest);
        String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json");
        return result;
    }
    //查询指定车辆编号的最新定位
    public static String findLatestGps(String[] code){
        String findHistoryGpsDataApi = ARTEMIS_PATH +"/api/rtsm/v1/gps/findLatestGps";
        Map<String,String> path = new HashMap<String,String>(2){
            {
                put("https://",findHistoryGpsDataApi);
            }
        };
        String body= JSONUtil.toJsonStr(code);
        String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json");
        return result;
    }
    //获取监控点预览取流URL
    public static String previewURLs(PreviewURLsVo previewURLsVo){
        String findHistoryGpsDataApi = ARTEMIS_PATH +"/api/video/v1/cameras/previewURLs";
        Map<String,String> path = new HashMap<String,String>(2){
            {
                put("https://",findHistoryGpsDataApi);
            }
        };
        String body= JSONUtil.toJsonStr(previewURLsVo);
        String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json");
        return result;
    }
    //获取监控点回放取流URL
    public static String playbackURLs(PlaybackURLsVo playbackURLsVo){
        String findHistoryGpsDataApi = ARTEMIS_PATH +"/api/video/v1/cameras/playbackURLs";
        Map<String,String> path = new HashMap<String,String>(2){
            {
                put("https://",findHistoryGpsDataApi);
            }
        };
        String body= JSONUtil.toJsonStr(playbackURLsVo);
        String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json");
        return result;
    }
    //语音对讲
    public static String talkURLs(TalkURLsVo talkURLsVo){
        String findHistoryGpsDataApi = ARTEMIS_PATH +"/api/video/v1/cameras/talkURLs";
        Map<String,String> path = new HashMap<String,String>(2){
            {
                put("https://",findHistoryGpsDataApi);
            }
        };
        String body= JSONUtil.toJsonStr(talkURLsVo);
        String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json");
        return result;
    }
    //按事件类型获取事件订阅信息
    public static String getTopicInfo(){
        String findHistoryGpsDataApi = ARTEMIS_PATH +"/api/common/v1/event/getTopicInfo";
        Map<String,String> path = new HashMap<String,String>(2){
            {
                put("https://",findHistoryGpsDataApi);
            }
        };
        String eventTypes[] = {"5201154049"};
        String body= JSONUtil.toJsonStr(eventTypes);
        String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json");
        return result;
    }
    public static void main(String[] args) {
//        FindHistoryGpsRequest findHistoryGpsRequest = new FindHistoryGpsRequest();
//        findHistoryGpsRequest.setVehicleIndexCode("b279d865eabe497db465eb2f4d2cc87d");
//        findHistoryGpsRequest.setPageNo(1);
//        findHistoryGpsRequest.setPageSize(20);
//        findHistoryGpsRequest.setBeginTime("2021-11-25T03:10:01.000+08:00");
//        findHistoryGpsRequest.setEndTime("2021-11-25T12:10:01.000+08:00");
//        System.out.println(findHistoryGps(findHistoryGpsRequest));
//        String code[] = {"b279d865eabe497db465eb2f4d2cc87d"};
//        System.out.println(findLatestGps(code));
    }
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/vo/FindHistoryGpsRequest.java
New file
@@ -0,0 +1,49 @@
package cn.exrick.xboot.your.vo;
public class FindHistoryGpsRequest {
    private String beginTime;
    private String endTime;
    private String vehicleIndexCode;
    private Integer pageNo;
    private Integer pageSize;
    public String getBeginTime() {
        return beginTime;
    }
    public void setBeginTime(String beginTime) {
        this.beginTime = beginTime;
    }
    public String getEndTime() {
        return endTime;
    }
    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }
    public String getVehicleIndexCode() {
        return vehicleIndexCode;
    }
    public void setVehicleIndexCode(String vehicleIndexCode) {
        this.vehicleIndexCode = vehicleIndexCode;
    }
    public Integer getPageNo() {
        return pageNo;
    }
    public void setPageNo(Integer pageNo) {
        this.pageNo = pageNo;
    }
    public Integer getPageSize() {
        return pageSize;
    }
    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/vo/PlaybackURLsVo.java
New file
@@ -0,0 +1,77 @@
package cn.exrick.xboot.your.vo;
public class PlaybackURLsVo {
    private String beginTime;
    private String endTime;
    private String cameraIndexCode;
    private String recordLocation="0";//录像存储位置(0-中心存储,1-设备存储),默认中心存储
    private String protocol;//协议类型(rtsp-rtsp协议,rtmp-rtmp协议,hLS-hLS协议,默认为rtsp)
    private Boolean needReturnClipInfo=true;//是否返回录像片段详细信息(默认false。当需要展示该时间段的录像片段信息时,需要填写true)
    private String uuid;//上一次查询返回的uuid,用于继续查询剩余片段,默认为空字符串
    private String expand="transCode=0";
    public String getBeginTime() {
        return beginTime;
    }
    public void setBeginTime(String beginTime) {
        this.beginTime = beginTime;
    }
    public String getEndTime() {
        return endTime;
    }
    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }
    public String getCameraIndexCode() {
        return cameraIndexCode;
    }
    public void setCameraIndexCode(String cameraIndexCode) {
        this.cameraIndexCode = cameraIndexCode;
    }
    public String getRecordLocation() {
        return recordLocation;
    }
    public void setRecordLocation(String recordLocation) {
        this.recordLocation = recordLocation;
    }
    public String getProtocol() {
        return protocol;
    }
    public void setProtocol(String protocol) {
        this.protocol = protocol;
    }
    public Boolean getNeedReturnClipInfo() {
        return needReturnClipInfo;
    }
    public void setNeedReturnClipInfo(Boolean needReturnClipInfo) {
        this.needReturnClipInfo = needReturnClipInfo;
    }
    public String getUuid() {
        return uuid;
    }
    public void setUuid(String uuid) {
        this.uuid = uuid;
    }
    public String getExpand() {
        return expand;
    }
    public void setExpand(String expand) {
        this.expand = expand;
    }
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/vo/PreviewURLsVo.java
New file
@@ -0,0 +1,49 @@
package cn.exrick.xboot.your.vo;
public class PreviewURLsVo {
    private String protocol;//协议类型(rtsp-rtsp协议,rtmp-rtmp协议,hls-hLS协议),未填写为rtsp协议
    private String cameraIndexCode;
    private Integer streamType=0;//码流类型(0-主码流,1-子码流),未填默认为主码流
    private Integer transmode=0;//协议类型( 0-udp,1-tcp),默认为tcp,在protocol设置为rtsp或者rtmp时有效
    private String expand="transcode=0";//
    public String getProtocol() {
        return protocol;
    }
    public void setProtocol(String protocol) {
        this.protocol = protocol;
    }
    public String getCameraIndexCode() {
        return cameraIndexCode;
    }
    public void setCameraIndexCode(String cameraIndexCode) {
        this.cameraIndexCode = cameraIndexCode;
    }
    public Integer getStreamType() {
        return streamType;
    }
    public void setStreamType(Integer streamType) {
        this.streamType = streamType;
    }
    public Integer getTransmode() {
        return transmode;
    }
    public void setTransmode(Integer transmode) {
        this.transmode = transmode;
    }
    public String getExpand() {
        return expand;
    }
    public void setExpand(String expand) {
        this.expand = expand;
    }
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/vo/TalkURLsVo.java
New file
@@ -0,0 +1,31 @@
package cn.exrick.xboot.your.vo;
public class TalkURLsVo {
    private String cameraIndexCode;
    private Integer transmode=0;//协议类型, 0: UDP 1: TCP 未填默认为TCP
    private String expand="streamform=ps";
    public String getCameraIndexCode() {
        return cameraIndexCode;
    }
    public void setCameraIndexCode(String cameraIndexCode) {
        this.cameraIndexCode = cameraIndexCode;
    }
    public Integer getTransmode() {
        return transmode;
    }
    public void setTransmode(Integer transmode) {
        this.transmode = transmode;
    }
    public String getExpand() {
        return expand;
    }
    public void setExpand(String expand) {
        this.expand = expand;
    }
}