package com.bonus.canteen.core.order.web.vo.export;

import cn.hutool.core.bean.BeanUtil;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.bonus.canteen.core.common.constant.NuclearModeEnum;
import com.bonus.canteen.core.common.enums.DeliveryTypeEnum;
import com.bonus.canteen.core.common.enums.SourceTypeEnum;
import com.bonus.canteen.core.common.utils.CustomNumberConverter;
import com.bonus.canteen.core.common.utils.SysUtil;
import com.bonus.canteen.core.order.common.constants.OrderStateEnum;
import com.bonus.canteen.core.order.common.constants.OrderStateMixEnum;
import com.bonus.canteen.core.order.utils.LeOrderUtil;
import com.bonus.canteen.core.order.web.vo.OrderListWebVO;
import com.bonus.canteen.core.pay.common.constants.PayStateEnum;
import io.swagger.annotations.ApiModelProperty;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

public class OrderSupermarketDetailExportVO {
   @ApiModelProperty("人员id")
   @ExcelIgnore
   private Long custId;
   @ApiModelProperty("人员姓名")
   @ExcelProperty(
      value = {"用户姓名"},
      order = 0
   )
   private String custName;
   @ApiModelProperty("人员编号")
   @ExcelProperty(
      value = {"用户编号"},
      order = 1
   )
   private String custNum;
   @ApiModelProperty("手机号")
   @ExcelProperty(
      value = {"用户手机号"},
      order = 2
   )
   private String mobile;
   @ApiModelProperty("组织名称")
   @ExcelProperty(
      value = {"所属组织"},
      order = 3
   )
   private String orgFullName;
   @ApiModelProperty("人员类别")
   @ExcelProperty(
      value = {"用户类别"},
      order = 4
   )
   private String psnTypeName;
   @ApiModelProperty("订单来源")
   @ExcelProperty(
      value = {"订单来源"},
      order = 5,
      converter = SourceTypeEnum.ExcelConvertor.class
   )
   private Integer sourceType;
   @ApiModelProperty("设备sn码")
   @ExcelProperty(
      value = {"设备SN码"},
      order = 6
   )
   private String machineSn;
   @ApiModelProperty("设备编号")
   @ExcelProperty(
      value = {"设备编号"},
      order = 6
   )
   private String machineNum;
   @ApiModelProperty("设备名称")
   @ExcelProperty(
      value = {"设备名称"},
      order = 6
   )
   private String deviceName;
   @ApiModelProperty("设备型号")
   @ExcelProperty(
      value = {"设备型号"},
      order = 6
   )
   private String deviceModel;
   @ApiModelProperty("订单号")
   @ExcelProperty(
      value = {"订单号"},
      order = 7
   )
   private Long orderId;
   @ApiModelProperty("设备订单号")
   @ExcelProperty(
      value = {"设备订单号"},
      order = 8
   )
   private String macOrderId;
   @ApiModelProperty("订单日期")
   @ExcelProperty(
      value = {"订单日期"},
      order = 9
   )
   private LocalDate orderDate;
   @ApiModelProperty("下单时间")
   @ExcelProperty(
      value = {"下单时间"},
      order = 10
   )
   private LocalDateTime orderTime;
   @ApiModelProperty("支付时间")
   @ExcelProperty(
      value = {"支付时间"},
      order = 11
   )
   private LocalDateTime payTime;
   @ApiModelProperty(
      value = "食堂id",
      hidden = true
   )
   @ExcelIgnore
   private Long canteenId;
   @ApiModelProperty("超市名称")
   @ExcelProperty(
      value = {"超市名称"},
      order = 12
   )
   private String canteenName;
   @ApiModelProperty(
      value = "档口id",
      hidden = true
   )
   @ExcelIgnore
   private Long stallId;
   @ApiModelProperty("所属档口")
   @ExcelIgnore
   private String stallName;
   @ApiModelProperty(
      value = "餐次类型",
      hidden = true
   )
   @ExcelIgnore
   private Integer mealtimeType;
   @ApiModelProperty("餐次名称")
   @ExcelProperty(
      value = {"餐次名称"},
      order = 14
   )
   @ExcelIgnore
   private String mealtimeName;
   @ExcelProperty(
      value = {"商品明细"},
      order = 15
   )
   private String dishDetailStr;
   @ExcelProperty(
      value = {"已退商品"},
      order = 28
   )
   private String refundDishDetailStr;
   @ApiModelProperty("商品明细")
   @ExcelProperty(
      value = {"商品明细"},
      order = 15
   )
   private String orderDetailList;
   @ApiModelProperty("已退商品")
   @ExcelProperty(
      value = {"已退商品"},
      order = 28
   )
   private String refundOrderDetailList;
   @ApiModelProperty("订单金额")
   @ExcelProperty(
      value = {"订单金额"},
      order = 16,
      converter = CustomNumberConverter.class
   )
   private BigDecimal payableAmount;
   @ApiModelProperty("餐券支付金额")
   @ExcelProperty(
      value = {"餐券支付金额"},
      order = 17,
      converter = CustomNumberConverter.class
   )
   @ExcelIgnore
   private BigDecimal couponAmount;
   @ApiModelProperty("餐券名称")
   @ExcelProperty(
      value = {"餐券名称"},
      order = 18
   )
   @ExcelIgnore
   private String couponName;
   @ApiModelProperty("核身方式")
   @ExcelProperty(
      value = {"核身方式"},
      order = 19,
      converter = NuclearModeEnum.ExcelConvertor.class
   )
   @ExcelIgnore
   private Integer nuClearMode;
   @ApiModelProperty("实付金额")
   @ExcelProperty(
      value = {"实付金额"},
      order = 20,
      converter = CustomNumberConverter.class
   )
   private BigDecimal realAmount;
   @ExcelProperty(
      value = {"退款金额"},
      order = 28,
      converter = CustomNumberConverter.class
   )
   private BigDecimal refundAmount;
   @ApiModelProperty("支付方式")
   @ExcelProperty(
      value = {"支付方式"},
      order = 21
   )
   private Integer payType;
   @ApiModelProperty("支付渠道")
   private Integer payChannel;
   @ApiModelProperty("扣款类型 1 下单扣款 2 核销扣款")
   private Integer deductionType;
   @ApiModelProperty("配送方式")
   @ExcelProperty(
      value = {"配送方式"},
      order = 22,
      converter = DeliveryTypeEnum.ExcelConvertor.class
   )
   private Integer deliveryType;
   /** @deprecated */
   @ExcelProperty(
      value = {"订单状态"},
      order = 23,
      converter = OrderStateEnum.ExcelConvertor.class
   )
   private Integer orderState;
   @ApiModelProperty("订单状态（混合版）")
   @ExcelProperty(
      value = {"订单状态"},
      order = 23,
      converter = OrderStateMixEnum.ExcelConvertor.class
   )
   private Integer orderStateMix;
   @ApiModelProperty("支付状态")
   @ExcelProperty(
      value = {"支付状态"},
      order = 24,
      converter = PayStateEnum.ExcelConvertor.class
   )
   private Integer payState;
   @ApiModelProperty("订单退款状态")
   @ExcelProperty(
      value = {"订单退款状态"},
      order = 25
   )
   private Integer orderRefundState;
   @ApiModelProperty("配送费")
   @ExcelProperty(
      value = {"配送费"},
      order = 26,
      converter = CustomNumberConverter.class
   )
   private BigDecimal deliveryAmount;
   @ApiModelProperty("包装费")
   @ExcelProperty(
      value = {"包装费"},
      order = 27,
      converter = CustomNumberConverter.class
   )
   private BigDecimal packingAmount;
   @ApiModelProperty("订单图片")
   private String imgUrl;
   @ApiModelProperty("订单备注")
   @ExcelIgnore
   private String remark;
   @ApiModelProperty("设备支付抓拍照片")
   @ExcelIgnore
   private String orderPhotoUrl;
   @ExcelProperty(
      value = {"流水号"},
      order = 28
   )
   private String mealCode;

