2021与蓝度共同重构项目,服务端
zhanzhiqin
2021-12-22 3f95846ca34bf97b00346417c99b1549293b72d2
萤石云摄像头
已修改5个文件
194 ■■■■ 文件已修改
dao/src/main/java/com/sandu/ximon/dao/domain/YSY_MonitorDto.java 132 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/MonitorController.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/manager/iot/amqp/AmqpMessageListener.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/param/MonitorParam.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/MonitorService.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/java/com/sandu/ximon/dao/domain/YSY_MonitorDto.java
@@ -1,6 +1,5 @@
package com.sandu.ximon.dao.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -14,43 +13,21 @@
public class YSY_MonitorDto {
    private String code;
    private String msg;
    private data data;
    private MonitorDto data;
    public class data {
//        {
//            "deviceSerial": "F34465099",
//                "deviceName": "DS-2DE4223IW-DE(F34465099)",
//                "localName": "DS-2DE4223IW-DE(F34465099)",
//                "model": "DS-2DE4223IW-DE",
//                "status": 1,
//                "defence": 0,
//                "isEncrypt": 1,
//                "alarmSoundMode": 0,
//                "offlineNotify": 0,
//                "category": "UNKNOWN",
//                "parentCategory": "COMMON",
//                "updateTime": 1612337396000,
//                "netType": null,
//                "signal": null,
//                "riskLevel": 0,
//                "netAddress": "119.132.57.169"
//        }
    @NoArgsConstructor
    @Data
    public class MonitorDto {
        /**
         * 萤石云摄像头相关参数开始
         */
        private String deviceSerial;
        private String deviceName;
        private String localName;
        private String model;
        private Integer status;
        private Integer defence;
        private Integer isEncrypt;
        private Integer alarmSoundMode;
        private Integer offlineNotify;
        private String category;
        private String parentCategory;
        private LocalDateTime updateTime;
//        private Object netType;
//        private Object signal;
        private Integer riskLevel;
        private String netAddress;
        public String getDeviceSerial() {
@@ -69,14 +46,6 @@
            this.deviceName = deviceName;
        }
        public String getLocalName() {
            return localName;
        }
        public void setLocalName(String localName) {
            this.localName = localName;
        }
        public String getModel() {
            return model;
        }
@@ -93,52 +62,12 @@
            this.status = status;
        }
        public Integer getDefence() {
            return defence;
        }
        public void setDefence(Integer defence) {
            this.defence = defence;
        }
        public Integer getIsEncrypt() {
            return isEncrypt;
        }
        public void setIsEncrypt(Integer isEncrypt) {
            this.isEncrypt = isEncrypt;
        }
        public Integer getAlarmSoundMode() {
            return alarmSoundMode;
        }
        public void setAlarmSoundMode(Integer alarmSoundMode) {
            this.alarmSoundMode = alarmSoundMode;
        }
        public Integer getOfflineNotify() {
            return offlineNotify;
        }
        public void setOfflineNotify(Integer offlineNotify) {
            this.offlineNotify = offlineNotify;
        }
        public String getCategory() {
            return category;
        }
        public void setCategory(String category) {
            this.category = category;
        }
        public String getParentCategory() {
            return parentCategory;
        }
        public void setParentCategory(String parentCategory) {
            this.parentCategory = parentCategory;
        }
        public LocalDateTime getUpdateTime() {
@@ -149,14 +78,6 @@
            this.updateTime = updateTime;
        }
        public Integer getRiskLevel() {
            return riskLevel;
        }
        public void setRiskLevel(Integer riskLevel) {
            this.riskLevel = riskLevel;
        }
        public String getNetAddress() {
            return netAddress;
        }
@@ -164,6 +85,45 @@
        public void setNetAddress(String netAddress) {
            this.netAddress = netAddress;
        }
        /**
         * 萤石云摄像头相关参数结束
         */
        /**
         * 萤石云摄像头播放地址相关参数开始
         */
        private String id;
        private String url;
        private String expireTime;
        public String getId() {
            return id;
        }
        public void setId(String id) {
            this.id = id;
        }
        public String getUrl() {
            return url;
        }
        public void setUrl(String url) {
            this.url = url;
        }
        public String getExpireTime() {
            return expireTime;
        }
        public void setExpireTime(String expireTime) {
            this.expireTime = expireTime;
        }
/**
         * 萤石云摄像头播放地址相关参数结束
         */
    }
}
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/MonitorController.java
@@ -153,10 +153,7 @@
    /**
     *     编辑摄像头设备信息
     */
    /**
     * 获取单个设备信息   getYSYMonitorInfo
     * 编辑摄像头设备信息
     */
    @PostMapping("/UpDateMonitorInfo")
    public ResponseVO<Object> UpDateMonitorInfo(@RequestBody MonitorParam monitorParam) {
@@ -176,4 +173,14 @@
        }
    }
    /**
     * 编辑摄像头设备信息
     */
    @GetMapping("/getMonitorVideoUrl")
    public ResponseVO<Object> getMonitorVideoUrl(@RequestBody MonitorParam monitorParam) {
        String URL = monitorService.getMonitorVideoUrl(monitorParam.getAccessToken(), monitorParam.getDeviceSerial(), monitorParam.getProtocol());
        return ResponseUtil.success(URL);
    }
}
ximon-admin/src/main/java/com/sandu/ximon/admin/manager/iot/amqp/AmqpMessageListener.java
@@ -109,18 +109,28 @@
        String functionCode = frame.getPayload().substring(2, 4);
        if (A5C3ReportEnum.NETWORK_REQUEST.getCode().equals(functionCode)) {
            A5C3CommonReportInnerFrame netRequestFrame = new A5C3CommonReportInnerFrame().transformFrame(frame.getPayload());
            log.info("C3充电桩上报处理_netRequestFrame");
            log.info(netRequestFrame.toString());
        } else if (A5C3ReportEnum.QR_CODE_REQUEST.getCode().equals(functionCode)) {
            A5C3CommonReportInnerFrame codeRequestFrame = new A5C3CommonReportInnerFrame().transformFrame(frame.getPayload());
            log.info("C3充电桩上报处理_codeRequestFrame");
            log.info(codeRequestFrame.toString());
        } else if (A5C3ReportEnum.HEART_BEAT.getCode().equals(functionCode)) {
            A5C3HeartbeatReportInnerFrame heartbeatReportInnerFrame = new A5C3HeartbeatReportInnerFrame().transformFrame(frame.getPayload());
            log.info("C3充电桩上报处理_heartbeatReportInnerFrame");
            log.info(heartbeatReportInnerFrame.toString());
        } else if (A5C3ReportEnum.CHARGE_COMPLETE.getCode().equals(functionCode)) {
            A5C3CommonReportInnerFrame completeRequestFrame = new A5C3CommonReportInnerFrame().transformFrame(frame.getPayload());
            log.info("C3充电桩上报处理_completeRequestFrame");
            log.info(completeRequestFrame.toString());
        } else if (A5C3ReportEnum.CHARGE_STOP.getCode().equals(functionCode)) {
            A5C3CommonReportInnerFrame stopRequestFrame = new A5C3CommonReportInnerFrame().transformFrame(frame.getPayload());
            log.info("C3充电桩上报处理_stopRequestFrame");
            log.info(stopRequestFrame.toString());
        } else if (A5C3ReportEnum.ERROR_CODE.getCode().equals(functionCode)) {
            A5C3ErrorCodeReportInnerFrame errorCodeRequestFrame = new A5C3ErrorCodeReportInnerFrame().transformFrame(frame.getPayload());
            log.info("C3充电桩上报处理_errorCodeRequestFrame");
            log.info(errorCodeRequestFrame.toString());
        }
    }
