package com.jjt.ws.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jjt.common.annotation.Excel;
import com.jjt.elec.domain.ElecPrice;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
 * 能耗
 *
 * @author ruoyi
 * @date 2024-12-30
 */
@Data
@ApiModel(value = "MonthCalcVO", description = "月统计视图")
public class MonthCalcVO {
    private static final long serialVersionUID = 1L;

    public MonthCalcVO() {
        this.d = new D();
        this.s = new S();
        this.q = new Q();
    }

    @ApiModelProperty("日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date date;
    @ApiModelProperty("电价")
    private ElecPrice elecPrice;
    @ApiModelProperty(name = "总费用")
    private BigDecimal price;
    @ApiModelProperty(name = "米长")
    private BigDecimal length;
    @ApiModelProperty(name = "重量")
    private BigDecimal weight;
    @ApiModelProperty(name = "平均每米费用")
    private BigDecimal avgLengthPrice;
    @ApiModelProperty(name = "平均每KG费用")
    private BigDecimal avgWeightPrice;
    @ApiModelProperty(name = "电")
    private D d;

    @ApiModelProperty(name = "水")
    private S s;

    @ApiModelProperty(name = "汽")
    private Q q;

    public void setPrice() {
        BigDecimal dPrice = d.getQz().getPrice().add(d.getHz().getPrice()).add(d.getYr().getPrice());
        d.setPrice(dPrice);
        BigDecimal qPrice = q.getLowPrice();
        if (q.getMidPrice() != null) {
            qPrice = qPrice.add(q.getMidPrice());
        }
        q.setPrice(qPrice);
        BigDecimal sPrice = s.getPrice();
        this.price = dPrice.add(qPrice).add(sPrice);
    }


    @Data
    public static class D {
        public D() {
            this.qz = new DD();
            this.hz = new DD();
            this.yr = new DD();
            this.price = BigDecimal.ZERO;
        }

        @ApiModelProperty("电总费用")
        private BigDecimal price;
        @ApiModelProperty("前整车间")
        private DD qz;
        @ApiModelProperty("后整车间")
        private DD hz;
        @ApiModelProperty("印染车间")
        private DD yr;

        @Data
        public static class DD {
            private BigDecimal use;
            private BigDecimal fUse;
            private BigDecimal gUse;
            private BigDecimal pUse;
            private BigDecimal jfUse;
            private BigDecimal price;
            private BigDecimal fPrice;
            private BigDecimal gPrice;
            private BigDecimal pPrice;
            private BigDecimal jfPrice;
        }
    }

    @Data
    public static class S {
        @ApiModelProperty("水总费用")
        private BigDecimal price;
        @ApiModelProperty("水用量")
        private BigDecimal use;
        @ApiModelProperty("单价")
        private BigDecimal unitPrice;
        @ApiModelProperty("水洗用量")
        private BigDecimal sxUse;
        @ApiModelProperty("水洗价格")
        private BigDecimal sxPrice;
        @ApiModelProperty("调浆用量")
        private BigDecimal tjUse;
        @ApiModelProperty("调浆价格")
        private BigDecimal tjPrice;
        @ApiModelProperty("洗版用量")
        private BigDecimal xbUse;
        @ApiModelProperty("洗版价格")
        private BigDecimal xbPrice;
        @ApiModelProperty("制版用量")
        private BigDecimal zbUse;
        @ApiModelProperty("制版价格")
        private BigDecimal zbPrice;
    }

    @Data
    public static class Q {
        @ApiModelProperty("汽总费用")
        private BigDecimal price;
        @ApiModelProperty("低压用量")
        private BigDecimal lowUse;
        @ApiModelProperty("低压单价")
        private BigDecimal lowUnitPrice;
        @ApiModelProperty("低压总价")
        private BigDecimal lowPrice;
        @ApiModelProperty("中压用量")
        private BigDecimal midUse;
        @ApiModelProperty("中压单价")
        private BigDecimal midUnitPrice;
        @ApiModelProperty("中压总价")
        private BigDecimal midPrice;
    }


}
