package com.njcn.event.pojo.po;

import cn.hutool.core.util.NumberUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.LocalDate;

/**
 * <p>
 * 
 * </p>
 *
 * @author rui.wu
 * @since 2022-10-11
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("r_stat_event_org_m")
@ApiModel(value="RStatEventOrgM对象", description="")
public class RStatEventOrgM implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "单位ID")
    @TableId(value = "org_no", type = IdType.ASSIGN_ID)
    private String orgNo;

    @ApiModelProperty(value = "生成数据的时间,每月统计一次")
    private LocalDate dataDate;

    @ApiModelProperty(value = "稳态指标类型Id，字典表ID")
    private String eventType;

    @ApiModelProperty(value = "日均发生暂态监测点数（根据 发生暂态监测点数 取平均值）")
    private Float eventMeasurementAverage;

    @ApiModelProperty(value = "累计发生暂态监测点数（监测点暂态指标超标明细日表）")
    private Integer eventMeasurementAccrued;

    @ApiModelProperty(value = "暂态指标发生频次（日表的暂态指标发生次数之和/日表的发生暂态监测点数之和）")
    private Float eventFreq;

    @ApiModelProperty(value = "暂态指标发生次数（日表的暂态指标发生次数之和）")
    private Integer eventCount;

    @ApiModelProperty(value = "日均发生暂态监测点数占比（根据 日均发生暂态监测点数占比 取平均值）")
    private Float eventMeasurementRatioAverage;

    @ApiModelProperty(value = "累计发生暂态监测点数占比（此表的累计发生暂态监测点数/区域统计表中的区域分类统计月表中的发生暂态的监测点数）")
    private Float eventMeasurementRatioAccrued;

    @ApiModelProperty(value = "数据类型,字典表（01：主网测点  02：配网测点）")
    private String dataType;

    public void setEventMeasurementRatioAverage(Float eventMeasurementRatioAverage) {
        this.eventMeasurementRatioAverage = NumberUtil.round(eventMeasurementRatioAverage*100,2).floatValue();;
    }

    public void setEventMeasurementRatioAccrued(Float eventMeasurementRatioAccrued) {
        this.eventMeasurementRatioAccrued =  NumberUtil.round(eventMeasurementRatioAccrued*100,2).floatValue();;
    }
}
