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

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

There is a newer version: 1.0.13.7
Show 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 ChannelControlNormalRequest extends AbstractIccRequest {

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

    public ChannelControlNormalRequest(Builder builder) {
        super(AccessControlConstant.url(AccessControlConstant.ASSESS_CONTROL_URL_STAY_OPEN_POST), Method.POST);
        this.channelCodeList = builder.channelCodeList;
        putBodyParameter("channelCodeList",channelCodeList);
    }

    public ChannelControlNormalRequest(){
        super(AccessControlConstant.url(AccessControlConstant.ASSESS_CONTROL_URL_STAY_OPEN_POST), Method.POST);
    }

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

    @Override
    public Class getResponseClass() {
        return ChannelControlNormalResponse.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 ChannelControlNormalRequest build() throws ClientException {
            return new ChannelControlNormalRequest(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