   public String getImgUrl() {
      return SysUtil.getCutFileUrl(this.imgUrl);
   }

   public Integer getOrderStateMix() {
      return OrderStateMixEnum.mixStateBy(this.getOrderState(), this.getPayState(), this.getOrderRefundState());
   }

   public String getOrderPhotoUrl() {
      return SysUtil.getCutFileUrl(this.orderPhotoUrl);
   }

   public static OrderSupermarketDetailExportVO of(OrderListWebVO orderListWebVO, Integer orderType) {
      OrderSupermarketDetailExportVO vo = (OrderSupermarketDetailExportVO)BeanUtil.copyProperties(orderListWebVO, OrderSupermarketDetailExportVO.class, new String[0]);
      vo.setDishDetailStr(LeOrderUtil.getDetailDescStr(orderListWebVO.getOrderDetailList(), orderType));
      vo.setRefundDishDetailStr(LeOrderUtil.getDetailRefundDescStr(orderListWebVO.getOrderDetailList(), orderType));
      vo.setOrderDetailList(vo.getDishDetailStr());
      vo.setRefundOrderDetailList(vo.getRefundDishDetailStr());
      return vo;
   }

   public Long getCustId() {
      return this.custId;
   }

   public String getCustName() {
      return this.custName;
   }

   public String getCustNum() {
      return this.custNum;
   }

