package com.bonus.canteen.core.menu.vo;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Optional;

@ColumnWidth(25)
@HeadRowHeight(25)
@ContentRowHeight(25)
public class MenuDishesExportVO {
   @ExcelProperty(
      value = {"菜品/套餐编号"},
      order = 1
   )
   private String dishesNum;
   @ExcelProperty(
      value = {"菜品/套餐名称"},
      order = 2
   )
   private String dishesName;
   @ExcelProperty(
      value = {"类型"},
      order = 3
   )
   private String mealType;
   @ExcelProperty(
      value = {"分类"},
      order = 4
   )
   private String typeName;
   @ExcelProperty(
      value = {"计价方式"},
      order = 5
   )
   private String salesMode;
   @ExcelProperty(
      value = {"规格"},
      order = 6
   )
   private String sizeType;
   @ExcelProperty(
      value = {"所属区域"},
      order = 7
   )
   private String areaName;
   @ExcelProperty(
      value = {"所属食堂"},
      order = 8
   )
   private String canteenName;
   @ExcelProperty(
      value = {"所属档口"},
      order = 9
   )
   private String stallName;
   @ExcelProperty(
      value = {"售价"},
      order = 10
   )
   private String price;
   @ExcelProperty(
      value = {"成本价"},
      order = 11
   )
   private String materialCost;
   @ExcelProperty(
      value = {"毛利"},
      order = 12
   )
   private String grossProfit;
   @ExcelProperty(
      value = {"毛利率"},
      order = 13
   )
   private String grossProfitRate;
   private Integer mealTypeIn;
   private Integer salesModeIn;
   private Integer sizeTypeIn;
   private Integer unitPriceIn;
   private Integer priceIn;
   private Integer materialCostIn;
   private Integer grossProfitIn;
   private BigDecimal grossProfitRateIn;

   public String getMealType() {
      return this.mealTypeIn == 1 ? "菜品" : "套餐";
   }

   public String getSalesMode() {
      return this.salesModeIn == 1 ? "按份" : "称重";
   }

   public String getSizeType() {
      if (this.salesModeIn == 1) {
         return this.sizeTypeIn == 1 ? "标准" : "大小份";
      } else {
         return this.unitPriceIn == 50 ? "50g" : "100g";
      }
   }

   public String getPrice() {
      String unit;
      if (this.salesModeIn == 1) {
         unit = "/份";
      } else if (this.unitPriceIn == 50) {
         unit = "/50g";
      } else {
         unit = "/100g";
      }

      BigDecimal priceB = BigDecimal.valueOf((long)this.priceIn).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP);
      String var10000 = String.valueOf(priceB);
      return var10000 + unit;
   }

   public String getMaterialCost() {
      BigDecimal materialCostB = BigDecimal.valueOf((long)(Integer)Optional.ofNullable(this.materialCostIn).orElse(0)).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP);
      return String.valueOf(materialCostB) + "元";
   }

   public String getGrossProfit() {
      BigDecimal grossProfitB = BigDecimal.valueOf((long)(Integer)Optional.ofNullable(this.grossProfitIn).orElse(0)).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP);
      return String.valueOf(grossProfitB) + "元";
   }

   public String getGrossProfitRate() {
      BigDecimal var10000 = ((BigDecimal)Optional.ofNullable(this.grossProfitRateIn).orElse(BigDecimal.ZERO)).multiply(new BigDecimal("100"));
      return String.valueOf(var10000.setScale(0, RoundingMode.HALF_UP)) + "%";
   }

   public String getDishesNum() {
      return this.dishesNum;
   }

   public String getDishesName() {
      return this.dishesName;
   }

   public String getTypeName() {
      return this.typeName;
   }

   public String getAreaName() {
      return this.areaName;
   }

   public String getCanteenName() {
      return this.canteenName;
   }

   public String getStallName() {
      return this.stallName;
   }

   public Integer getMealTypeIn() {
      return this.mealTypeIn;
   }

   public Integer getSalesModeIn() {
      return this.salesModeIn;
   }

   public Integer getSizeTypeIn() {
      return this.sizeTypeIn;
   }

   public Integer getUnitPriceIn() {
      return this.unitPriceIn;
   }

   public Integer getPriceIn() {
      return this.priceIn;
   }

   public Integer getMaterialCostIn() {
      return this.materialCostIn;
   }

   public Integer getGrossProfitIn() {
      return this.grossProfitIn;
   }

   public BigDecimal getGrossProfitRateIn() {
      return this.grossProfitRateIn;
   }

   public void setDishesNum(final String dishesNum) {
      this.dishesNum = dishesNum;
   }

   public void setDishesName(final String dishesName) {
      this.dishesName = dishesName;
   }

   public void setMealType(final String mealType) {
      this.mealType = mealType;
   }

   public void setTypeName(final String typeName) {
      this.typeName = typeName;
   }

   public void setSalesMode(final String salesMode) {
      this.salesMode = salesMode;
   }

   public void setSizeType(final String sizeType) {
      this.sizeType = sizeType;
   }

   public void setAreaName(final String areaName) {
      this.areaName = areaName;
   }

   public void setCanteenName(final String canteenName) {
      this.canteenName = canteenName;
   }

   public void setStallName(final String stallName) {
      this.stallName = stallName;
   }

   public void setPrice(final String price) {
      this.price = price;
   }

   public void setMaterialCost(final String materialCost) {
      this.materialCost = materialCost;
   }

   public void setGrossProfit(final String grossProfit) {
      this.grossProfit = grossProfit;
   }

   public void setGrossProfitRate(final String grossProfitRate) {
      this.grossProfitRate = grossProfitRate;
   }

   public void setMealTypeIn(final Integer mealTypeIn) {
      this.mealTypeIn = mealTypeIn;
   }

   public void setSalesModeIn(final Integer salesModeIn) {
      this.salesModeIn = salesModeIn;
   }

   public void setSizeTypeIn(final Integer sizeTypeIn) {
      this.sizeTypeIn = sizeTypeIn;
   }

   public void setUnitPriceIn(final Integer unitPriceIn) {
      this.unitPriceIn = unitPriceIn;
   }

   public void setPriceIn(final Integer priceIn) {
      this.priceIn = priceIn;
   }

   public void setMaterialCostIn(final Integer materialCostIn) {
      this.materialCostIn = materialCostIn;
   }

   public void setGrossProfitIn(final Integer grossProfitIn) {
      this.grossProfitIn = grossProfitIn;
   }

   public void setGrossProfitRateIn(final BigDecimal grossProfitRateIn) {
      this.grossProfitRateIn = grossProfitRateIn;
   }
}
