package com.casic.PgInterface.construction.dto;

import com.casic.PgInterface.construction.domain.PgConstruction;

import java.text.SimpleDateFormat;
/**
 * Created by zxh on 2018/3/23.
 */
public class PgConstructionDto{

    private String id;
    private String cs_name;//项目名称
    private String cs_detail;//施工内容
    private String cs_beginTime;//施工开始时间
    private String cs_endTime;//施工结束时间
    private String cs_charge;//施工负责人
    private String cs_phone;//联系方式
    private String cs_type;//工程类别
    private String parName;//施工区域
    private String ConstructionType;//项目状态
    private String active;//状态位
    private String doc_name;//施工文档

    public String getId() {
        return id;
    }

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

    public String getCs_name() {
        return cs_name;
    }

    public void setCs_name(String cs_name) {
        this.cs_name = cs_name;
    }

    public String getCs_detail() {
        return cs_detail;
    }

    public void setCs_detail(String cs_detail) {
        this.cs_detail = cs_detail;
    }

    public String getCs_beginTime() {
        return cs_beginTime;
    }

    public void setCs_beginTime(String cs_beginTime) {
        this.cs_beginTime = cs_beginTime;
    }

    public String getCs_endTime() {
        return cs_endTime;
    }

    public void setCs_endTime(String cs_endTime) {
        this.cs_endTime = cs_endTime;
    }

    public String getCs_charge() {
        return cs_charge;
    }

    public void setCs_charge(String cs_charge) {
        this.cs_charge = cs_charge;
    }

    public String getCs_phone() {
        return cs_phone;
    }

    public void setCs_phone(String cs_phone) {
        this.cs_phone = cs_phone;
    }

    public String getCs_type() {
        return cs_type;
    }

    public void setCs_type(String cs_type) {
        this.cs_type = cs_type;
    }

    public String getParName() {
        return parName;
    }

    public void setParName(String parName) {
        this.parName = parName;
    }

    public String getActive(){ return active; }

    public void setActive(String active){ this.active = active; }

    public String getConstructionType() {
        return ConstructionType;
    }

    public void setConstructionType(String constructionType) {
        ConstructionType = constructionType;
    }

    public String getDoc_name() {
        return doc_name;
    }

    public void setDoc_name(String doc_name) {
        this.doc_name = doc_name;
    }

    public PgConstructionDto(PgConstruction pgConstruction) {

        if (pgConstruction == null) {
            return;
        } else {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

            this.setId(String.valueOf(pgConstruction.getId()));
            this.setCs_name(pgConstruction.getCs_name());
            this.setCs_detail(pgConstruction.getCs_detail());
            if (pgConstruction.getCs_beginTime() != null)
                this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime()));
            else
                this.setCs_beginTime("");
            if (pgConstruction.getCs_endTime() != null)
                this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime()));
            else
                this.setCs_endTime("");
            this.setCs_charge(pgConstruction.getCs_charge());
            this.setCs_phone(pgConstruction.getCs_phone());
            this.setCs_type(pgConstruction.getCs_type());
            if(pgConstruction.getPgPartitionId()==null)
                this.setParName("");
            else
                this.setParName(pgConstruction.getPgPartitionId().getParName());
            if(pgConstruction.getPgConstructionTypeId()==null)
                this.setConstructionType("");
            else
                this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName());
            this.setActive(String.valueOf(pgConstruction.getActive()));
        }
    }
}
