package com.casic.PgInterface.construction.dto;

import com.casic.PgInterface.construction.domain.PgCsDocument;
import com.casic.PgInterface.construction.manager.PgConstructionManager;
import com.casic.PgInterface.construction.manager.PgConstructionTypeManager;
import com.casic.PgInterface.core.util.DateUtils;

/**
 * Created by zxh on 2018/3/28.
 */
public class PgCsDocumentDto{

    private String id;
    private String doc_name;//文档名称
    private String cs_name;//项目名称
    private String cs_type;//工程类别
    private String cs_time;//施工时间

    public String getId() {
        return id;
    }

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

    public String getDoc_name(){ return doc_name; }

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

    public String getCs_name() {
        return cs_name;
    }

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

    public String getCs_type() {
        return cs_type;
    }

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

    public String getCs_time() {
        return cs_time;
    }

    public void setCs_time(String cs_time) {
        this.cs_time = cs_time;
    }

    public PgCsDocumentDto(){}

    public PgCsDocumentDto (PgCsDocument pgCsDocument, PgConstructionManager pgConstructionManager,
                            PgConstructionTypeManager pgConstructionTypeManager)
    {
        this.setId(String.valueOf(pgCsDocument.getId()));
        this.setDoc_name(pgCsDocument.getDoc_name());

        if(pgCsDocument.getPgConstructionId()==null||pgConstructionManager.get(pgCsDocument.getPgConstructionId())==null) {
            this.setCs_name("");
            this.setCs_type("");
            this.setCs_time("");
        }
        else {
            this.setCs_name(pgConstructionManager.get(pgCsDocument.getPgConstructionId()).getCs_name());
            if(pgConstructionTypeManager.get(pgConstructionManager.get(pgCsDocument.getPgConstructionId()))==null)
                this.setCs_type("");
            else
                this.setCs_type(pgConstructionTypeManager.get(pgConstructionManager.get(pgCsDocument.getPgConstructionId())).getTypeName());
            this.setCs_time(DateUtils.sdf_day.format(pgConstructionManager.get(pgCsDocument.getPgConstructionId()).getCs_beginTime()));
        }

    }
}
