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

com.dahuatech.icc.multiinone.visitor.vo.CommunityAppointmentRequest Maven / Gradle / Ivy

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

import com.dahuatech.icc.multiinone.exception.BusinessException;
import com.dahuatech.icc.multiinone.utils.StringUtils;
import com.dahuatech.icc.multiinone.vo.BaseRequest;

import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

public class CommunityAppointmentRequest extends BaseRequest {

    private String v_name;
    private String v_phone;
    private String v_dw;
    private String v_plateNumber;
    private String v_certificateType;
    private String v_certificateNumber;
    private String v_reason;
    private Integer v_personSum = 1;
    private String v_timeStr;
    private String v_lvTimeStr;
    private String isvCode;
    private List videoTokeChannels = new ArrayList();

    private List accessChannels = new ArrayList();

    private List parkingLotCodes = new ArrayList();

    private Integer times = 255;

    private String orgCode;

    private Integer isAuthIPMS = 1;
    private File v_capturePicFile;
    public String getV_name() {
        return v_name;
    }

    public void setV_name(String v_name) {
        this.v_name = v_name;
    }

    public String getV_phone() {
        return v_phone;
    }

    public void setV_phone(String v_phone) {
        this.v_phone = v_phone;
    }

    public String getV_dw() {
        return v_dw;
    }

    public void setV_dw(String v_dw) {
        this.v_dw = v_dw;
    }

    public String getV_plateNumber() {
        return v_plateNumber;
    }

    public void setV_plateNumber(String v_plateNumber) {
        this.v_plateNumber = v_plateNumber;
    }

    public String getV_certificateType() {
        return v_certificateType;
    }

    public void setV_certificateType(String v_certificateType) {
        this.v_certificateType = v_certificateType;
    }

    public String getV_certificateNumber() {
        return v_certificateNumber;
    }

    public void setV_certificateNumber(String v_certificateNumber) {
        this.v_certificateNumber = v_certificateNumber;
    }

    public String getV_reason() {
        return v_reason;
    }

    public void setV_reason(String v_reason) {
        this.v_reason = v_reason;
    }

    public Integer getV_personSum() {
        return v_personSum;
    }

    public void setV_personSum(Integer v_personSum) {
        this.v_personSum = v_personSum;
    }

    public String getV_timeStr() {
        return v_timeStr;
    }

    public void setV_timeStr(String v_timeStr) {
        this.v_timeStr = v_timeStr;
    }

    public String getV_lvTimeStr() {
        return v_lvTimeStr;
    }

    public void setV_lvTimeStr(String v_lvTimeStr) {
        this.v_lvTimeStr = v_lvTimeStr;
    }

    public String getIsvCode() {
        return isvCode;
    }

    public void setIsvCode(String isvCode) {
        this.isvCode = isvCode;
    }

    public List getVideoTokeChannels() {
        return videoTokeChannels;
    }

    public void setVideoTokeChannels(List videoTokeChannels) {
        this.videoTokeChannels = videoTokeChannels;
    }

    public List getAccessChannels() {
        return accessChannels;
    }

    public void setAccessChannels(List accessChannels) {
        this.accessChannels = accessChannels;
    }

    public List getParkingLotCodes() {
        return parkingLotCodes;
    }

    public void setParkingLotCodes(List parkingLotCodes) {
        this.parkingLotCodes = parkingLotCodes;
    }

    public Integer getTimes() {
        return times;
    }

    public void setTimes(Integer times) {
        this.times = times;
    }

    public String getOrgCode() {
        return orgCode;
    }

    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }

    public Integer getIsAuthIPMS() {
        return isAuthIPMS;
    }

    public void setIsAuthIPMS(Integer isAuthIPMS) {
        this.isAuthIPMS = isAuthIPMS;
    }

    public File getV_capturePicFile() {
        return v_capturePicFile;
    }

    public void setV_capturePicFile(File v_capturePicFile) {
        this.v_capturePicFile = v_capturePicFile;
    }

    public void businessValid() {
        if(StringUtils.isEmpty(v_name) || !v_name.matches("^[a-zA-Z0-9\\-_\\u4E00-\\u9FA5]{1,20}$")){
            throw new BusinessException("访客姓名非法");
        }
        if(StringUtils.isEmpty(v_phone) || !v_phone.matches("^(([0\\+][0-9]{2,3}-)?(0[0-9]{2,3})-)?(\\d{7,8})(-(\\d{3,}))?$|^1[3|4|5|7|8|9][0-9]{9}$")){
            throw new BusinessException("访客手机号非法");
        }
        if(StringUtils.isEmpty(v_certificateType)){
            throw new BusinessException("访客证件类型为空");
        }
        if(StringUtils.isEmpty(v_certificateNumber) || !v_certificateNumber.matches("^[a-zA-Z0-9]+$")){
            throw new BusinessException("访客证件号码非法");
        }
        if(!StringUtils.isEmpty(v_plateNumber) && (v_plateNumber.length() > 8 || v_plateNumber.length() < 7)){
            throw new BusinessException("访客车牌号非法");
        }
        if(StringUtils.isEmpty(v_reason)){
            throw new BusinessException("访客来访事由为空");
        }
        if(StringUtils.isEmpty(isvCode)){
            throw new BusinessException("被访人编号为空");
        }
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        dateFormat.setLenient(false);
        if(StringUtils.isEmpty(v_timeStr)){
            throw new BusinessException("预约来访时间为空");
        }
        if(StringUtils.isEmpty(v_lvTimeStr)){
            throw new BusinessException("预约离访时间为空");
        }
        try{
            dateFormat.parse(v_timeStr);
        }catch (Exception e){
            throw new BusinessException("预约来访时间格式非法");
        }
        try{
            dateFormat.parse(v_lvTimeStr);
        }catch (Exception e){
            throw new BusinessException("预约离访时间格式非法");
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy