package com.pqs9000.pojo.report;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.metadata.BaseRowModel;

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

/**
 * 提取用采数据或者将用采数据写进excel的实体类
 * @author hongawen
 * @Date: 2019/4/11 10:43
 */
public class UserDataExcelBody extends BaseRowModel implements Serializable,Comparable<UserDataExcelBody> {

    @ExcelProperty(index = 0)
    private Date time;

    @ExcelProperty(value = "瞬时有功" ,index = 1)
    private BigDecimal work;

    @ExcelProperty(value = "户号" ,index = 2)
    private String userId;

    @ExcelProperty(value = "测量点局号" ,index = 3)
    private String line;

    //事件发生时间的毫秒计时
    @ExcelProperty(value = "户名" ,index = 4)
    private String userName;


    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public BigDecimal getWork() {
        return work;
    }

    public void setWork(BigDecimal work) {
        this.work = new BigDecimal(Math.abs(work.floatValue()));
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getLine() {
        return line;
    }

    public void setLine(String line) {
        this.line = line;
    }

    @Override
    public String toString() {
        return "UserDataExcelBody{" +
                "time=" + time +
                ", work=" + work +
                ", userId='" + userId + '\'' +
                ", line='" + line + '\'' +
                ", userName='" + userName + '\'' +
                '}';
    }

    @Override
    public int compareTo(UserDataExcelBody o) {
        if(this.time.getTime()>o.getTime().getTime()){
            return 1;
        }else if(this.time.getTime()==o.getTime().getTime()){

        }
        return -1;
    }
}
