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

com.dahuatech.icc.electricity.model.v202208.device.DeviceInfoRequest Maven / Gradle / Ivy

There is a newer version: 1.0.13.10
Show newest version
package com.dahuatech.icc.electricity.model.v202208.device;

import com.dahuatech.hutool.http.Method;
import com.dahuatech.icc.common.ParamValidEnum;
import com.dahuatech.icc.electricity.constant.ElectricityConstant;
import com.dahuatech.icc.exception.ClientException;
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: 355079
 * @Date:2022-08-22 10:19
 * @Description: 获取设备能力
 */
public class DeviceInfoRequest extends AbstractIccRequest {
    private String address;
    private Integer port;
    private String deviceNo;
    private String deviceManufacturer;
    private String deviceClass;
    private String deviceCode;
    private String protocolType;
    private String type;
    private String password;
    private String userName;

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        putBodyParameter("address",address);
        this.address = address;
    }

    public Integer getPort() {
        return port;
    }

    public void setPort(Integer port) {
        putBodyParameter("port",port);
        this.port = port;
    }

    public String getDeviceNo() {
        return deviceNo;
    }

    public void setDeviceNo(String deviceNo) {
        putBodyParameter("deviceNo",deviceNo);
        this.deviceNo = deviceNo;
    }

    public String getDeviceManufacturer() {
        return deviceManufacturer;
    }

    public void setDeviceManufacturer(String deviceManufacturer) {
        putBodyParameter("deviceManufacturer",deviceManufacturer);
        this.deviceManufacturer = deviceManufacturer;
    }

    public String getDeviceClass() {
        return deviceClass;
    }

    public void setDeviceClass(String deviceClass) {
        putBodyParameter("deviceClass",deviceClass);
        this.deviceClass = deviceClass;
    }

    public String getDeviceCode() {
        return deviceCode;
    }

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

    public String getProtocolType() {
        return protocolType;
    }

    public void setProtocolType(String protocolType) {
        putBodyParameter("protocolType",protocolType);
        this.protocolType = protocolType;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        putBodyParameter("type",type);
        this.type = type;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        putBodyParameter("password",password);
        this.password = password;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        putBodyParameter("userName",userName);
        this.userName = userName;
    }

    public DeviceInfoRequest() throws ClientException {
        super(ElectricityConstant.url(ElectricityConstant.DEVICE_INFO), Method.POST);
    }

    public DeviceInfoRequest(HttpConfigInfo httpConfigInfo, String url, Method method) throws ClientException {
        super(httpConfigInfo.getPrefixUrl() + url, method, Boolean.TRUE);
    }

    @Override
    public Class getResponseClass() {
        return DeviceInfoResponse.class;
    }

    public void businessValid() {
        if (StringUtils.isEmpty(deviceManufacturer)) {
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "deviceManufacturer");
        }
        if (StringUtils.isEmpty(deviceClass)) {
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "deviceClass");
        }
        if (StringUtils.isEmpty(deviceCode)) {
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "deviceCode");
        }
        if (StringUtils.isEmpty(protocolType)) {
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "protocolType");
        }
        if (StringUtils.isEmpty(type)) {
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "type");
        }
        if (StringUtils.isEmpty(userName)) {
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "userName");
        }
        if (StringUtils.isEmpty(password)) {
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "password");
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy