package cn.gtmap.estateplat.config.model;

import cn.gtmap.estateplat.config.utils.ArdExcelUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;

import java.util.Date;

/**
 * @author <a href="mailto:yulei1@gtmap.cn">yulei</a>
 * @version 1.0, 2017/9/7
 * @description
 */
public class ArdBdcTdcbnydsyq implements ArdInfo {

    /**
     * @author <a href="mailto:yulei1@gtmap.cn">yulei</a>
     * @description 业务号
     */
    private String ywh;

    /**
     * @author <a href="mailto:yulei1@gtmap.cn">yulei</a>
     * @description 登记时间
     */
    private Date djsj;

    /**
     * @author <a href="mailto:yulei1@gtmap.cn">yulei</a>
     * @description 登簿人
     */
    private String dbr;

    /**
     * @author <a href="mailto:yulei1@gtmap.cn">yulei</a>
     * @description 权利起始时间
     */
    private Date qlqssj;

    /**
     * @author <a href="mailto:yulei1@gtmap.cn">yulei</a>
     * @description 权利结束时间
     */
    private Date qljssj;

    /**
     * @author <a href="mailto:yulei1@gtmap.cn">yulei</a>
     * @description 使用开始期限
     */
    private Date syksqx;

    /**
     * @author <a href="mailto:yulei1@gtmap.cn">yulei</a>
     * @description 使用结束期限
     */
    private Date syjsqx;

    /**
     * @author <a href="mailto:yulei1@gtmap.cn">yulei</a>
     * @description 水域滩涂类型
     */
    private String syttlx;

    /**
     * @author <a href="mailto:yulei1@gtmap.cn">yulei</a>
     * @description 养殖业方式
     */
    private String yzyfs;

    /**
     * @author <a href="mailto:yulei1@gtmap.cn">yulei</a>
     * @description 草原质量
     */
    private String cyzl;

    /**
     * @author <a href="mailto:yulei1@gtmap.cn">yulei</a>
     * @description 适宜载畜量
     */
    private Integer syzcl;

    /**
     * @author <a href="mailto:yulei1@gtmap.cn">yulei</a>
     * @description 土地所有权性质
     */
    private String tdsyqxz;

    /**
     * @author <a href="mailto:yulei1@gtmap.cn">yulei</a>
     * @description 发包方名称
     */
    private String fbfmc;

    /**
     * @author <a href="mailto:yulei1@gtmap.cn">yulei</a>
     * @description 取得承包方式
     */
    private String qdcbfs;

    /**
     * @author <a href="mailto:yulei1@gtmap.cn">yulei</a>
     * @description 草层高度
     */
    private Double ccgd;

    /**
     * @author <a href="mailto:yulei1@gtmap.cn">yulei</a>
     * @description 草地优势种
     */
    private String cdysz;

    /**
     * @author <a href="mailto:yulei1@gtmap.cn">yulei</a>
     * @description 草地建群
     */
    private String cdjq;

    /**
     * @author <a href="mailto:yulei1@gtmap.cn">yulei</a>
     * @description 草地覆盖度
     */
    private String cdfgd;

    /**
     * @author <a href="mailto:yulei1@gtmap.cn">yulei</a>
     * @description 附记
     */
    private String fj;

    private ArdBdcTdcbnydsyq(Row row, int lineNum) {
        boolean ywhFlag = false;
        boolean djsjFlag = false;
        boolean dbrFlag = false;
        boolean qlqssjFlag = false;
        boolean qljssjFlag = false;
        boolean syksqxFlag = false;
        boolean syjsqxFlag = false;
        boolean syttlxFlag = false;
        boolean yzyfsFlag = false;
        boolean cyzlFlag = false;
        boolean syzclFlag = false;
        boolean tdsyqxzFlag = false;
        boolean fbfmcFlag = false;
        boolean qdcbfsFlag = false;
        boolean ccgdFlag = false;
        boolean cdyszFlag = false;
        boolean cdjqFlag = false;
        boolean cdfgdFlag = false;
        boolean fjFlag = false;
        Cell currentCell;
        for (int i = 0; i < lineNum; i++) {
            currentCell = row.getCell(i);
            if (StringUtils.isBlank(this.getYwh()) && !ywhFlag) {
                if (currentCell != null && StringUtils.isNotBlank(currentCell.toString())) {
                    this.setYwh(StringUtils.deleteWhitespace(ArdExcelUtil.getValue(currentCell)));
                }
                ywhFlag = true;
                continue;
            }
            if (this.getDjsj() == null && !djsjFlag) {
                if (currentCell != null && StringUtils.isNotBlank(currentCell.toString())) {
                    this.setDjsj(currentCell.getDateCellValue());
                }
                djsjFlag = true;
                continue;
            }
            if (StringUtils.isBlank(this.getDbr()) && !dbrFlag) {
                if (currentCell != null && StringUtils.isNotBlank(currentCell.toString())) {
                    this.setDbr(StringUtils.deleteWhitespace(ArdExcelUtil.getValue(currentCell)));
                }
                dbrFlag = true;
                continue;
            }
            if (this.getQlqssj() == null && !qlqssjFlag) {
                if (currentCell != null && StringUtils.isNotBlank(currentCell.toString())) {
                    this.setQlqssj(currentCell.getDateCellValue());
                }
                qlqssjFlag = true;
                continue;
            }
            if (this.getQljssj() == null && !qljssjFlag) {
                if (currentCell != null && StringUtils.isNotBlank(currentCell.toString())) {
                    this.setQljssj(currentCell.getDateCellValue());
                }
                qljssjFlag = true;
                continue;
            }
            if (this.getSyksqx() == null && !syksqxFlag) {
                if (currentCell != null && StringUtils.isNotBlank(currentCell.toString())) {
                    this.setSyksqx(currentCell.getDateCellValue());
                }
                syksqxFlag = true;
                continue;
            }
            if (this.getSyjsqx() == null && !syjsqxFlag) {
                if (currentCell != null && StringUtils.isNotBlank(currentCell.toString())) {
                    this.setSyjsqx(currentCell.getDateCellValue());
                }
                syjsqxFlag = true;
                continue;
            }
            if (StringUtils.isBlank(this.getSyttlx()) && !syttlxFlag) {
                if (currentCell != null && StringUtils.isNotBlank(currentCell.toString())) {
                    this.setSyttlx(StringUtils.deleteWhitespace(ArdExcelUtil.getValue(currentCell)));
                }
                syttlxFlag = true;
                continue;
            }
            if (StringUtils.isBlank(this.getYzyfs()) && !yzyfsFlag) {
                if (currentCell != null && StringUtils.isNotBlank(currentCell.toString())) {
                    this.setYzyfs(StringUtils.deleteWhitespace(ArdExcelUtil.getValue(currentCell)));
                }
                yzyfsFlag = true;
                continue;
            }
            if (StringUtils.isBlank(this.getCyzl()) && !cyzlFlag) {
                if (currentCell != null && StringUtils.isNotBlank(currentCell.toString())) {
                    this.setCyzl(StringUtils.deleteWhitespace(ArdExcelUtil.getValue(currentCell)));
                }
                cyzlFlag = true;
                continue;
            }
            if (this.getSyzcl() == null && !syzclFlag) {
                if (currentCell != null && StringUtils.isNotBlank(currentCell.toString())) {
                    this.setSyzcl(Integer.parseInt(StringUtils.deleteWhitespace(ArdExcelUtil.getValue(currentCell))));
                }
                syzclFlag = true;
                continue;
            }
            if (StringUtils.isBlank(this.getTdsyqxz()) && !tdsyqxzFlag) {
                if (currentCell != null && StringUtils.isNotBlank(currentCell.toString())) {
                    this.setTdsyqxz(StringUtils.deleteWhitespace(ArdExcelUtil.getValue(currentCell)));
                }
                tdsyqxzFlag = true;
                continue;
            }
            if (StringUtils.isBlank(this.getFbfmc()) && !fbfmcFlag) {
                if (currentCell != null && StringUtils.isNotBlank(currentCell.toString())) {
                    this.setFbfmc(StringUtils.deleteWhitespace(ArdExcelUtil.getValue(currentCell)));
                }
                fbfmcFlag = true;
                continue;
            }
            if (StringUtils.isBlank(this.getQdcbfs()) && !qdcbfsFlag) {
                if (currentCell != null && StringUtils.isNotBlank(currentCell.toString())) {
                    this.setQdcbfs(StringUtils.deleteWhitespace(ArdExcelUtil.getValue(currentCell)));
                }
                qdcbfsFlag = true;
                continue;
            }
            if (this.getCcgd() == null && !ccgdFlag) {
                if (currentCell != null && StringUtils.isNotBlank(currentCell.toString())) {
                    this.setCcgd(Double.parseDouble(StringUtils.deleteWhitespace(ArdExcelUtil.getValue(currentCell))));
                }
                ccgdFlag = true;
                continue;
            }
            if (StringUtils.isBlank(this.getCdysz()) && !cdyszFlag) {
                if (currentCell != null && StringUtils.isNotBlank(currentCell.toString())) {
                    this.setCdysz(StringUtils.deleteWhitespace(ArdExcelUtil.getValue(currentCell)));
                }
                cdyszFlag = true;
                continue;
            }
            if (StringUtils.isBlank(this.getCdjq()) && !cdjqFlag) {
                if (currentCell != null && StringUtils.isNotBlank(currentCell.toString())) {
                    this.setCdjq(StringUtils.deleteWhitespace(ArdExcelUtil.getValue(currentCell)));
                }
                cdjqFlag = true;
                continue;
            }
            if (StringUtils.isBlank(this.getCdfgd()) && !cdfgdFlag) {
                if (currentCell != null && StringUtils.isNotBlank(currentCell.toString())) {
                    this.setCdfgd(StringUtils.deleteWhitespace(ArdExcelUtil.getValue(currentCell)));
                }
                cdfgdFlag = true;
                continue;
            }
            if (StringUtils.isBlank(this.getFj()) && !fjFlag) {
                if (currentCell != null && StringUtils.isNotBlank(currentCell.toString())) {
                    this.setFj(StringUtils.deleteWhitespace(ArdExcelUtil.getValue(currentCell)));
                }
                fjFlag = true;
            }
        }
    }

    public static ArdBdcTdcbnydsyq initArdBdcTdcbnydsyq(Row row, int lineNum) {
        return new ArdBdcTdcbnydsyq(row, lineNum);
    }

    public String getYwh() {
        return ywh;
    }

    public void setYwh(String ywh) {
        this.ywh = ywh;
    }

    public String getDbr() {
        return dbr;
    }

    public void setDbr(String dbr) {
        this.dbr = dbr;
    }

    public Date getDjsj() {
        return djsj;
    }

    public void setDjsj(Date djsj) {
        this.djsj = djsj;
    }

    public Date getQlqssj() {
        return qlqssj;
    }

    public void setQlqssj(Date qlqssj) {
        this.qlqssj = qlqssj;
    }

    public Date getQljssj() {
        return qljssj;
    }

    public void setQljssj(Date qljssj) {
        this.qljssj = qljssj;
    }

    public Date getSyksqx() {
        return syksqx;
    }

    public void setSyksqx(Date syksqx) {
        this.syksqx = syksqx;
    }

    public Date getSyjsqx() {
        return syjsqx;
    }

    public void setSyjsqx(Date syjsqx) {
        this.syjsqx = syjsqx;
    }

    public String getSyttlx() {
        return syttlx;
    }

    public void setSyttlx(String syttlx) {
        this.syttlx = syttlx;
    }

    public String getYzyfs() {
        return yzyfs;
    }

    public void setYzyfs(String yzyfs) {
        this.yzyfs = yzyfs;
    }

    public String getCyzl() {
        return cyzl;
    }

    public void setCyzl(String cyzl) {
        this.cyzl = cyzl;
    }

    public Integer getSyzcl() {
        return syzcl;
    }

    public void setSyzcl(Integer syzcl) {
        this.syzcl = syzcl;
    }

    public String getTdsyqxz() {
        return tdsyqxz;
    }

    public void setTdsyqxz(String tdsyqxz) {
        this.tdsyqxz = tdsyqxz;
    }

    public String getFbfmc() {
        return fbfmc;
    }

    public void setFbfmc(String fbfmc) {
        this.fbfmc = fbfmc;
    }

    public String getQdcbfs() {
        return qdcbfs;
    }

    public void setQdcbfs(String qdcbfs) {
        this.qdcbfs = qdcbfs;
    }

    public Double getCcgd() {
        return ccgd;
    }

    public void setCcgd(Double ccgd) {
        this.ccgd = ccgd;
    }

    public String getCdysz() {
        return cdysz;
    }

    public void setCdysz(String cdysz) {
        this.cdysz = cdysz;
    }

    public String getCdjq() {
        return cdjq;
    }

    public void setCdjq(String cdjq) {
        this.cdjq = cdjq;
    }

    public String getCdfgd() {
        return cdfgd;
    }

    public void setCdfgd(String cdfgd) {
        this.cdfgd = cdfgd;
    }

    public String getFj() {
        return fj;
    }

    public void setFj(String fj) {
        this.fj = fj;
    }

    @Override
    public String toString() {
        return "ArdBdcTdcbnydsyq{" +
                "ywh='" + ywh + '\'' +
                ", djsj=" + djsj +
                ", dbr='" + dbr + '\'' +
                ", qlqssj=" + qlqssj +
                ", qljssj=" + qljssj +
                ", syksqx=" + syksqx +
                ", syjsqx=" + syjsqx +
                ", syttlx='" + syttlx + '\'' +
                ", yzyfs='" + yzyfs + '\'' +
                ", cyzl='" + cyzl + '\'' +
                ", syzcl=" + syzcl +
                ", tdsyqxz='" + tdsyqxz + '\'' +
                ", fbfmc='" + fbfmc + '\'' +
                ", qdcbfs='" + qdcbfs + '\'' +
                ", ccgd=" + ccgd +
                ", cdysz='" + cdysz + '\'' +
                ", cdjq='" + cdjq + '\'' +
                ", cdfgd='" + cdfgd + '\'' +
                ", fj='" + fj + '\'' +
                '}';
    }
}
