package com.unis.base.common.vo;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.NotBlank;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Transient;
import javax.validation.constraints.Pattern;

/**
 * @author huangxing
 * @version 1.0
 * @Title DCfxxsjyDO
 * @ProjectName 油罐业务对象
 * @Description
 * @date 2019/07/22 17点26分
 */

@SuppressWarnings("serial")
@Getter
@Setter
@ApiModel("油罐业务对象")
public class OiltankVO extends BaseEntity {
	private String id;
	/**
	 * 油罐编号
	 */
	@ApiModelProperty(value = " 油罐编号")
	private String ygbh;


	/**
	 * 油罐名称
	 */
	@ApiModelProperty(value = "油罐名称",required = true)
	@NotBlank(message = "请填写正确油罐名称")
	@Pattern(regexp = "[^暂无|测试|无|空]+",message = "请填写正确油罐名称")
	private String ygmc;


	/**
	 * 库点编号
	 */
	@ApiModelProperty(value = "库点编号",required = true)
	private String kddm;

	/**
	 * 库点名称
	 */
	@ApiModelProperty(value = "库点名称")
	private String kdmc;

	/**
	 * 设计罐容
	 */
	@ApiModelProperty(value = "设计罐容")
	private Double sjgr;

	/**
	 * 实际罐容
	 */
	@ApiModelProperty(value = "实际罐容")
	private Double sjgr01;

	/**
	 * 油罐直径
	 */
	@ApiModelProperty(value = "油罐直径")
	private Double ygzj;

	/**
	 * 油罐高度
	 */
	@ApiModelProperty(value = "油罐高度")
	private Double yggd;

	/**
	 * 装油高度
	 */
	@ApiModelProperty(value = "装油高度")
	private Double zygd;

	/**
	 * 设计年代
	 */
	@ApiModelProperty(value = "设计年代")
	@JSONField(format="yyyy-MM-dd")
    @DateTimeFormat( pattern = "yyyy-MM-dd")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
	private Date sjnd;

	/**
	 * 油罐精度
	 */
	@ApiModelProperty(value = "油罐精度")
	private Double ygjd;

	/**
	 * 油罐维度
	 */
	@ApiModelProperty(value = "油罐维度")
	private Double ygwd;

	/**
	 * 油罐状态
	 */
	@ApiModelProperty(value = "油罐状态")
	@NotBlank(message = "请填写正确油罐状态")
	@Pattern(regexp = "^1$|^2$|^3$|^4$|^5$|^6$|^9$",message = "请填写正确油罐状态")
	private String ygzt;

	/**
	 * 油罐使用状态
	 */
	@ApiModelProperty(value = "油罐使用状态")
	private String ygsyzt;


	/**
	 * 油罐类型
	 */
	@ApiModelProperty(value = "油罐类型")
	@NotBlank(message = "请填写正确油罐类型")
	@Pattern(regexp = "^1$|^2$|^3$|^4$|^5$",message = "请填写正确油罐类型")
	private String yglx;

	/**
	 * 油罐底面积
	 */
	@ApiModelProperty(value = "油罐底面积")
	private Double ygdmj;

	/**
	 * 油罐内直径
	 */
	@ApiModelProperty(value = "油罐内直径")
	private Double ygnzj;

	/**
	 * 油罐出油口高度
	 */
	@ApiModelProperty(value = "油罐出油口高度")
	private Double ygcykgd;

	/**
	 * 油罐检查口高度
	 */
	@ApiModelProperty(value = "油罐检查口高度")
	private Double ygjckgd;

	/**
	 * 油罐平面图
	 */
	@ApiModelProperty(value = "油罐平面图")
	private String ygpmt;


	/**
	 * 油罐库区图
	 */
	@ApiModelProperty(value = "油罐库区图")
	private String ygkqt;

	@ApiModelProperty(value = "是否备案，0，未备案，1，待提交，2待审核，3已驳回，4，已备案", notes ="是否备案，0，未备案，1，待提交，2待审核，3已驳回，4，已备案", required = false)
	private Integer sfba;

