com.dahuatech.icc.cirs.model.v202209.device.ConfigDeviceRequest Maven / Gradle / Ivy
package com.dahuatech.icc.cirs.model.v202209.device;
import com.dahuatech.hutool.http.Method;
import com.dahuatech.icc.cirs.constant.CirsConstant;
import com.dahuatech.icc.cirs.enums.ConfigTypeEnums;
import com.dahuatech.icc.common.ParamValidEnum;
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-09-07 15:57
* @Description:
*/
public class ConfigDeviceRequest extends AbstractIccRequest {
private Integer configType;
private Long id;
private String configValue;
public Integer getConfigType() {
return configType;
}
public void setConfigType(Integer configType) {
putBodyParameter("configType",configType);
this.configType = configType;
}
public Long getId() {
return id;
}
public void setId(Long id) {
putBodyParameter("id",id);
this.id = id;
}
public String getConfigValue() {
return configValue;
}
public void setConfigValue(String configValue) {
putBodyParameter("configValue",configValue);
this.configValue = configValue;
}
public ConfigDeviceRequest() throws ClientException {
super(CirsConstant.url(CirsConstant.CONFIG_DEVICE), Method.POST);
}
public ConfigDeviceRequest(HttpConfigInfo httpConfigInfo, String url, Method method) throws ClientException {
super(httpConfigInfo.getPrefixUrl() + url, method, Boolean.TRUE);
}
@Override
public Class getResponseClass() {
return ConfigDeviceResponse.class;
}
public void businessValid() {
if(!ConfigTypeEnums.isRight(configType)){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "configType");
}
if(id==null){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "id");
}
if(StringUtils.isEmpty(configValue)){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "configValue");
}
}
}