package com.jpsoft.shinestar.modules.base.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jpsoft.shinestar.modules.common.utils.StringUtils;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

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

/**
 * @author 墨鱼_mo
 * @date 2020-4-14 9:15
 */
@Data
public class ParkingRecord {


    private String id;
    private Long parkId;
    private String carNum;
    private BigDecimal parkingTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    private Date inParkingTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    private Date paymentTime;
    private BigDecimal totalAmount = BigDecimal.ZERO;
    private BigDecimal reduceAmount =BigDecimal.ZERO;
    private BigDecimal payAmount =BigDecimal.ZERO;
    private Integer payStatus;
    private String payType;
    private String payTypeN;
    private String serialNumber;
    private String transactionNumber;
    private String productTheme;
    private String openId;
    private String createBy;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    private Date createTime;
    private String updateBy;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    private Date updateTime;
    private Boolean delFlag = false;

    private String carType;

    private String cType;

    private String orderNumber;

    private String inChannelId;

    private String inChannel;

    private String outChannelId;

    private String outChannel;

    private String inImage;

    private String outImage;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    private Date outParkingTime;


    public String getPayTypeN() {
        if(StringUtils.isNotEmpty(payType)) {
            if (payType.equals("wechat")) {
                return "微信";
            } else if (payType.equals("alipay")) {
                return "支付宝";
            } else{
                return "现金";
            }
        }
        else{
            return "";
        }
    }


}