   public String getMobile() {
      return this.mobile;
   }

   public String getOrgFullName() {
      return this.orgFullName;
   }

   public String getPsnTypeName() {
      return this.psnTypeName;
   }

   public Integer getSourceType() {
      return this.sourceType;
   }

   public String getMachineSn() {
      return this.machineSn;
   }

   public String getMachineNum() {
      return this.machineNum;
   }

   public String getDeviceName() {
      return this.deviceName;
   }

   public String getDeviceModel() {
      return this.deviceModel;
   }

   public Long getOrderId() {
      return this.orderId;
   }

   public String getMacOrderId() {
      return this.macOrderId;
   }

   public LocalDate getOrderDate() {
      return this.orderDate;
   }

   public LocalDateTime getOrderTime() {
      return this.orderTime;
   }

   public LocalDateTime getPayTime() {
      return this.payTime;
   }

   public Long getCanteenId() {
      return this.canteenId;
   }

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

   public Long getStallId() {
      return this.stallId;
   }

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

   public Integer getMealtimeType() {
      return this.mealtimeType;
   }

   public String getMealtimeName() {
      return this.mealtimeName;
   }

   public String getDishDetailStr() {
      return this.dishDetailStr;
   }

   public String getRefundDishDetailStr() {
      return this.refundDishDetailStr;
   }

   public String getOrderDetailList() {
      return this.orderDetailList;
   }

   public String getRefundOrderDetailList() {
      return this.refundOrderDetailList;
   }

   public BigDecimal getPayableAmount() {
      return this.payableAmount;
   }

   public BigDecimal getCouponAmount() {
      return this.couponAmount;
   }

   public String getCouponName() {
      return this.couponName;
   }

   public Integer getNuClearMode() {
      return this.nuClearMode;
   }

   public BigDecimal getRealAmount() {
      return this.realAmount;
   }

   public BigDecimal getRefundAmount() {
      return this.refundAmount;
   }

   public Integer getPayType() {
      return this.payType;
   }

   public Integer getPayChannel() {
      return this.payChannel;
   }

   public Integer getDeductionType() {
      return this.deductionType;
   }

   public Integer getDeliveryType() {
      return this.deliveryType;
   }

   /** @deprecated */
   @Deprecated
   public Integer getOrderState() {
      return this.orderState;
   }

   public Integer getPayState() {
      return this.payState;
   }

   public Integer getOrderRefundState() {
      return this.orderRefundState;
   }

   public BigDecimal getDeliveryAmount() {
      return this.deliveryAmount;
   }

   public BigDecimal getPackingAmount() {
      return this.packingAmount;
   }

   public String getRemark() {
      return this.remark;
   }

   public String getMealCode() {
      return this.mealCode;
   }

   public void setCustId(final Long custId) {
      this.custId = custId;
   }

   public void setCustName(final String custName) {
      this.custName = custName;
   }

   public void setCustNum(final String custNum) {
      this.custNum = custNum;
   }

   public void setMobile(final String mobile) {
      this.mobile = mobile;
   }

