com.dahuatech.icc.assesscontrol.model.v202103.doorPlan.TimeQuantumAddRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-sdk-accesscontrol Show documentation
Show all versions of java-sdk-accesscontrol Show documentation
Dahua ICC Open API SDK for Java
package com.dahuatech.icc.assesscontrol.model.v202103.doorPlan;
import com.dahuatech.hutool.http.Method;
import com.dahuatech.icc.assesscontrol.constant.AccessControlConstant;
import com.dahuatech.icc.assesscontrol.constant.ParamConstant;
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.util.CollectionUtil;
import com.dahuatech.icc.util.StringUtils;
/**
* 添加开门计划
*
* @author 237417
*/
public class TimeQuantumAddRequest extends AbstractIccRequest {
/** 开门计划细节(monday-sunday代表周一到周日,每天可以配置四个时间段,前后时间段不能重叠) */
private String detail;
/** 描述 */
private String memo;
/** 开门计划 */
private String name;
/** 计划类型:1-普通时段。目前只支持普通时段 */
private Integer type;
/*--------以上必填-----*/
public TimeQuantumAddRequest(Builder builder) {
super(AccessControlConstant.url(AccessControlConstant.ASSESS_CONTROL_URL_TIME_QUANTUM_ADD_POST), Method.POST);
this.detail = builder.detail;
this.memo = builder.memo;
this.name = builder.name;
this.type = builder.type;
putBodyParameter("detail",detail);
putBodyParameter("memo",memo);
putBodyParameter("name",name);
putBodyParameter("type",type);
}
public TimeQuantumAddRequest(){
super(AccessControlConstant.url(AccessControlConstant.ASSESS_CONTROL_URL_TIME_QUANTUM_ADD_POST), Method.POST);
}
public static Builder builder() {
return new Builder();
}
@Override
public Class getResponseClass() {
return TimeQuantumAddResponse.class;
}
public String getDetail() {
return detail;
}
public void setDetail(String detail) {
this.detail = detail;
putBodyParameter("detail",detail);
}
public String getMemo() {
return memo;
}
public void setMemo(String memo) {
this.memo = memo;
putBodyParameter("memo",memo);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
putBodyParameter("name",name);
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
putBodyParameter("type",type);
}
public static class Builder {
/** 开门计划细节(monday-sunday代表周一到周日,每天可以配置四个时间段,前后时间段不能重叠) */
private String detail;
/** 描述 */
private String memo;
/** 开门计划 */
private String name;
/** 计划类型:1-普通时段。目前只支持普通时段 */
private Integer type;
public Builder detail(String detail) {
this.detail = detail;
return this;
}
public Builder memo(String memo) {
this.memo = memo;
return this;
}
public Builder name(String name) {
this.name = name;
return this;
}
public Builder type(Integer type) {
this.type = type;
return this;
}
public TimeQuantumAddRequest build() throws ClientException {
return new TimeQuantumAddRequest(this);
}
}
public void businessValid() {
if(StringUtils.isEmpty(detail)){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "detail");
}
if(StringUtils.isEmpty(memo)){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "memo");
}
if(StringUtils.isEmpty(name)){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "name");
}
if(type == null){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "type");
}
}
}