All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dahuatech.icc.multiinone.admin.vo.StartTalkRequest Maven / Gradle / Ivy

There is a newer version: 1.0.13.7
Show newest version
package com.dahuatech.icc.multiinone.admin.vo;

import com.dahuatech.hutool.http.Method;
import com.dahuatech.icc.common.ParamValidEnum;
import com.dahuatech.icc.exception.ClientException;
import com.dahuatech.icc.multiinone.admin.constant.AdminConstant;
import com.dahuatech.icc.oauth.exception.BusinessException;
import com.dahuatech.icc.oauth.http.AbstractIccRequest;
import com.dahuatech.icc.oauth.model.v202010.HttpConfigInfo;
import com.dahuatech.icc.util.StringUtils;

/**
 * program:java-sdk
 *
 * Author: 312013
 * Date:2022-07-21 17:28
 * Description: 开始语音对讲
 */
public class StartTalkRequest extends AbstractIccRequest {

    private StartTalkData data;

    public StartTalkData getData() {
        return data;
    }

    public void setData(StartTalkData data) {
        putBodyParameter("data", data);
        this.data = data;
    }

    public class StartTalkData {
        private String source;
        private String deviceCode;
        private String talkType;
        private String target;
        private String audioBit;
        private String audioType;
        private String broadcastChannels;
        private String sampleRate;
        private String talkmode;
        private String channelSeq;

        public String getSource() {
            return source;
        }

        public void setSource(String source) {
            putBodyParameter("source",source);
            this.source = source;
        }

        public String getDeviceCode() {
            return deviceCode;
        }

        public void setDeviceCode(String deviceCode) {
            putBodyParameter("deviceCode",deviceCode);
            this.deviceCode = deviceCode;
        }

        public String getTalkType() {
            return talkType;
        }

        public void setTalkType(String talkType) {
            putBodyParameter("talkType",talkType);
            this.talkType = talkType;
        }

        public String getTarget() {
            return target;
        }

        public void setTarget(String target) {
            putBodyParameter("target",target);
            this.target = target;
        }

        public String getAudioBit() {
            return audioBit;
        }

        public void setAudioBit(String audioBit) {
            putBodyParameter("audioBit",audioBit);
            this.audioBit = audioBit;
        }

        public String getAudioType() {
            return audioType;
        }

        public void setAudioType(String audioType) {
            putBodyParameter("audioType",audioType);
            this.audioType = audioType;
        }

        public String getBroadcastChannels() {
            return broadcastChannels;
        }

        public void setBroadcastChannels(String broadcastChannels) {
            putBodyParameter("broadcastChannels",broadcastChannels);
            this.broadcastChannels = broadcastChannels;
        }

        public String getSampleRate() {
            return sampleRate;
        }

        public void setSampleRate(String sampleRate) {
            putBodyParameter("sampleRate",sampleRate);
            this.sampleRate = sampleRate;
        }

        public String getTalkmode() {
            return talkmode;
        }

        public void setTalkmode(String talkmode) {
            putBodyParameter("talkmode",talkmode);
            this.talkmode = talkmode;
        }

        public String getChannelSeq() {
            return channelSeq;
        }

        public void setChannelSeq(String channelSeq) {
            putBodyParameter("channelSeq",channelSeq);
            this.channelSeq = channelSeq;
        }
    }
    public StartTalkRequest() throws ClientException {
        super(AdminConstant.START_TALK, Method.POST);
    }
    public StartTalkRequest(HttpConfigInfo httpConfigInfo, String url, Method method) throws ClientException {
        super(httpConfigInfo.getPrefixUrl() + url, method, Boolean.TRUE);
    }
    @Override
    public Class getResponseClass() {
        return StartTalkResponse.class;
    }

    public void businessValid() {
        if(data == null){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(),ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "data");
        }
        if(StringUtils.isEmpty(data.getDeviceCode())){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(),ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "deviceCode");
        }
        if(StringUtils.isEmpty(data.getTalkType())){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(),ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "talkType");
        }
        if(!"1".equals(data.getTalkType()) && !"2".equals(data.getTalkType()) && !"3".equals(data.getTalkType())){
            throw new BusinessException(ParamValidEnum.PARAM_SCOP_ERROR.getCode(),ParamValidEnum.PARAM_SCOP_ERROR.getErrMsg(), "talkType");
        }
        if(StringUtils.isEmpty(data.getAudioBit())){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(),ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "audioBit");
        }
        if(StringUtils.isEmpty(data.getAudioType())){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(),ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "audioType");
        }
        if(StringUtils.isEmpty(data.getSampleRate())){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(),ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "sampleRate");
        }
        if(StringUtils.isEmpty(data.getChannelSeq())){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(),ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "channelSeq");
        }
        if(!StringUtils.isEmpty(data.talkmode)){
            if(!"0".equals(data.getTalkmode()) && !"1".equals(data.getTalkmode())){
                throw new BusinessException(ParamValidEnum.PARAM_SCOP_ERROR.getCode(),ParamValidEnum.PARAM_SCOP_ERROR.getErrMsg(), "talkType");
            }
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy