ustcyc
2025-01-07 de5d55508afd27fb2b47e6d4d6fd9984525c222c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package com.zhitan.realtimedata.service;
 
import com.zhitan.common.enums.CollectionModes;
import com.zhitan.common.enums.RetrievalModes;
import com.zhitan.realtimedata.domain.TagValue;
 
import java.util.Date;
import java.util.List;
 
public interface RealtimeDatabase {
 
    long id = System.currentTimeMillis();
 
    /**
     * 关闭连接
     */
    void close();
 
    /**
     * 根据点位号获取实时数据
     *
     * @param tagCodes 点位号列表
     * @return
     */
    List<TagValue> retrieve(List<String> tagCodes) throws Exception;
 
    /**
     * 根据点位号获取某一时刻的历史数据
     *
     * @param tagCodes 点位号集合
     * @param dataTime 历史时刻
     * @param timeCode 区分时间类型的timeCode
     * @return
     */
    List<TagValue> retrieve(List<String> tagCodes, Date dataTime,String timeCode) throws Exception;
 
    /**
     * 根据查询方式获取一段时间内的历史数据
     *
     * @param tagCodes       点位号集合
     * @param beginTime      开始时间
     * @param endTime        结束时间
     * @param retrievalModes 查询方式(循环、拟合、全部)
     * @param pointCount     要查询的数据个数
     * @return
     */
    List<TagValue> retrieve(List<String> tagCodes, Date beginTime, Date endTime,
                            RetrievalModes retrievalModes, int pointCount) throws Exception;
 
    /**
     * 汇总实时数据
     *
     * @param tagCodes        点位号集合
     * @param beginTime       开始时间
     * @param endTime         结束时间
     * @param collectionModes 汇总方式(最大值、最小值、平均值、求和等)
     * @return
     */
    List<TagValue> statistics(List<String> tagCodes, Date beginTime, Date endTime,
                              CollectionModes collectionModes) throws Exception;
 
    /**
     * 插入实时数据
     *
     * @param tagValues 实时数据集合
     * @return
     */
    Boolean storeData(List<TagValue> tagValues) throws Exception;
 
    /**
     * 插入历史数据
     *
     * @param tagValues 历史数据集合
     * @return
     */
    Boolean insertData(List<TagValue> tagValues) throws Exception;
 
    /**
     * 打开连接
     *
     * @param host     实时数据库地址
     * @param port     端口号
     * @param userName 登录用户名
     * @param pwd      登录密码
     * @return 是否连接成功
     */
    boolean open(String host, int port, String userName, String pwd) throws Exception;
}