package com.mvc.model.forwarding;

import com.mvc.model.TAireadModel;
import com.mvc.utils.DateUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * 万帮拓源数据对接请求参数
 */
public class WbtyRequestModel {
    private String meterAddr;
    private String wellNum;
    private Integer csq;
    private Double voltage;
    private List<WbtyRequestNumModel> nums;

    /**
     * TAireadModel构造
     * @param tAireadModel
     */
    public WbtyRequestModel(TAireadModel tAireadModel) {
        this.meterAddr = tAireadModel.getDeviceSn();
        this.wellNum = tAireadModel.getStationCode();//机井编码,用站编码
        this.csq = tAireadModel.getCsq()!=null?tAireadModel.getCsq():tAireadModel.getRsrp();//旧设备可能没有csq,没有的就用RSRP
        this.voltage = tAireadModel.getVoltage().doubleValue();
        WbtyRequestNumModel num = new WbtyRequestNumModel();
        num.setDatetime(DateUtil.formateDate(tAireadModel.getSampleTime(), DateUtil.PATTERN_DATA_NORMAL));
        List<WbtyRequestNumModel> temp = new ArrayList<>();
        temp.add(num);
        this.setNums(temp);
    }

    public String getMeterAddr() {
        return meterAddr;
    }

    public void setMeterAddr(String meterAddr) {
        this.meterAddr = meterAddr;
    }

    public String getWellNum() {
        return wellNum;
    }

    public void setWellNum(String wellNum) {
        this.wellNum = wellNum;
    }

    public Integer getCsq() {
        return csq;
    }

    public void setCsq(Integer csq) {
        this.csq = csq;
    }

    public Double getVoltage() {
        return voltage;
    }

    public void setVoltage(Double voltage) {
        this.voltage = voltage;
    }

    public List<WbtyRequestNumModel> getNums() {
        return nums;
    }

    public void setNums(List<WbtyRequestNumModel> nums) {
        this.nums = nums;
    }
}
