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

com.dahuatech.icc.brm.model.v202010.car.BrmCarDelRequest Maven / Gradle / Ivy

There is a newer version: 1.0.13.7
Show newest version
package com.dahuatech.icc.brm.model.v202010.car;

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;
import com.dahuatech.icc.util.CollectionUtil;
import com.dahuatech.icc.util.StringUtils;

import java.util.List;

/**
 * 车辆删除(可批量)
 *
 * @author 232676
 * @since 1.0.0 2020/11/6 10:00
 */
public class BrmCarDelRequest extends AbstractIccRequest {

  /** 车牌号数组 */
  private List carNumList;
  /** 车辆编号数组 */
  private List carCodeList;
  /** 子系统服务名 */
  private String service;

  private BrmCarDelRequest(Builder builder) {
    super(BrmConstant.url(BrmConstant.BRM_URL_CAR_DELETE_POST), Method.POST);
    this.carNumList = builder.carNumList;
    this.carCodeList = builder.carCodeList;
    putBodyParameter("carCodeList", carCodeList);
    putBodyParameter("carNumList", carNumList);
  }

    public BrmCarDelRequest(){
        super(BrmConstant.url(BrmConstant.BRM_URL_CAR_DELETE_POST), Method.POST);
    }

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

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

  public List getCarNumList() {
    return carNumList;
  }

  public void setCarNumList(List carNumList) {
    this.carNumList = carNumList;
    putBodyParameter("carNumList", carNumList);
  }

  public List getCarCodeList() {
    return carCodeList;
  }

  public void setCarCodeList(List carCodeList) {
    this.carCodeList = carCodeList;
    putBodyParameter("carCodeList", carCodeList);
  }

  public String getService() {
    return service;
  }

  public void setService(String service) {
    this.service = service;
    putBodyParameter("service", service);
  }

  public static class Builder {
    /** 车牌号数组 */
    private List carNumList;
    /** 车辆编号数组 */
    private List carCodeList;

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy