package com.yccrc.kede.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yccrc.common.core.domain.BaseEntity;
import com.yccrc.common.utils.StringUtils;
import lombok.Data;

/**
 * @TableName enterprise_year_info
 */
@TableName(value = "enterprise_year_info")
@Data
public class EnterpriseYearInfo extends BaseEntity {
    /**
     *
     */
    @TableId
    private Integer id;

    /**
     * 关联企业ID
     */
    private Integer entId;

    /**
     * 企业名称
     */
    private String entName;

    /**
     * 年份
     */
    private String projectYear;

    /**
     * 通讯地址
     */
    private String address;

    /**
     * 联系人姓名
     */
    private String linkName;

    /**
     * 联系座机
     */
    private String linkPhone;

    /**
     * 联系人手机
     */
    private String linkMobile;

    /**
     * 职工总人数
     */
    private String totoalPersons;

    /**
     * 年度销售收入(万元)
     */
    private String sales;

    /**
     * 研发人数
     */
    private String techPersons;

    /**
     * 年度研发投入(万元)
     */
    private String techInvest;

    /**
     * 占销售收入比例
     */
    private String techRate;

    /**
     * 企业所属行业
     */
    private String industry;

    /**
     * 创新示范区企业
     */
    private Boolean innovateFlag;

    /**
     * 是否中小企业
     */
    private Boolean smallFlag;

    /**
     * 是否高新企业
     */
    private Boolean techFlag;

    /**
     * 高新企业所属技术领域(JSON数组)
     */
    private String techScope;

    /**
     * 高新证书有效期
     */
    private String techStartDate;

    /**
     * 高新证书有效期
     */
    private String techEndDate;

    /**
     * 高新证书
     */
    private String techLicense;

    // 总数
    @TableField(exist = false)
    private int total;

    public EnterpriseYearInfo(Integer entId, String entName, String projectYear, String address, String linkName, String linkPhone, String linkMobile) {
        this.entId = entId;
        this.entName = entName;
        this.projectYear = projectYear;
        this.address = address;
        this.linkName = linkName;
        this.linkPhone = linkPhone;
        this.linkMobile = linkMobile;
    }

    public EnterpriseYearInfo(Integer id, Integer entId, String entName, String projectYear, String address,
                              String linkName, String linkPhone, String linkMobile, String totoalPersons, String sales,
                              String techPersons, String techInvest, String techRate, String industry,
                              Boolean innovateFlag, Boolean smallFlag, Boolean techFlag, String techScope,
                              String techStartDate, String techEndDate, String techLicense) {
        this.id = id;
        this.entId = entId;
        this.entName = entName;
        this.projectYear = projectYear;
        this.address = address;
        this.linkName = linkName;
        this.linkPhone = linkPhone;
        this.linkMobile = linkMobile;
        this.totoalPersons = totoalPersons;
        this.sales = sales;
        this.techPersons = techPersons;
        this.techInvest = techInvest;
        this.techRate = techRate;
        this.industry = industry;
        this.innovateFlag = innovateFlag;
        this.smallFlag = smallFlag;
        this.techFlag = techFlag;
        this.techScope = techScope;
        this.techStartDate = techStartDate;
        this.techEndDate = techEndDate;
        this.techLicense = techLicense;
    }

    public EnterpriseYearInfo() {
    }

    public int getTotal() {
        int success = 0;
        if (StringUtils.isNotEmpty(getProjectYear())) {
            success++;
        }
        if (StringUtils.isNotEmpty(getSales())) {
            success++;
        }
        if (StringUtils.isNotEmpty(getTotoalPersons())) {
            success++;
        }
        if (StringUtils.isNotEmpty(getTechPersons())) {
            success++;
        }
        if (StringUtils.isNotEmpty(getTechInvest())) {
            success++;
        }
        if (StringUtils.isNotEmpty(getIndustry())) {
            success++;
        }
        if (getInnovateFlag() != null) {
            success++;
        }
        if (getSmallFlag() != null) {
            success++;
        }
        if (getTechFlag() != null) {
            success++;
        }
        return success;
    }
}