package com.zcxk.charge.api.dto.generalview;

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

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

/**
 * @description 供水/原水数据详情
 * @author  wangli
 * @data 2020/12/31 16:44
 */
@Data
@Api("供水/原水数据详情")
public class DeviceWaterAmount implements Serializable {

    private static final long serialVersionUID = 1140562129268115741L;

    @ApiModelProperty("供水瞬时流量")
    @JsonSerialize(using = BigDecimalJsonSerializer.class)
    private BigDecimal waterSupplyAmountForNow = BigDecimal.ZERO;
    @ApiModelProperty("本日供水量")
    @JsonSerialize(using = BigDecimalJsonSerializer.class)
    private BigDecimal waterSupplyAmountForDay = BigDecimal.ZERO;
    @ApiModelProperty("本月供水量")
    @JsonSerialize(using = BigDecimalJsonSerializer.class)
    private BigDecimal waterSupplyAmountForMonth = BigDecimal.ZERO;
    @ApiModelProperty("本年供水量")
    @JsonSerialize(using = BigDecimalJsonSerializer.class)
    private BigDecimal waterSupplyAmountForYear = BigDecimal.ZERO;

    @ApiModelProperty("原水瞬时流量")
    @JsonSerialize(using = BigDecimalJsonSerializer.class)
    private BigDecimal waterIntakeAmountForNow = BigDecimal.ZERO;
    @ApiModelProperty("本日原水量")
    @JsonSerialize(using = BigDecimalJsonSerializer.class)
    private BigDecimal waterIntakeAmountForDay = BigDecimal.ZERO;
    @ApiModelProperty("本月原水量")
    @JsonSerialize(using = BigDecimalJsonSerializer.class)
    private BigDecimal waterIntakeAmountForMonth = BigDecimal.ZERO;
    @ApiModelProperty("本年原水量")
    @JsonSerialize(using = BigDecimalJsonSerializer.class)
    private BigDecimal waterIntakeAmountForYear = BigDecimal.ZERO;

    public void addWaterSupplyAmountForNow(BigDecimal amount){
        if(this.waterSupplyAmountForNow == null){
            this.waterSupplyAmountForNow = amount;
        }else{
            this.waterSupplyAmountForNow = this.waterSupplyAmountForNow.add(amount);
        }
    }

    public void addWaterIntakeAmountForNow(BigDecimal amount){
        if(this.waterIntakeAmountForNow == null){
            this.waterIntakeAmountForNow = amount;
        }else{
            this.waterIntakeAmountForNow = this.waterIntakeAmountForNow.add(amount);
        }
    }


    public void addWaterSupplyAmountForDay(BigDecimal amount){
        if(this.waterSupplyAmountForDay == null){
            this.waterSupplyAmountForDay = amount;
        }else{
            this.waterSupplyAmountForDay = this.waterSupplyAmountForDay.add(amount);
        }
    }

    public void addWaterIntakeAmountForDay(BigDecimal amount){
        if(this.waterIntakeAmountForDay == null){
            this.waterIntakeAmountForDay = amount;
        }else{
            this.waterIntakeAmountForDay= this.waterIntakeAmountForDay.add(amount);
        }
    }
}
