package com.zcxk.charge.core.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.zcxk.charge.api.dto.DeviceDto;
import com.zcxk.charge.api.vo.DeviceVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

/**
 * sms_day_report
 * @author: WYY
 * @date 2020-12-03 16:20
 */
@Data
@TableName("sms_day_report")
public class DayReportEntity{

    private static final long serialVersionUID = 1L;

    /** 主键 */ 
	@TableId(type = IdType.AUTO)
    @ApiModelProperty(value = "主键")
    private Long id;

    /** 租户标识 */
    @ApiModelProperty(value = "租户标识")
    private String tenantId;

    /** 年 */
    @ApiModelProperty(value = "年")
    private Integer year;

    /** 月 */
    @ApiModelProperty(value = "月")
    private Integer month;

    /** 日 */
    @ApiModelProperty(value = "日")
    private Integer day;

    /** 时 */
    @ApiModelProperty(value = "时")
    private Integer hour;

    /** 一级场景 */
    @ApiModelProperty(value = "一级场景")
    private Long parentSceneId;

    /** 一级场景s */
    @JsonIgnore
    @ApiModelProperty(value = "一级场景IDS")
    private Long[] parentSceneIds;

    @ApiModelProperty(value = "一级场景s")
    @JsonIgnore
    @TableField(exist = false)
    private List<SceneEntity> sceneEntities;

    /** 设备s */
    @JsonIgnore
    @ApiModelProperty(value = "设备IDS")
    private List<DeviceVo> deviceIds;


    /** 一级场景名称 */
    @ApiModelProperty(value = "一级场景名称")
    private String parentSceneName;

    /** 场景信息 */
    @ApiModelProperty(value = "场景信息")
    private Long sceneId;

    /** 场景名称 */
    @ApiModelProperty(value = "场景名称")
    private String sceneName;

    /** 设备信息 */
    @ApiModelProperty(value = "设备信息")
    private Long deviceId;

    /** 设备名称 */
    @ApiModelProperty(value = "设备名称")
    private String deviceName;

    /** 设备编号 */
    @ApiModelProperty(value = "设备编号")
    private String deviceCode;

    /** 设备属性 */
    @ApiModelProperty(value = "设备属性")
    private Long attributeId;

    /** 设备属性名称 */
    @ApiModelProperty(value = "设备属性名称")
    private String attributeName;

    /** 最小值 */
    @ApiModelProperty(value = "最小值")
    private Double minValue;

    /** 最大值 */
    @ApiModelProperty(value = "最大值")
    private Double maxValue;

    /** 平均值 */
    @ApiModelProperty(value = "平均值")
    private Double avgValue;

    /** 合计值 */
    @ApiModelProperty(value = "合计值")
    private Double sumValue;

    /** 最新值 */
    @ApiModelProperty(value = "最新值")
    private Double latestValue;
    /** 最新值 */
    @ApiModelProperty(value = "初始值")
    private Double firstValue;

    /** 采集时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
    @NotNull(message = "参数值不能为空")
    @ApiModelProperty(value = "采集时间")
    private Date collectDate;


    @JsonIgnore
    private Date dateCreate;

    @ApiModelProperty(value = "创建人")
    @JsonIgnore
    private String createBy;

    @JsonIgnore
    private Date dateUpdate;

    @ApiModelProperty(value = "更新人")
    @JsonIgnore
    private String updateBy;

    @ApiModelProperty(value = "报表类型")
    @TableField(exist = false)
    @JsonIgnore
    private Integer type;

    @ApiModelProperty(value = "报表类型")
    @JsonIgnore
    private List<Integer> typeIds;

    public String getMapkey(){
        StringBuilder stringBuilder=new StringBuilder();
        stringBuilder.append(this.deviceId);
        stringBuilder.append(this.attributeId);
        return stringBuilder.toString();
    }

}
