package com.zcxk.dto.generalView;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.zcxk.util.jsonSerializer.BigDecimalJsonSerializer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

/**
 * @description
 * @auto wangli
 * @data 2021/1/6 14:44
 */
@Api("供水曲线图")
@Data
public class WaterSupplyChart implements Serializable {

    private static final long serialVersionUID = -7408540431210984136L;

    @ApiModelProperty("序号")
    private Integer sort;
    @ApiModelProperty("日期")
    private String date;
    @ApiModelProperty("制水量/取水量/水位")
    @JsonSerialize(using = BigDecimalJsonSerializer.class)
    private BigDecimal waterData = BigDecimal.ZERO;
    @ApiModelProperty("电耗")
    @JsonSerialize(using = BigDecimalJsonSerializer.class)
    private BigDecimal powerData = BigDecimal.ZERO;
    @ApiModelProperty("药耗")
    @JsonSerialize(using = BigDecimalJsonSerializer.class)
    private BigDecimal drugData = BigDecimal.ZERO;


    public WaterSupplyChart (){ }

    public WaterSupplyChart ( Integer i){
        this.sort=i;
        this.waterData=BigDecimal.ZERO;
        this.powerData=BigDecimal.ZERO;
        this.drugData=BigDecimal.ZERO;
        this.date= DateTimeFormatter.ofPattern("yyyy-MM-dd").format(LocalDate.now().plusDays(-i));

    }
    public WaterSupplyChart ( Integer i,Integer type){
        this.sort=i;
        this.waterData=BigDecimal.ZERO;
        this.powerData=BigDecimal.ZERO;
        this.drugData=BigDecimal.ZERO;
        this.date= DateTimeFormatter.ofPattern("yyyy-MM").format(LocalDate.now().plusMonths(-i));

    }
    public WaterSupplyChart (Integer i,String dateString){
        this.sort=i;
        this.waterData=BigDecimal.ZERO;
        this.powerData=BigDecimal.ZERO;
        this.drugData=BigDecimal.ZERO;
        this.date= dateString;

    }
}