13693261870
2025-07-02 6708810c4de34dfb9513061432d656f91d56ee3a
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
package com.ruoyi.quartz.task;
 
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.fuzhou.domain.*;
import com.ruoyi.fuzhou.enums.DataTypeEnum;
import com.ruoyi.fuzhou.service.*;
import com.ruoyi.fuzhou.utils.electricitymodbus.HexStringToInt;
import com.ruoyi.fuzhou.utils.hj1239.FileReadUtils;
import com.ruoyi.fuzhou.utils.hj1239.StringToHexUtil;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
import com.ruoyi.common.utils.StringUtils;
 
import java.io.File;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
 
/**
 * 定时任务调度测试
 *
 * @author ruoyi
 */
@Component("ryTask")
public class RyTask {
    @Resource
    private EquipmentService equipmentService;
 
    @Resource
    private ReceiveElectricityInfoService receiveElectricityInfoService;
 
    @Resource
    private ReceiveOilInfoService receiveOilInfoService;
 
    @Resource
    private ReceiveWaterInfoService receiveWaterInfoService;
 
    @Resource
    private ReceiveCarRuleService receiveCarRuleService;
 
    @Resource
    private ReceiveCarValueService receiveCarValueService;
 
    @Resource
    private ReceiveWeatherInfoService receiveWeatherInfoService;
 
    @Resource
    private ReceiveSlmInfoService receiveSlmInfoService;
 
    @Resource
    private ReceiveWeatherValueService receiveWeatherValueService;
 
    @Resource
    private HikService hikService;
 
    @Resource
    private ReceiveElectricityValueService receiveElectricityValueService;
 
    /**
     * 电数据接入
     */
    public void ryMultipleParams(String name) {
        List<DpEquipment> equipments = equipmentService.list(new LambdaQueryWrapper<DpEquipment>() {{
            or().like(StringUtils.isNotEmpty(name), DpEquipment::getEquName, name).eq(DpEquipment::getEquipmentTypeId, DataTypeEnum.ELECTRICITY.getCode());
        }});
        for (DpEquipment info : equipments) {
            List<ReceiveElectricityInfo> list = receiveElectricityInfoService.list(new LambdaQueryWrapper<ReceiveElectricityInfo>() {{
                or().eq(ReceiveElectricityInfo::getDeviceName, String.valueOf(info.getId())).notIn(ReceiveElectricityInfo::getParamCode, "createTime");
            }});
            if (list != null && list.size() > 0) {
                receiveElectricityInfoService.saveElectricity(list, info);
            }
        }
    }
 
    /**
     * 油数据接入
     *
     * @param name
     */
    public void ryParams(String name) {
        System.out.println("执行有参方法:" + name);
        List<DpEquipment> equipments = equipmentService.list(new LambdaQueryWrapper<DpEquipment>() {{
            or().like(StringUtils.isNotEmpty(name), DpEquipment::getEquName, name).in(DpEquipment::getEquipmentTypeId, DataTypeEnum.OIL.getCode());
        }});
        for (DpEquipment info : equipments) {
            List<ReceiveOilInfo> list = receiveOilInfoService.list(new LambdaQueryWrapper<ReceiveOilInfo>() {{
                or().eq(ReceiveOilInfo::getDeviceName, String.valueOf(info.getId())).notIn(ReceiveOilInfo::getParamCode, "createTime");
            }});
            if (list != null && list.size() > 0) {
                receiveOilInfoService.saveOil(list, info);
            }
        }
    }
 
 
    /**
     * 气象数据数据接入
     *
     * @param name
     */
    public void wsParams(String name) {
        System.out.println("执行有参方法:" + name);
        List<DpEquipment> equipments = equipmentService.list(new LambdaQueryWrapper<DpEquipment>() {{
            or().like(StringUtils.isNotEmpty(name), DpEquipment::getEquName, name).in(DpEquipment::getEquipmentTypeId, DataTypeEnum.WEATHER.getCode());
        }});
        for (DpEquipment info : equipments) {
            List<ReceiveWeatherInfo> list = receiveWeatherInfoService.list(new LambdaQueryWrapper<ReceiveWeatherInfo>() {{
                or().eq(ReceiveWeatherInfo::getDeviceName, String.valueOf(info.getId())).notIn(ReceiveWeatherInfo::getParamCode, "createTime");
            }});
            if (list != null && list.size() > 0) {
                receiveWeatherInfoService.saveData(list, info);
            }
        }
    }
 
