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

com.dahuatech.icc.assesscontrol.model.v202103.channelControl.ChannelControlOpenDoorRequest Maven / Gradle / Ivy

The newest version!
package com.dahuatech.icc.assesscontrol.model.v202103.channelControl;

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 java.util.List;

/**
 * 门通道控制开门
 *
 * @author 237417
 */
public class ChannelControlOpenDoorRequest extends AbstractIccRequest {

    /** 门通道编码 */
    private List channelCodeList;

    public ChannelControlOpenDoorRequest(Builder builder) throws ClientException {
        super(AccessControlConstant.url(AccessControlConstant.ASSESS_CONTROL_URL_OPEN_DOOR_POST), Method.POST);
        this.channelCodeList = builder.channelCodeList;
        putBodyParameter("channelCodeList",channelCodeList);
    }

    public ChannelControlOpenDoorRequest(){
        super(AccessControlConstant.url(AccessControlConstant.ASSESS_CONTROL_URL_OPEN_DOOR_POST), Method.POST);
    }

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

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

    public List getChannelCodeList() {
        return channelCodeList;
    }

    public void setChannelCodeList(List channelCodeList) {
        this.channelCodeList = channelCodeList;
        putBodyParameter("channelCodeList",channelCodeList);
    }

    public static class Builder {
        /** 门通道编码 */
        private List channelCodeList;

        public Builder channelCodeList(List channelCodeList) {
            this.channelCodeList = channelCodeList;
            return this;
        }

        public ChannelControlOpenDoorRequest build() throws ClientException {
            return new ChannelControlOpenDoorRequest(this);
        }
    }

    public void businessValid() {
        if(CollectionUtil.isEmpty(channelCodeList)){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "channelCodeList");
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy