com.dahuatech.icc.cirs.model.v202209.group.InsertGroupRequest Maven / Gradle / Ivy
package com.dahuatech.icc.cirs.model.v202209.group;
import com.dahuatech.hutool.http.Method;
import com.dahuatech.icc.cirs.constant.CirsConstant;
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.oauth.model.v202010.HttpConfigInfo;
import com.dahuatech.icc.util.StringUtils;
/**
* program:java-sdk
*
* @Author: 355079
* @Date:2022-09-05 11:13
* @Description: 新增分组
*/
public class InsertGroupRequest extends AbstractIccRequest {
private String deptCode;
private String groupName;
private Integer type;
public String getDeptCode() {
return deptCode;
}
public void setDeptCode(String deptCode) {
putBodyParameter("deptCode",deptCode);
this.deptCode = deptCode;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
putBodyParameter("groupName",groupName);
this.groupName = groupName;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
putBodyParameter("type",type);
this.type = type;
}
public InsertGroupRequest() throws ClientException {
super(CirsConstant.url(CirsConstant.Insert_GROUP), Method.POST);
}
public InsertGroupRequest(HttpConfigInfo httpConfigInfo, String url, Method method) throws ClientException {
super(httpConfigInfo.getPrefixUrl() + url, method, Boolean.TRUE);
}
@Override
public Class getResponseClass() {
return InsertGroupResponse.class;
}
public void businessValid() {
if (StringUtils.isEmpty(groupName)) {
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "groupName");
}
if(type==null){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "type");
}
if(type<0||type>6){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_SCOP_ERROR.getErrMsg(), "type");
}
}
}