package com.gci.boot.modules.vehicles.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gci.boot.annotation.Query.SelectQuery;
import com.gci.boot.common.dict.annotation.Dict;
import com.gci.boot.common.dict.excel.DictConverter;
import com.gci.boot.common.validated.ImportValidated;
import com.gci.boot.common.validated.SaveValidated;
import com.gci.boot.common.validated.UpdateValidated;
import com.gci.boot.modules.vehicles.vo.AttachmentDetailVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Digits;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 加油充电登记
 * </p>
 *
 * @author admin
 * @since 2023-11-30
 */
@Getter
@Setter
@TableName("tb_refuel_charge_record")
@ApiModel(value = "TbRefuelChargeRecord对象", description = "加油充电记录")
@ColumnWidth(20)
public class TbRefuelChargeRecord implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("主键id")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @ExcelIgnore
    private String id;

    @ApiModelProperty("日期")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat("yyyy-MM-dd")
    @org.springframework.format.annotation.DateTimeFormat(pattern="yyyy-MM-dd")
    @ExcelProperty(value = "日期", index = 0)
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    private Date recordDate;

    @ApiModelProperty("单号")
    @ExcelProperty(value = "单号", index = 1)
    @SelectQuery()
    @Length(max = 64,message = "单号不能超过64位！",groups = {SaveValidated.class, UpdateValidated.class})
    private String orderNo;

    @ApiModelProperty("开始时间")
    @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss")
    @DateTimeFormat("HH:mm:ss")
    @org.springframework.format.annotation.DateTimeFormat(pattern="HH:mm:ss")
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    @ExcelProperty(value = "开始时间", index = 2)
    private Date startTime;

    @ApiModelProperty("结束时间")
    @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss")
    @DateTimeFormat("HH:mm:ss")
    @org.springframework.format.annotation.DateTimeFormat(pattern="HH:mm:ss")
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    @ExcelProperty(value = "结束时间", index = 3)
    private Date endTime;

    @ApiModelProperty("所属项目")
    @ExcelProperty(value = "所属项目", converter = DictConverter.class, index = 5)
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    @Dict(dictTable = "tb_projects", dicText = "project_name", dicCode = "id")
    private String projectId;

    @ApiModelProperty("车辆id")
    @ExcelIgnore
    private String vehicleId;

    @ApiModelProperty("车架号")
    @ExcelIgnore

    @SelectQuery()
    private String frameNumber;

    @ApiModelProperty("车辆型号")
    @ExcelIgnore
    private String vehicleModel;

    @ApiModelProperty("车辆种类")
    @Dict(dicCode = "vehicle_type")
    @ExcelProperty(value = "车辆种类",converter = DictConverter.class, index = 8)
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    private String vehicleType;

    @ApiModelProperty("车牌号")
    @ExcelProperty(value = "车牌号", index = 6)
    @SelectQuery()
    private String plateNumber;

    @ApiModelProperty("燃料类型")
    @Dict(dicCode = "fuel_type")
    @ExcelProperty(value = "燃料类型",converter = DictConverter.class, index = 9)
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    private String fuelType;

    @ApiModelProperty("油卡卡号")
    @ExcelProperty(value = "卡号", index = 7)
    @SelectQuery(Type = SelectQuery.SelectType.LIKE)
    @Length(max = 32,message = "油卡卡号不能超过32位！",groups = {SaveValidated.class, UpdateValidated.class})
    private String oilCard;

    @ApiModelProperty("油品规格1：0号 车用柴油(Ⅵ)，2：92号 车用汽油(ⅥB)，3：95号 车用汽油(ⅥB)，4：充电")
    @Dict(dicCode = "oil_type")
    @ExcelProperty(value = "油品规格",converter = DictConverter.class, index = 10)
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    private String oilType;

    @ApiModelProperty("单价")
    @ExcelProperty(value = "单价", index = 11)
    @Min(value = 0, message = "油卡余额(元)最小值为0！", groups = {SaveValidated.class, UpdateValidated.class, ImportValidated.class})
    @Max(value = 999999, message = "油卡余额(元)最大值为999999！", groups = {SaveValidated.class, UpdateValidated.class, ImportValidated.class})
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private BigDecimal price;

    @ApiModelProperty("数量")
    @ExcelProperty(value = "数量（升/度）", index = 12)
    @Min(value = 0, message = "油卡余额(元)最小值为0！", groups = {SaveValidated.class, UpdateValidated.class, ImportValidated.class})
    @Max(value = 999999, message = "油卡余额(元)最大值为999999！", groups = {SaveValidated.class, UpdateValidated.class, ImportValidated.class})
    private BigDecimal amount;

    @ApiModelProperty("金额")
    @ExcelProperty(value = "金额（元）", index = 13)
    @Min(value = 0, message = "油卡余额(元)最小值为0！", groups = {SaveValidated.class, UpdateValidated.class, ImportValidated.class})
    @Max(value = 999999, message = "油卡余额(元)最大值为999999！", groups = {SaveValidated.class, UpdateValidated.class, ImportValidated.class})
    private BigDecimal totalPrice;

    @ApiModelProperty("加油（充电）时里程km")
    @ExcelProperty(value = "加油（充电）时里程（km）", index = 14)
    @Min(value = 0, message = "油卡余额(元)最小值为0！", groups = {SaveValidated.class, UpdateValidated.class, ImportValidated.class})
    @Max(value = 999999, message = "油卡余额(元)最大值为999999！", groups = {SaveValidated.class, UpdateValidated.class, ImportValidated.class})
    private BigDecimal mileage;

    @ApiModelProperty("备注")
    @ExcelProperty(value = "备注", index = 15)
    @Length(max = 1000,message = "备注不能超过1000位！",groups = {SaveValidated.class, UpdateValidated.class})
    private String remark;

    @ApiModelProperty("所属机构")
    @Dict(dictTable = "sys_depart", dicCode = "org_code", dicText = "depart_name")
    @ExcelProperty(value = "所属机构", converter = DictConverter.class, index = 4)
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    private String sysOrgCode;

    @ApiModelProperty("创建时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private Date createTime;

    @ApiModelProperty("更新时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private Date updateTime;

    @ApiModelProperty("创建人")
    @ExcelIgnore
    private String createBy;

    @ApiModelProperty("更新人")
    @ExcelIgnore
    @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname")
    private String updateBy;

    @ExcelIgnore
    @ApiModelProperty("删除标志")
    private Integer delFlag;

    @ApiModelProperty("记录类型(1加油，2充电)")
    @ExcelIgnore
    private String refuelType;

    @ApiModelProperty("来源（1后台，2小程序，3后台导入）")
    @ExcelIgnore
    private String sourceType;
    
    @ApiModelProperty("日期开始")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @org.springframework.format.annotation.DateTimeFormat(pattern="yyyy-MM-dd")
    @TableField(exist = false)
    @ExcelIgnore
    private Date dateStart;

    @ApiModelProperty("日期结束")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @org.springframework.format.annotation.DateTimeFormat(pattern="yyyy-MM-dd")
    @TableField(exist = false)
    @ExcelIgnore
    private Date dateEnd;


    @ApiModelProperty("驾驶员")
    @Length(max = 64,message = "驾驶员不能超过64位！",groups = {SaveValidated.class, UpdateValidated.class})
    @ExcelProperty(value = "驾驶员", index = 16)
    private String driver;
    @ApiModelProperty("加油站")
    @Length(max = 64,message = "加油站不能超过64位！",groups = {SaveValidated.class, UpdateValidated.class})
    @ExcelProperty(value = "加油站", index = 17)
    private String oilStation;
    @ApiModelProperty("卡余额(元)")
    @Min(value = 0, message = "卡余额(元)最小值为0！", groups = {SaveValidated.class, UpdateValidated.class, ImportValidated.class})
    @Max(value = 999999, message = "卡余额(元)最大值为999999！", groups = {SaveValidated.class, UpdateValidated.class, ImportValidated.class})
    @ExcelProperty(value = "卡余额(元)", index = 18)
    private BigDecimal oilCardBalance;
    @ExcelIgnore
    @ApiModelProperty("附件URL")
    private String attachmentUrl;

}
