package com.jjt.ws.domain;

import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.jjt.common.annotation.Excel;
import com.jjt.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
 * 能源统计对象 TWIN_WORKSHOP_CALC
 *
 * @author wukai
 * @date 2025-03-16
 */
@ApiModel(value = "TwinWorkshopCalc", description = "能源统计")
@Data
public class TwinWorkshopCalc extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 统计ID
     */
    @ApiModelProperty("统计ID")
    @TableId
    private Long calcId;

    /**
     * 日期
     */
    @ApiModelProperty("日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date dataDate;

    /**
     * 车间ID
     */
    @ApiModelProperty("车间ID")
    @Excel(name = "车间ID")
    private Long wsId;

    @ApiModelProperty("车间编码")
    private String wsCode;
    @ApiModelProperty("车间名称")
    private String wsName;

    /**
     * 总价格
     */
    @ApiModelProperty("总价格")
    @Excel(name = "总价格")
    private BigDecimal totalPrice;

    /**
     * A班价格
     */
    @ApiModelProperty("A班价格")
    @Excel(name = "A班价格")
    @JsonProperty("aPrice")
    private BigDecimal aPrice;

    /**
     * B班价格
     */
    @ApiModelProperty("B班价格")
    @Excel(name = "B班价格")
    @JsonProperty("bPrice")
    private BigDecimal bPrice;

    /**
     * 总计
     */
    @ApiModelProperty("总计")
    @Excel(name = "总计")
    private BigDecimal totalValue;

    /**
     * A班统计
     */
    @ApiModelProperty("A班统计")
    @Excel(name = "A班统计")
    @JsonProperty("aValue")
    private BigDecimal aValue;

    /**
     * B班统计
     */
    @ApiModelProperty("B班统计")
    @Excel(name = "B班统计")
    @JsonProperty("bValue")
    private BigDecimal bValue;

    /**
     * 峰电电价
     */
    @ApiModelProperty("峰电电价")
    @Excel(name = "峰电电价")
    private BigDecimal peakUPrice;

    /**
     * 谷电电价
     */
    @ApiModelProperty("谷电电价")
    @Excel(name = "谷电电价")
    private BigDecimal valleyUPrice;

    /**
     * 平电电价
     */
    @ApiModelProperty("平电电价")
    @Excel(name = "平电电价")
    private BigDecimal flatUPrice;

    /**
     * 尖峰电价
     */
    @ApiModelProperty("尖峰电价")
    @Excel(name = "尖峰电价")
    private BigDecimal superPeakUPrice;

    /**
     * 峰电电费
     */
    @ApiModelProperty("峰电电费")
    @Excel(name = "峰电电费")
    private BigDecimal peakTPrice;

    /**
     * 谷电电费
     */
    @ApiModelProperty("谷电电费")
    @Excel(name = "谷电电费")
    private BigDecimal valleyTPrice;

    /**
     * 平电电费
     */
    @ApiModelProperty("平电电费")
    @Excel(name = "平电电费")
    private BigDecimal flatTPrice;

    /**
     * 尖峰电费
     */
    @ApiModelProperty("尖峰电费")
    @Excel(name = "尖峰电费")
    private BigDecimal superPeakTPrice;

    /**
     * 峰电用能
     */
    @ApiModelProperty("峰电用能")
    @Excel(name = "峰电用能")
    private BigDecimal peakValue;

    /**
     * 谷电用能
     */
    @ApiModelProperty("谷电用能")
    @Excel(name = "谷电用能")
    private BigDecimal valleyValue;

    /**
     * 平电用能
     */
    @ApiModelProperty("平电用能")
    @Excel(name = "平电用能")
    private BigDecimal flatValue;

    /**
     * 尖峰用能
     */
    @ApiModelProperty("尖峰用能")
    @Excel(name = "尖峰用能")
    private BigDecimal superPeakValue;

    public void setValue(BigDecimal aValue, BigDecimal bValue) {
        this.aValue = aValue == null ? BigDecimal.ZERO : aValue;
        this.bValue = bValue == null ? BigDecimal.ZERO : bValue;
        this.totalValue = this.aValue.add(this.bValue);
    }

    public void setPrice(BigDecimal aPrice, BigDecimal bPrice) {
        this.aPrice = aPrice == null ? BigDecimal.ZERO : aPrice;
        this.bPrice = bPrice == null ? BigDecimal.ZERO : bPrice;
        this.totalPrice = this.aPrice.add(this.bPrice);
    }
}
