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

com.dahuatech.icc.oauth.model.v202010.OauthPwdChangeRequest Maven / Gradle / Ivy

The newest version!
package com.dahuatech.icc.oauth.model.v202010;

import com.dahuatech.hutool.http.Method;
import com.dahuatech.icc.common.ParamValidEnum;
import com.dahuatech.icc.exception.ClientException;
import com.dahuatech.icc.oauth.constant.OauthConstant;
import com.dahuatech.icc.oauth.exception.BusinessException;
import com.dahuatech.icc.oauth.http.AbstractIccRequest;
import com.dahuatech.icc.oauth.model.v202010.oSDK.OauthParamConstant;
import com.dahuatech.icc.util.StringUtils;

/**
 * 密码修改
 *
 * @author 232676
 * @since 1.0.0 2020-10-24 20:59:11
 */
public class OauthPwdChangeRequest extends AbstractIccRequest {
  /** 登录用户名 */
  private String loginName;
  /** + 新密码(需RSA加密) */
  private String loginPass;
  /** 旧密码(需RSA加密) */
  private String oldLoginPass;
  /** 公钥 */
  private String public_key;

  public OauthPwdChangeRequest() {
    super(OauthConstant.url(OauthConstant.OAUTH_URL_PWD_CHANGE_POST), Method.POST, Boolean.TRUE);
  }

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

  public String getLoginName() {
    return loginName;
  }

  public void setLoginName(String loginName) {
    this.loginName = loginName;
    putBodyParameter("loginName", loginName);
  }

  public String getLoginPass() {
    return loginPass;
  }

  public void setLoginPass(String loginPass) {
    this.loginPass = loginPass;
    putBodyParameter("loginPass", loginPass);
  }

  public String getOldLoginPass() {
    return oldLoginPass;
  }

  public void setOldLoginPass(String oldLoginPass) {
    this.oldLoginPass = oldLoginPass;
    putBodyParameter("oldLoginPass", oldLoginPass);
  }

  public String getPublic_key() {
    return public_key;
  }

  public void setPublic_key(String public_key) {
    this.public_key = public_key;
    putBodyParameter("public_key", public_key);
  }

    public void businessValid() {
        if(StringUtils.isEmpty(loginName)){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "loginName");
        }
        if(StringUtils.isEmpty(loginPass)){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "loginPass");
        }
        if(StringUtils.isEmpty(oldLoginPass)){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "oldLoginPass");
        }
        if(StringUtils.isEmpty(public_key)){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "public_key");
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy