package cn.com.victorysoft.business.indicator.dto;

import cn.com.victorysoft.business.indicator.entity.MoreSummary;
import cn.com.victorysoft.business.sys.param.UnitMonthParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

import static cn.com.victorysoft.business.indicator.constant.Constants.*;

@ApiModel("超注统计返回对象")
@Data
public class MoreSummaryDto {

    public MoreSummaryDto(MoreSummary summary) {
        this.unitcode = summary.getUnitcode();
        this.unitname = summary.getUnitname();
        this.month = summary.getMonth();
        this.summaryDate = summary.getSummaryDate();
    }

    public MoreSummaryDto(UnitMonthParam param) {
        this.unitcode = param.getUnitcode();
        this.month = param.getMonth();
    }

    @ApiModelProperty("单位代码")
    private String unitcode;

    @ApiModelProperty("单位名称")
    private String unitname;

    @ApiModelProperty("年月")
    private String month;

    @ApiModelProperty("原有超注层井数-提水类")
    private Integer originalWellLift;

    @ApiModelProperty("原有超注层层数-提水类")
    private Integer originalSectionLift;

    @ApiModelProperty("原有超注层水量-提水类")
    private BigDecimal originalWaterLift;

    @ApiModelProperty("新增超注层井数-提水类")
    private Integer increaseWellLift;

    @ApiModelProperty("新增超注层层数-提水类")
    private Integer increaseSectionLift;

    @ApiModelProperty("新增超注层水量-提水类")
    private BigDecimal increaseWaterLift;

    @ApiModelProperty("治理超注层井数-提水类")
    private Integer reduceWellLift;

    @ApiModelProperty("治理超注层层数-提水类")
    private Integer reduceSectionLift;

    @ApiModelProperty("治理超注层水量-提水类")
    private BigDecimal reduceWaterLift;

    @ApiModelProperty("超注层井数-提水类")
    private Integer wellLift;

    @ApiModelProperty("超注层层数-提水类")
    private Integer sectionLift;

    @ApiModelProperty("超注层水量-提水类")
    private BigDecimal waterLift;

    @ApiModelProperty("原有超注层井数-保合格率")
    private Integer originalWellQualify;

    @ApiModelProperty("原有超注层层数-保合格率")
    private Integer originalSectionQualify;

    @ApiModelProperty("原有超注层水量-保合格率")
    private BigDecimal originalWaterQualify;

    @ApiModelProperty("新增超注层井数-保合格率")
    private Integer increaseWellQualify;

    @ApiModelProperty("新增超注层层数-保合格率")
    private Integer increaseSectionQualify;

    @ApiModelProperty("新增超注层水量-保合格率")
    private BigDecimal increaseWaterQualify;

    @ApiModelProperty("治理超注层井数-保合格率")
    private Integer reduceWellQualify;

    @ApiModelProperty("治理超注层层数-保合格率")
    private Integer reduceSectionQualify;

    @ApiModelProperty("治理超注层水量-保合格率")
    private BigDecimal reduceWaterQualify;

    @ApiModelProperty("超注层井数-保合格率")
    private Integer wellQualify;

    @ApiModelProperty("超注层层数-保合格率")
    private Integer sectionQualify;

    @ApiModelProperty("超注层水量-保合格率")
    private BigDecimal waterQualify;

    @ApiModelProperty("原有超注层井数-死嘴漏失")
    private Integer originalWellLeakage;

    @ApiModelProperty("原有超注层层数-死嘴漏失")
    private Integer originalSectionLeakage;

    @ApiModelProperty("原有超注层水量-死嘴漏失")
    private BigDecimal originalWaterLeakage;

    @ApiModelProperty("新增超注层井数-死嘴漏失")
    private Integer increaseWellLeakage;

    @ApiModelProperty("新增超注层层数-死嘴漏失")
    private Integer increaseSectionLeakage;

    @ApiModelProperty("新增超注层水量-死嘴漏失")
    private BigDecimal increaseWaterLeakage;

    @ApiModelProperty("治理超注层井数-死嘴漏失")
    private Integer reduceWellLeakage;

    @ApiModelProperty("治理超注层层数-死嘴漏失")
    private Integer reduceSectionLeakage;

    @ApiModelProperty("治理超注层水量-死嘴漏失")
    private BigDecimal reduceWaterLeakage;

    @ApiModelProperty("超注层井数-死嘴漏失")
    private Integer wellLeakage;

    @ApiModelProperty("超注层层数-死嘴漏失")
    private Integer sectionLeakage;

    @ApiModelProperty("超注层水量-死嘴漏失")
    private BigDecimal waterLeakage;

    @ApiModelProperty("统计时间")
    private Date summaryDate;

    public boolean equalSummary(MoreSummary summary) {
        return this.getUnitcode().equals(summary.getUnitcode()) && this.getMonth().equals(summary.getMonth());
    }

    public void setSummaryValue(MoreSummary summary) {
        if (TI_SHUI_LEI.equals(summary.getReasonId())) {
            this.originalWellLift = summary.getOriginalWell();
            this.originalSectionLift = summary.getOriginalSection();
            this.originalWaterLift = summary.getOriginalWater();
            this.increaseWellLift = summary.getIncreaseWell();
            this.increaseSectionLift = summary.getIncreaseSection();
            this.increaseWaterLift = summary.getIncreaseWater();
            this.reduceWellLift = summary.getReduceWell();
            this.reduceSectionLift = summary.getReduceSection();
            this.reduceWaterLift = summary.getReduceWater();
            this.wellLift = summary.getWell();
            this.sectionLift = summary.getSection();
            this.waterLift = summary.getWater();
        }
        if (BAO_HE_GE_LV.equals(summary.getReasonId())) {
            this.originalWellQualify = summary.getOriginalWell();
            this.originalSectionQualify = summary.getOriginalSection();
            this.originalWaterQualify = summary.getOriginalWater();
            this.increaseWellQualify = summary.getIncreaseWell();
            this.increaseSectionQualify = summary.getIncreaseSection();
            this.increaseWaterQualify = summary.getIncreaseWater();
            this.reduceWellQualify = summary.getReduceWell();
            this.reduceSectionQualify = summary.getReduceSection();
            this.reduceWaterQualify = summary.getReduceWater();
            this.wellQualify = summary.getWell();
            this.sectionQualify = summary.getSection();
            this.waterQualify = summary.getWater();
        }
        if (SI_ZUI_LOU_SHI.equals(summary.getReasonId())) {
            this.originalWellLeakage = summary.getOriginalWell();
            this.originalSectionLeakage = summary.getOriginalSection();
            this.originalWaterLeakage = summary.getOriginalWater();
            this.increaseWellLeakage = summary.getIncreaseWell();
            this.increaseSectionLeakage = summary.getIncreaseSection();
            this.increaseWaterLeakage = summary.getIncreaseWater();
            this.reduceWellLeakage = summary.getReduceWell();
            this.reduceSectionLeakage = summary.getReduceSection();
            this.reduceWaterLeakage = summary.getReduceWater();
            this.wellLeakage = summary.getWell();
            this.sectionLeakage = summary.getSection();
            this.waterLeakage = summary.getWater();
        }
    }
}
