com.dahuatech.icc.brm.model.v202010.department.BrmDeptAddRequest 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.department;
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/5 11:27
*/
public class BrmDeptAddRequest extends AbstractIccRequest {
private Long parentId;
private String name;
private String memo;
private String service;
private DeptOperateLock depOperateLock;
private BrmDeptAddRequest(Builder builder) {
super(BrmConstant.url(BrmConstant.BRM_URL_DEPT_ADD_POST), Method.POST);
this.parentId = builder.parentId;
this.name = builder.name;
putBodyParameter("parentId", parentId);
putBodyParameter("name", name);
}
public BrmDeptAddRequest(){
super(BrmConstant.url(BrmConstant.BRM_URL_DEPT_ADD_POST), Method.POST);
}
public static Builder builder() {
return new Builder();
}
@Override
public Class getResponseClass() {
return BrmDeptAddResponse.class;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
putBodyParameter("parentId", parentId);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
putBodyParameter("name", name);
}
public String getMemo() {
return memo;
}
public void setMemo(String memo) {
this.memo = memo;
putBodyParameter("memo", memo);
}
public String getService() {
return service;
}
public void setService(String service) {
this.service = service;
putBodyParameter("service", service);
}
public DeptOperateLock getDepOperateLock() {
return depOperateLock;
}
public void setDepOperateLock(DeptOperateLock depOperateLock) {
this.depOperateLock = depOperateLock;
putBodyParameter("depOperateLock", depOperateLock);
}
public static class Builder {
private Long parentId;
private String name;
public Builder parentId(Long parentId) {
this.parentId = parentId;
return this;
}
public Builder name(String name) {
this.name = name;
return this;
}
public BrmDeptAddRequest build() throws ClientException {
return new BrmDeptAddRequest(this);
}
}
public void businessValid() {
if(parentId == null){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(),ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "parentId");
}
if(name == null){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(),ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "name");
}
}
}