package com.mvc.model.biz;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mvc.model.ReqPageGeeker;
import com.mvc.model.StationAccModel;
import com.mvc.model.TaskRemoteCfgModel;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @Description: 维护记录表
 * @Author: guozhao
 * @CreateDate: 2024-12-26 11:13:49
 */
public class TMaintenanceRecordsV2Model extends ReqPageGeeker {
    public TMaintenanceRecordsV2Model() {
    }

    public TMaintenanceRecordsV2Model(StationAccModel accModel, TaskRemoteCfgModel oldCfgModel, TaskRemoteCfgModel newCfgModel) {
        this.stationAccId = accModel.getId();
        this.stationCode = accModel.getStationCode();
        this.maintenanceMan = accModel.getDeviceSetupMan();
        this.maintenanceTime = new Date();
        this.maintenanceStatus = "0";
        this.maintenanceMemo = accModel.getMemo();
        if (oldCfgModel != null) {
            this.oldDeviceSn = oldCfgModel.getDeviceSn();
            this.oldDeviceCfgId = oldCfgModel.getId();
            this.maintenanceType = "2";//更换
        }
        if (newCfgModel != null) {
            this.newDeviceSn = newCfgModel.getDeviceSn();
            this.newDeviceCfgId = newCfgModel.getId();
            this.maintenanceType = oldCfgModel == null ? "1" : this.maintenanceType;
        }
    }

    /**
     *
     */
    private Integer id;

    /**
     * 站点台账ID
     */
    private Integer stationAccId;

    /**
     * 遥测站编码
     */
    private String stationCode;

    /**
     * 新安装设备的Sn
     */
    private String newDeviceSn;

    /**
     * 旧设备的SN
     */
    private String oldDeviceSn;

    /**
     * 新设备远程配置任务ID
     */
    private Integer newDeviceCfgId;

    /**
     * 旧设备远程配置任务ID
     */
    private Integer oldDeviceCfgId;

    /**
     * 维护类型(0安装,1更换)
     */
    private String maintenanceType;

    /**
     * 维护时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date maintenanceTime;

    /**
     * 维护人
     */
    private String maintenanceMan;

    /**
     * 维护状态(0:进行中,1:已完成)
     */
    private String maintenanceStatus;

    /**
     * 备注
     */
    private String maintenanceMemo;

    /**
     * 旧设备远程配置任务状态
     */
    private String oldDeviceCfgStatus;

    /**
     * 新设备远程配置任务状态
     */
    private String newDeviceCfgStatus;

    private String stationName;

    public Integer getId() {
        return id;
    }

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

    public Integer getStationAccId() {
        return stationAccId;
    }

    public void setStationAccId(Integer stationAccId) {
        this.stationAccId = stationAccId;
    }

    public String getStationCode() {
        return stationCode;
    }

    public void setStationCode(String stationCode) {
        this.stationCode = stationCode == null ? null : stationCode.trim();
    }

    public String getNewDeviceSn() {
        return newDeviceSn;
    }

    public void setNewDeviceSn(String newDeviceSn) {
        this.newDeviceSn = newDeviceSn == null ? null : newDeviceSn.trim();
    }

    public String getOldDeviceSn() {
        return oldDeviceSn;
    }

    public void setOldDeviceSn(String oldDeviceSn) {
        this.oldDeviceSn = oldDeviceSn == null ? null : oldDeviceSn.trim();
    }

    public Integer getNewDeviceCfgId() {
        return newDeviceCfgId;
    }

    public void setNewDeviceCfgId(Integer newDeviceCfgId) {
        this.newDeviceCfgId = newDeviceCfgId;
    }

    public Integer getOldDeviceCfgId() {
        return oldDeviceCfgId;
    }

    public void setOldDeviceCfgId(Integer oldDeviceCfgId) {
        this.oldDeviceCfgId = oldDeviceCfgId;
    }

    public String getMaintenanceType() {
        return maintenanceType;
    }

    public void setMaintenanceType(String maintenanceType) {
        this.maintenanceType = maintenanceType == null ? null : maintenanceType.trim();
    }

    public Date getMaintenanceTime() {
        return maintenanceTime;
    }

    public void setMaintenanceTime(Date maintenanceTime) {
        this.maintenanceTime = maintenanceTime;
    }

    public String getMaintenanceMan() {
        return maintenanceMan;
    }

    public void setMaintenanceMan(String maintenanceMan) {
        this.maintenanceMan = maintenanceMan == null ? null : maintenanceMan.trim();
    }

    public String getMaintenanceStatus() {
        return maintenanceStatus;
    }

    public void setMaintenanceStatus(String maintenanceStatus) {
        this.maintenanceStatus = maintenanceStatus == null ? null : maintenanceStatus.trim();
    }

    public String getMaintenanceMemo() {
        return maintenanceMemo;
    }

    public void setMaintenanceMemo(String maintenanceMemo) {
        this.maintenanceMemo = maintenanceMemo == null ? null : maintenanceMemo.trim();
    }

    public String getOldDeviceCfgStatus() {
        return oldDeviceCfgStatus;
    }

    public void setOldDeviceCfgStatus(String oldDeviceCfgStatus) {
        if (oldDeviceCfgStatus != null) {
            oldDeviceCfgStatus = oldDeviceCfgStatus.equals("0") ? "未完成" : "已完成";
        }
        this.oldDeviceCfgStatus = oldDeviceCfgStatus;
    }

    public String getNewDeviceCfgStatus() {
        return newDeviceCfgStatus;
    }

    public void setNewDeviceCfgStatus(String newDeviceCfgStatus) {
        if (newDeviceCfgStatus != null) {
            newDeviceCfgStatus = newDeviceCfgStatus.equals("0") ? "未完成" : "已完成";
        }
        this.newDeviceCfgStatus = newDeviceCfgStatus;
    }

    public String getStationName() {
        return stationName;
    }

    public void setStationName(String stationName) {
        this.stationName = stationName;
    }
}