   public void setOrgFullName(final String orgFullName) {
      this.orgFullName = orgFullName;
   }

   public void setPsnTypeName(final String psnTypeName) {
      this.psnTypeName = psnTypeName;
   }

   public void setSourceType(final Integer sourceType) {
      this.sourceType = sourceType;
   }

   public void setMachineSn(final String machineSn) {
      this.machineSn = machineSn;
   }

   public void setMachineNum(final String machineNum) {
      this.machineNum = machineNum;
   }

   public void setDeviceName(final String deviceName) {
      this.deviceName = deviceName;
   }

   public void setDeviceModel(final String deviceModel) {
      this.deviceModel = deviceModel;
   }

   public void setOrderId(final Long orderId) {
      this.orderId = orderId;
   }

   public void setMacOrderId(final String macOrderId) {
      this.macOrderId = macOrderId;
   }

   public void setOrderDate(final LocalDate orderDate) {
      this.orderDate = orderDate;
   }

   public void setOrderTime(final LocalDateTime orderTime) {
      this.orderTime = orderTime;
   }

   public void setPayTime(final LocalDateTime payTime) {
      this.payTime = payTime;
   }

   public void setCanteenId(final Long canteenId) {
      this.canteenId = canteenId;
   }

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

   public void setStallId(final Long stallId) {
      this.stallId = stallId;
   }

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

   public void setMealtimeType(final Integer mealtimeType) {
      this.mealtimeType = mealtimeType;
   }

   public void setMealtimeName(final String mealtimeName) {
      this.mealtimeName = mealtimeName;
   }

   public void setDishDetailStr(final String dishDetailStr) {
      this.dishDetailStr = dishDetailStr;
   }

   public void setRefundDishDetailStr(final String refundDishDetailStr) {
      this.refundDishDetailStr = refundDishDetailStr;
   }

   public void setOrderDetailList(final String orderDetailList) {
      this.orderDetailList = orderDetailList;
   }

   public void setRefundOrderDetailList(final String refundOrderDetailList) {
      this.refundOrderDetailList = refundOrderDetailList;
   }

   public void setPayableAmount(final BigDecimal payableAmount) {
      this.payableAmount = payableAmount;
   }

   public void setCouponAmount(final BigDecimal couponAmount) {
      this.couponAmount = couponAmount;
   }

   public void setCouponName(final String couponName) {
      this.couponName = couponName;
   }

   public void setNuClearMode(final Integer nuClearMode) {
      this.nuClearMode = nuClearMode;
   }

   public void setRealAmount(final BigDecimal realAmount) {
      this.realAmount = realAmount;
   }

   public void setRefundAmount(final BigDecimal refundAmount) {
      this.refundAmount = refundAmount;
   }

   public void setPayType(final Integer payType) {
      this.payType = payType;
   }

   public void setPayChannel(final Integer payChannel) {
      this.payChannel = payChannel;
   }

   public void setDeductionType(final Integer deductionType) {
      this.deductionType = deductionType;
   }

   public void setDeliveryType(final Integer deliveryType) {
      this.deliveryType = deliveryType;
   }

   /** @deprecated */
   @Deprecated
   public void setOrderState(final Integer orderState) {
      this.orderState = orderState;
   }

   public void setOrderStateMix(final Integer orderStateMix) {
      this.orderStateMix = orderStateMix;
   }

   public void setPayState(final Integer payState) {
      this.payState = payState;
   }

   public void setOrderRefundState(final Integer orderRefundState) {
      this.orderRefundState = orderRefundState;
   }

   public void setDeliveryAmount(final BigDecimal deliveryAmount) {
      this.deliveryAmount = deliveryAmount;
   }

   public void setPackingAmount(final BigDecimal packingAmount) {
      this.packingAmount = packingAmount;
   }

   public void setImgUrl(final String imgUrl) {
      this.imgUrl = imgUrl;
   }

   public void setRemark(final String remark) {
      this.remark = remark;
   }

   public void setOrderPhotoUrl(final String orderPhotoUrl) {
      this.orderPhotoUrl = orderPhotoUrl;
   }

   public void setMealCode(final String mealCode) {
      this.mealCode = mealCode;
   }

}
