删除了IoTDB相关的实体类、接口和注解。这些代码可能已经移动到另一个位置或者不再需要这些结构。受影响的代码包括:
- 删除了`com.muyu.carData.domain.IoTDBRecord`实体类,它用于定义IoT数据库记录。 - 删除了`com.muyu.carData.interfaces.IoTDBRecordable`接口,它定义了如何将对象转换为IoTDBRecord。 - 删除了`com.muyu.carData.annotation.IoTTableName`注解,它用于标记类对应IoT数据库表的名称。 - 删除了`com.muyu.carData.constract.IoTDBTableParam`类,它包含IoT数据库表参数的常量定义。master
parent
a17d1b4557
commit
614ddceebc
|
@ -1,18 +0,0 @@
|
||||||
package com.muyu.carData.annotation;
|
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:张腾
|
|
||||||
* @Package:com.muyu.carData.annotation
|
|
||||||
* @Project:cloud-server-8
|
|
||||||
* @name:IoTTableName
|
|
||||||
* @Date:2024/9/27 19:29
|
|
||||||
*/
|
|
||||||
@Documented
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
|
|
||||||
public @interface IoTTableName {
|
|
||||||
|
|
||||||
String value() default "";
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
package com.muyu.carData.constract;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:张腾
|
|
||||||
* @Package:com.muyu.carData.constract
|
|
||||||
* @Project:cloud-server-8
|
|
||||||
* @name:IoTDBTableParam
|
|
||||||
* @Date:2024/9/27 20:02
|
|
||||||
*/
|
|
||||||
public class IoTDBTableParam {
|
|
||||||
|
|
||||||
public static final String SYSLOG_IOT_TABLE = "student";
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
package com.muyu.carData.domain;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:张腾
|
|
||||||
* @Package:com.muyu.carData.domain
|
|
||||||
* @Project:cloud-server-8
|
|
||||||
* @name:IoTDBRecord
|
|
||||||
* @Date:2024/9/27 19:25
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class IoTDBRecord {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 节点路径
|
|
||||||
*/
|
|
||||||
private String deviceId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 时间戳
|
|
||||||
*/
|
|
||||||
private long time = System.currentTimeMillis();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 属性
|
|
||||||
*/
|
|
||||||
private List<String> measurementList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 属性值
|
|
||||||
*/
|
|
||||||
private List<Object> valueList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 数据类型
|
|
||||||
*/
|
|
||||||
private List<String> typeList;
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
package com.muyu.carData.interfaces;
|
|
||||||
|
|
||||||
import com.muyu.carData.annotation.IoTTableName;
|
|
||||||
import com.muyu.carData.domain.IoTDBRecord;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:张腾
|
|
||||||
* @Package:com.muyu.carData.interfaces
|
|
||||||
* @Project:cloud-server-8
|
|
||||||
* @name:IoTDBRecordable
|
|
||||||
* @Date:2024/9/27 19:22
|
|
||||||
* iot基类
|
|
||||||
*/
|
|
||||||
public interface IoTDBRecordable {
|
|
||||||
|
|
||||||
Logger logger = LoggerFactory.getLogger(IoTDBRecordable.class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 数据载入方法
|
|
||||||
* @return Record
|
|
||||||
*/
|
|
||||||
default IoTDBRecord toRecord() throws Exception {
|
|
||||||
IoTDBRecord ioTDBRecord = new IoTDBRecord();
|
|
||||||
Object getIoTDBTime = this.getClass().getMethod("getIoTDBTime").invoke(this);
|
|
||||||
if (null != getIoTDBTime){
|
|
||||||
ioTDBRecord.setTime((Long) getIoTDBTime);
|
|
||||||
}
|
|
||||||
Class aClass = this.getClass();
|
|
||||||
IoTTableName name = this.getClass().getAnnotation(IoTTableName.class);
|
|
||||||
ioTDBRecord.setDeviceId(name.value());
|
|
||||||
Field[] declaredFields = aClass.getDeclaredFields();
|
|
||||||
ArrayList<String> measurements = new ArrayList<>();
|
|
||||||
ArrayList<Object> records = new ArrayList<>();
|
|
||||||
ArrayList<String> types = new ArrayList<>();
|
|
||||||
for (Field declaredField : declaredFields) {
|
|
||||||
measurements.add(declaredField.getName());
|
|
||||||
String methodNamePro = declaredField.getName().substring(0, 1).toUpperCase() + declaredField.getName().substring(1);
|
|
||||||
Method methodName = this.getClass().getMethod("get" + methodNamePro);
|
|
||||||
records.add(methodName.invoke(this));
|
|
||||||
types.add(methodName.getReturnType().getName());
|
|
||||||
}
|
|
||||||
ioTDBRecord.setMeasurementList(measurements);
|
|
||||||
ioTDBRecord.setValueList(records);
|
|
||||||
ioTDBRecord.setTypeList(types);
|
|
||||||
return ioTDBRecord;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue