导入设备数据
This commit is contained in:
@ -60,7 +60,7 @@ public class DeviceType extends TenantEntity {
|
||||
private String networkWay;
|
||||
|
||||
@Schema(title = "通讯方式", example = "通讯方式 0:4G;1:蓝牙,2 4G&蓝牙")
|
||||
private Integer communicationMode;
|
||||
private String communicationMode;
|
||||
|
||||
/**
|
||||
* 创建人名称
|
||||
|
||||
@ -1,24 +1,21 @@
|
||||
package com.fuyuanshen.equipment.domain.dto;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
|
||||
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
|
||||
import com.alibaba.excel.converters.bytearray.ByteArrayImageConverter;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: 默苍璃
|
||||
* @date: 2025-06-0710:00
|
||||
* @date: 2025-06-07 10:00
|
||||
*/
|
||||
@Data
|
||||
@HeadRowHeight(20) // 表头行高
|
||||
@ContentRowHeight(100) // 内容行高
|
||||
public class DeviceExcelImportDTO {
|
||||
|
||||
// @ExcelProperty("设备类型")
|
||||
// private Long deviceType;
|
||||
|
||||
@ExcelProperty("设备名称")
|
||||
@ColumnWidth(20)
|
||||
private String deviceName;
|
||||
@ -26,14 +23,23 @@ public class DeviceExcelImportDTO {
|
||||
@ExcelProperty("设备类型名称")
|
||||
private String typeName;
|
||||
|
||||
// @ExcelProperty(value = "设备图片", converter = ByteArrayImageConverter.class)
|
||||
// @ColumnWidth(15)
|
||||
// private byte[] devicePic;
|
||||
//
|
||||
// // 添加图片写入方法
|
||||
// public void setDevicePicFromBytes(byte[] bytes) {
|
||||
// this.devicePic = bytes;
|
||||
// }
|
||||
/**
|
||||
* 设备图片
|
||||
* 导入时的图片处理方式:
|
||||
* 在导入过程中,图片不是通过Excel单元格中的文本数据(如URL)来处理的
|
||||
* 而是直接从Excel文件中提取嵌入的图片数据
|
||||
* 代码通过POI库直接读取Excel中的图片对象,然后上传到OSS并生成URL
|
||||
*/
|
||||
@ExcelProperty("设备图片")
|
||||
@ColumnWidth(20)
|
||||
private byte[] devicePic;
|
||||
|
||||
/**
|
||||
* 用于存储实际图片数据的字段
|
||||
* 使用@ExcelIgnore注解忽略该字段,避免创建额外的列
|
||||
*/
|
||||
@ExcelIgnore
|
||||
private byte[] imageData;
|
||||
|
||||
@ExcelProperty("设备MAC")
|
||||
@ColumnWidth(20)
|
||||
@ -46,18 +52,46 @@ public class DeviceExcelImportDTO {
|
||||
@ExcelProperty("蓝牙名称")
|
||||
private String bluetoothName;
|
||||
|
||||
// @ExcelProperty("设备SN")
|
||||
// @ColumnWidth(20)
|
||||
// private String deviceSn;
|
||||
//
|
||||
// @ExcelProperty("经度")
|
||||
// private String longitude;
|
||||
//
|
||||
// @ExcelProperty("纬度")
|
||||
// private String latitude;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
@ColumnWidth(30)
|
||||
private String remark;
|
||||
|
||||
/*
|
||||
*设备类型数据
|
||||
*/
|
||||
@ExcelProperty("是否支持蓝牙")
|
||||
@ColumnWidth(15)
|
||||
private String isSupportBle;
|
||||
|
||||
@ExcelProperty("定位方式")
|
||||
@ColumnWidth(20)
|
||||
private String locateMode;
|
||||
|
||||
@ExcelProperty("通讯方式")
|
||||
@ColumnWidth(20)
|
||||
private String communicationMode;
|
||||
|
||||
/**
|
||||
* 型号字典用于APP页面跳转
|
||||
* app_model_dictionary
|
||||
*/
|
||||
@ExcelProperty("型号字典用于APP页面跳转")
|
||||
@ColumnWidth(20)
|
||||
private String appModelDictionary;
|
||||
|
||||
/**
|
||||
* 型号字典用于PC页面跳转
|
||||
* pc_model_dictionary
|
||||
*/
|
||||
@ExcelProperty("型号字典用于PC页面跳转")
|
||||
@ColumnWidth(20)
|
||||
private String pcModelDictionary;
|
||||
|
||||
/**
|
||||
* 错误原因
|
||||
*/
|
||||
@ExcelProperty("错误原因")
|
||||
@ColumnWidth(30)
|
||||
private String errorMessage;
|
||||
|
||||
}
|
||||
@ -0,0 +1,98 @@
|
||||
package com.fuyuanshen.equipment.domain.dto;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
|
||||
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* 设备及完整类型信息导出DTO
|
||||
*
|
||||
* @author: 默苍璃
|
||||
* @date: 2025-11-0416:25
|
||||
*/
|
||||
@Data
|
||||
@HeadRowHeight(20) // 表头行高
|
||||
@ContentRowHeight(100) // 内容行高
|
||||
public class DeviceWithTypeExcelExportDTO {
|
||||
|
||||
@ExcelProperty("设备名称")
|
||||
@ColumnWidth(20)
|
||||
private String deviceName;
|
||||
|
||||
@ExcelProperty("设备类型名称")
|
||||
@ColumnWidth(20)
|
||||
private String typeName;
|
||||
|
||||
@ExcelProperty(value = "设备图片")
|
||||
@ColumnWidth(30) // 设置图片列宽度
|
||||
private URL devicePic; // 使用URL类型
|
||||
|
||||
@ExcelProperty("设备MAC")
|
||||
@ColumnWidth(20)
|
||||
private String deviceMac;
|
||||
|
||||
@ExcelProperty("蓝牙名称")
|
||||
@ColumnWidth(20)
|
||||
private String bluetoothName;
|
||||
|
||||
@ExcelProperty("设备IMEI")
|
||||
@ColumnWidth(20)
|
||||
private String deviceImei;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
@ColumnWidth(30)
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 绑定状态
|
||||
* 0 未绑定
|
||||
* 1 已绑定
|
||||
*/
|
||||
@ExcelProperty("绑定状态")
|
||||
@ColumnWidth(20)
|
||||
private String bindingStatus;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
@ColumnWidth(20)
|
||||
private String createTime;
|
||||
|
||||
@ExcelProperty("创建人")
|
||||
@ColumnWidth(20)
|
||||
private String createBy;
|
||||
|
||||
/*
|
||||
*设备类型数据
|
||||
*/
|
||||
@ExcelProperty("是否支持蓝牙")
|
||||
@ColumnWidth(15)
|
||||
private String isSupportBle;
|
||||
|
||||
@ExcelProperty("定位方式")
|
||||
@ColumnWidth(20)
|
||||
private String locateMode;
|
||||
|
||||
@ExcelProperty("通讯方式")
|
||||
@ColumnWidth(20)
|
||||
private String communicationMode;
|
||||
|
||||
/**
|
||||
* 型号字典用于APP页面跳转
|
||||
* app_model_dictionary
|
||||
*/
|
||||
@ExcelProperty("型号字典用于APP页面跳转")
|
||||
@ColumnWidth(20)
|
||||
private String appModelDictionary;
|
||||
|
||||
/**
|
||||
* 型号字典用于PC页面跳转
|
||||
* pc_model_dictionary
|
||||
*/
|
||||
@ExcelProperty("型号字典用于PC页面跳转")
|
||||
@ColumnWidth(20)
|
||||
private String pcModelDictionary;
|
||||
|
||||
}
|
||||
@ -26,8 +26,6 @@ public class DeviceForm {
|
||||
@Schema(title = "客户号")
|
||||
private Long customerId;
|
||||
|
||||
/*@Schema(value = "设备编号")
|
||||
private String deviceNo;*/
|
||||
|
||||
@NotBlank(message = "设备名称不能为空")
|
||||
@Schema(title = "设备名称", required = true)
|
||||
@ -56,4 +54,25 @@ public class DeviceForm {
|
||||
@Schema(title = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
// 设备类型相关字段
|
||||
@Schema(title = "设备类型名称")
|
||||
private String typeName;
|
||||
|
||||
@Schema(title = "是否支持蓝牙")
|
||||
private String isSupportBle;
|
||||
|
||||
@Schema(title = "定位方式")
|
||||
private String locateMode;
|
||||
|
||||
@Schema(title = "通讯方式")
|
||||
private String communicationMode;
|
||||
|
||||
@Schema(title = "APP模型字典")
|
||||
private String appModelDictionary;
|
||||
|
||||
@Schema(title = "PC模型字典")
|
||||
private String pcModelDictionary;
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user