package com.yanzhu.jh.project.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.yanzhu.jh.project.domain.SurProjectBuildNodeData;
import org.apache.poi.ss.usermodel.HorizontalAlignment;

import java.util.Date;

public class SurProjectBuildNodeDataExport {

    @Excel(name = "编号(不要修改)", width = 20,prompt = "不要修改修改此列")
    private Long id;
    @Excel(name = "项目编号", width = 10,prompt = "不要修改修改此列")
    private Long projectId;
    @Excel(name = "项目名称", width = 30,align = HorizontalAlignment.LEFT,prompt = "不要修改修改此列")
    private String projectName;

    @Excel(name = "一级", width = 20,align = HorizontalAlignment.LEFT,prompt = "不要修改修改此列")
    private String lvl1;
    @Excel(name = "二级", width = 20,align = HorizontalAlignment.LEFT,prompt = "不要修改修改此列")
    private String lvl2;
    @Excel(name = "三级", width = 20,align = HorizontalAlignment.LEFT,prompt = "不要修改修改此列")
    private String lvl3;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "计划开始时间", width = 15, dateFormat = "yyyy-MM-dd")
    private Date planStartDate;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "计划结束时间", width = 15, dateFormat = "yyyy-MM-dd")
    private Date planEndDate;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "实际开始时间", width = 15, dateFormat = "yyyy-MM-dd")
    private Date startDate;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "实际结束时间", width = 15, dateFormat = "yyyy-MM-dd")
    private Date endDate;

    public Long getProjectId() {
        return projectId;
    }

    public void setProjectId(Long projectId) {
        this.projectId = projectId;
    }

    public static SurProjectBuildNodeDataExport convert(SurProjectBuildNodeData it) {
        SurProjectBuildNodeDataExport d=new SurProjectBuildNodeDataExport();
        d.id=it.getId();
        d.projectName=it.getProject().getProjectName();
        d.planStartDate=it.getPlanStartDate();
        d.planEndDate=it.getPlanEndDate();
        d.startDate=it.getStartDate();
        d.endDate=it.getEndDate();
        d.projectId=it.getProjectId();
        String name= it.getBaseBuildNode().getNodeText();
        String lvl=it.getBaseBuildNode().getNodeLvl();
        d.lvl1="";
        d.lvl2="";
        d.lvl3="";
        if(lvl.length()==2){
            d.lvl1=name;
        }
        if(lvl.length()==4){
            d.lvl2=name;
        }
        if(lvl.length()==6){
            d.lvl3=name;
        }
        return d;
    }

    public Long getId() {
        return id;
    }

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

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public String getLvl1() {
        return lvl1;
    }

    public void setLvl1(String lvl1) {
        this.lvl1 = lvl1;
    }

    public String getLvl2() {
        return lvl2;
    }

    public void setLvl2(String lvl2) {
        this.lvl2 = lvl2;
    }

    public String getLvl3() {
        return lvl3;
    }

    public void setLvl3(String lvl3) {
        this.lvl3 = lvl3;
    }

    public Date getPlanStartDate() {
        return planStartDate;
    }

    public void setPlanStartDate(Date planStartDate) {
        this.planStartDate = planStartDate;
    }

    public Date getPlanEndDate() {
        return planEndDate;
    }

    public void setPlanEndDate(Date planEndDate) {
        this.planEndDate = planEndDate;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }


}
