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

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.bonus.canteen.core.common.utils.CustomLocalDateStringConverter;
import com.bonus.canteen.core.common.utils.CustomNumberConverter;
import com.bonus.canteen.core.common.utils.SysUtil;
import com.bonus.canteen.core.order.common.constants.CheckStateEnum;
import com.bonus.canteen.core.order.utils.LeOrderUtil;
import com.bonus.canteen.core.order.web.vo.OrderRefundDetailVO;
import com.bonus.canteen.core.order.web.vo.OrderRefundWebVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;

@ApiModel("超市退款审核列表导出VO")
public class OrderSupermarketRefundExportVO {
   @ApiModelProperty("审核状态 1 待审核 2 审核通过 3 审核未通过")
   @ExcelProperty(
      value = {"退款状态"},
      order = 0,
      converter = CheckStateEnum.ExcelConvertor.class
   )
   private Integer checkState;
   @ApiModelProperty("申请时间")
   @ExcelProperty(
      value = {"申请时间"},
      order = 1,
      converter = CustomLocalDateStringConverter.class
   )
   private LocalDateTime applyTime;
   @ApiModelProperty("人员编号")
   @ExcelProperty(
      value = {"用户编号"},
      order = 2
   )
   private String custNum;
   @ApiModelProperty("人员姓名")
   @ExcelProperty(
      value = {"用户姓名"},
      order = 3
   )
   private String custName;
   @ApiModelProperty("手机号")
   @ExcelProperty(
      value = {"用户手机号"},
      order = 4
   )
   private String mobile;
   @ApiModelProperty("组织名称")
   @ExcelProperty(
      value = {"所属组织"},
      order = 5
   )
   private String orgFullName;
   @ApiModelProperty("退款原因")
   @ExcelProperty(
      value = {"退款原因"},
      order = 6
   )
   private String applyReason;
   @ExcelProperty(
      value = {"同意退款商品"},
      order = 9
   )
   private String realDishDetailStr;
   @ApiModelProperty("商品金额 分")
   @ExcelProperty(
      value = {"申请退款金额"},
      order = 10,
      converter = CustomNumberConverter.class
   )
   private BigDecimal refundAmount;
   @ApiModelProperty("订单id")
   @ExcelProperty(
      value = {"订单号"},
      order = 11
   )
   private String orderId;
   @ApiModelProperty("设备订单号")
   @ExcelProperty(
      value = {"设备订单号"},
      order = 12
   )
   private String macOrderId;
   @ApiModelProperty("订单退单id")
   @ExcelIgnore
   private Long orderRefundId;
   @ApiModelProperty("申请类型  1-退单 2-纠错")
   @ExcelIgnore
   private Integer applyType;
   @ApiModelProperty("纠错图片 多个用逗号分割")
   @ExcelProperty(
      value = {"退款图片"},
      order = 14
   )
   private String resressPicurl;
   @ApiModelProperty("审核时间  yyyy-MM-dd HH:mm:ss")
   @ExcelIgnore
   private LocalDateTime checkTime;
   @ApiModelProperty("审核结果")
   @ExcelIgnore
   private String checkResult;
   @ExcelProperty(
      value = {"审核人"},
      order = 13
   )
   private String checkBy;
   @ApiModelProperty("绑盘时间  yyyy-MM-dd HH:mm:ss")
   @ExcelIgnore
   private LocalDateTime macBindTime;
   @ApiModelProperty("餐盘编号")
   @ExcelIgnore
   private String plateNum;
   @ApiModelProperty("退款明细")
   private List<OrderRefundDetailVO> refundDetailList;

   public String getResressPicurl() {
      return (String)StrUtil.splitTrim(this.resressPicurl, ",").stream().map(SysUtil::getCutFileUrl).collect(Collectors.joining(","));
   }

   public static OrderSupermarketRefundExportVO of(OrderRefundWebVO orderRefundWebVO, Integer orderType) {
      OrderSupermarketRefundExportVO vo = (OrderSupermarketRefundExportVO)BeanUtil.copyProperties(orderRefundWebVO, OrderSupermarketRefundExportVO.class, new String[0]);
      if (orderRefundWebVO.getRefundDetailList() != null) {
         vo.setRealDishDetailStr(LeOrderUtil.getRefundDetailDescStr(orderRefundWebVO.getRefundDetailList(), orderType, true));
      }

      return vo;
   }

   public Integer getCheckState() {
      return this.checkState;
   }

   public LocalDateTime getApplyTime() {
      return this.applyTime;
   }

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

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

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

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

   public String getApplyReason() {
      return this.applyReason;
   }

   public String getRealDishDetailStr() {
      return this.realDishDetailStr;
   }

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

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

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

   public Long getOrderRefundId() {
      return this.orderRefundId;
   }

   public Integer getApplyType() {
      return this.applyType;
   }

   public LocalDateTime getCheckTime() {
      return this.checkTime;
   }

   public String getCheckResult() {
      return this.checkResult;
   }

   public String getCheckBy() {
      return this.checkBy;
   }

   public LocalDateTime getMacBindTime() {
      return this.macBindTime;
   }

   public String getPlateNum() {
      return this.plateNum;
   }

   public List<OrderRefundDetailVO> getRefundDetailList() {
      return this.refundDetailList;
   }

   public void setCheckState(final Integer checkState) {
      this.checkState = checkState;
   }

   public void setApplyTime(final LocalDateTime applyTime) {
      this.applyTime = applyTime;
   }

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

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

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

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

   public void setApplyReason(final String applyReason) {
      this.applyReason = applyReason;
   }

   public void setRealDishDetailStr(final String realDishDetailStr) {
      this.realDishDetailStr = realDishDetailStr;
   }

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

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

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

   public void setOrderRefundId(final Long orderRefundId) {
      this.orderRefundId = orderRefundId;
   }

   public void setApplyType(final Integer applyType) {
      this.applyType = applyType;
   }

   public void setResressPicurl(final String resressPicurl) {
      this.resressPicurl = resressPicurl;
   }

   public void setCheckTime(final LocalDateTime checkTime) {
      this.checkTime = checkTime;
   }

   public void setCheckResult(final String checkResult) {
      this.checkResult = checkResult;
   }

   public void setCheckBy(final String checkBy) {
      this.checkBy = checkBy;
   }

   public void setMacBindTime(final LocalDateTime macBindTime) {
      this.macBindTime = macBindTime;
   }

   public void setPlateNum(final String plateNum) {
      this.plateNum = plateNum;
   }

   public void setRefundDetailList(final List<OrderRefundDetailVO> refundDetailList) {
      this.refundDetailList = refundDetailList;
   }

}
