VehicleBean.java 9.94 KB
package com.glsx.usedcar.export;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.glsx.usedcar.export.converter.ListConverter;
import com.glsx.usedcar.module.vehicle.entity.*;
import lombok.Data;

import java.time.LocalDate;
import java.util.List;

@Data
public class VehicleBean {
    @ExcelIgnore
    private int vehicleId;

    @ExcelProperty("车辆品牌名称")
    @ColumnWidth(10)
    private String carBrand;

    @ExcelProperty("子品牌名字")
    private String carChildsBrandName;

    @ExcelProperty("车系名字")
    @ColumnWidth(15)
    private String carSeriesName;

    @ExcelProperty("车型名称")
    @ColumnWidth(30)
    private String carTypeName;

    // 从BaseInfo补充的属性
    @ExcelIgnore
    @ExcelProperty("车辆品牌id")
    private int carBrandId;

    @ExcelIgnore
    @ExcelProperty("子品牌id")
    private int carChildsBrandId;
    @ExcelIgnore
    @ExcelProperty("车系id")
    private int carSeriesId;
    @ExcelIgnore
    @ExcelProperty("车型id")
    private int carTypeId;

    @ExcelProperty("表显里程")
    private int mileage;

    @ExcelProperty("车架号")
    private String vin;

    @ExcelProperty("车牌号")
    private String licensePlate;

    @ExcelProperty("车源号(平台唯一识别编号)")
    private String sourceNo;

    @ExcelProperty(value = "标签(如:准新车)", converter = ListConverter.class)
    private List<String> tags;

    @ExcelProperty("新车指导价(元)")
    private double guidePrice;

    // 从OwnerInfo补充的属性
    @ExcelProperty("车主姓名")
    private String previousOwnerName;

    @ExcelProperty("车主联系方式(手机号)")
    private String previousOwnerPhone;

    // 从LicenseInfo补充的属性
    @ExcelProperty("年检到期")
    private LocalDate annualInspectionExpiry;

    @ExcelProperty("交强险到期")
    private LocalDate compulsoryInsuranceExpiry;

    @ExcelProperty("商业险到期日")
    private LocalDate commercialInsuranceExpiry;

    @ExcelProperty("钥匙数")
    private int keyCount;

    @ExcelProperty("钥匙编码")
    private String keyCode;

    // 从CoreSpecs补充的属性
    @ExcelProperty("出厂日期")
    private LocalDate productionDate;

    @ExcelProperty("排放标准(3-国3/4-国4/5-国5/6-国6)")
    private int emissionStandard;

    @ExcelProperty("排量(T/L)")
    private String displacement;

    @ExcelProperty("进气形式(自然吸气/涡轮增压等)")
    private String jqxs;

    @ExcelProperty("燃料形式(汽油/柴油等)")
    private String rlxs;

    @ExcelProperty("变速箱类型")
    private String bxslx;

    @ExcelProperty("驱动方式(前驱/后驱/四驱等)")
    private String qdfs;

    @ExcelProperty("车型分类名称(级别)")
    private String vehicleClass;

    @ExcelProperty("车身颜色")
    private String exteriorColor;

    @ExcelProperty("内饰颜色")
    private String interiorColor;

    @ExcelProperty("座位数")
    private String seat;

    @ExcelProperty("天窗:1-无天窗/2-普通天窗/3-全景天窗")
    private int sunroof;

    // 从Ownership补充的属性
    @ExcelProperty("车辆所在地省份ID")
    private int carProvinceId;

    @ExcelProperty("车辆所在地省份名称")
    private String carProvinceName;

    @ExcelProperty("车辆所在地城市ID")
    private int carCityId;

    @ExcelProperty("车辆所在地城市名称")
    private String carCityName;

    @ExcelProperty("首次上牌时间")
    private LocalDate registrationDate;

    @ExcelProperty("过户次数")
    private int transferCount;

    @ExcelProperty("最近过户时间")
    private LocalDate lastTransferDate;

    @ExcelProperty("使用性质:1-非营运/2-营运/3-营转非")
    private int usageType;

    @ExcelProperty("所有人性质:1-个人/2-单位")
    private int ownerType;

    @ExcelProperty("是否有抵押:true/false")
    private boolean hasMortgage;

    // 从EvaluationTransaction补充的属性
    @ExcelProperty("评估单编号")
    private String evalOrderNo;

    @ExcelProperty("评估意见")
    private String evalOpinion;

    @ExcelProperty("收购价格(元)")
    private double purchasePrice;

    @ExcelProperty("车辆来源门店")
    private String sellerMerchantName;

    @ExcelProperty("销售顾问")
    private String sellerName;

    @ExcelProperty("综合评价:1-优/2-良/3-中/4-差")
    private int overallRating;

    // 从CustodianInfo补充的属性
    @ExcelProperty("车辆保管人姓名")
    private String custodianName;

    @ExcelProperty("车辆保管人联系方式")
    private String custodianPhone;

    @ExcelProperty("车辆停放地址信息")
    private String handoverAddress;

    // 从HistoryCondition补充的属性
    @ExcelProperty("是否事故:1-是/0-否")
    private int hasAccident;

    @ExcelProperty("水泡检测:1-是/0-否")
    private int floodCheck;

