com.dahuatech.icc.cirs.model.v202209.device.OperateDeviceRequest 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.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;
import java.util.List;
/**
* program:java-sdk
*
* @Author: 355079
* @Date:2022-09-07 13:44
* @Description: 下发操作设备指令
*/
public class OperateDeviceRequest extends AbstractIccRequest {
private String action;
private List deviceIds;
public String getAction() {
return action;
}
public void setAction(String action) {
putBodyParameter("action",action);
this.action = action;
}
public List getDeviceIds() {
return deviceIds;
}
public void setDeviceIds(List deviceIds) {
putBodyParameter("deviceIds",deviceIds);
this.deviceIds = deviceIds;
}
public OperateDeviceRequest() throws ClientException {
super(CirsConstant.url(CirsConstant.OPERATE_DEVICE), Method.POST);
}
public OperateDeviceRequest(HttpConfigInfo httpConfigInfo, String url, Method method) throws ClientException {
super(httpConfigInfo.getPrefixUrl() + url, method, Boolean.TRUE);
}
@Override
public Class getResponseClass() {
return OperateDeviceResponse.class;
}
public void businessValid() {
if(StringUtils.isEmpty(action)){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "action");
}
if(deviceIds==null||deviceIds.size()==0){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "deviceIds");
}
}
}