xc
2020-12-04 6566968d727f3739926c401b39925c6f55dff4ec
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
package com.hbbh.adapter.covert;
import com.google.common.collect.Lists;
 
import com.hbbh.adapter.dto.SMSDto;
import com.hbbh.adapter.pojo.Point;
import com.hbbh.adapter.pojo.golden.*;
import com.hbbh.adapter.utils.DateUtil;
import com.rtdb.model.BasePoint;
import com.rtdb.model.FullPoint;
import com.rtdb.model.MinPoint;
 
import java.util.Date;
import java.util.List;
 
public class PointConvert {
 
    public static SMSDto targetToSMSDto(MinPoint minPoint){
        SMSDto sMSDto = new SMSDto();
        sMSDto.setId(minPoint.getId());
        sMSDto.setTagName(minPoint.getTagName());
        sMSDto.setDesc(minPoint.getDesc());
        sMSDto.setValueType(minPoint.getValueType());
        sMSDto.setTagType(minPoint.getTagType());
        //sMSDto.setTimestamp();
        return sMSDto;
    }
 
 
    public static List<Point> fullpointsToPointEntity(List<FullPoint> fullPoints) {
        List<Point> pointlist=Lists.newArrayList();
        for (FullPoint fullPoint :fullPoints) {
            pointlist.add(convertFromFullPoint(fullPoint));
        }
        return pointlist;
    }
 
 
 
    private static Point convertFromFullPoint(FullPoint fullPoint) {
        BasePoint basePoint = fullPoint.getBasePoint();
 
        Point point = new Point();
        point.setId(basePoint.getId());
        point.setTagName(basePoint.getTable_dot_tag());
        point.setRemark(basePoint.getDesc());
        point.setUnit(basePoint.getUnit());
        //TODO:缺少属性值
        //point.setValue(basePoint.getCompdev()+"");
        //point.setQuality();
        point.setType(basePoint.getType().name());
 
        String timeStamp = new Date().getTime()/1000 + "";
        point.setTimeStamp(timeStamp);
        String timeStampStr = DateUtil.timeStamp2Date(timeStamp, DateUtil.date_format);
        point.setTimeStampStr(timeStampStr);
 
        return point;
    }
 
    public static SMS pointToSMS(Point p) {
        SMS sMS = new SMS();
        sMS.setId(p.getId());
        sMS.setTagName(p.getTagName());
        sMS.setRemark(p.getRemark());
        sMS.setValue(p.getValue());
        sMS.setUnit(p.getUnit());
        sMS.setTimeStamp(p.getTimeStamp());
        sMS.setTimeStampStr(p.getTimeStampStr());
        sMS.setQuality(p.getQuality());
        sMS.setType(p.getType());
        return sMS;
    }
 
    public static DLZ_PLC pointToDLZPLC(Point p) {
        DLZ_PLC dLZ_PLC = new DLZ_PLC();
        dLZ_PLC.setId(p.getId());
        dLZ_PLC.setTagName(p.getTagName());
        dLZ_PLC.setRemark(p.getRemark());
        dLZ_PLC.setValue(p.getValue());
        dLZ_PLC.setUnit(p.getUnit());
        dLZ_PLC.setTimeStamp(p.getTimeStamp());
        dLZ_PLC.setTimeStampStr(p.getTimeStampStr());
        dLZ_PLC.setQuality(p.getQuality());
        dLZ_PLC.setType(p.getType());
        return dLZ_PLC;
    }
 
    public static DJW_PLC pointToDJWPLC(Point p) {
        DJW_PLC dJW_PLC = new DJW_PLC();
        dJW_PLC.setId(p.getId());
        dJW_PLC.setTagName(p.getTagName());
        dJW_PLC.setRemark(p.getRemark());
        dJW_PLC.setValue(p.getValue());
        dJW_PLC.setUnit(p.getUnit());
        dJW_PLC.setTimeStamp(p.getTimeStamp());
        dJW_PLC.setTimeStampStr(p.getTimeStampStr());
        dJW_PLC.setQuality(p.getQuality());
        dJW_PLC.setType(p.getType());
        return dJW_PLC;
 
 
    }
 
    public static BDS_PLC pointToBDSPLC(Point p) {
        BDS_PLC bDS_PLC = new BDS_PLC();
        bDS_PLC.setId(p.getId());
        bDS_PLC.setTagName(p.getTagName());
        bDS_PLC.setRemark(p.getRemark());
        bDS_PLC.setValue(p.getValue());
        bDS_PLC.setUnit(p.getUnit());
        bDS_PLC.setTimeStamp(p.getTimeStamp());
        bDS_PLC.setTimeStampStr(p.getTimeStampStr());
        bDS_PLC.setQuality(p.getQuality());
        bDS_PLC.setType(p.getType());
        return bDS_PLC;
 
 
    }
 
    public static KTNZ2C_PLC pointToKTNZ2CPLC(Point p) {
        KTNZ2C_PLC kTNZ2C_PLC = new KTNZ2C_PLC();
        kTNZ2C_PLC.setId(p.getId());
        kTNZ2C_PLC.setTagName(p.getTagName());
        kTNZ2C_PLC.setRemark(p.getRemark());
        kTNZ2C_PLC.setValue(p.getValue());
        kTNZ2C_PLC.setUnit(p.getUnit());
        kTNZ2C_PLC.setTimeStamp(p.getTimeStamp());
        kTNZ2C_PLC.setTimeStampStr(p.getTimeStampStr());
        kTNZ2C_PLC.setQuality(p.getQuality());
        kTNZ2C_PLC.setType(p.getType());
        kTNZ2C_PLC.setId(p.getId());
        kTNZ2C_PLC.setTagName(p.getTagName());
        kTNZ2C_PLC.setRemark(p.getRemark());
        kTNZ2C_PLC.setValue(p.getValue());
        kTNZ2C_PLC.setUnit(p.getUnit());
        kTNZ2C_PLC.setTimeStamp(p.getTimeStamp());
        kTNZ2C_PLC.setTimeStampStr(p.getTimeStampStr());
        kTNZ2C_PLC.setQuality(p.getQuality());
        kTNZ2C_PLC.setType(p.getType());
        return kTNZ2C_PLC;
 
 
    }
}