com.dahuatech.icc.brm.model.v202010.card.BrmCardSyncRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-sdk-brm Show documentation
Show all versions of java-sdk-brm Show documentation
Dahua ICC Open API SDK for Java
package com.dahuatech.icc.brm.model.v202010.card;
import com.dahuatech.hutool.http.ContentType;
import com.dahuatech.hutool.http.Method;
import com.dahuatech.icc.brm.constant.BrmConstant;
import com.dahuatech.icc.brm.constant.ParamConstant;
import com.dahuatech.icc.brm.exception.BusinessException;
import com.dahuatech.icc.common.ParamValidEnum;
import com.dahuatech.icc.exception.ClientException;
import com.dahuatech.icc.oauth.http.AbstractIccRequest;
import com.dahuatech.icc.util.CollectionUtil;
/**
* 卡片全量数据同步
*
* @author 232676
* @since 1.0.0 2020/11/12 19:27
*/
public class BrmCardSyncRequest extends AbstractIccRequest {
private Integer pageNum;
private Integer pageSize;
private String searchKey;
public BrmCardSyncRequest() {
super(BrmConstant.url(BrmConstant.BRM_URL_CARD_SYNC_POST), Method.POST);
// 可能参数为空,hutool使用默认application/x-www-form-urlencoded
httpRequest.contentType(ContentType.JSON.toString());
// 设置个空置,防止Required request body is missing
putBodyParameter("searchKey", "");
}
public int getPageNum() {
return pageNum;
}
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
putBodyParameter("pageNum", pageNum);
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
putBodyParameter("pageSize", pageSize);
}
public String getSearchKey() {
return searchKey;
}
public void setSearchKey(String searchKey) {
this.searchKey = searchKey;
putBodyParameter("searchKey", searchKey);
}
@Override
public Class getResponseClass() {
return BrmCardSyncResponse.class;
}
public void businessValid() {
if(pageNum == null){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(),ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "pageNum");
}
if(pageSize == null){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(),ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "pageSize");
}
}
}