package com.yuchen.saas.parking.api.vo;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.poi.ss.usermodel.HorizontalAlignment;

import java.util.Date;


@HeadRowHeight(value = 35) // 表头行高
@ContentRowHeight(value = 25) // 内容行高
@ColumnWidth(value = 25) // 列宽
@HeadStyle(horizontalAlignment = HorizontalAlignment.CENTER)
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER)
@Data
public class StaggeredRefundExcelDetailVO {

    @ApiModelProperty(value = "停车场所")
    @ExcelProperty(value = {"停车场所"}, order = 1)
    private String parkingName;

    @ApiModelProperty(value = "车牌号码")
    @ExcelProperty(value = {"车牌号码"}, order = 2)
    private String plateNo;

    @ApiModelProperty(value = "车主姓名")
    @ExcelProperty(value = {"车主姓名"}, order = 3)
    private String name;

    @ApiModelProperty(value = "开始时间")
    @ExcelProperty(value = {"开始时间"}, order = 4)
    private String beginTimeE;
    @ExcelIgnore
    private Date beginTime;

    @ApiModelProperty(value = "结束时间")
    @ExcelProperty(value = {"结束时间"}, order = 4)
    private String endTimeE;
    @ExcelIgnore
    private Date endTime;

    @ApiModelProperty(value = "支付时间")
    @ExcelProperty(value = {"支付时间"}, order = 5)
    private String payTimeE;
    @ExcelIgnore
    private Date payTime;

    @ApiModelProperty(value = "实缴金额（元）")
    @ExcelProperty(value = {"实缴金额（元）"}, order = 6)
    private String paidCostE;
    @ExcelIgnore
    private Long paidCost;

    @ApiModelProperty(value = "订单号")
    @ExcelProperty(value = {"订单号"}, order = 7)
    private String orderNumber;

    @ApiModelProperty(value = "退款订单号")
    @ExcelProperty(value = {"退款订单号"}, order = 8)
    private String orderRefundNumber;

    @ApiModelProperty(value = "退款时间")
    @ExcelProperty(value = {"退款时间"}, order = 9)
    private String refundTimeE;
    @ExcelIgnore
    private Date refundTime;

    @ApiModelProperty(value = "退款金额（元）")
    @ExcelProperty(value = {"退款金额（元）"}, order = 10)
    private String refundCostE;
    @ExcelIgnore
    private Long refundCost;

    @ApiModelProperty(value = "退款理由")
    @ExcelProperty(value = {"退款理由"}, order = 11)
    private String refundReason;

    @ApiModelProperty(value = "拒绝理由")
    @ExcelProperty(value = {"拒绝理由"}, order = 12)
    private String refuseReason;

    @ApiModelProperty(value = "退款状态")
    @ExcelProperty(value = {"退款状态"}, order = 13)
    private String refundStateE;
    @ExcelIgnore
    private Integer refundState;

    public String getRefundStateE() {
        if(this.refundState!=null){
            if(0==this.refundState){
                return "退款中";
            }else if(1==this.refundState){
                return "退款成功";
            }else if(2==this.refundState){
                return "退款失败";
            }

        }
        return "";
    }

    public String getPaidCostE() {
        if(this.paidCost!=null){
            return NumberUtil.decimalFormat("#.##",NumberUtil.div(Double.parseDouble(this.paidCost+""),100D,2));
        }
        return "";
    }

    public String getRefundCostE() {
        if(this.refundCost!=null){
            return NumberUtil.decimalFormat("#.##",NumberUtil.div(Double.parseDouble(this.refundCost+""),100D,2));
        }
        return "";
    }
//    public String getRefundCostYuan() {
//        if(this.refundCost!=null){
//            return NumberUtil.decimalFormat("#.##",NumberUtil.div(Double.parseDouble(this.refundCost+""),100D,2));
//        }
//        return "";
//    }

    public String getPayTimeE() {
        if(this.payTime!=null){
            return DateUtil.format(this.payTime,"yyyy-MM-dd HH:mm:ss");
        }
        return "";
    }

    public String getRefundTimeE() {
        if(this.refundTime!=null){
            return DateUtil.format(this.refundTime,"yyyy-MM-dd HH:mm:ss");
        }
        return "";
    }

    public String getBeginTimeE() {
        if(this.beginTime!=null){
            return DateUtil.format(this.beginTime,"yyyy-MM-dd HH:mm:ss");
        }
        return "";
    }

    public String getEndTimeE() {
        if(this.endTime!=null){
            return DateUtil.format(this.endTime,"yyyy-MM-dd HH:mm:ss");
        }
        return "";
    }

}