    /**
     * 气象数据告警
     *
     * @param windSpeedValue  风速阈值
     * @param windSpeedTime   风速检测时间
     * @param tempSpeedValue  温度阈值
     * @param tempSpeedTime   温度检测时间
     */
    public void wsGaoJingParams(Integer windSpeedValue,Integer windSpeedTime,Integer tempSpeedValue,Integer tempSpeedTime,Integer interval) {
        System.out.println("执行气象数据--告警有参方法:" + windSpeedValue+";"+ windSpeedTime+";"+ tempSpeedValue+";"+ tempSpeedTime+";");
 
        if(interval==null){
            interval=10;
        }
        LocalDateTime now=LocalDateTime.now();
        Date nowDate=new Date();
 
        LocalDateTime agoSpeedTime=now.minusMinutes(windSpeedTime);
        LocalDateTime agoWenduSpeedTime=now.minusMinutes(tempSpeedTime);
 
 
        List<ReceiveWeatherValue> list = receiveWeatherValueService.list(new LambdaQueryWrapper<ReceiveWeatherValue>() {{
             ge(ReceiveWeatherValue::getCreateTime,agoSpeedTime).le(ReceiveWeatherValue::getCreateTime,now);
        }});
 
        Boolean hasfengsubaojing=fengsubaojingpanduan(list,windSpeedValue,nowDate,interval);
 
        if(hasfengsubaojing){
            HikEvent hikEvent=new HikEvent();
            hikEvent.setHappenTime(list.get(0).getCreateTime());
            hikEvent.setSendTime(nowDate);
            hikEvent.setEventType(101);//风速101 温度102
            hikEvent.setSrcName("风速告警");
            hikEvent.setSrcType("气象设备");
            hikService.saveInsert(hikEvent);
        }
        List<ReceiveWeatherValue> listTemp = receiveWeatherValueService.list(new LambdaQueryWrapper<ReceiveWeatherValue>() {{
            ge(ReceiveWeatherValue::getCreateTime,agoWenduSpeedTime).le(ReceiveWeatherValue::getCreateTime,now);
        }});
 
        Boolean haswendubaojing=wendubaojingpanduan(listTemp,tempSpeedValue,nowDate,interval);
 
        if(haswendubaojing){
            HikEvent hikEvent=new HikEvent();
            hikEvent.setHappenTime(list.get(0).getCreateTime());
            hikEvent.setSendTime(nowDate);
            hikEvent.setEventType(102);//风速101 温度102
            hikEvent.setSrcName("温度告警");
            hikEvent.setSrcType("气象设备");
            hikService.saveInsert(hikEvent);
        }
    }
 
    /**
     * 智能电表报警
     * @param lXian 线电压-低
     * @param hXian 线电压-高
     * @param lXiang 相电压-低
     * @param hXiang 相电压-高
     */
    public void dbGaoJing(Integer lXian, Integer hXian, Integer lXiang, Integer hXiang) {
        List<DpEquipment> list = equipmentService.getListByType(3);
        if (null == list || list.isEmpty()) return;
 
        for (DpEquipment dp : list) {
            QueryWrapper<ReceiveElectricityValue> wrapper = new QueryWrapper<>();
            //wrapper.eq(ReceiveElectricityValue::getDeviceName, String.valueOf(dp.getId()));
            wrapper.eq("DEVICE_NAME", String.valueOf(dp.getId()));
            //wrapper.orderByDesc(ReceiveElectricityValue::getCreateTime);
            wrapper.orderByDesc("CREATE_TIME");
            wrapper.last("limit 1");
 
            ReceiveElectricityValue rs = receiveElectricityValueService.getOne(wrapper);
            if (null == rs) continue;
            double voltageA = Double.parseDouble(rs.getVoltageA());
            double voltageB = Double.parseDouble(rs.getVoltageB());
            double voltageC = Double.parseDouble(rs.getVoltageC());
            double voltageCa = Double.parseDouble(rs.getVoltageCa());
            double voltageAb = Double.parseDouble(rs.getVoltageAb());
            double voltageBc = Double.parseDouble(rs.getVoltageBc());
 
            HikEvent hikEvent = new HikEvent();
            hikEvent.setHappenTime(rs.getCreateTime());
            hikEvent.setSendTime(new Date());
            hikEvent.setSrcName(dp.getEquName());
            hikEvent.setSrcIndex(String.valueOf(dp.getId()));
 
            // voltageA-A相电压, B相电压-voltageB, C相电压-voltageC
            List<String> ycList = new ArrayList<>();
            if (voltageA < 1) ycList.add("A");
            if (voltageB < 1) ycList.add("B");
            if (voltageC < 1) ycList.add("C");
            if (!ycList.isEmpty()) {
                hikEvent.setEventType(103); // 103-电压异常, 104-过欠压
                hikEvent.setSrcType(StringUtils.join(ycList, " | "));
                hikService.saveInsert(hikEvent);
                continue;
            }
 
            List<String> qyList = new ArrayList<>();
            // voltageCa-CA线电压, AB线电压-voltageAb, BC线电压-voltageBc
            if (voltageCa < lXian || voltageCa > hXian) qyList.add("CA");
            if (voltageAb < lXian || voltageAb > hXian) qyList.add("AB");
            if (voltageBc < lXian || voltageBc > hXian) qyList.add("BC");
 
            // voltageA-A相电压, B相电压-voltageB, C相电压-voltageC
            if (voltageA < lXiang || voltageA > hXiang) qyList.add("A");
            if (voltageB < lXiang || voltageB > hXiang) qyList.add("B");
            if (voltageC < lXiang || voltageC > hXiang) qyList.add("C");
            if (!qyList.isEmpty()) {
                hikEvent.setEventType(104); // 103-电压异常, 104-过欠压
                hikEvent.setSrcType(StringUtils.join(qyList, " | "));
                hikService.saveInsert(hikEvent);
            }
        }
    }
 
