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

com.dahuatech.icc.multiinone.accesscontrol.vo.AccessAuthByPersonRequest Maven / Gradle / Ivy

The newest version!
package com.dahuatech.icc.multiinone.accesscontrol.vo;

import com.dahuatech.icc.assesscontrol.enums.PrivilegeTypeEnum;
import com.dahuatech.icc.multiinone.accesscontrol.domain.CardPrivilege;
import com.dahuatech.icc.multiinone.exception.BusinessException;
import com.dahuatech.icc.multiinone.utils.CollectionsUtils;
import com.dahuatech.icc.multiinone.utils.StringUtils;
import com.dahuatech.icc.multiinone.vo.BaseRequest;

import java.util.List;

public class AccessAuthByPersonRequest extends BaseRequest {
    /**人员id*/
    private Long personId;
    /**人员编码*/
    private String personCode;
    /**卡号*/
    private String cardNumber;
    /**开门计划id*/
    private Long timeQuantumId = 1l;
    /**权限细节详情*/
    private List cardPrivilegeDetails;

    public Long getPersonId() {
        return personId;
    }

    public void setPersonId(Long personId) {
        this.personId = personId;
    }

    public String getPersonCode() {
        return personCode;
    }

    public void setPersonCode(String personCode) {
        this.personCode = personCode;
    }

    public String getCardNumber() {
        return cardNumber;
    }

    public void setCardNumber(String cardNumber) {
        this.cardNumber = cardNumber;
    }

    public Long getTimeQuantumId() {
        return timeQuantumId;
    }

    public void setTimeQuantumId(Long timeQuantumId) {
        this.timeQuantumId = timeQuantumId;
    }

    public List getCardPrivilegeDetails() {
        return cardPrivilegeDetails;
    }

    public void setCardPrivilegeDetails(List cardPrivilegeDetails) {
        this.cardPrivilegeDetails = cardPrivilegeDetails;
    }

    public void businessValid() {
        if(StringUtils.isEmpty(cardNumber) && StringUtils.isEmpty(personCode) && personId == null){
            throw new BusinessException("卡片|人员编码|人员id为空");
        }
        if(CollectionsUtils.isEmpty(cardPrivilegeDetails)){
            throw new BusinessException("授权细节为空");
        }
        for(CardPrivilege cardPrivilege : cardPrivilegeDetails){
            if(cardPrivilege.getPrivilegeType() == null || !PrivilegeTypeEnum.isRight(cardPrivilege.getPrivilegeType())){
                throw new BusinessException("授权类型非法");
            }
            if(StringUtils.isEmpty(cardPrivilege.getResouceCode())){
                throw new BusinessException("授权设备为空");
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy