package com.casic.PgInterface.maintenance.dto;

import com.casic.PgInterface.maintenance.domain.PgAssetPlan;

import java.util.ArrayList;
import java.util.List;

public class PgAssetPlanDto {

    private Long id;
    private String PLAN_NO;//巡检计划编号
    private String PLAN_NAME;//巡检计划名称
    private String INSPECTION_TYPE;//巡检类型
    private String INSPECTION_START_TIME;//巡检开始时间
    private String INSPECTION_END_TIME;//巡检结束时间
    private String INSPECTION_PRACE;//巡检地点
    private String FREQUENCY;//巡检频率
    private String CREATOR;//创建人
    private String DEVELOP_DEPT;//制定部门
    private String PROJECT;//项目
    private String STATE;//状态

    public Long getId() {
        return id;
    }

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

    public String getPLAN_NO() {
        return PLAN_NO;
    }

    public void setPLAN_NO(String PLAN_NO) {
        this.PLAN_NO = PLAN_NO;
    }

    public String getPLAN_NAME() {
        return PLAN_NAME;
    }

    public void setPLAN_NAME(String PLAN_NAME) {
        this.PLAN_NAME = PLAN_NAME;
    }

    public String getINSPECTION_TYPE() {
        return INSPECTION_TYPE;
    }

    public void setINSPECTION_TYPE(String INSPECTION_TYPE) {
        this.INSPECTION_TYPE = INSPECTION_TYPE;
    }

    public String getINSPECTION_START_TIME() {
        return INSPECTION_START_TIME;
    }

    public void setINSPECTION_START_TIME(String INSPECTION_START_TIME) {
        this.INSPECTION_START_TIME = INSPECTION_START_TIME;
    }

    public String getINSPECTION_END_TIME() {
        return INSPECTION_END_TIME;
    }

    public void setINSPECTION_END_TIME(String INSPECTION_END_TIME) {
        this.INSPECTION_END_TIME = INSPECTION_END_TIME;
    }

    public String getINSPECTION_PRACE() {
        return INSPECTION_PRACE;
    }

    public void setINSPECTION_PRACE(String INSPECTION_PRACE) {
        this.INSPECTION_PRACE = INSPECTION_PRACE;
    }

    public String getFREQUENCY() {
        return FREQUENCY;
    }

    public void setFREQUENCY(String FREQUENCY) {
        this.FREQUENCY = FREQUENCY;
    }

    public String getCREATOR() {
        return CREATOR;
    }

    public void setCREATOR(String CREATOR) {
        this.CREATOR = CREATOR;
    }

    public String getDEVELOP_DEPT() {
        return DEVELOP_DEPT;
    }

    public void setDEVELOP_DEPT(String DEVELOP_DEPT) {
        this.DEVELOP_DEPT = DEVELOP_DEPT;
    }

    public String getPROJECT() {
        return PROJECT;
    }

    public void setPROJECT(String PROJECT) {
        this.PROJECT = PROJECT;
    }

    public String getSTATE() {
        return STATE;
    }

    public void setSTATE(String STATE) {
        this.STATE = STATE;
    }

    public static PgAssetPlanDto ConvertToPgAssetPlanDTO(PgAssetPlan pgAssetPlan){

        PgAssetPlanDto pgAssetPlanDto=new PgAssetPlanDto();

        pgAssetPlanDto.setId(pgAssetPlan.getId());
        pgAssetPlanDto.setPLAN_NO(pgAssetPlan.getPLAN_NO());
        pgAssetPlanDto.setPLAN_NAME(pgAssetPlan.getPLAN_NAME());

        if(pgAssetPlan.getINSPECTION_TYPE().equals(""))
            pgAssetPlanDto.setINSPECTION_TYPE("");
        else if(pgAssetPlan.getINSPECTION_TYPE().equals("1"))
            pgAssetPlanDto.setINSPECTION_TYPE("廊内巡检");
        else if(pgAssetPlan.getINSPECTION_TYPE().equals("2"))
            pgAssetPlanDto.setINSPECTION_TYPE("廊外巡检");

        pgAssetPlanDto.setINSPECTION_START_TIME(pgAssetPlan.getSTART_DATE());
        pgAssetPlanDto.setINSPECTION_END_TIME(pgAssetPlan.getEND_DATE());
        pgAssetPlanDto.setINSPECTION_PRACE(pgAssetPlan.getINSPECTION_PRACE());
        pgAssetPlanDto.setFREQUENCY(pgAssetPlan.getFREQUENCY());
        pgAssetPlanDto.setCREATOR(pgAssetPlan.getCREATOR());
        pgAssetPlanDto.setDEVELOP_DEPT(pgAssetPlan.getDEVELOP_DEPT());
        pgAssetPlanDto.setPROJECT(pgAssetPlan.getPROJECT());
        if(pgAssetPlan.getSTATE().equals("0"))
            pgAssetPlanDto.setSTATE("待执行");
        else if(pgAssetPlan.getSTATE().equals("1"))
            pgAssetPlanDto.setSTATE("执行中");
        else if(pgAssetPlan.getSTATE().equals("2"))
            pgAssetPlanDto.setSTATE("执行结束");

        return pgAssetPlanDto;
    }

    public static List<PgAssetPlanDto> ConvertToPgAssetDtoList(List<PgAssetPlan> pgAssetPlanList){

        List<PgAssetPlanDto> pgAssetPlanDtoList=new ArrayList<>();

        for(PgAssetPlan pgAssetPlan:pgAssetPlanList){
            pgAssetPlanDtoList.add(ConvertToPgAssetPlanDTO(pgAssetPlan));
        }

        return pgAssetPlanDtoList;
    }

}