package com.zcxk.charge.core.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.zcxk.core.utils.encrypt.Md5;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 数据报警详情
 * @author lihui
 * @version V1.0
 * @date 2021/5/31
 **/
@Data
@TableName("sms_data_alarm_detail")
public class DataAlarmDetailEntity extends DataAlarmSetting {

    @ApiModelProperty(value = "报警管理ID")
    private Long manageId;

    @ApiModelProperty(value = "名称")
    private String alarmName;

    @ApiModelProperty(value = "报警开始时间")
    private Date alarmStartTime;

    @ApiModelProperty(value = "报警结束时间")
    private Date alarmEndTime;

    @ApiModelProperty(value = "报警值")
    private BigDecimal beAlarmValue;

    @ApiModelProperty(value = "对比报警值")
    private BigDecimal toAlarmValue;

    @ApiModelProperty(value = "报警结果值")
    private BigDecimal resultAlarmValue;

    @ApiModelProperty(value = "历史数据：0不是，1是")
    private int isHistory;

    @ApiModelProperty(value = "是否被挂起：0不是，1是")
    private int isHangup;

    public String getMd5Query(){
        StringBuffer buffer = new StringBuffer();
        buffer.append(super.getBeSceneId()).append(super.getBeDeviceId()).append(super.getBeAttributeId())
                .append(super.getBeType()).append(super.getComputeRules()).append(super.getToSceneId()).append(super.getToDeviceId())
                .append(super.getToAttributeId()).append(super.getToType()).append(super.getAlarmRules()).append(super.getAlarmValue());
        return Md5.hash(buffer.toString());
    }

}