    public Boolean fengsubaojingpanduan(List<ReceiveWeatherValue> list,int value,Date now,Integer interval){
        if(list.size()>=5){
            for (int i = 0; i < list.size(); i++) {
                if(list.get(i).getWindSpeed()!=null&&Double.parseDouble(list.get(i).getWindSpeed())<value){
                    return false;
                }
            }
            //最后一次报警时间   getSendTime 插入时间  happenTime 数据时间
            List<HikEvent> hList=hikService.list(new LambdaQueryWrapper<HikEvent>() {{
                eq(HikEvent::getEventType,101).orderByDesc(HikEvent::getSendTime).last("LIMIT 1");
            }});
            if(hList.size()>0){
                HikEvent hData=hList.get(0);
 
                if(now.getTime()-hData.getSendTime().getTime()>=1000*60*interval){
                    return true;
                }
 
 
            }
            return false;
        }else {
            return false;
        }
 
    }
 
    public Boolean wendubaojingpanduan(List<ReceiveWeatherValue> list,int value,Date now,Integer interval){
        if(list.size()>=5){
            for (int i = 0; i < list.size(); i++) {
                if(list.get(i).getTemp()!=null&&Double.parseDouble(list.get(i).getTemp())<value){
                    return false;
                }
            }
            //最后一次报警时间   getSendTime 插入时间  happenTime 数据时间
            List<HikEvent> hList=hikService.list(new LambdaQueryWrapper<HikEvent>() {{
                eq(HikEvent::getEventType,102).orderByDesc(HikEvent::getSendTime).last("LIMIT 1");
            }});
            if(hList.size()>0){
                HikEvent hData=hList.get(0);
 
                if(now.getTime()-hData.getSendTime().getTime()>=1000*60*interval){
                    return true;
                }
 
 
            }
            return false;
        }else {
            return false;
        }
 
    }
 
    /**
     * 激光雷达数据数据接入
     *
     * @param name
     */
    public void slmParams(String name) {
        System.out.println("执行有参方法:" + name);
        List<DpEquipment> equipments = equipmentService.list(new LambdaQueryWrapper<DpEquipment>() {{
            or().like(StringUtils.isNotEmpty(name), DpEquipment::getEquName, name).in(DpEquipment::getEquipmentTypeId, DataTypeEnum.SLM.getCode());
        }});
        for (DpEquipment info : equipments) {
            List<ReceiveSlmInfo> list = receiveSlmInfoService.list(new LambdaQueryWrapper<ReceiveSlmInfo>() {{
                or().eq(ReceiveSlmInfo::getDeviceName, String.valueOf(info.getId())).notIn(ReceiveSlmInfo::getParamCode, "createTime");
            }});
            if (list != null && list.size() > 0) {
                receiveSlmInfoService.saveData(list, info);
            }
        }
    }
 
    /**
     * 利旧油数据接入
     *
     * @param name
     */
    public void ryLijiuParams(String name) {
        System.out.println("执行有参方法:" + name);
        List<DpEquipment> equipments = equipmentService.list(new LambdaQueryWrapper<DpEquipment>() {{
            or().like(StringUtils.isNotEmpty(name), DpEquipment::getEquName, name).in(DpEquipment::getEquipmentTypeId, DataTypeEnum.LIJIUOIL.getCode());
        }});
        for (DpEquipment info : equipments) {
            List<ReceiveOilInfo> list = receiveOilInfoService.list(new LambdaQueryWrapper<ReceiveOilInfo>() {{
                or().eq(ReceiveOilInfo::getDeviceName, String.valueOf(info.getId())).notIn(ReceiveOilInfo::getParamCode, "createTime");
            }});
            if (list != null && list.size() > 0) {
                receiveOilInfoService.saveLijiuOil(list, info);
            }
        }
    }
 
    /**
     * 宁德退油数据接入
     *
     * @param name
     */
    public synchronized void ningdeLijiuParams(String name) {
        System.out.println("执行有参方法:" + name);
        List<DpEquipment> equipments = equipmentService.list(new LambdaQueryWrapper<DpEquipment>() {{
            or().like(StringUtils.isNotEmpty(name), DpEquipment::getEquName, name).in(DpEquipment::getEquipmentTypeId, DataTypeEnum.LIJIUJUN.getCode());
        }});
        for (DpEquipment info : equipments) {
            try {
                List<ReceiveOilInfo> list = receiveOilInfoService.list(new LambdaQueryWrapper<ReceiveOilInfo>() {{
                    or().eq(ReceiveOilInfo::getDeviceName, String.valueOf(info.getId())).notIn(ReceiveOilInfo::getParamCode, "createTime");
                }});
                Thread.sleep(1000);
                if (list != null && list.size() > 0) {
                    receiveOilInfoService.saveOilLijiuNingde(list, info);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
 
        }
    }
 
    /**
     * 水数据接入
     */
    public void ryNoParams(String name) {
        System.out.println("执行无参方法");
        List<DpEquipment> equipments = equipmentService.list(new LambdaQueryWrapper<DpEquipment>() {{
            or().like(StringUtils.isNotEmpty(name), DpEquipment::getEquName, name).in(DpEquipment::getEquipmentTypeId, DataTypeEnum.WATER_FLOW.getCode());
        }});
        for (DpEquipment info : equipments
        ) {
            List<ReceiveWaterInfo> list = receiveWaterInfoService.list(new LambdaQueryWrapper<ReceiveWaterInfo>() {{
                or().eq(ReceiveWaterInfo::getDeviceName, String.valueOf(info.getId())).notIn(ReceiveWaterInfo::getParamCode, "createTime");
            }});
            if (list != null && list.size() > 0) {
                receiveWaterInfoService.saveWater(list, info);
            }
        }
    }
 
    /**
     * 水数据接入
     */
    public void saveWaterYa(String name) {
        System.out.println("执行无参方法");
        List<DpEquipment> equipments = equipmentService.list(new LambdaQueryWrapper<DpEquipment>() {{
            or().like(StringUtils.isNotEmpty(name), DpEquipment::getEquName, name).in(DpEquipment::getEquipmentTypeId, DataTypeEnum.WATER_YA.getCode());
        }});
        for (DpEquipment info : equipments
        ) {
            List<ReceiveWaterInfo> list = receiveWaterInfoService.list(new LambdaQueryWrapper<ReceiveWaterInfo>() {{
                or().eq(ReceiveWaterInfo::getDeviceName, String.valueOf(info.getId())).notIn(ReceiveWaterInfo::getParamCode, "createTime");
            }});
            if (list != null && list.size() > 0) {
                receiveWaterInfoService.saveWaterYa(list, info);
            }
        }
    }
 
    /**
     * 水数据接入
     */
    public void saveWaterDept(String name) {
        System.out.println("执行无参方法");
        List<DpEquipment> equipments = equipmentService.list(new LambdaQueryWrapper<DpEquipment>() {{
            or().like(StringUtils.isNotEmpty(name), DpEquipment::getEquName, name).in(DpEquipment::getEquipmentTypeId, DataTypeEnum.WATER_DEPT.getCode());
        }});
        for (DpEquipment info : equipments
        ) {
            List<ReceiveWaterInfo> list = receiveWaterInfoService.list(new LambdaQueryWrapper<ReceiveWaterInfo>() {{
                or().eq(ReceiveWaterInfo::getDeviceName, String.valueOf(info.getId())).notIn(ReceiveWaterInfo::getParamCode, "createTime");
            }});
            if (list != null && list.size() > 0) {
                receiveWaterInfoService.saveWaterDept(list, info);
            }
        }
    }
 
    public void carHj1239Task(String ftpFilePath, String tmpPath) {
        File file = new File(ftpFilePath);
        File[] fs = file.listFiles();
        List<String> filePath = new ArrayList<>();
        for (File f : fs) {
            if (!f.isDirectory()) {
                filePath.add(f.getAbsolutePath());
            }
        }
        List<ReceiveCarRule> receiveCarRules = receiveCarRuleService.list(new LambdaQueryWrapper<ReceiveCarRule>() {{
            orderByAsc(ReceiveCarRule::getId);
        }});
        for (String path : filePath
        ) {
            try {
                byte[] bytes = FileReadUtils.readFromByteFile(path);
                String content = FileReadUtils.bytesToHex(bytes);
                content = content.replace("aaaabbbbccccaaaa", "aaaabbbb,ccccaaaa");
                String[] src = content.split(",");
                List<ReceiveCarValue> receiveCarValues = new ArrayList<>();
                for (int i = 0; i < src.length; i++) {
                    String item = src[i];
                    JSONObject jsonObject = getvalue(receiveCarRules, item);
                    ReceiveCarValue receiveCarValue = JSON.parseObject(jsonObject.toJSONString(), ReceiveCarValue.class);
                    receiveCarValue.setCreateTime(new Date());
                    receiveCarValues.add(receiveCarValue);
                    System.out.println(jsonObject);
                }
                receiveCarValueService.saveOrUpdateBatch(receiveCarValues);
                //源文件
                File a = new File(path);
                //目标目录
                File b = new File(tmpPath);
                if (!b.exists()) {
                    b.mkdirs();
                }
                File bFile = new File(b + a.getName());
                //调用File类的核心方法renameTo
                a.renameTo(bFile);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
 
    private static JSONObject getvalue(List<ReceiveCarRule> rule, String content) {
        JSONObject jsonObject = new JSONObject();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        for (ReceiveCarRule r : rule
        ) {
 
            if (!"createTime".equals(r.getCarCode())) {
                String xx = content.substring(r.getStart() * 2, r.getStart() * 2 + r.getDataLength() * 2);
                if ("VARCHAR".equals(r.getDataType()) && "NONE".equals(r.getRule())) {
                    jsonObject.put(r.getCarCode(), StringToHexUtil.convertHexToString(xx));
                } else if ("WORD".equals(r.getDataType()) && "NONE".equals(r.getRule())) {
                    jsonObject.put(r.getCarCode(), String.valueOf(HexStringToInt.hexStringToInt2(xx)));
                } else if ("BYTE[6]".equals(r.getDataType()) && "NONE".equals(r.getRule())) {
                    String dateTime = "20";
                    dateTime = dateTime + HexStringToInt.hexStringToString(xx.substring(0, 2)) + "-";
                    dateTime = dateTime + HexStringToInt.hexStringToString(xx.substring(2, 4)) + "-";
                    dateTime = dateTime + HexStringToInt.hexStringToString(xx.substring(4, 6)) + " ";
                    dateTime = dateTime + HexStringToInt.hexStringToString(xx.substring(6, 8)) + ":";
                    dateTime = dateTime + HexStringToInt.hexStringToString(xx.substring(8, 10)) + ":";
                    dateTime = dateTime + HexStringToInt.hexStringToString(xx.substring(10, 12));
                    jsonObject.put(r.getCarCode(), dateTime);
                } else if ("WORD".equals(r.getDataType()) && "COMPUTE".equals(r.getRule())) {
                    if ("ffff".equals(xx)) {
                        jsonObject.put(r.getCarCode(), "");
                    } else {
                        jsonObject.put(r.getCarCode(), String.valueOf(new BigDecimal(HexStringToInt.hexStringToInt2(xx) * Double.valueOf(r.getRuleValue()) + Double.valueOf(r.getOffset())).setScale(3, RoundingMode.UP).doubleValue()));
                    }
                } else if ("BYTE".equals(r.getDataType()) && "COMPUTE".equals(r.getRule())) {
                    if ("ff".equals(xx)) {
                        jsonObject.put(r.getCarCode(), "");
                    } else {
                        jsonObject.put(r.getCarCode(), String.valueOf(HexStringToInt.hexStringToInt2(xx) * Double.valueOf(r.getRuleValue()) + Double.valueOf(r.getOffset())));
                    }
                } else if ("DWORD".equals(r.getDataType()) && "COMPUTE".equals(r.getRule())) {
                    if ("ffffffff".equals(xx)) {
                        jsonObject.put(r.getCarCode(), "");
                    } else {
                        jsonObject.put(r.getCarCode(), String.valueOf(Long.parseLong(xx, 16) * Double.valueOf(r.getRuleValue()) + Double.valueOf(r.getOffset())));
                    }
 
                }
            }
        }
        try {
            jsonObject.put("id", sdf.parse(jsonObject.getString("dataTime")).getTime() + jsonObject.getString("vin"));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonObject;
    }
}