ximon-admin/src/main/java/com/sandu/ximon/admin/param/MonitorParam.java
@@ -28,4 +28,13 @@
    /**
     * 结束萤石云摄像头相关参数
     */
    /**
     * 开始萤石云摄像头播放地址相关参数
     */
    //流播放协议,1-ezopen、2-hls、3-rtmp、4-flv,默认为1
    private int protocol;
    /**
     * 结束萤石云摄像头播放地址相关参数
     */
}
ximon-admin/src/main/java/com/sandu/ximon/admin/service/MonitorService.java
@@ -38,6 +38,8 @@
    private static final String DELETE_DEVICE_URL = "/device/delete";
    //获取萤石云单个设备信息
    private static final String GET_DEVICE_URL = "/device/info";
    //获取萤石云摄像头播放地址URL
    private static final String GET_VEDIO_URL = "/v2/live/address/get";
    /**
     * 查询全部摄像头
@@ -200,5 +202,27 @@
        return updateById(monitor);
    }
    /**
     * 返回摄像头实时画面播放地址
     *
     * @param accessToken
     * @param deviceSerial
     * @return
     */
    public String getMonitorVideoUrl(String accessToken, String deviceSerial, int protocol) {
        Map<String, Object> paramMap = new HashMap<>();
        paramMap.put("accessToken", accessToken);
        paramMap.put("deviceSerial", deviceSerial);
        paramMap.put("protocol", protocol);
        String s = HttpUtil.post(YSY_URL + GET_VEDIO_URL, paramMap);
        System.out.println(s);
        YSY_MonitorDto monitor = JSON.parseObject(s, YSY_MonitorDto.class);
        if ("200".equals(monitor.getCode())) {
            return monitor.getData().getUrl();
        } else {
            throw new BusinessException(monitor.getMsg());
        }
    }
}