package com.casic.PgInterface.devTable.dto;

import com.casic.PgInterface.devTable.domain.PgPipeLine;

import java.text.SimpleDateFormat;

/**
 * Created by yxw on 2017/10/30.
 */
public class PgPipeLineDto{

    private String id;
    private String lineName;//管线唯一编号
    private String lineType;//管线类型
    private String ownerUnit;//权属单位
    private String enterDate;//入廊时间
    private String layerNum;//所在层数
    private String diameter;//管径
    private String pipeGallery;//仓位
    private String pipeLength;//管线长度
    private String partition;//分区
    private String active;//状态位

    public String getId() {
        return id;
    }

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

    public String getLineName() {
        return lineName;
    }

    public void setLineName(String lineName) {
        this.lineName = lineName;
    }

    public String getLineType() {
        return lineType;
    }

    public void setLineType(String lineType) {
        this.lineType = lineType;
    }

    public String getOwnerUnit() {
        return ownerUnit;
    }

    public void setOwnerUnit(String ownerUnit) {
        this.ownerUnit = ownerUnit;
    }

    public String getEnterDate() {
        return enterDate;
    }

    public void setEnterDate(String enterDate) {
        this.enterDate = enterDate;
    }

    public String getLayerNum() {
        return layerNum;
    }

    public void setLayerNum(String layerNum) {
        this.layerNum = layerNum;
    }

    public String getDiameter() {
        return diameter;
    }

    public void setDiameter(String diameter) {
        this.diameter = diameter;
    }

    public String getPipeGallery() {
        return pipeGallery;
    }

    public void setPipeGallery(String pipeGallery) {
        this.pipeGallery = pipeGallery;
    }

    public String getPipeLength() {
        return pipeLength;
    }

    public void setPipeLength(String pipeLength) {
        this.pipeLength = pipeLength;
    }

    public String getPartition() {
        return partition;
    }

    public void setPartition(String partition) {
        this.partition = partition;
    }

    public String getActive() {
        return active;
    }

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

    public PgPipeLineDto(PgPipeLine pgPipeLine) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

        this.setId(String.valueOf(pgPipeLine.getId()));
        this.setLineName(pgPipeLine.getLineName());
        this.setLineType(pgPipeLine.getLineType());
        this.setOwnerUnit(pgPipeLine.getOwnerUnit());
        if (pgPipeLine.getEnterDate() != null)
            this.setEnterDate(sdf.format(pgPipeLine.getEnterDate()));
        else
            this.setEnterDate("");
        this.setLayerNum(pgPipeLine.getLayerNum());
        this.setDiameter(pgPipeLine.getDiameter());
        this.setPipeGallery(pgPipeLine.getPipeGalleryId().getPgName());
        this.setPipeLength(String.valueOf(pgPipeLine.getPipeLength()));
        this.setPartition(pgPipeLine.getPipeGalleryId().getPgPartitionId().getParName());
        this.setActive(String.valueOf(pgPipeLine.getActive()));
    }
}
