package com.gyee.alarm.model.auto;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.util.Date;

import lombok.*;

/**
 * <p>
 * 评审记录
 * </p>
 *
 * @author shilin
 * @since 2023-09-13
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class ProEconInspectOrder extends Model {

    private static final long serialVersionUID = 1L;

    /**
     * 编号
     */
    private String id;

    /**
     * 场站编号
     */
    private String windpowerstationId;

    /**
     * 设备编号
     */
    private String windturbineId;

    /**
     * 诊断报告 earlyreportwindturbine表id
     */
    private String reportWindturbineId;

    /**
     * 评审人
     */
    private String verifyUser;

    /**
     * 评审时间
     */
    private Date verifyTime;

    /**
     * 评审结论
     */
    private String verifyView;

    /**
     * 计划时间
     */
    private Date createPlanTime;

    /**
     * 计划人
     */
    private String createPlanUser;

    /**
     * 计划开始时间
     */
    private Date planStartTime;

    /**
     * 计划结束时间
     */
    private Date planEndTime;

    /**
     * 巡检人
     */
    private String inspectUser;

    /**
     * 巡检时间
     */
    private Date inspectTime;

    /**
     * 巡检结论
     */
    private String inspectView;

    /**
     * 是否与报告相符
     */
    private Boolean accordReport;

    /**
     * 是否关闭
     */
    private Boolean closed;

    /**
     * 结果已经验证
     */
    private Boolean verifyResult;

    @TableField(exist = false)
    private ProEconEarlyReportWt proEconEarlyReportWt;

    @TableField(exist = false)
    @Getter(AccessLevel.NONE)
    @Setter(AccessLevel.NONE)
    private String step;

    @TableField(exist = false)
    private int stepMark;

    public void setStep(String step) {
        this.step = step;
    }
    public String getStep() {
        //节点 1-待审核，2-已审核，3-未计划，4-已计划，5-未巡检，6-已巡检
        String result = "";
        if (inspectTime != null && createPlanTime != null && verifyTime != null) {
            result = "已巡检";
            stepMark=6;
        } else if (inspectTime == null && createPlanTime != null && verifyTime != null) {
            result = "已计划，未巡检";
            stepMark=5;
        } else if (inspectTime == null && createPlanTime == null && verifyTime != null && verifyResult == true) {
            result = "已评审，未计划";

        } else if (inspectTime == null && createPlanTime == null && verifyTime != null && verifyResult == false) {
            result="审核不通过";
        }else{
            return "";
        }
        return step;
    }

}
