com.dahuatech.icc.assesscontrol.model.v202103.firstCard.FirstCardAddRequest 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
The newest version!
package com.dahuatech.icc.assesscontrol.model.v202103.firstCard;
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;
import java.util.List;
/**
* 添加首卡
*
* @author 237417
*/
public class FirstCardAddRequest extends AbstractIccRequest {
/** 人员编码 */
private String personCode;
/** 通道编码 */
private String channelCode;
/** 开门计划 */
private String firstCardOpenTime;
/** 开门计划ID */
private List firstCardOpenTimeId;
/** 首卡状态 */
private String firstCardStatus;
/*--------以上必填-----*/
/** ID */
private String id;
public FirstCardAddRequest(Builder builder) throws ClientException {
super(AccessControlConstant.url(AccessControlConstant.ASSESS_CONTROL_URL_FIRST_CARD_ADD_POST), Method.POST);
this.personCode = builder.personCode;
this.channelCode = builder.channelCode;
this.firstCardOpenTime = builder.firstCardOpenTime;
this.firstCardOpenTimeId = builder.firstCardOpenTimeId;
this.firstCardStatus = builder.firstCardStatus;
putBodyParameter("personCode",personCode);
putBodyParameter("channelCode",channelCode);
putBodyParameter("firstCardOpenTime",firstCardOpenTime);
putBodyParameter("firstCardOpenTimeId",firstCardOpenTimeId);
putBodyParameter("firstCardStatus",firstCardStatus);
}
public FirstCardAddRequest(){
super(AccessControlConstant.url(AccessControlConstant.ASSESS_CONTROL_URL_FIRST_CARD_ADD_POST), Method.POST);
}
public static Builder builder() {
return new Builder();
}
@Override
public Class getResponseClass() {
return FirstCardAddResponse.class;
}
public String getPersonCode() {
return personCode;
}
public void setPersonCode(String personCode) {
this.personCode = personCode;
putBodyParameter("personCode",personCode);
}
public String getChannelCode() {
return channelCode;
}
public void setChannelCode(String channelCode) {
this.channelCode = channelCode;
putBodyParameter("channelCode",channelCode);
}
public String getFirstCardOpenTime() {
return firstCardOpenTime;
}
public void setFirstCardOpenTime(String firstCardOpenTime) {
this.firstCardOpenTime = firstCardOpenTime;
putBodyParameter("firstCardOpenTime",firstCardOpenTime);
}
public List getFirstCardOpenTimeId() {
return firstCardOpenTimeId;
}
public void setFirstCardOpenTimeId(List firstCardOpenTimeId) {
this.firstCardOpenTimeId = firstCardOpenTimeId;
putBodyParameter("firstCardOpenTimeId",firstCardOpenTimeId);
}
public String getFirstCardStatus() {
return firstCardStatus;
}
public void setFirstCardStatus(String firstCardStatus) {
this.firstCardStatus = firstCardStatus;
putBodyParameter("firstCardStatus",firstCardStatus);
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
putBodyParameter("id",id);
}
public static class Builder {
/** 人员编码 */
private String personCode;
/** 通道编码 */
private String channelCode;
/** 开门计划 */
private String firstCardOpenTime;
/** 开门计划ID */
private List firstCardOpenTimeId;
/** 首卡状态 */
private String firstCardStatus;
public Builder personCode(String personCode) {
this.personCode = personCode;
return this;
}
public Builder channelCode(String channelCode) {
this.channelCode = channelCode;
return this;
}
public Builder firstCardOpenTime(String firstCardOpenTime) {
this.firstCardOpenTime = firstCardOpenTime;
return this;
}
public Builder firstCardOpenTimeId(List firstCardOpenTimeId) {
this.firstCardOpenTimeId = firstCardOpenTimeId;
return this;
}
public Builder firstCardStatus(String firstCardStatus) {
this.firstCardStatus = firstCardStatus;
return this;
}
public FirstCardAddRequest build() throws ClientException {
return new FirstCardAddRequest(this);
}
}
public void businessValid() {
if(StringUtils.isEmpty(personCode)){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "personCode");
}
if(StringUtils.isEmpty(channelCode)){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "channelCode");
}
if(StringUtils.isEmpty(firstCardOpenTime)){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "firstCardOpenTime");
}
if(CollectionUtil.isEmpty(firstCardOpenTimeId)){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "firstCardOpenTimeId");
}
if(StringUtils.isEmpty(firstCardStatus)){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "firstCardStatus");
}
}
}