优化标签导入

This commit is contained in:
zhou-hao 2020-06-11 17:22:48 +08:00
parent aae6966a60
commit 529e03541b
2 changed files with 6 additions and 4 deletions

View File

@ -60,6 +60,6 @@ public class DeviceTagEntity extends GenericEntity<String> {
}
public static String createTagId(String deviceId,String key){
return DigestUtils.md5Hex(deviceId.concat(":").concat(key));
return DigestUtils.md5Hex(deviceId + ":" + key);
}
}

View File

@ -33,7 +33,7 @@ public class DeviceExcelInfo {
private long rowNumber;
public void tag(String key, String name, Object value,String type) {
public void tag(String key, String name, Object value, String type) {
if (value == null) {
return;
}
@ -43,13 +43,15 @@ public class DeviceExcelInfo {
entity.setName(name);
entity.setDeviceId(id);
entity.setType(type);
entity.setId(String.valueOf(id).concat(":").concat(key));
entity.setId(DeviceTagEntity.createTagId(id,key));
tags.add(entity);
}
public void setId(String id) {
this.id = id;
for (DeviceTagEntity tag : tags) {
tag.setId(String.valueOf(id).concat(":").concat(tag.getKey()));
tag.setDeviceId(id);
tag.setId(DeviceTagEntity.createTagId(tag.getDeviceId(),tag.getKey()));
}
}