    @ExcelProperty("火烧检测:1-是/0-否")
    private int fireCheck;

    @ExcelProperty("车况描述")
    private String conditionDescription;

    // 无参构造方法(EasyExcel需要)
    public VehicleBean() {
    }

    // 全参构造方法
    // 核心:以多个类为构造参数,提取属性赋值
    public VehicleBean(Vehicle vehicle) {
        // 基础属性
        this.vehicleId = vehicle.getVehicleId();
        BaseInfo baseInfo = vehicle.getBaseInfo();
        OwnerInfo ownerInfo = vehicle.getOwnerInfo();
        LicenseInfo licenseInfo = vehicle.getLicenseInfo();
        CoreSpecs coreSpecs = vehicle.getCoreSpecs();
        Ownership ownership = vehicle.getOwnership();
        EvaluationTransaction evaluationTransaction = vehicle.getEvaluationTransaction();
        CustodianInfo custodianInfo = vehicle.getCustodianInfo();
        HistoryCondition historyCondition = vehicle.getHistoryCondition();
        // 从BaseInfo提取
        if (baseInfo != null) {
            this.carBrandId = baseInfo.getCarBrandId();
            this.carChildsBrandId = baseInfo.getCarChildsBrandId();
            this.carSeriesId = baseInfo.getCarSeriesId();
            this.carTypeId = baseInfo.getCarTypeId();
            this.carBrand = baseInfo.getCarBrand();
            this.carChildsBrandName = baseInfo.getCarChildsBrandName();
            this.carSeriesName = baseInfo.getCarSeriesName();
            this.carTypeName = baseInfo.getCarTypeName();

            this.mileage = baseInfo.getMileage();
            this.vin = baseInfo.getVin();
            this.licensePlate = baseInfo.getLicensePlate();
            this.sourceNo = baseInfo.getSourceNo();
            this.tags = baseInfo.getTags();
            this.guidePrice = baseInfo.getGuidePrice();
        }

        // 从OwnerInfo提取
        if (ownerInfo != null) {
            this.previousOwnerName = ownerInfo.getPreviousOwnerName();
            this.previousOwnerPhone = ownerInfo.getPreviousOwnerPhone();
        }

        // 从LicenseInfo提取
        if (licenseInfo != null) {
            this.annualInspectionExpiry = licenseInfo.getAnnualInspectionExpiry();
            this.compulsoryInsuranceExpiry = licenseInfo.getCompulsoryInsuranceExpiry();
            this.commercialInsuranceExpiry = licenseInfo.getCommercialInsuranceExpiry();
            this.keyCount = licenseInfo.getKeyCount();
            this.keyCode = licenseInfo.getKeyCode();
        }

        // 从CoreSpecs提取
        if (coreSpecs != null) {
            this.productionDate = coreSpecs.getProductionDate();
            this.emissionStandard = coreSpecs.getEmissionStandard();
            this.displacement = coreSpecs.getDisplacement();
            this.jqxs = coreSpecs.getJqxs();
            this.rlxs = coreSpecs.getRlxs();
            this.bxslx = coreSpecs.getBxslx();
            this.qdfs = coreSpecs.getQdfs();
            this.vehicleClass = coreSpecs.getVehicleClass();
            this.exteriorColor = coreSpecs.getExteriorColor();
            this.interiorColor = coreSpecs.getInteriorColor();
            this.seat = coreSpecs.getSeat();
            this.sunroof = coreSpecs.getSunroof();
        }

        // 从Ownership提取
        if (ownership != null) {
            this.carProvinceId = ownership.getCarProvinceId();
            this.carProvinceName = ownership.getCarProvinceName();
            this.carCityId = ownership.getCarCityId();
            this.carCityName = ownership.getCarCityName();
            this.registrationDate = ownership.getRegistrationDate();
            this.transferCount = ownership.getTransferCount();
            this.lastTransferDate = ownership.getLastTransferDate();
            this.usageType = ownership.getUsageType();
            this.ownerType = ownership.getOwnerType();
            this.hasMortgage = ownership.isHasMortgage();
        }

        // 从EvaluationTransaction提取
        if (evaluationTransaction != null) {
            this.evalOrderNo = evaluationTransaction.getEvalOrderNo();
            this.evalOpinion = evaluationTransaction.getEvalOpinion();
            this.purchasePrice = evaluationTransaction.getPurchasePrice();
            this.sellerMerchantName = evaluationTransaction.getSellerMerchantName();
            this.sellerName = evaluationTransaction.getSellerName();
            this.overallRating = evaluationTransaction.getOverallRating();
        }

        // 从CustodianInfo提取
        if (custodianInfo != null) {
            this.custodianName = custodianInfo.getCustodianName();
            this.custodianPhone = custodianInfo.getCustodianPhone();
            this.handoverAddress = custodianInfo.getHandoverAddress();
        }

        // 从HistoryCondition提取
        if (historyCondition != null) {
            this.hasAccident = historyCondition.getHasAccident();
            this.floodCheck = historyCondition.getFloodCheck();
            this.fireCheck = historyCondition.getFireCheck();
            this.conditionDescription = historyCondition.getConditionDescription();
        }
    }
}