feat(excel): 添加Excel导入别名支持和改进导入功能
- 在Excel注解中新增aliasNames属性,支持多语言列名匹配 - 实现importExcelCopy方法,提供增强的Excel导入功能 - 添加对物模型实体的别名配置,支持Description、Name等多种列名 - 实现基于别名的字段映射匹配逻辑 - 修复标识符重复校验逻辑,确保数据完整性 - 优化Excel导入过程中的数据类型转换处理 Signed-off-by: Gjm <你的邮箱>
This commit is contained in:
@@ -30,8 +30,7 @@ public class ThingsModel extends BaseEntity
|
||||
|
||||
/** 物模型名称 */
|
||||
@ApiModelProperty("物模型名称")
|
||||
@Excel(name = "Description" ,prompt = "必填")
|
||||
private String modelName;
|
||||
@Excel(name = "物模型名称", aliasNames = {"Description", "Name"}, prompt = "必填") private String modelName;
|
||||
|
||||
|
||||
/** 物模型名称 */
|
||||
@@ -60,7 +59,7 @@ public class ThingsModel extends BaseEntity
|
||||
|
||||
/** 标识符,产品下唯一 */
|
||||
@ApiModelProperty("标识符,产品下唯一")
|
||||
@Excel(name = "MeasuringPointName",prompt = "modbus不填默认为寄存器地址")
|
||||
@Excel(name = "标识符", aliasNames = {"MeasuringPointName", "Identifier"}, prompt = "modbus不填默认为寄存器地址")
|
||||
private String identifier;
|
||||
|
||||
/** 模型类别(1-属性,2-功能,3-事件) */
|
||||
@@ -111,7 +110,7 @@ public class ThingsModel extends BaseEntity
|
||||
|
||||
/** 数据类型(integer、decimal、string、bool、array、enum) */
|
||||
@ApiModelProperty(value = "数据类型", notes = "(integer、decimal、string、bool、array、enum)")
|
||||
@Excel(name = "DataType", prompt = "integer、decimal、string、bool、array、enum")
|
||||
@Excel(name = "数据类型", aliasNames = {"DataType"}, prompt = "integer、decimal、string、bool、array、enum")
|
||||
private String datatype;
|
||||
|
||||
@Excel(name = "有效值范围")
|
||||
|
||||
@@ -410,12 +410,12 @@ public class ThingsModelServiceImpl implements IThingsModelService {
|
||||
failSb.append("<br/>").append(failure).append(",采集点: ").append(model.getModelName()).append("导入失败");
|
||||
}
|
||||
}
|
||||
// if (result) {
|
||||
// log.error("标识符不能重复");
|
||||
// failure++;
|
||||
// failSb.append("<br/>").append(failure).append(",采集点: ").append("标识符不能重复");
|
||||
// throw new ServiceException(failSb.toString());
|
||||
// }
|
||||
if (result) {
|
||||
log.error("标识符不能重复");
|
||||
failure++;
|
||||
failSb.append("<br/>").append(failure).append(",采集点: ").append("标识符不能重复");
|
||||
throw new ServiceException(failSb.toString());
|
||||
}
|
||||
if (failure > 0) {
|
||||
throw new ServiceException(failSb.toString());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user