package com.ruoyi.app.domain;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

/**
 * 肉商对象 purchaser
 * 
 * @author coede
 * @date 2025-03-19
 */
public class Purchaser extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** ID */
    private Long id;

    /** 肉商编号 */
    @Excel(name = "肉商编号")
    private String purchaserNo;

    /** 肉商名称 */
    @Excel(name = "肉商名称")
    private String purchaserName;

    /** 身份证号 */
    @Excel(name = "身份证号")
    private String idNumber;

    /** 联系电话 */
    @Excel(name = "联系电话")
    private String phone;

    /** 经营场所 */
    @Excel(name = "经营场所")
    private String businessPlace;

    /** 销售去向：三选一：1-本县（市、区）、3-本省、5-外省，默认本县（市、区 */
    @Excel(name = "销售去向：三选一：1-本县", readConverterExp = "市=、区")
    private String salePlace;

    /** 所在省市区 */
    @Excel(name = "所在省市区")
    private String region;

    /** 删除标志：0-存在，2-删除 */
    private String delFlag;

    public void setId(Long id) 
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }

    public void setPurchaserNo(String purchaserNo)
    {
        this.purchaserNo = purchaserNo;
    }

    @NotBlank(message = "肉商编号不能为空")
    @Size(min = 1, max = 3, message = "肉商编号输入超出最大长度限制（30位）")
    public String getPurchaserNo()
    {
        return purchaserNo;
    }

    public void setPurchaserName(String purchaserName) 
    {
        this.purchaserName = purchaserName;
    }

    @NotBlank(message = "肉商名称不能为空")
    @Size(min = 1, max = 30, message = "肉商名称输入超出最大长度限制（30位）")
    public String getPurchaserName() 
    {
        return purchaserName;
    }

    public void setIdNumber(String idNumber) 
    {
        this.idNumber = idNumber;
    }

    @Length(min = 0, max = 18, message = "身份证号格式输入错误")
    @Pattern(regexp = "(^$|^[1-9]\\d{5}(18|19|20)\\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])\\d{3}[0-9Xx]$)",
            message = "身份证号格式输入错误")
    public String getIdNumber() 
    {
        return idNumber;
    }

    public void setPhone(String phone) 
    {
        this.phone = phone;
    }

//    @NotBlank(message = "联系电话不能为空")
//    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "联系电话格式输入错误")
    public String getPhone() 
    {
        return phone;
    }

    public void setBusinessPlace(String businessPlace) 
    {
        this.businessPlace = businessPlace;
    }

    @Size(min = 0, max = 50, message = "经营场所输入超出最大长度限制（50位）")
    public String getBusinessPlace() 
    {
        return businessPlace;
    }

    public void setSalePlace(String salePlace) 
    {
        this.salePlace = salePlace;
    }

    @NotBlank(message = "销售去向不能为空")
    public String getSalePlace() 
    {
        return salePlace;
    }

    public void setRegion(String region) 
    {
        this.region = region;
    }

    @NotBlank(message = "所在省市县不能为空")
    public String getRegion() 
    {
        return region;
    }

    public void setDelFlag(String delFlag) 
    {
        this.delFlag = delFlag;
    }

    public String getDelFlag() 
    {
        return delFlag;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("purchaserNo", getPurchaserNo())
            .append("purchaserName", getPurchaserName())
            .append("idNumber", getIdNumber())
            .append("phone", getPhone())
            .append("businessPlace", getBusinessPlace())
            .append("salePlace", getSalePlace())
            .append("region", getRegion())
            .append("remark", getRemark())
            .append("createTime", getCreateTime())
            .append("createBy", getCreateBy())
            .append("updateTime", getUpdateTime())
            .append("updateBy", getUpdateBy())
            .append("delFlag", getDelFlag())
            .toString();
    }
}