	/**
	 * 油罐验收申请状态
	 */
	@ApiModelProperty(value="油罐验收申请状态，0 可编辑 1 不可编辑",notes ="油罐验收申请状态，0 可编辑 1 不可编辑")
	private String sqzt="0";

	private String tyshxydm;
	private String qyxz;

	@ApiModelProperty(value = "油罐代码")
	private String ygdm;

	@ApiModelProperty(value = "设计单位")
	private String sjdw;

	@ApiModelProperty(value = "建设单位")
	private String jsdw;

	@ApiModelProperty(value = "监理单位")
	private String jldw;

	@ApiModelProperty(value = "廒间代码")
	private String ajdh;

	@ApiModelProperty(value = "货位代码")
	private String hwdm;

	@ApiModelProperty(value = "存放粮油类型(0:原粮,1:成品粮)")
	private String lylx;

	@ApiModelProperty(value = "出入库状态")
	private String crkStatus;

	@ApiModelProperty(value = "审核人")
	private String approver;

	@ApiModelProperty(value = "审核意见")
	private String approvalComments;

	@ApiModelProperty(value = "审核日期")
	@JSONField(format="yyyy-MM-dd")
	@DateTimeFormat( pattern = "yyyy-MM-dd")
	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
	private Date approvalDate;

	@ApiModelProperty(value = "库级推送返回信息")
	private String sendResult;

	@ApiModelProperty(value = "油罐及附属设施是否完好")
	@NotBlank(message = "请填写正确油罐及附属设施是否完好")
	@Pattern(regexp = "^[0|1|9]$",message = "请填写正确油罐及附属设施是否完好")
	private String ygjfssssfwh;

	@ApiModelProperty(value = "有无加热装置")
	@NotBlank(message = "请填写正确有无加热装置")
	@Pattern(regexp = "^[0|1|9]$",message = "请填写正确有无加热装置")
	private String ywjrzz;

	@ApiModelProperty(value = "检定方式")
	@Pattern(regexp = "^[0|1|9]$",message = "请填写正确检定方式")
	private String jdfs;

	@ApiModelProperty(value = "焊接方式")
	@Pattern(regexp = "^1$|^2$|^9$",message = "请填写正确焊接方式")
	private String hjfs;

	@ApiModelProperty(value = "审核结果（通过：1；驳回：0）")
	private String approvalResult;

	@ApiModelProperty("标准库区编码")
	private String kqdm;

	@ApiModelProperty("ygbh油罐编号")
	private String realYgbh;

	@ApiModelProperty(value="是否可删除，0 可删除 1 不可删除")
	private String delFlag;

	@ApiModelProperty(value = "id")
	private List<String> ids;

    @Column(name = "data_ver")
    private Integer dataVer;

    @ApiModelProperty(value = "变更原因")
    private String changeReason;

    /**
     * 是否备案，<br/>
     * 0，未备案，1，待提交，2待审核，3已驳回，
     * <s>4，已备案</s>
     * <br/>
     * 5 通过
     * */
    public enum SFBA{
        /**待提交 1*/
        DTJ(1, "待提交"),
        /**待审核 2*/
        DSH(2, "待审核"),
        /**已驳回 3*/
        YBH(3, "已驳回"),
        /**通过 5*/
        TG(5, "通过");
        @Setter
        @Getter
        private Integer value;
        @Setter
        @Getter
        private String name;

        SFBA(Integer value, String name) {
            this.value = value;
            this.name = name;
        }
        public boolean equalsVal(Integer arg) {
            return Objects.equals(this.value, arg);
        }
    }

    public enum UPDATE_RES{
        INVALID(-3, "缺少参数");
        @Getter
        private Integer value;
        @Getter
        private String name;

        UPDATE_RES(Integer value, String name) {
            this.value = value;
            this.name = name;
        }

        public boolean equalVal(Integer arg) {
            return Objects.equals(this.value, arg);
        }
    }
}
