All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dahuatech.icc.brm.model.v202010.organization.BrmOrganizationSyncRequest Maven / Gradle / Ivy

The newest version!
package com.dahuatech.icc.brm.model.v202010.organization;

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;

/**
 * 组织全量同步,必填字段使用Builder
 *
 * @author 232676
 * @since 1.0.0 2020/11/3 11:22
 */
public class BrmOrganizationSyncRequest extends AbstractIccRequest {

  private Long maxRangeId;
  private String orgPreCode;
  private int pageSize;
  private int pageNum;

  private BrmOrganizationSyncRequest(Builder builder) {
    super(BrmConstant.url(BrmConstant.BRM_URL_ORGAN_PAGE_GET), Method.GET);
    this.maxRangeId = builder.maxRangeId;
    form("maxRangeId", maxRangeId);
  }

  public BrmOrganizationSyncRequest(){
      super(BrmConstant.url(BrmConstant.BRM_URL_ORGAN_PAGE_GET), Method.GET);
  }

  public static Builder builder() {
    return new Builder();
  }

  @Override
  public Class getResponseClass() {
    return BrmOrganizationSyncResponse.class;
  }

  public Long getMaxRangeId() {
    return maxRangeId;
  }

  public void setMaxRangeId(Long maxRangeId) {
    this.maxRangeId = maxRangeId;
    form("maxRangeId", maxRangeId);
  }

  public String getOrgPreCode() {
    return orgPreCode;
  }

  public void setOrgPreCode(String orgPreCode) {
    this.orgPreCode = orgPreCode;
    form("orgPreCode", orgPreCode);
  }

  public int getPageSize() {
    return pageSize;
  }

  public void setPageSize(int pageSize) {
    this.pageSize = pageSize;
    form("pageSize", pageSize);
  }

  public int getPageNum() {
    return pageNum;
  }

  public void setPageNum(int pageNum) {
    this.pageNum = pageNum;
    form("pageNum", pageNum);
  }

  public static class Builder {
    private Long maxRangeId;

    public Builder maxRangeId(Long maxRangeId) {
      this.maxRangeId = maxRangeId;
      return this;
    }

    public BrmOrganizationSyncRequest build() throws ClientException {
      return new BrmOrganizationSyncRequest(this);
    }
  }
    public void businessValid() {
      if(maxRangeId == null){
          throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(),ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "maxRangeId");
      }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy