package com.bidizhaobiao.data.bigdata.persistence.orgproject.entity;

import org.neo4j.ogm.annotation.GeneratedValue;
import org.neo4j.ogm.annotation.Id;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Property;

@NodeEntity(label = "Organization")
public class Organization {

    @Id
    @GeneratedValue
    private Long nodeId;
    @Property(name = "name")
    private String name;

    /**
     * 此企业的别名集合（多个使用逗号分隔）
     */
    @Property(name = "nicknames")
    private String nicknames;
    @Property(name = "area")
    private String area;
    @Property(name = "province")
    private String province;
    @Property(name = "city")
    private String city;
    @Property(name = "district")
    private String district;
    // 此属性用于解决bug 将一些数据重新跑入其他库的时候使用 用完就可以删除对应的属性
    @Property(name = "status")
    private String status;

    /**
     * 旗下招标相同的项目的合并状态(1 已经合并、-1 合并中、0或者空 待合并,用于旧数据的处理，处理好了此属性可以删掉)
     */
    private Integer mergeStatus;

    /**
     * 这个属性用于旧数据的升级(null和0：待升级、-1：升级中、1：已升级)
     */
    private Integer upgradeStatus;

    private Integer bidNumber;           // 总的招投标数量 = 招标数量 + 代理数量 + 中标数量 + 投标数量
    private Integer zhaoBiaoNumber;     // 招标数量
    private Integer daiLiNumber;        // 代理数量
    private Integer zhongBiaoNumber;    // 中标数量
    private Integer touBiaoNumber;      // 投标数量

    /**
     * 比地id(即：企业在我们这边的一个唯一标识)
     */
    private Long bidiId;

    /**
     * 注册资金
     */
    private String regCapital;

    /**
     * 注册时间
     */
    private String estiblishTime;


    public Organization() {
    }

    public Organization(String name) {
        this.name = name;
    }

    public Long getNodeId() {
        return nodeId;
    }

    public void setNodeId(Long nodeId) {
        this.nodeId = nodeId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getDistrict() {
        return district;
    }

    public void setDistrict(String district) {
        this.district = district;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getNicknames() {
        return nicknames;
    }

    public void setNicknames(String nicknames) {
        this.nicknames = nicknames;
    }

    public Integer getMergeStatus() {
        return mergeStatus == null ? 0 : mergeStatus;
    }

    public void setMergeStatus(Integer mergeStatus) {
        this.mergeStatus = mergeStatus;
    }

    public Integer getUpgradeStatus() {
        return upgradeStatus;
    }

    public void setUpgradeStatus(Integer upgradeStatus) {
        this.upgradeStatus = upgradeStatus;
    }

    public Integer getBidNumber() {
        return bidNumber;
    }

    public void setBidNumber(Integer bidNumber) {
        this.bidNumber = bidNumber;
    }

    public Integer getZhaoBiaoNumber() {
        return zhaoBiaoNumber;
    }

    public void setZhaoBiaoNumber(Integer zhaoBiaoNumber) {
        this.zhaoBiaoNumber = zhaoBiaoNumber;
    }

    public Integer getDaiLiNumber() {
        return daiLiNumber;
    }

    public void setDaiLiNumber(Integer daiLiNumber) {
        this.daiLiNumber = daiLiNumber;
    }

    public Integer getZhongBiaoNumber() {
        return zhongBiaoNumber;
    }

    public void setZhongBiaoNumber(Integer zhongBiaoNumber) {
        this.zhongBiaoNumber = zhongBiaoNumber;
    }

    public Integer getTouBiaoNumber() {
        return touBiaoNumber;
    }

    public void setTouBiaoNumber(Integer touBiaoNumber) {
        this.touBiaoNumber = touBiaoNumber;
    }

    public Long getBidiId() {
        return bidiId;
    }

    public void setBidiId(Long bidiId) {
        this.bidiId = bidiId;
    }

    public String getRegCapital() {
        return regCapital;
    }

    public void setRegCapital(String regCapital) {
        this.regCapital = regCapital;
    }

    public String getEstiblishTime() {
        return estiblishTime;
    }

    public void setEstiblishTime(String estiblishTime) {
        this.estiblishTime = estiblishTime;
    }

    /**
     * 计算 总的招投标数
     */
    public void calculateBidNumber() {
        zhaoBiaoNumber = zhaoBiaoNumber == null ? 0 : zhaoBiaoNumber;
        daiLiNumber = daiLiNumber == null ? 0 : daiLiNumber;
        zhongBiaoNumber = zhongBiaoNumber == null ? 0 : zhongBiaoNumber;
        touBiaoNumber = touBiaoNumber == null ? 0 : touBiaoNumber;

        bidNumber = zhaoBiaoNumber + daiLiNumber + zhongBiaoNumber + touBiaoNumber;
    }

}
