Commit ebd4bdc4 by gonglei

加入框架代码

1 parent d92432be
...@@ -4,10 +4,13 @@ import com.alibaba.excel.annotation.ExcelIgnore; ...@@ -4,10 +4,13 @@ import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.glsx.usedcar.export.converter.ListConverter; import com.glsx.usedcar.export.converter.ListConverter;
import com.glsx.usedcar.export.converter.VehicleStateConverter;
import com.glsx.usedcar.module.vehicle.entity.*; import com.glsx.usedcar.module.vehicle.entity.*;
import jakarta.persistence.Column;
import lombok.Data; import lombok.Data;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@Data @Data
...@@ -72,12 +75,15 @@ public class VehicleBean { ...@@ -72,12 +75,15 @@ public class VehicleBean {
// 从LicenseInfo补充的属性 // 从LicenseInfo补充的属性
@ExcelProperty("年检到期") @ExcelProperty("年检到期")
@ColumnWidth(15)
private LocalDate annualInspectionExpiry; private LocalDate annualInspectionExpiry;
@ExcelProperty("交强险到期") @ExcelProperty("交强险到期")
@ColumnWidth(15)
private LocalDate compulsoryInsuranceExpiry; private LocalDate compulsoryInsuranceExpiry;
@ExcelProperty("商业险到期日") @ExcelProperty("商业险到期日")
@ColumnWidth(15)
private LocalDate commercialInsuranceExpiry; private LocalDate commercialInsuranceExpiry;
@ExcelProperty("钥匙数") @ExcelProperty("钥匙数")
...@@ -137,12 +143,14 @@ public class VehicleBean { ...@@ -137,12 +143,14 @@ public class VehicleBean {
private String carCityName; private String carCityName;
@ExcelProperty("首次上牌时间") @ExcelProperty("首次上牌时间")
@ColumnWidth(15)
private LocalDate registrationDate; private LocalDate registrationDate;
@ExcelProperty("过户次数") @ExcelProperty("过户次数")
private int transferCount; private int transferCount;
@ExcelProperty("最近过户时间") @ExcelProperty("最近过户时间")
@ColumnWidth(15)
private LocalDate lastTransferDate; private LocalDate lastTransferDate;
@ExcelProperty("使用性质:1-非营运/2-营运/3-营转非") @ExcelProperty("使用性质:1-非营运/2-营运/3-营转非")
...@@ -196,6 +204,32 @@ public class VehicleBean { ...@@ -196,6 +204,32 @@ public class VehicleBean {
@ExcelProperty("车况描述") @ExcelProperty("车况描述")
private String conditionDescription; private String conditionDescription;
@ExcelProperty("起拍价")
@ColumnWidth(12)
private double startingBidPrice;
@ExcelProperty("保留价")
@ColumnWidth(12)
private double reservePrice;
@ExcelProperty("创建时间")
@ColumnWidth(15)
private LocalDateTime createTime;
@ExcelProperty("入库时间")
@ColumnWidth(15)
private LocalDateTime warehousingTime;
@ExcelProperty("更新时间")
@ColumnWidth(15)
private LocalDateTime updateTime;
@ExcelProperty(value = "车辆状态", converter = VehicleStateConverter.class)
@ColumnWidth(15)
private Vehicle.VehicleState vehicleState;
// 无参构造方法(EasyExcel需要) // 无参构造方法(EasyExcel需要)
public VehicleBean() { public VehicleBean() {
} }
...@@ -205,6 +239,14 @@ public class VehicleBean { ...@@ -205,6 +239,14 @@ public class VehicleBean {
public VehicleBean(Vehicle vehicle) { public VehicleBean(Vehicle vehicle) {
// 基础属性 // 基础属性
this.vehicleId = vehicle.getVehicleId(); this.vehicleId = vehicle.getVehicleId();
this.createTime = vehicle.getCreateTime();
this.updateTime = vehicle.getUpdateTime();
this.warehousingTime = vehicle.getWarehousingTime();
this.vehicleState = vehicle.getVehicleState();
this.startingBidPrice = vehicle.getStartingBidPrice();
this.reservePrice = vehicle.getReservePrice();
BaseInfo baseInfo = vehicle.getBaseInfo(); BaseInfo baseInfo = vehicle.getBaseInfo();
OwnerInfo ownerInfo = vehicle.getOwnerInfo(); OwnerInfo ownerInfo = vehicle.getOwnerInfo();
LicenseInfo licenseInfo = vehicle.getLicenseInfo(); LicenseInfo licenseInfo = vehicle.getLicenseInfo();
......
package com.glsx.usedcar.export.converter;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.converters.WriteConverterContext;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.ReadCellData;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.glsx.usedcar.module.meta.AuditState;
import com.glsx.usedcar.module.vehicle.entity.Vehicle;
import org.summerframework.core.i18n.EnumMessage;
public class VehicleStateConverter implements Converter<Vehicle.VehicleState> {
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public Vehicle.VehicleState convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
return Converter.super.convertToJavaData(cellData, contentProperty, globalConfiguration);
}
@Override
public WriteCellData<?> convertToExcelData(WriteConverterContext<Vehicle.VehicleState> context) {
Vehicle.VehicleState auditState = context.getValue();
String i18nMessage = EnumMessage.getI18nMessage(auditState);
return new WriteCellData<>(i18nMessage);
}
}
<template> <template>
<a-page-header class="color-page-header" title="拍卖信息" v-if="auction"> <a-page-header class="color-page-header" title="拍卖信息" v-if="auction">
<template #extra> <template #extra>
<a-button v-sec="'control_2'" v-if="controllable" type="primary" @click="addVehicle"> <a-button v-sec="'control_2'" v-if="controllable&&auction.auctionState==='CLOSED'&&auction.auctionState!=='CANCELLED'" type="primary" @click="addVehicle">
添加车辆 添加车辆
</a-button> </a-button>
<a-button v-sec="'control_2'" v-if="controllable" type="primary" @click="delayAuction"> <a-button v-sec="'control_2'" v-if="controllable" type="primary" @click="delayAuction">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!